Package fr.gouv.vitam.metadata.core.utils

# Class MetadataJsonResponseUtils

java.lang.Object
fr.gouv.vitam.metadata.core.utils.MetadataJsonResponseUtils

public final class MetadataJsonResponseUtils extends Object
The purpose of this class is to centralize the generation of a metadata json response

- ## Method Summary

  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, Map<String,List<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 Details

  - ### 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, Map<String,List<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)