Search in sources :

Example 26 with QueryParameters

use of datawave.webservice.query.QueryParameters in project datawave by NationalSecurityAgency.

the class MixedGeoAndGeoWaveTest method getResultsIterator.

private Iterator getResultsIterator(String queryString, ShardQueryLogic logic) throws Exception {
    MultivaluedMap<String, String> params = new MultivaluedMapImpl<>();
    params.putSingle(QUERY_LOGIC_NAME, "EventQuery");
    params.putSingle(QUERY_STRING, queryString);
    params.putSingle(QUERY_NAME, "geoQuery");
    params.putSingle(QUERY_PERSISTENCE, "PERSISTENT");
    params.putSingle(QUERY_AUTHORIZATIONS, AUTHS);
    params.putSingle(QUERY_EXPIRATION, "20200101 000000.000");
    params.putSingle(QUERY_BEGIN, BEGIN_DATE);
    params.putSingle(QUERY_END, END_DATE);
    QueryParameters queryParams = new QueryParametersImpl();
    queryParams.validate(params);
    Set<Authorizations> auths = new HashSet<>();
    auths.add(new Authorizations(AUTHS));
    Query query = new QueryImpl();
    query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null);
    ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query);
    QueryModel queryModel = new QueryModel();
    queryModel.addTermToModel(GEO_FIELD, GEO_FIELD);
    queryModel.addTermToModel(GEO_FIELD, POINT_FIELD);
    config.setQueryModel(queryModel);
    logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths);
    logic.setupQuery(config);
    return logic.getTransformIterator(query);
}
Also used : Authorizations(org.apache.accumulo.core.security.Authorizations) QueryImpl(datawave.webservice.query.QueryImpl) Query(datawave.webservice.query.Query) MultivaluedMapImpl(org.jboss.resteasy.specimpl.MultivaluedMapImpl) QueryParameters(datawave.webservice.query.QueryParameters) QueryParametersImpl(datawave.webservice.query.QueryParametersImpl) ShardQueryConfiguration(datawave.query.config.ShardQueryConfiguration) QueryModel(datawave.query.model.QueryModel) HashSet(java.util.HashSet)

Aggregations

QueryParameters (datawave.webservice.query.QueryParameters)26 QueryParametersImpl (datawave.webservice.query.QueryParametersImpl)25 MultivaluedMapImpl (org.jboss.resteasy.specimpl.MultivaluedMapImpl)24 HashSet (java.util.HashSet)17 Test (org.junit.Test)16 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)16 ColumnVisibilitySecurityMarking (datawave.marking.ColumnVisibilitySecurityMarking)15 QueryMetricFactoryImpl (datawave.microservice.querymetric.QueryMetricFactoryImpl)15 QueryPersistence (datawave.webservice.query.QueryPersistence)15 Date (java.util.Date)15 Query (datawave.webservice.query.Query)12 QueryImpl (datawave.webservice.query.QueryImpl)12 ArrayList (java.util.ArrayList)12 Authorizations (org.apache.accumulo.core.security.Authorizations)11 SubjectIssuerDNPair (datawave.security.authorization.SubjectIssuerDNPair)10 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)9 DatawaveWebApplicationException (datawave.webservice.common.exception.DatawaveWebApplicationException)8 NoResultsQueryException (datawave.webservice.query.exception.NoResultsQueryException)8 QueryException (datawave.webservice.query.exception.QueryException)8 UUID (java.util.UUID)8