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
Access RequestResponseOK class contains list of results
default results : is an empty list (immutable)
default results : is an empty list (immutable)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionEmpty RequestResponseOK constructorRequestResponseOK
(com.fasterxml.jackson.databind.JsonNode query) Initialize from a queryRequestResponseOK
(com.fasterxml.jackson.databind.JsonNode query, List<T> results, int total) Initialize from a query and resultsRequestResponseOK
(com.fasterxml.jackson.databind.JsonNode query, List<T> results, int total, String scrollId) Initialize from a query and results -
Method Summary
Modifier and TypeMethodDescriptionaddAllFacetResults
(List<FacetResult> facetResultList) Add list of facetResultaddAllResults
(List<T> resultList) Add list of resultsaddFacetResult
(FacetResult facetResult) Add one facetResultAdd one resultstatic 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
getHits()
com.fasterxml.jackson.databind.JsonNode
getQuery()
List<com.fasterxml.jackson.databind.JsonNode>
boolean
isEmpty()
setHits
(long total, int offset, int limit) setHits
(long total, int offset, int limit, int size) setHits
(DatabaseCursor hits) setHttpCode
(int httpCode) setQuery
(com.fasterxml.jackson.databind.JsonNode query) setScrollId
(String scrollId) When activate scrollsetTotal
(long total) Should be used only with hints of elasticsearchjavax.ws.rs.core.Response
transform a RequestResponse to a standard responseMethods 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
-
Field Details
-
TAG_RESULTS
result in response- See Also:
-
TAG_FACET_RESULTS
facet results in response- See Also:
-
TAG_CONTEXT
context in response- See Also:
-
TAG_HISTORY
history in response- See Also:
-
-
Constructor Details
-
RequestResponseOK
public RequestResponseOK()Empty RequestResponseOK constructor -
RequestResponseOK
public RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query) Initialize from a query- Parameters:
query
-
-
RequestResponseOK
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
Add one result- Parameters:
result
- to add to request response- Returns:
- this
-
addAllResults
Add list of results- Parameters:
resultList
- the list of results- Returns:
- RequestResponseOK with mutable results list of String
-
addFacetResult
Add one facetResult- Parameters:
facetResult
- to add to request response- Returns:
- this
-
addAllFacetResults
Add list of facetResult- Parameters:
facetResultList
- the list of facetResults- Returns:
- RequestResponseOK with mutable results list of String
-
getHits
- Returns:
- the hits of RequestResponseOK object
-
setHits
- Parameters:
hits
- as DatabaseCursor object- Returns:
- RequestReponseOK with the hits are setted
-
setHits
- Parameters:
total
- of units inserted/modified as integeroffset
- of unit in database as integerlimit
- of unit per response as integer- Returns:
- the RequestReponseOK with the hits are setted
-
setHits
- Parameters:
total
- of units inserted/modified as integeroffset
- of unit in database as integerlimit
- of unit per response as integersize
- of unit per responsescrollId
- of response- Returns:
- the RequestReponseOK with the hits are setted
-
setHits
- Parameters:
total
- of units inserted/modified as integeroffset
- of unit in database as integerlimit
- of unit per response as integersize
- of unit per response- Returns:
- the RequestReponseOK with the hits are setted
-
setTotal
Should be used only with hints of elasticsearch- Parameters:
total
-- Returns:
-
setScrollId
When activate scroll- Parameters:
scrollId
-- Returns:
-
getFacetResults
- Returns:
- the facetResults
-
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
- Returns:
- the first result of RequestResponse as a
-
setQuery
- 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
- Overrides:
setHttpCode
in classRequestResponse<T>
- Parameters:
httpCode
- the httpCode to set- Returns:
- this
-
toResponse
public javax.ws.rs.core.Response toResponse()transform a RequestResponse to a standard response- Specified by:
toResponse
in classRequestResponse<T>
- Returns:
- Response
-