T
- Type of resultspublic final class RequestResponseOK<T> extends RequestResponse<T>
Modifier and Type | Field and Description |
---|---|
static String |
TAG_CONTEXT
context in response
|
static String |
TAG_RESULTS
result in response
|
Constructor and Description |
---|
RequestResponseOK()
Empty RequestResponseOK constructor
|
RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query)
Initialize from a query
|
Modifier and Type | Method and Description |
---|---|
RequestResponseOK<T> |
addAllResults(List<T> resultList)
Add list of results
|
RequestResponseOK<T> |
addResult(T result)
Add one result
|
T |
getFirstResult() |
static 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) |
DatabaseCursor |
getHits() |
com.fasterxml.jackson.databind.JsonNode |
getQuery() |
List<T> |
getResults() |
List<com.fasterxml.jackson.databind.JsonNode> |
getResultsAsJsonNodes() |
boolean |
isEmpty() |
RequestResponseOK<T> |
setHits(DatabaseCursor hits) |
RequestResponseOK<T> |
setHits(long total,
int offset,
int limit) |
RequestResponseOK<T> |
setHits(long total,
int offset,
int limit,
int size) |
RequestResponseOK<T> |
setHits(long total,
int offset,
int limit,
int size,
String scrollId) |
RequestResponseOK<T> |
setQuery(com.fasterxml.jackson.databind.JsonNode query) |
RequestResponseOK<T> |
setScrollId(String scrollId)
When activate scroll
|
RequestResponseOK<T> |
setTotal(long total)
Should be used only with hints of elasticsearch
|
javax.ws.rs.core.Response |
toResponse()
transform a RequestResponse to a standard response
|
addHeader, getHeaderString, getHttpCode, getStatus, getVitamHeaders, isOk, parseFromResponse, parseFromResponse, parseHeadersFromResponse, parseRequestResponseOk, parseVitamError, setHttpCode, toJsonNode, toString, unSetVitamHeaders
public static final String TAG_RESULTS
public static final String TAG_CONTEXT
public RequestResponseOK()
public RequestResponseOK(com.fasterxml.jackson.databind.JsonNode query)
query
- public RequestResponseOK<T> addResult(T result)
result
- to add to request responsepublic RequestResponseOK<T> addAllResults(List<T> resultList)
resultList
- the list of resultspublic DatabaseCursor getHits()
public RequestResponseOK<T> setHits(DatabaseCursor hits)
hits
- as DatabaseCursor objectpublic RequestResponseOK<T> setHits(long total, int offset, int limit)
total
- of units inserted/modified as integeroffset
- of unit in database as integerlimit
- of unit per response as integerpublic RequestResponseOK<T> setHits(long total, int offset, int limit, int size, String scrollId)
total
- of units inserted/modified as integeroffset
- of unit in database as integerlimit
- of unit per response as integersize
- of unit per responsescrollId
- of responsepublic RequestResponseOK<T> setHits(long total, int offset, int limit, int size)
total
- of units inserted/modified as integeroffset
- of unit in database as integerlimit
- of unit per response as integersize
- of unit per responsepublic RequestResponseOK<T> setTotal(long total)
total
- public RequestResponseOK<T> setScrollId(String scrollId)
scrollId
- public com.fasterxml.jackson.databind.JsonNode getQuery()
public T getFirstResult()
public RequestResponseOK<T> setQuery(com.fasterxml.jackson.databind.JsonNode query)
query
- the set to request responsepublic boolean isEmpty()
public static RequestResponseOK<com.fasterxml.jackson.databind.JsonNode> getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node) throws InvalidParseOperationException
node
- to transformInvalidParseOperationException
- if parse json object exception occurredpublic static <T> RequestResponseOK<T> getFromJsonNode(com.fasterxml.jackson.databind.JsonNode node, Class<T> clazz) throws InvalidParseOperationException
node
- to transformInvalidParseOperationException
- if parse json object exception occurredpublic List<com.fasterxml.jackson.databind.JsonNode> getResultsAsJsonNodes() throws InvalidParseOperationException
InvalidParseOperationException
public javax.ws.rs.core.Response toResponse()
toResponse
in class RequestResponse<T>
Copyright © 2018 Vitam. All rights reserved.