allOrders URL implementation
This commit is contained in:
parent
17a72d00a3
commit
c2d84ae1d2
@ -34,7 +34,12 @@ public class CustomerController {
|
|||||||
|
|
||||||
@RequestMapping(value = "/customer/{customerId}/orders", method = RequestMethod.GET)
|
@RequestMapping(value = "/customer/{customerId}/orders", method = RequestMethod.GET)
|
||||||
public List<Order> getOrdersForCustomer(@PathVariable final String customerId) {
|
public List<Order> getOrdersForCustomer(@PathVariable final String customerId) {
|
||||||
return orderService.getAllOrdersForCustomer(customerId);
|
final List<Order> orders = orderService.getAllOrdersForCustomer(customerId);
|
||||||
|
for (final Order order : orders) {
|
||||||
|
final Link selfLink = ControllerLinkBuilder.linkTo(ControllerLinkBuilder.methodOn(CustomerController.class).getOrderById(customerId, order.getOrderId())).withSelfRel();
|
||||||
|
order.add(selfLink);
|
||||||
|
}
|
||||||
|
return orders;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/customers", method = RequestMethod.GET)
|
@RequestMapping(value = "/customers", method = RequestMethod.GET)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user