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
  • Constructor Details

    • DbRequestResult

      public DbRequestResult()
      empty constructor
    • DbRequestResult

      public DbRequestResult(DbRequestResult requestResult)
  • 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
    • close

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