@Override
public Response getOrder(int id, UriInfo uriInfo)
{
OrderEntity entity = em.getReference(OrderEntity.class, id);
Order order = entity2domain(entity);
String self = uriInfo.getAbsolutePathBuilder().build().toString();
order.addLink(new Link("self", self, "application/xml"));
if (!order.isCancelled())
{
String cancel = uriInfo.getAbsolutePathBuilder().path("cancel").build().toString();
order.addLink(new Link("cancel", cancel, "application/xml"));
}
Response.ResponseBuilder builder = Response.ok(order);
if (!order.isCancelled()) addCancelHeader(uriInfo, builder);
return builder.build();
}