No Description

MovieController.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package fr.natan.akkastreamfileprocessingapi.controller;
  2. import fr.natan.akkastreamfileprocessingapi.service.AkkaStreamFileProcessing;
  3. import org.springframework.http.HttpStatus;
  4. import org.springframework.http.ResponseEntity;
  5. import org.springframework.web.bind.annotation.PathVariable;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import java.util.Collection;
  10. import java.util.List;
  11. @RestController
  12. public class MovieController {
  13. private final AkkaStreamFileProcessing akkaStreamFilesProcessing;
  14. public MovieController(AkkaStreamFileProcessing akkaStreamFilesProcessing) {
  15. this.akkaStreamFilesProcessing = akkaStreamFilesProcessing;
  16. }
  17. @RequestMapping(value = "/persons", method = RequestMethod.GET)
  18. private ResponseEntity<String> getallPersons(){
  19. akkaStreamFilesProcessing.getAllPersons();
  20. return new ResponseEntity<>("is running", HttpStatus.OK);
  21. }
  22. @RequestMapping(value = "/persons/id/{personID}", method = RequestMethod.GET)
  23. private ResponseEntity<String> getPersonByID(@PathVariable(name = "personID") String nconst){
  24. return new ResponseEntity<>(akkaStreamFilesProcessing.getPersonById(nconst).toString(), HttpStatus.OK);
  25. }
  26. @RequestMapping(value = "/persons/name/{primaryName}", method = RequestMethod.GET)
  27. private ResponseEntity<String> getPersonByName(@PathVariable(name = "primaryName") String primaryName){
  28. akkaStreamFilesProcessing.getPersonByName(primaryName);
  29. return new ResponseEntity<>("is running", HttpStatus.OK);
  30. }
  31. @RequestMapping(value = "/movies", method = RequestMethod.GET)
  32. private ResponseEntity<String> getAllMovies() {
  33. akkaStreamFilesProcessing.getAllTvSeries();
  34. return new ResponseEntity<>("is running", HttpStatus.OK);
  35. }
  36. @RequestMapping(value = "/movies/{movieTitle}", method = RequestMethod.GET)
  37. private ResponseEntity<String> getMovieByTitle(@PathVariable(name ="movieTitle" ) String movieTitle){
  38. akkaStreamFilesProcessing.getByTvSeriePrimaryTitle(movieTitle);
  39. return new ResponseEntity<>("is running", HttpStatus.OK);
  40. }
  41. @RequestMapping(value = "/movies/id/{tvSerieID}", method = RequestMethod.GET)
  42. private ResponseEntity<String> getListOfPersonsIDByTvSerieID(@PathVariable(name = "tvSerieID") String tvSerieID){
  43. akkaStreamFilesProcessing.getListOfPersonsIDByTvSerieID(tvSerieID);
  44. return new ResponseEntity<>("is running", HttpStatus.OK);
  45. }
  46. }

Powered by TurnKey Linux.