Skip to content

Instantly share code, notes, and snippets.

@Raouf25
Last active April 16, 2020 17:54
Show Gist options
  • Save Raouf25/9c761f4a8bad37fef499b0437f4ffc1b to your computer and use it in GitHub Desktop.
Save Raouf25/9c761f4a8bad37fef499b0437f4ffc1b to your computer and use it in GitHub Desktop.
/**
* get element using Criteria.
*
* @param spec *
* @param headers pagination data
* @param sort sort criteria
* @return retrieve elements with pagination
*/
public PagingResponse get(Specification<Car> spec, HttpHeaders headers, Sort sort) {
if (isRequestPaged(headers)) {
return get(spec, buildPageRequest(headers, sort));
} else {
final List<Car> entities = get(spec, sort);
return new PagingResponse((long) entities.size(), 0L, 0L, 0L, 0L, entities);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment