if (builder==null) {
// preconditions not met, we need to send the resource
UriBuilder uriBuilder;
URI uri;
Link link;
if (definition.getDataType()==DataType.MEASUREMENT) {
// create link to metrics
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("metric/data/" + scheduleId);
uri = uriBuilder.build();
link = new Link("metric",uri.toString());
metricSchedule.addLink(link);
}
// create link to the resource
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("resource/" + schedule.getResource().getId());
uri = uriBuilder.build();
link = new Link("resource",uri.toString());
metricSchedule.addLink(link);
// Link for updates
uriBuilder = uriInfo.getAbsolutePathBuilder();
uri = uriBuilder.build();
Link updateLink = new Link("edit",uri.toString());
metricSchedule.addLink(updateLink);
updateLink = new Link("self",uri.toString());
metricSchedule.addLink(updateLink);
metricSchedule.addLink(createUILink(uriInfo, UILinkTemplate.METRIC_SCHEDULE, schedule.getResource().getId()));
if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {