agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/model/serialization/MetadataItemSerializer.java
/**
     * Format {@link MetadataItem} to an {@link JsonNode} with resolved links
     * @param metadataItem {@link MetadataItem} to format
     * @return {@link JsonNode} equivalent of the MetadataItem
     */
Format  MetadataItem to an  JsonNode with resolved links
@param metadataItem  MetadataItem to format
@return  JsonNode equivalent of the MetadataItem
Format MetadataItem to an JsonNode with resolved links @param metadataItem MetadataItem to format @return JsonNode equivalent of the MetadataItem
public JsonNode formatMetadataItemJsonResult(MetadataItem metadataItem) throws UUIDException {
        ObjectNode metadataObject = formatMetadataItemToNode(metadataItem);
        ObjectNode hal = mapper.createObjectNode();
        if (resourceURL == null)
            this.resourceURL = TenancyHelper.resolveURLToCurrentTenant(Settings.IPLANT_METADATA_SERVICE);
        hal.putObject("self")
                .put("href",
                        resourceURL + "data/" +
                                metadataItem.getUuid());
        hal.putObject("permissions")
                .put("href",
                        resourceURL + "data/" +
                                metadataItem.getUuid() + "/pems");
        hal.putObject("owner")
                .put("href",
                        resourceURL + metadataItem.getOwner());
        if (metadataItem.getAssociations() != null) {
            MetadataAssociationList associationList = metadataItem.getAssociations();
            List<JsonNode> halAssociationIds = formatAssociationIdsToNodeList(associationList);
            hal.putArray("associationIds")
                    .addAll(halAssociationIds);
        }
        if (metadataItem.getSchemaId() != null && !StringUtils.isEmpty(metadataItem.getSchemaId())) {
            AgaveUUID agaveUUID = new AgaveUUID(metadataItem.getSchemaId());
            hal.putObject(agaveUUID.getResourceType().name())
                    .put("href", TenancyHelper.resolveURLToCurrentTenant(agaveUUID.getObjectReference()));
        }
        metadataObject.replace("_links", hal);
        return metadataObject;
    }
public JsonNode formatMetadataItemJsonResult ( MetadataItem metadataItem ) throws UUIDException { ObjectNode metadataObject = formatMetadataItemToNode ( metadataItem ) ; ObjectNode hal = mapper . createObjectNode ( ) ; if ( resourceURL == null ) this . resourceURL = TenancyHelper . resolveURLToCurrentTenant ( Settings . IPLANT_METADATA_SERVICE ) ; hal . putObject ( "self" ) . put ( "href" , resourceURL + "data/" + metadataItem . getUuid ( ) ) ; hal . putObject ( "permissions" ) . put ( "href" , resourceURL + "data/" + metadataItem . getUuid ( ) + "/pems" ) ; hal . putObject ( "owner" ) . put ( "href" , resourceURL + metadataItem . getOwner ( ) ) ; if ( metadataItem . getAssociations ( ) != null ) { MetadataAssociationList associationList = metadataItem . getAssociations ( ) ; List < JsonNode > halAssociationIds = formatAssociationIdsToNodeList ( associationList ) ; hal . putArray ( "associationIds" ) . addAll ( halAssociationIds ) ; } if ( metadataItem . getSchemaId ( ) != null && ! StringUtils . isEmpty ( metadataItem . getSchemaId ( ) ) ) { AgaveUUID agaveUUID = new AgaveUUID ( metadataItem . getSchemaId ( ) ) ; hal . putObject ( agaveUUID . getResourceType ( ) . name ( ) ) . put ( "href" , TenancyHelper . resolveURLToCurrentTenant ( agaveUUID . getObjectReference ( ) ) ) ; } metadataObject . replace ( "_links" , hal ) ; return metadataObject ; }
Format {@link MetadataItem} to an {@link JsonNode} with resolved links
 @param metadataItem {@link MetadataItem} to format
 @return {@link JsonNode} equivalent of the MetadataItem
Format { @link MetadataItem } to an { @link JsonNode } with resolved links @param metadataItem { @link MetadataItem } to format @return { @link JsonNode } equivalent of the MetadataItem