Class DbRequestResult
java.lang.Object
fr.gouv.vitam.common.database.server.DbRequestResult
- All Implemented Interfaces:
VitamAutoCloseable
,AutoCloseable
This class is the result of DbRequestSingle's execution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 ParserTokenslong
getCount()
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 listlong
getLimit()
long
<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 classlong
getTotal()
boolean
setCount
(long count) setCursor
(com.mongodb.client.MongoCursor<VitamDocument<?>> cursor) setLimit
(long limit) setOffset
(long offset) setTotal
(long total)
-
Constructor Details
-
DbRequestResult
public DbRequestResult()empty constructor -
DbRequestResult
-
-
Method Details
-
getCount
public long getCount()- Returns:
- the count
-
setCount
- Parameters:
count
- the count to set- Returns:
- this
-
getTotal
public long getTotal()- Returns:
- the possible total result (select)
-
setTotal
- Parameters:
total
- the possible total result (select)- Returns:
- this
-
getDiffs
- Returns:
- the diffs
-
getOffset
public long getOffset()- Returns:
- the offset
-
setOffset
- Parameters:
offset
- the offset to set- Returns:
- this
-
getLimit
public long getLimit()- Returns:
- the limit
-
setLimit
- Parameters:
limit
- the limit to set- Returns:
- this
-
setDiffs
- Parameters:
diffs
- the diffs to set- Returns:
- this
-
hasResult
public boolean hasResult()- Returns:
- True if the query has at least one result
-
setCursor
- Parameters:
cursor
- the cursor to set- Returns:
- this
-
getDocuments
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 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, 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
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 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
- Returns:
- the corresponding DatabaseCursor
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-