Search in sources :

Example 16 with Parameter

use of datawave.webservice.query.QueryImpl.Parameter in project datawave by NationalSecurityAgency.

the class PartitionedQueryLogic method initialize.

@Override
public GenericQueryConfiguration initialize(Connector connection, Query settings, Set<Authorizations> auths) throws Exception {
    log.trace("initialize()");
    this.connector = connection;
    this.auths = auths;
    this.settings = settings.duplicate(settings.getQueryName() + "-chunk");
    this.settings.setQuery(getJexlQueryString(this.settings));
    chunker.setBaseQuery(this.settings);
    // this logic only accepts a list of selectors, possibly with ORs between them (simplified LUCENE)
    // but if the parent class thinks that the syntax is LUCENE, it will convert it to JEXL which screws up the chuncker
    Set<Parameter> params = new HashSet<>();
    Set<Parameter> origParams = this.settings.getParameters();
    for (Parameter p : origParams) {
        if (p.getParameterName().equals(QueryParameters.QUERY_SYNTAX) == false) {
            params.add(p);
        }
    }
    // ensure that the parent logic thinks that the syntax is JEXL so that it leaves it alone
    params.add(new Parameter(QueryParameters.QUERY_SYNTAX, "JEXL"));
    this.settings.setParameters(params);
    if (chunker.preInitializeQueryLogic()) {
        GenericQueryConfiguration config = super.initialize(this.connector, this.settings, this.auths);
        if (!config.getQueries().hasNext()) {
            return config;
        }
        chunker.initialize(config);
    }
    return initializeNextChunk();
}
Also used : Parameter(datawave.webservice.query.QueryImpl.Parameter) GenericQueryConfiguration(datawave.webservice.query.configuration.GenericQueryConfiguration) HashSet(java.util.HashSet)

Example 17 with Parameter

use of datawave.webservice.query.QueryImpl.Parameter in project datawave-query-metric-service by NationalSecurityAgency.

the class QueryMetricsDetailListResponse method toParametersString.

private static String toParametersString(final Set<Parameter> parameters) {
    final StringBuilder params = new StringBuilder();
    final String PARAMETER_SEPARATOR = ";";
    final String PARAMETER_NAME_VALUE_SEPARATOR = ":";
    if (null != parameters) {
        for (final Parameter param : parameters) {
            if (params.length() > 0) {
                params.append(PARAMETER_SEPARATOR);
            }
            params.append(param.getParameterName());
            params.append(PARAMETER_NAME_VALUE_SEPARATOR);
            params.append(param.getParameterValue());
        }
    }
    return params.toString();
}
Also used : Parameter(datawave.webservice.query.QueryImpl.Parameter)

Aggregations

Parameter (datawave.webservice.query.QueryImpl.Parameter)17 HashSet (java.util.HashSet)5 ArrayList (java.util.ArrayList)4 DatawavePrincipal (datawave.security.authorization.DatawavePrincipal)3 BadRequestException (datawave.webservice.common.exception.BadRequestException)3 DatawaveWebApplicationException (datawave.webservice.common.exception.DatawaveWebApplicationException)3 NoResultsException (datawave.webservice.common.exception.NoResultsException)3 UnauthorizedException (datawave.webservice.common.exception.UnauthorizedException)3 Query (datawave.webservice.query.Query)3 BadRequestQueryException (datawave.webservice.query.exception.BadRequestQueryException)3 NoResultsQueryException (datawave.webservice.query.exception.NoResultsQueryException)3 NotFoundQueryException (datawave.webservice.query.exception.NotFoundQueryException)3 PreConditionFailedQueryException (datawave.webservice.query.exception.PreConditionFailedQueryException)3 QueryException (datawave.webservice.query.exception.QueryException)3 UnauthorizedQueryException (datawave.webservice.query.exception.UnauthorizedQueryException)3 IOException (java.io.IOException)3 CancellationException (java.util.concurrent.CancellationException)3 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)3 HeuristicMixedException (javax.transaction.HeuristicMixedException)3 HeuristicRollbackException (javax.transaction.HeuristicRollbackException)3