/** * * @param server */ public static void define(RestExpress server) { Map<String, String> routes = server.getRouteUrlsByName(); HyperExpress.relationships() .forClass(Client.class) .forCollectionOf(Client.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.CLIENT_COLLECTION)) .withQuery("limit={limit}") .withQuery("offset={offset}") .rel(RelTypes.NEXT, routes.get(Constants.Routes.CLIENT_COLLECTION) + "?offset={nextOffset}") .withQuery("limit={limit}") .optional() .rel(RelTypes.PREV, routes.get(Constants.Routes.CLIENT_COLLECTION) + "?offset={prevOffset}") .withQuery("limit={limit}") .optional() .forClass(Client.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.SINGLE_CLIENT)) .rel(RelTypes.UP, routes.get(Constants.Routes.CLIENT_COLLECTION)); } }
public static void define(RestExpress server) { Map<String, String> routes = server.getRouteUrlsByName(); HyperExpress.relationships() .forCollectionOf(Record.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.RECORD_COLLECTION)) .withQuery("limit={limit}") .withQuery("offset={offset}") .rel(RelTypes.NEXT, routes.get(Constants.Routes.RECORD_COLLECTION) + "?offset={nextOffset}") .withQuery("limit={limit}") .optional() .rel(RelTypes.PREV, routes.get(Constants.Routes.RECORD_COLLECTION) + "?offset={prevOffset}") .withQuery("limit={limit}") .optional() .forClass(Record.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.SINGLE_RECORD)) .rel(RelTypes.UP, routes.get(Constants.Routes.RECORD_COLLECTION)); } }
/** * * @param server */ public static void define(RestExpress server) { Map<String, String> routes = server.getRouteUrlsByName(); HyperExpress.relationships() .forCollectionOf(Transaction.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.TRANSACTION_COLLECTION)) .withQuery("limit={limit}") .withQuery("offset={offset}") .rel(RelTypes.NEXT, routes.get(Constants.Routes.TRANSACTION_COLLECTION) + "?offset={nextOffset}") .withQuery("limit={limit}") .optional() .rel(RelTypes.PREV, routes.get(Constants.Routes.TRANSACTION_COLLECTION) + "?offset={prevOffset}") .withQuery("limit={limit}") .optional() .forClass(Transaction.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.SINGLE_TRANSACTION)) .rel(RelTypes.UP, routes.get(Constants.Routes.TRANSACTION_COLLECTION)); } }
/** * * @param server */ public static void define(RestExpress server) { Map<String, String> routes = server.getRouteUrlsByName(); HyperExpress.relationships() .forCollectionOf(Vehicle.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.VEHICLE_COLLECTION)) .withQuery("limit={limit}") .withQuery("offset={offset}") .rel(RelTypes.NEXT, routes.get(Constants.Routes.VEHICLE_COLLECTION) + "?offset={nextOffset}") .withQuery("limit={limit}") .optional() .rel(RelTypes.PREV, routes.get(Constants.Routes.VEHICLE_COLLECTION) + "?offset={prevOffset}") .withQuery("limit={limit}") .optional() .forClass(Vehicle.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.SINGLE_VEHICLE)) .rel(RelTypes.UP, routes.get(Constants.Routes.VEHICLE_COLLECTION)); } }
.rel(RelTypes.SELF, routes.get(Constants.Routes.BLOGS_READ_ROUTE)) .forClass(Blog.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.BLOG_READ_ROUTE)) .rel("entries", routes.get(Constants.Routes.BLOG_ENTRIES_READ_ROUTE)) .rel(RelTypes.UP, routes.get(Constants.Routes.BLOG_READ_ROUTE)) .forClass(BlogEntry.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.BLOG_ENTRY_READ_ROUTE)) .rel(RelTypes.UP, routes.get(Constants.Routes.BLOG_ENTRIES_READ_ROUTE)) .rel(RelTypes.UP, routes.get(Constants.Routes.COMMENT_READ_ROUTE)) .forClass(Comment.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.COMMENT_READ_ROUTE)) .rel(RelTypes.UP, routes.get(Constants.Routes.COMMENTS_READ_ROUTE));