Class DbRequestResult
- java.lang.Object
-
- fr.gouv.vitam.common.database.server.DbRequestResult
-
- All Implemented Interfaces:
VitamAutoCloseable
,java.lang.AutoCloseable
public class DbRequestResult extends java.lang.Object implements VitamAutoCloseable
This class is the result of DbRequestSingle's execution
-
-
Constructor Summary
Constructors Constructor Description DbRequestResult()
empty constructorDbRequestResult(DbRequestResult requestResult)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
filterFinalResponse(VitamDocument<?> document)
This method will modify the document argument in order to filter as output all _varname to corresponding #varname according to ParserTokenslong
getCount()
DatabaseCursor
getDatabaseCursor()
java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getDiffs()
<T extends VitamDocument<?>>
java.util.List<T>getDocuments(java.lang.Class<T> cls)
Returns directly the VitamDocuments list<T extends VitamDocument<T>,V>
java.util.List<V>getDocuments(java.lang.Class<T> cls, java.lang.Class<V> clsFromJson)
Return directly the clsFomJson items listlong
getLimit()
long
getOffset()
<T extends VitamDocument<T>>
RequestResponseOK<T>getRequestResponseOK(com.fasterxml.jackson.databind.JsonNode query, java.lang.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, java.lang.Class<T> cls, java.lang.Class<V> clsFromJson)
Return directly a RequestResponseOk from result using clsFromJson classlong
getTotal()
boolean
hasResult()
DbRequestResult
setCount(long count)
DbRequestResult
setCursor(com.mongodb.client.MongoCursor<VitamDocument<?>> cursor)
DbRequestResult
setDiffs(java.util.Map<java.lang.String,java.util.List<java.lang.String>> diffs)
DbRequestResult
setLimit(long limit)
DbRequestResult
setOffset(long offset)
DbRequestResult
setTotal(long total)
-
-
-
Constructor Detail
-
DbRequestResult
public DbRequestResult()
empty constructor
-
DbRequestResult
public DbRequestResult(DbRequestResult requestResult)
-
-
Method Detail
-
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 java.util.Map<java.lang.String,java.util.List<java.lang.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(java.util.Map<java.lang.String,java.util.List<java.lang.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<?>> java.util.List<T> getDocuments(java.lang.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> java.util.List<V> getDocuments(java.lang.Class<T> cls, java.lang.Class<V> clsFromJson) throws InvalidParseOperationException
Return directly the clsFomJson items list- Type Parameters:
T
- the original class used by the collection extending VitamCollectionV
- the target class using Json native decoding- Parameters:
cls
- source classclsFromJson
- 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, java.lang.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, java.lang.Class<T> cls, java.lang.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 VitamCollectionV
- the target class using Json native decoding- Parameters:
cls
- Native MongoDb ClassclsFromJson
- 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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-
-