Package fr.gouv.vitam.common.model

# Class RequestResponseOK<T>

java.lang.Object
fr.gouv.vitam.common.model.RequestResponse<T>
fr.gouv.vitam.common.model.RequestResponseOK<T>

Type Parameters:
  `T` - Type of results

public final class RequestResponseOK<T> extends RequestResponse<T>
Access RequestResponseOK class contains list of results
default results : is an empty list (immutable)

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `TAG_CONTEXT`
  context in response
  `static final String`
  `TAG_FACET_RESULTS`
  facet results in response
  `static final String`
  `TAG_HISTORY`
  history in response
  `static final String`
  `TAG_RESULTS`
  result in response

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RequestResponseOK()`
  Empty RequestResponseOK constructor
  `RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query)`
  Initialize from a query
  `RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, List<T> results, int total)`
  Initialize from a query and results
  `RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, List<T> results, int total, String scrollId)`
  Initialize from a query and results

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RequestResponseOK<T>`
  `addAllFacetResults(List<FacetResult> facetResultList)`
  Add list of facetResult
  `RequestResponseOK<T>`
  `addAllResults(List<T> resultList)`
  Add list of results
  `RequestResponseOK<T>`
  `addFacetResult(FacetResult facetResult)`
  Add one facetResult
  `RequestResponseOK<T>`
  `addResult(T result)`
  Add one result
  `List<FacetResult>`
  `getFacetResults()`
  `T`
  `getFirstResult()`
  `static RequestResponseOK<com.fasterxml.jackson.databind.JsonNode>`
  `getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node)`
  `static <T> RequestResponseOK<T>`
  `getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node, Class<T> clazz)`
  `com.fasterxml.jackson.databind.JsonNode`
  `getHistory()`
  `DatabaseCursor`
  `getHits()`
  `com.fasterxml.jackson.databind.JsonNode`
  `getQuery()`
  `List<T>`
  `getResults()`
  `List<com.fasterxml.jackson.databind.JsonNode>`
  `getResultsAsJsonNodes()`
  `boolean`
  `isEmpty()`
  `RequestResponseOK<T>`
  `setHits(long total, int offset, int limit)`
  `RequestResponseOK<T>`
  `setHits(long total, int offset, int limit, int size)`
  `RequestResponseOK<T>`
  `setHits(long total, int offset, int limit, int size, String scrollId)`
  `RequestResponseOK<T>`
  `setHits(DatabaseCursor hits)`
  `RequestResponseOK<T>`
  `setHttpCode(int httpCode)`
  `RequestResponseOK<T>`
  `setQuery(com.fasterxml.jackson.databind.JsonNode query)`
  `RequestResponseOK<T>`
  `setScrollId(String scrollId)`
  When activate scroll
  `RequestResponseOK<T>`
  `setTotal(long total)`
  Should be used only with hints of elasticsearch
  `jakarta.ws.rs.core.Response`
  `toResponse()`
  transform a RequestResponse to a standard response

  ### Methods inherited from class fr.gouv.vitam.common.model.RequestResponse

  `addHeader, getHeaderString, getHttpCode, getStatus, getVitamHeaders, isOk, isRequestResponseEmpty, isRequestResponseOk, parseFromResponse, parseFromResponse, parseHeadersFromResponse, parseRequestResponseOk, parseRequestResponseOk, parseVitamError, parseVitamError, toJsonNode, toString, unSetVitamHeaders`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### TAG_RESULTS

    public static final String TAG_RESULTS
    result in response
    See Also:
      - Constant Field Values

  - ### TAG_FACET_RESULTS

    public static final String TAG_FACET_RESULTS
    facet results in response
    See Also:
      - Constant Field Values

  - ### TAG_CONTEXT

    public static final String TAG_CONTEXT
    context in response
    See Also:
      - Constant Field Values

  - ### TAG_HISTORY

    public static final String TAG_HISTORY
    history in response
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### RequestResponseOK

    public RequestResponseOK()
    Empty RequestResponseOK constructor

  - ### RequestResponseOK

    public RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query)
    Initialize from a query
    Parameters:
      `query` -

  - ### RequestResponseOK

    public RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, List<T> results, int total)
    Initialize from a query and results
    Parameters:
      `query` -

  - ### RequestResponseOK

    public RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, List<T> results, int total, String scrollId)
    Initialize from a query and results
    Parameters:
      `query` -

- ## Method Details

  - ### addResult

    public RequestResponseOK<T> addResult(T result)
    Add one result
    Parameters:
      `result` - to add to request response
    Returns:
      this

  - ### addAllResults

    public RequestResponseOK<T> addAllResults(List<T> resultList)
    Add list of results
    Parameters:
      `resultList` - the list of results
    Returns:
      RequestResponseOK with mutable results list of String

  - ### addFacetResult

    public RequestResponseOK<T> addFacetResult(FacetResult facetResult)
    Add one facetResult
    Parameters:
      `facetResult` - to add to request response
    Returns:
      this

  - ### addAllFacetResults

    public RequestResponseOK<T> addAllFacetResults(List<FacetResult> facetResultList)
    Add list of facetResult
    Parameters:
      `facetResultList` - the list of facetResults
    Returns:
      RequestResponseOK with mutable results list of String

  - ### getHits

    public DatabaseCursor getHits()
    Returns:
      the hits of RequestResponseOK object

  - ### setHits

    public RequestResponseOK<T> setHits(DatabaseCursor hits)
    Parameters:
      `hits` - as DatabaseCursor object
    Returns:
      RequestReponseOK with the hits are setted

  - ### setHits

    public RequestResponseOK<T> setHits(long total, int offset, int limit)
    Parameters:
      `total` - of units inserted/modified as integer
      `offset` - of unit in database as integer
      `limit` - of unit per response as integer
    Returns:
      the RequestReponseOK with the hits are setted

  - ### setHits

    public RequestResponseOK<T> setHits(long total, int offset, int limit, int size, String scrollId)
    Parameters:
      `total` - of units inserted/modified as integer
      `offset` - of unit in database as integer
      `limit` - of unit per response as integer
      `size` - of unit per response
      `scrollId` - of response
    Returns:
      the RequestReponseOK with the hits are setted

  - ### setHits

    public RequestResponseOK<T> setHits(long total, int offset, int limit, int size)
    Parameters:
      `total` - of units inserted/modified as integer
      `offset` - of unit in database as integer
      `limit` - of unit per response as integer
      `size` - of unit per response
    Returns:
      the RequestReponseOK with the hits are setted

  - ### setTotal

    public RequestResponseOK<T> setTotal(long total)
    Should be used only with hints of elasticsearch
    Parameters:
      `total` -
    Returns:

  - ### setScrollId

    public RequestResponseOK<T> setScrollId(String scrollId)
    When activate scroll
    Parameters:
      `scrollId` -
    Returns:

  - ### getFacetResults

    public List<FacetResult> getFacetResults()
    Returns:
      the facetResults

  - ### getResults

    public List<T> getResults()
    Returns:
      the result of RequestResponse as a list of

  - ### getQuery

    public com.fasterxml.jackson.databind.JsonNode getQuery()
    Returns:
      the query as JsonNode of Response

  - ### getHistory

    public com.fasterxml.jackson.databind.JsonNode getHistory()
    Returns:
      the history as JsonNode of Response

  - ### getFirstResult

    public T getFirstResult()
    Returns:
      the first result of RequestResponse as a

  - ### setQuery

    public RequestResponseOK<T> setQuery(com.fasterxml.jackson.databind.JsonNode query)
    Parameters:
      `query` - the set to request response
    Returns:
      this

  - ### isEmpty

    public boolean isEmpty()
    Returns:
      True if the result is empty

  - ### getFromJsonNode

    public static RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node) throws InvalidParseOperationException
    Parameters:
      `node` - to transform
    Returns:
      the corresponding VitamError
    Throws:
      `InvalidParseOperationException` - if parse json object exception occurred

  - ### getFromJsonNode

    public static <T> RequestResponseOK<T> getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node, Class<T> clazz) throws InvalidParseOperationException
    Parameters:
      `node` - to transform
    Returns:
      the corresponding VitamError
    Throws:
      `InvalidParseOperationException` - if parse json object exception occurred

  - ### getResultsAsJsonNodes

    public List<com.fasterxml.jackson.databind.JsonNode> getResultsAsJsonNodes() throws InvalidParseOperationException
    Returns:
      the result of RequestResponse as a list of jsonNode
    Throws:
      `InvalidParseOperationException`

  - ### setHttpCode

    public RequestResponseOK<T> setHttpCode(int httpCode)
    Overrides:
      `setHttpCode` in class `RequestResponse<T>`
    Parameters:
      `httpCode` - the httpCode to set
    Returns:
      this

  - ### toResponse

    public jakarta.ws.rs.core.Response toResponse()
    transform a RequestResponse to a standard response
    Specified by:
      `toResponse` in class `RequestResponse<T>`
    Returns:
      Response