Нет описания

MovieController.java 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. @RestController
  10. public class MovieController {
  11. private final AkkaStreamFileProcessing akkaStreamFilesProcessing;
  12. public MovieController(AkkaStreamFileProcessing akkaStreamFilesProcessing) {
  13. this.akkaStreamFilesProcessing = akkaStreamFilesProcessing;
  14. }
  15. @RequestMapping(value = "/persons", method = RequestMethod.GET)
  16. private ResponseEntity<String> getallPersons(){
  17. akkaStreamFilesProcessing.getAllPersons();
  18. return new ResponseEntity<>("is running", HttpStatus.OK);
  19. }
  20. @RequestMapping(value = "/persons/id/{personID}", method = RequestMethod.GET)
  21. private ResponseEntity<String> getPersonByID(@PathVariable(name = "personID") String nconst){
  22. return new ResponseEntity<>(akkaStreamFilesProcessing.getPersonById(nconst).toString(), HttpStatus.OK);
  23. }
  24. @RequestMapping(value = "/persons/name/{primaryName}", method = RequestMethod.GET)
  25. private ResponseEntity<String> getPersonByName(@PathVariable(name = "primaryName") String primaryName){
  26. akkaStreamFilesProcessing.getPersonByName(primaryName);
  27. return new ResponseEntity<>("is running", HttpStatus.OK);
  28. }
  29. @RequestMapping(value = "/tvseries", method = RequestMethod.GET)
  30. private ResponseEntity<String> getAllvSeries() {
  31. akkaStreamFilesProcessing.getAllTvSeries();
  32. return new ResponseEntity<>("is running", HttpStatus.OK);
  33. }
  34. @RequestMapping(value = "/tvseries/{tvseriePrimaryTitle}", method = RequestMethod.GET)
  35. private ResponseEntity<String> getTvserieByPrimaryTitle(@PathVariable(name ="tvseriePrimaryTitle" ) String tvseriePrimaryTitle){
  36. akkaStreamFilesProcessing.getByTvSeriePrimaryTitle(tvseriePrimaryTitle);
  37. return new ResponseEntity<>("OK", HttpStatus.OK);
  38. }
  39. @RequestMapping(value = "/tvseries/title/{tvSerieTitle}", method = RequestMethod.GET)
  40. private ResponseEntity<String> getListOfPersonsIDByTvSerieID(@PathVariable(name = "tvSerieTitle") String tvSerieTitle){
  41. akkaStreamFilesProcessing.getPersonsTeamForTvSerie(tvSerieTitle);
  42. return new ResponseEntity<>("is running", HttpStatus.OK);
  43. }
  44. }

Powered by TurnKey Linux.