HATEOAS Links - Samgbr/LSMPServiceRS GitHub Wiki
Here are the HATEOAS links.
- Get Book links
private void setLinks(BookRepresentation bookRepresentation) {
// Set up the activities that can be performed on orders
Link check = new Link("check",
"http://localhost:8082/ProductInventory/productinventoryservice/productinventory/"+ bookRepresentation.getProductID() ,"application/json");
Link reviews = new Link("reviews",
"http://localhost:8082/ProductReview/productreviewservice/productreviews/"+ bookRepresentation.getProductID() ,"application/json");
Link createreview = new Link("createreview",
"http://localhost:8082/ProductReview/productreviewservice/productreview" ,"application/json");
Link updatebook = new Link("updatebook",
"http://localhost:8082/BookProduct/bookservice/book" ,"application/json");
Link deletebook = new Link("deletebook",
"http://localhost:8082/BookProduct/bookservice/book/"+ bookRepresentation.getProductID() ,"application/json");
bookRepresentation.setLinks(check,reviews,createreview,updatebook,deletebook);
}
- Inventory Link
private void setLinks(ProductInventoryRepresentation productInventoryRepresentation) {
// Set up the activities that can be performed on orders
Link buy = new Link("buy",
"http://localhost:8082/Order/orderservice/order" ,"application/xml");
productInventoryRepresentation.setLinks(buy);
}
- Order Link
private void setLinks(OrderRepresentation orderRepresentation) {
Link payment = new Link("payment",
"http://localhost:8082/Order/orderservice/payment" ,"application/json");
Link cancel = new Link("cancel",
"http://localhost:8082/Order/orderservice/order" ,"application/json");
orderRepresentation.setLinks(payment,cancel);
}
- Customer link
private void setLinks(CustomerRepresentation customerRepresentation) {
Link updatecustomer = new Link("updatecustomer",
"http://localhost:8082/Customer/shopperservice/shopper" ,"application/json");
Link deletecustomer = new Link("deletecustomer",
"http://localhost:8082/Customer/shopperservice/shopper/"+ customerRepresentation.getProfileID() ,"application/json");
customerRepresentation.setLinks(updatecustomer,deletecustomer);
}
- Partner link
private void setLinks(PartnerRepresentation partnerRepresentation) {
Link updatepartner = new Link("updatepartner",
"http://localhost:8082/Partner/partnerservice/partner" ,"application/json");
Link deletepartner = new Link("deletepartner",
" http://localhost:8082/Partner/partnerservice/partner/"+ partnerRepresentation.getProfileID() ,"application/json");
partnerRepresentation.setLinks(updatepartner,deletepartner);
}