Package fr.gouv.vitam.common.database.server

# Class DbRequestResult

java.lang.Object
fr.gouv.vitam.common.database.server.DbRequestResult

All Implemented Interfaces:
  `VitamAutoCloseable`, `AutoCloseable`

public class DbRequestResult extends Object implements VitamAutoCloseable
This class is the result of DbRequestSingle's execution

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected List<FacetResult>`
  `facetResult`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DbRequestResult()`
  empty constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFacetResult(FacetResult facetResult)`
  Add a FacetResult
  `void`
  `close()`
  `final void`
  `filterFinalResponse(VitamDocument<?> document)`
  This method will modify the document argument in order to filter as output all _varname to corresponding #varname according to ParserTokens
  `long`
  `getCount()`
  `com.mongodb.client.MongoCursor<VitamDocument<?>>`
  `getCursor()`
  `DatabaseCursor`
  `getDatabaseCursor()`
  `Map<String,List<String>>`
  `getDiffs()`
  `<T extends VitamDocument<?>>
  List<T>`
  `getDocuments(Class<T> cls)`
  Returns directly the VitamDocuments list
  `<T extends VitamDocument<T>, V>
  List<V>`
  `getDocuments(Class<T> cls, Class<V> clsFromJson)`
  Return directly the clsFomJson items list
  `List<FacetResult>`
  `getFacet()`
  `long`
  `getLimit()`
  `long`
  `getOffset()`
  `<T extends VitamDocument<T>>
  RequestResponseOK<T>`
  `getRequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, Class<T> cls)`
  Return directly a RequestResponseOk from result using default VitamDocument
  `<T extends VitamDocument<T>, V>
  RequestResponseOK<V>`
  `getRequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, Class<T> cls, Class<V> clsFromJson)`
  Return directly a RequestResponseOk from result using clsFromJson class
  `long`
  `getTotal()`
  `boolean`
  `hasResult()`
  `DbRequestResult`
  `setCount(long count)`
  `DbRequestResult`
  `setCursor(com.mongodb.client.MongoCursor<VitamDocument<?>> cursor)`
  `DbRequestResult`
  `setDiffs(Map<String,List<String>> diffs)`
  `DbRequestResult`
  `setLimit(long limit)`
  `DbRequestResult`
  `setOffset(long offset)`
  `DbRequestResult`
  `setTotal(long total)`

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

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

- ## Field Details

  - ### facetResult

    protected List<FacetResult> facetResult

- ## Constructor Details

  - ### DbRequestResult

    public DbRequestResult()
    empty constructor

- ## Method Details

  - ### getCount

    public long getCount()
    Returns:
      the count

  - ### setCount

    public DbRequestResult setCount(long count)
    Parameters:
      `count` - the count to set
    Returns:
      this

  - ### getTotal

    public long getTotal()
    Returns:
      the possible total result (select)

  - ### setTotal

    public DbRequestResult setTotal(long total)
    Parameters:
      `total` - the possible total result (select)
    Returns:
      this

  - ### getDiffs

    public Map<String,List<String>> getDiffs()
    Returns:
      the diffs

  - ### getOffset

    public long getOffset()
    Returns:
      the offset

  - ### setOffset

    public DbRequestResult setOffset(long offset)
    Parameters:
      `offset` - the offset to set
    Returns:
      this

  - ### getLimit

    public long getLimit()
    Returns:
      the limit

  - ### setLimit

    public DbRequestResult setLimit(long limit)
    Parameters:
      `limit` - the limit to set
    Returns:
      this

  - ### setDiffs

    public DbRequestResult setDiffs(Map<String,List<String>> diffs)
    Parameters:
      `diffs` - the diffs to set
    Returns:
      this

  - ### hasResult

    public boolean hasResult()
    Returns:
      True if the query has at least one result

  - ### setCursor

    public DbRequestResult setCursor(com.mongodb.client.MongoCursor<VitamDocument<?>> cursor)
    Parameters:
      `cursor` - the cursor to set
    Returns:
      this

  - ### getDocuments

    public <T extends VitamDocument<?>> List<T> getDocuments(Class<T> cls)
    Returns directly the VitamDocuments list
    Type Parameters:
      `T` - the original class used by the collection extending VitamCollection
    Parameters:
      `cls` - source class
    Returns:
      the documents (copy)

  - ### getDocuments

    public <T extends VitamDocument<T>, V> List<V> getDocuments(Class<T> cls, Class<V> clsFromJson) throws InvalidParseOperationException
    Return directly the clsFomJson items list
    Type Parameters:
      `T` - the original class used by the collection extending VitamCollection
      `V` - the target class using Json native decoding
    Parameters:
      `cls` - source class
      `clsFromJson` - target class
    Returns:
      the documents using the target class
    Throws:
      `InvalidParseOperationException` - if parsing is in error

  - ### getRequestResponseOK

    public <T extends VitamDocument<T>> RequestResponseOK<T> getRequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, Class<T> cls)
    Return directly a RequestResponseOk from result using default VitamDocument
    Type Parameters:
      `T` - the original class used by the collection extending VitamCollection
    Parameters:
      `cls` - Native MongoDb Class
    Returns:
      a RequestResponseOK with Hits and Results sets (not request)

  - ### filterFinalResponse

    public final void filterFinalResponse(VitamDocument<?> document)
    This method will modify the document argument in order to filter as output all _varname to corresponding #varname according to ParserTokens
    Parameters:
      `document` - of type Document to be modified

  - ### getRequestResponseOK

    public <T extends VitamDocument<T>, V> RequestResponseOK<V> getRequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, Class<T> cls, Class<V> clsFromJson) throws InvalidParseOperationException
    Return directly a RequestResponseOk from result using clsFromJson class
    Type Parameters:
      `T` - the original class used by the collection extending VitamCollection
      `V` - the target class using Json native decoding
    Parameters:
      `cls` - Native MongoDb Class
      `clsFromJson` - target class
    Returns:
      a RequestResponseOK with Hits and Results sets (not request)
    Throws:
      `InvalidParseOperationException`

  - ### getDatabaseCursor

    public DatabaseCursor getDatabaseCursor()
    Returns:
      the corresponding DatabaseCursor

  - ### getFacet

    public List<FacetResult> getFacet()
    Returns:
      the list of FacetResult

  - ### addFacetResult

    public void addFacetResult(FacetResult facetResult)
    Add a FacetResult
    Parameters:
      `facetResult` - facetResult

  - ### getCursor

    public com.mongodb.client.MongoCursor<VitamDocument<?>> getCursor()

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `VitamAutoCloseable`