1 package de.spring.example.rest.controllers;
3 import java.io.Serializable;
5 import org.springframework.data.domain.Page;
6 import org.springframework.data.history.Revision;
7 import org.springframework.web.bind.annotation.PathVariable;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestMethod;
10 import org.springframework.web.bind.annotation.RequestParam;
11 import org.springframework.web.bind.annotation.ResponseBody;
13 public interface RevisionRestController<T, ID extends Serializable, N extends Number & Comparable<N>> {
16 * Returns a {@link Page} of revisions for the entity with the given id
18 * @param page Page number starting from 0. default to 0
19 * @param size Number of resources by pages. default to 10
20 * @param direction Optional sort direction, could be "asc" or "desc"
21 * @param properties Ordered list of comma separeted properies used for sorting resulats. At least one property should be provided if direction is specified
22 * @return OK http status code if the request has been correctly processed, with the a paginated collection of all resource enclosed in the body.
24 @RequestMapping(value="{id}/revisions/", method = RequestMethod.GET)
26 public Page<Revision<N, T>> findRevisionsPaginated(@PathVariable ID id,
27 @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
28 @RequestParam(value = "size", required = false, defaultValue = "10") Integer size,
29 @RequestParam(value = "direction", required = false, defaultValue = "") String direction,
30 @RequestParam(value = "properties", required = false) String properties);