use of org.hisp.dhis.common.QueryFilter in project dhis2-core by dhis2.
the class EventAnalyticsTest method createRequestParamsWithFilter.
protected EventQueryParams createRequestParamsWithFilter(ProgramStage withProgramStage, ValueType withQueryItemValueType, QueryOperator withOperator, String withQueryFilter) {
EventQueryParams.Builder params = new EventQueryParams.Builder(createRequestParams(withProgramStage, withQueryItemValueType));
QueryItem queryItem = params.build().getItems().get(0);
queryItem.addFilter(new QueryFilter(withOperator, withQueryFilter));
return params.build();
}
use of org.hisp.dhis.common.QueryFilter in project dhis2-core by dhis2.
the class AbstractJdbcEventAnalyticsManagerTest method verifyGetSelectSqlWithNonTextDataElement.
@Test
void verifyGetSelectSqlWithNonTextDataElement() {
DimensionalItemObject dio = new BaseDimensionalItemObject(dataElementA.getUid());
QueryItem item = new QueryItem(dio);
item.setValueType(ValueType.NUMBER);
String column = subject.getSelectSql(new QueryFilter(), item, from, to);
assertThat(column, is("ax.\"" + dataElementA.getUid() + "\""));
}
use of org.hisp.dhis.common.QueryFilter in project dhis2-core by dhis2.
the class AbstractJdbcEventAnalyticsManagerTest method verifyGetSelectSqlWithTextDataElement.
@Test
void verifyGetSelectSqlWithTextDataElement() {
DimensionalItemObject dio = new BaseDimensionalItemObject(dataElementA.getUid());
QueryItem item = new QueryItem(dio);
item.setValueType(ValueType.TEXT);
QueryFilter queryFilter = new QueryFilter(QueryOperator.EQ, "EQ");
String column = subject.getSelectSql(queryFilter, item, from, to);
assertThat(column, is("ax.\"" + dataElementA.getUid() + "\""));
}
use of org.hisp.dhis.common.QueryFilter in project dhis2-core by dhis2.
the class RequestToSearchParamsMapper method getQueryItem.
private QueryItem getQueryItem(String item) {
String[] split = item.split(DimensionalObject.DIMENSION_NAME_SEP);
if (split == null || split.length % 2 != 1) {
throw new IllegalQueryException("Query item or filter is invalid: " + item);
}
QueryItem queryItem = getItem(split[0]);
if (split.length > 1) {
for (int i = 1; i < split.length; i += 2) {
QueryOperator operator = QueryOperator.fromString(split[i]);
queryItem.getFilters().add(new QueryFilter(operator, split[i + 1]));
}
}
return queryItem;
}
use of org.hisp.dhis.common.QueryFilter in project dhis2-core by dhis2.
the class AbstractEventService method getQueryItem.
private QueryItem getQueryItem(String item) {
String[] split = item.split(DimensionalObject.DIMENSION_NAME_SEP);
if (split == null || split.length % 2 != 1) {
throw new IllegalQueryException("Query item or filter is invalid: " + item);
}
QueryItem queryItem = getItem(split[0]);
if (split.length > 1) {
for (int i = 1; i < split.length; i += 2) {
QueryOperator operator = QueryOperator.fromString(split[i]);
queryItem.getFilters().add(new QueryFilter(operator, split[i + 1]));
}
}
return queryItem;
}
Aggregations