UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/operation/definitions");
uriBuilder.queryParam("resourceId", res.getId());
URI uri = uriBuilder.build();
Link link = new Link("operationDefinitions", uri.toString());
rwt.addLink(link);
link = getLinkToResource(res, uriInfo, "self");
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/schedules");
uri = uriBuilder.build(res.getId());
link = new Link("schedules", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/availability");
uri = uriBuilder.build(res.getId());
link = new Link("availability", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/children");
uri = uriBuilder.build(res.getId());
link = new Link("children", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/alerts");
uri = uriBuilder.build(res.getId());
link = new Link("alerts", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/alert/definitions");
uriBuilder.queryParam("resourceId",res.getId());
uri = uriBuilder.build(res.getId());
link = new Link("alertDefinitions", uri.toString());
rwt.addLink(link);
if (parent != null) {
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/");
uri = uriBuilder.build(parent.getId());
link = new Link("parent", uri.toString());
rwt.addLink(link);
}
rwt.addLink(createUILink(uriInfo,UILinkTemplate.RESOURCE,res.getId()));
return rwt;