MetricSchedule schedule = new MetricSchedule(def.getId(),def.getName(),def.getDisplayName(),false,def.getDefaultInterval(),
def.getUnits().getName(),def.getDataType().toString());
schedule.setDefinitionId(def.getId());
if (def.getDataType()== DataType.MEASUREMENT) {
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/metric/data/group/{groupId}/{definitionId}");
URI uri = uriBuilder.build(id,def.getId());
Link link = new Link("metric",uri.toString());
schedule.addLink(link);
}