@ApiOperation(value = "Find movies")
@GetMapping(produces = MediaTypes.HAL_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public
PagedResources<MovieSearchResultResource> findMovies(
@ApiParam(value = "The title of the movie")
@RequestParam(value = "title", required = false) final String title,
@ApiParam(value = "The type of the movie")
@RequestParam(value = "type", required = false) final MovieType type,
@ApiParam(value = "Release date range \"from\"")
@RequestParam(value = "fromDate", required = false) @DateTimeFormat(pattern="yyyy-MM-dd") final Date fromDate,
@ApiParam(value = "Release date range \"to\"")
@RequestParam(value = "toDate", required = false) @DateTimeFormat(pattern="yyyy-MM-dd") final Date toDate,
@ApiParam(value = "List of countries")
@RequestParam(value = "country", required = false) final List<CountryType> countries,
@ApiParam(value = "List of languages")
@RequestParam(value = "language", required = false) final List<LanguageType> languages,
@ApiParam(value = "List of genres")
@RequestParam(value = "genre", required = false) final List<GenreType> genres,
@ApiParam(value = "Min. rating")
@RequestParam(value = "minRating", required = false) @Size(max = 10) final Integer minRating,
@ApiParam(value = "Max. rating")
@RequestParam(value = "maxRating", required = false) @Size(max = 10) final Integer maxRating,
@PageableDefault(sort = {"title"}, direction = Sort.Direction.DESC) final Pageable page,
final PagedResourcesAssembler<MovieSearchResult> assembler
) {
log.info("Called with" + " title {}, type {}," +
"fromDate {}, toDate {}, countries {}," +
"languages {}, genres {}, minRating {}," +
"maxRating {}, page {},",
title, type, fromDate, toDate, countries, languages, genres, minRating, maxRating, page);
// Build the self link which will be used for the next, previous, etc links
final Link self = ControllerLinkBuilder
.linkTo(
ControllerLinkBuilder
.methodOn(MovieRestController.class)
.findMovies(
title,
type,
fromDate,
toDate,
countries,
languages,
genres,
minRating,
maxRating,
page,
assembler
)
).withSelfRel();
return assembler.toResource(this.movieSearchService.findMovies(
title, type, fromDate, toDate, countries, languages, genres, minRating, maxRating, page
), this.movieSearchResultResourceAssembler, self);
}
MovieRestController.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:REST-Web-Services
作者:
评论列表
文章目录