Search in sources :

Example 1 with QueryWizardStep3Response

use of datawave.webservice.result.QueryWizardStep3Response in project datawave by NationalSecurityAgency.

the class BasicQueryBean method showQueryWizardStep3.

/**
 * Display the query plan and link to basic query results for a simple query web UI in the quickstart
 *
 * @HTTP 200 Success
 * @return datawave.webservice.result.QueryWizardStep3Response
 * @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 X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 */
@POST
@Produces({ "application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "text/html" })
@Path("/{logicName}/showQueryWizardStep3")
@GenerateQuerySessionId(cookieBasePath = "/DataWave/BasicQuery/")
@Interceptors({ ResponseInterceptor.class })
@Timed(name = "dw.query.showQueryWizardStep3", absolute = true)
public QueryWizardStep3Response showQueryWizardStep3(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String, String> queryParameters, @Context HttpHeaders httpHeaders) {
    CreateQuerySessionIDFilter.QUERY_ID.set(null);
    GenericResponse<String> createResponse;
    QueryWizardStep3Response queryWizardStep3Response = new QueryWizardStep3Response();
    try {
        createResponse = queryExecutor.createQuery(logicName, queryParameters, httpHeaders);
    } catch (Exception e) {
        queryWizardStep3Response.setErrorMessage(e.getMessage());
        return queryWizardStep3Response;
    }
    String queryId = createResponse.getResult();
    CreateQuerySessionIDFilter.QUERY_ID.set(queryId);
    queryWizardStep3Response.setQueryId(queryId);
    BaseQueryLogic logic = getQueryLogic(logicName);
    if (logic != null && !(NO_PLAN_REQUIRED.contains(logic.getClass().getName()))) {
        GenericResponse<String> planResponse;
        try {
            planResponse = queryExecutor.plan(queryId);
        } catch (Exception e) {
            queryWizardStep3Response.setErrorMessage(e.getMessage());
            return queryWizardStep3Response;
        }
        queryWizardStep3Response.setQueryPlan(planResponse.getResult());
    } else
        queryWizardStep3Response.setQueryPlan("No plan required for this query");
    return queryWizardStep3Response;
}
Also used : QueryWizardStep3Response(datawave.webservice.result.QueryWizardStep3Response) QueryException(datawave.webservice.query.exception.QueryException) BaseQueryLogic(datawave.webservice.query.logic.BaseQueryLogic) Path(javax.ws.rs.Path) GenerateQuerySessionId(datawave.annotation.GenerateQuerySessionId) Interceptors(javax.interceptor.Interceptors) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Timed (com.codahale.metrics.annotation.Timed)1 GenerateQuerySessionId (datawave.annotation.GenerateQuerySessionId)1 QueryException (datawave.webservice.query.exception.QueryException)1 BaseQueryLogic (datawave.webservice.query.logic.BaseQueryLogic)1 QueryWizardStep3Response (datawave.webservice.result.QueryWizardStep3Response)1 Interceptors (javax.interceptor.Interceptors)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1