agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/search/JsonHandler.java
/**
     * Parse JsonNode jsonMetadata containing MetadataItem information to a Document
     *
     * @param jsonMetadata {@link JsonNode}
     * @return {@link Document} matching the JsonNode
     * @throws MetadataQueryException if unable to parse field
     */
Parse JsonNode jsonMetadata containing MetadataItem information to a Document
@param jsonMetadata  JsonNode
@return  Document matching the JsonNode
@throws MetadataQueryException if unable to parse field
Parse JsonNode jsonMetadata containing MetadataItem information to a Document @param jsonMetadata JsonNode @return Document matching the JsonNode @throws MetadataQueryException if unable to parse field
public Document parseJsonMetadataToDocument(JsonNode jsonMetadata) throws MetadataQueryException {
        Document doc = new Document();
        if (jsonMetadata.has("uuid")) {
            String uuid = jsonMetadata.get("uuid").asText();
            if (StringUtils.isNotBlank(uuid)) {
                doc.append("uuid", uuid);
            }
        }
        String name = parseNameToString(jsonMetadata);
        if (name != null)
            doc.append("name", name);
        JsonNode value = parseValueToJsonNode(jsonMetadata);
        if (value != null) {
            Document valueDoc = parseNestedJsonNodeToDocument(value);
            doc.append("value", valueDoc);
        }
        List<String> associationList = parseAssociationIdsToList(jsonMetadata);
        if (associationList.size() > 0)
            doc.append("associationIds", associationList);
        String schemaId = parseSchemaIdToString(jsonMetadata);
        if (schemaId != null)
            doc.append("schemaId", schemaId);
        List<Document> permissions = parsePermissionToList(jsonMetadata);
        if (permissions != null) {
            doc.append("permissions", permissions);
        }
        List<Document> notifications = parseNotificationToList(jsonMetadata);
        if (notifications != null)
            doc.append("notifications", notifications);
        return doc;
    }
public Document parseJsonMetadataToDocument ( JsonNode jsonMetadata ) throws MetadataQueryException { Document doc = new Document ( ) ; if ( jsonMetadata . has ( "uuid" ) ) { String uuid = jsonMetadata . get ( "uuid" ) . asText ( ) ; if ( StringUtils . isNotBlank ( uuid ) ) { doc . append ( "uuid" , uuid ) ; } } String name = parseNameToString ( jsonMetadata ) ; if ( name != null ) doc . append ( "name" , name ) ; JsonNode value = parseValueToJsonNode ( jsonMetadata ) ; if ( value != null ) { Document valueDoc = parseNestedJsonNodeToDocument ( value ) ; doc . append ( "value" , valueDoc ) ; } List < String > associationList = parseAssociationIdsToList ( jsonMetadata ) ; if ( associationList . size ( ) > 0 ) doc . append ( "associationIds" , associationList ) ; String schemaId = parseSchemaIdToString ( jsonMetadata ) ; if ( schemaId != null ) doc . append ( "schemaId" , schemaId ) ; List < Document > permissions = parsePermissionToList ( jsonMetadata ) ; if ( permissions != null ) { doc . append ( "permissions" , permissions ) ; } List < Document > notifications = parseNotificationToList ( jsonMetadata ) ; if ( notifications != null ) doc . append ( "notifications" , notifications ) ; return doc ; }
Parse JsonNode jsonMetadata containing MetadataItem information to a Document
 @param jsonMetadata {@link JsonNode}
 @return {@link Document} matching the JsonNode
 @throws MetadataQueryException if unable to parse field
Parse JsonNode jsonMetadata containing MetadataItem information to a Document @param jsonMetadata { @link JsonNode } @return { @link Document } matching the JsonNode @throws MetadataQueryException if unable to parse field