use of datawave.webservice.query.util.PostUUIDCriteria in project datawave by NationalSecurityAgency.
the class QueryExecutorBean method lookupContentByUUIDBatch.
/**
* @param queryParameters
* @param httpHeaders
* @return content results, either as a paged BaseQueryResponse or StreamingOutput
* @RequestHeader X-ProxiedEntitiesChain use when proxying request for user, by specifying a chain of DNs of the identities to proxy
* @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
* @ResponseHeader query-session-id this header and value will be in the Set-Cookie header, subsequent calls for this session will need to supply the
* query-session-id header in the request in a Cookie header or as a query parameter
* @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
* @ResponseHeader X-Partial-Results true if the page contains less than the requested number of results
*
* @HTTP 200 success
* @HTTP 204 success and no results
* @HTTP 400 invalid or missing parameter
* @HTTP 500 internal server error
*/
@POST
@Path("/lookupContentUUID")
@Produces({ "application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff" })
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@Interceptors({ ResponseInterceptor.class, RequiredInterceptor.class })
@Override
@Timed(name = "dw.query.lookupContentUUIDBatch", absolute = true)
public <T> T lookupContentByUUIDBatch(MultivaluedMap<String, String> queryParameters, @Required("httpHeaders") @Context HttpHeaders httpHeaders) {
if (!queryParameters.containsKey("uuidPairs")) {
throw new BadRequestException(new IllegalArgumentException("uuidPairs missing from query parameters"), new VoidResponse());
}
T response = null;
String queryId = null;
try {
String uuidPairs = queryParameters.getFirst("uuidPairs");
String streaming = queryParameters.getFirst("streaming");
boolean streamingOutput = false;
if (!StringUtils.isEmpty(streaming)) {
streamingOutput = Boolean.parseBoolean(streaming);
}
// Create the criteria for looking up the respective events, which we need to get the shard IDs and column families
// required for the content lookup
final PostUUIDCriteria criteria = new PostUUIDCriteria(uuidPairs, queryParameters);
// Set the HTTP headers if a streamed response is required
if (streamingOutput) {
criteria.setStreamingOutputHeaders(httpHeaders);
}
response = this.lookupUUIDUtil.lookupContentByUUIDs(criteria);
if (response instanceof BaseQueryResponse) {
queryId = ((BaseQueryResponse) response).getQueryId();
}
return response;
} finally {
if (null != queryId) {
asyncClose(queryId);
}
}
}
use of datawave.webservice.query.util.PostUUIDCriteria in project datawave by NationalSecurityAgency.
the class QueryExecutorBean method lookupUUIDBatch.
/**
* @param queryParameters
* @param httpHeaders
* @return event results, either as a paged BaseQueryResponse or StreamingOutput
* @RequestHeader X-ProxiedEntitiesChain use when proxying request for user, by specifying a chain of DNs of the identities to proxy
* @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
* @ResponseHeader query-session-id this header and value will be in the Set-Cookie header, subsequent calls for this session will need to supply the
* query-session-id header in the request in a Cookie header or as a query parameter
* @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
* @ResponseHeader X-Partial-Results true if the page contains less than the requested number of results
*
* @HTTP 200 success
* @HTTP 204 success and no results
* @HTTP 400 invalid or missing parameter
* @HTTP 500 internal server error
*/
@POST
@Path("/lookupUUID")
@Produces({ "application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff" })
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@Interceptors({ ResponseInterceptor.class, RequiredInterceptor.class })
@Override
@Timed(name = "dw.query.lookupUUIDBatch", absolute = true)
public <T> T lookupUUIDBatch(MultivaluedMap<String, String> queryParameters, @Required("httpHeaders") @Context HttpHeaders httpHeaders) {
if (!queryParameters.containsKey("uuidPairs")) {
throw new BadRequestException(new IllegalArgumentException("uuidPairs missing from query parameters"), new VoidResponse());
}
T response;
String queryId = null;
try {
String uuidPairs = queryParameters.getFirst("uuidPairs");
String streaming = queryParameters.getFirst("streaming");
boolean streamingOutput = false;
if (!StringUtils.isEmpty(streaming)) {
streamingOutput = Boolean.parseBoolean(streaming);
}
final PostUUIDCriteria criteria = new PostUUIDCriteria(uuidPairs, queryParameters);
if (streamingOutput) {
criteria.setStreamingOutputHeaders(httpHeaders);
}
response = this.lookupUUIDUtil.createUUIDQueryAndNext(criteria);
if (response instanceof BaseQueryResponse) {
queryId = ((BaseQueryResponse) response).getQueryId();
}
return response;
} finally {
if (null != queryId) {
asyncClose(queryId);
}
}
}
Aggregations