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)); } }
/** * * @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)); } }
HyperExpress.relationships() .forCollectionOf(Blog.class) .rel(RelTypes.SELF, routes.get(Constants.Routes.BLOGS_READ_ROUTE))