agave-metadata/metadata-core/src/main/java/org/iplantc/service/metadata/search/JsonHandler.java
/**
     * Parse {@link JsonNode} to {@link MetadataItem}
     *
     * @param jsonMetadata {@link JsonNode} parse from the query string
     * @throws MetadataValidationException if query values are missing or invalid
     */
Parse  JsonNode to  MetadataItem
@param jsonMetadata  JsonNode parse from the query string
@throws MetadataValidationException if query values are missing or invalid
Parse JsonNode to MetadataItem @param jsonMetadata JsonNode parse from the query string @throws MetadataValidationException if query values are missing or invalid
public MetadataItem parseJsonMetadata(JsonNode jsonMetadata) throws MetadataValidationException {
        try {
            MetadataItem metadataItem = new MetadataItem();
            setPermissions(mapper.createArrayNode());
            setNotifications(mapper.createArrayNode());
            if (jsonMetadata.has("uuid")) {
                String muuid = jsonMetadata.get("uuid").asText();
                if (StringUtils.isNotBlank(muuid)) {
                    metadataItem.setUuid(muuid);
                }
            }
            String name = parseNameToString(jsonMetadata);
            JsonNode value = parseValueToJsonNode(jsonMetadata);
            metadataItem.setName(name);
            metadataItem.setValue(value);
            metadataItem.getAssociations().addAll(parseAssociationIdsToList(jsonMetadata));
            metadataItem.setSchemaId(parseSchemaIdToString(jsonMetadata));
            setPermissions(parsePermissionToArrayNode(jsonMetadata));
            setNotifications(parseNotificationToArrayNode(jsonMetadata));
            return metadataItem;
        } catch (Exception e) {
            throw new MetadataValidationException(
                    "Unable to parse metadata item. " + e.getMessage());
        }
    }
public MetadataItem parseJsonMetadata ( JsonNode jsonMetadata ) throws MetadataValidationException { try { MetadataItem metadataItem = new MetadataItem ( ) ; setPermissions ( mapper . createArrayNode ( ) ) ; setNotifications ( mapper . createArrayNode ( ) ) ; if ( jsonMetadata . has ( "uuid" ) ) { String muuid = jsonMetadata . get ( "uuid" ) . asText ( ) ; if ( StringUtils . isNotBlank ( muuid ) ) { metadataItem . setUuid ( muuid ) ; } } String name = parseNameToString ( jsonMetadata ) ; JsonNode value = parseValueToJsonNode ( jsonMetadata ) ; metadataItem . setName ( name ) ; metadataItem . setValue ( value ) ; metadataItem . getAssociations ( ) . addAll ( parseAssociationIdsToList ( jsonMetadata ) ) ; metadataItem . setSchemaId ( parseSchemaIdToString ( jsonMetadata ) ) ; setPermissions ( parsePermissionToArrayNode ( jsonMetadata ) ) ; setNotifications ( parseNotificationToArrayNode ( jsonMetadata ) ) ; return metadataItem ; } catch ( Exception e ) { throw new MetadataValidationException ( "Unable to parse metadata item. " + e . getMessage ( ) ) ; } }
Parse {@link JsonNode} to {@link MetadataItem}
 @param jsonMetadata {@link JsonNode} parse from the query string
 @throws MetadataValidationException if query values are missing or invalid
Parse { @link JsonNode } to { @link MetadataItem } @param jsonMetadata { @link JsonNode } parse from the query string @throws MetadataValidationException if query values are missing or invalid
// why do we do this here rather than letting the validator handle it? //            if (name == null) //                throw new MetadataQueryException( //                        "No name attribute specified. " + //                                "Please associate a value with the metadata name."); // why do we do this here rather than letting the validator handle it? //            if (value == null) //                throw new MetadataQueryException( //                        "No value attribute specified. " + //                                "Please associate a value with the metadata value."); //MetadataRequestPermissionProcessor will handle the notification parsing //MetadataRequestNotificationProcessor will handle the notification parsing