Class MetadataJsonResponseUtils


  • public final class MetadataJsonResponseUtils
    extends java.lang.Object
    The purpose of this class is to centralize the generation of a metadata json response
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.fasterxml.jackson.databind.node.ArrayNode populateJSONObjectResponse​(Result result, RequestParserMultiple selectRequest)
      create Json response
      static com.fasterxml.jackson.databind.node.ArrayNode populateJSONObjectResponse​(Result result, java.util.Map<java.lang.String,​java.util.List<java.lang.String>> diff)
      create Json response with diff information
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • populateJSONObjectResponse

        public static com.fasterxml.jackson.databind.node.ArrayNode populateJSONObjectResponse​(Result result,
                                                                                               RequestParserMultiple selectRequest)
                                                                                        throws InvalidParseOperationException
        create Json response
        Parameters:
        result - contains final unit(s)/ObjectGroup(s) list
        can be empty
        selectRequest - the select request of type RequestParserMultiple
        Returns:
        ArrayNode {$hits{},$context{},$result:[{}....{}],}
        $context will be added later (Access)
        $result array of units or ObjectGroup (can be empty)
        Throws:
        InvalidParseOperationException - thrown when json query is not valid
      • populateJSONObjectResponse

        public static com.fasterxml.jackson.databind.node.ArrayNode populateJSONObjectResponse​(Result result,
                                                                                               java.util.Map<java.lang.String,​java.util.List<java.lang.String>> diff)
        create Json response with diff information
        Parameters:
        result - contains final unit(s)/ObjectGroup(s) list
        can be empty
        diff - the diff map list with the unit id as key and the diff list as value
        Returns:
        JsonNode {$hits{},$context{},$result:[{_id:...,_diff:...}},...{}]}
        $context will be added later (Access)
        $result array of units or ObjectGroup (can be empty)