use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.
the class SitesResources method query.
@GET
@Produces(MediaType.APPLICATION_JSON)
public String query(@QueryParam("activity") List<Integer> activityIds, @QueryParam("database") List<Integer> databaseIds, @QueryParam("format") String format) throws IOException {
Filter filter = new Filter();
filter.addRestriction(DimensionType.Activity, activityIds);
filter.addRestriction(DimensionType.Database, databaseIds);
List<SiteDTO> sites = dispatcher.execute(new GetSites(filter)).getData();
StringWriter writer = new StringWriter();
JsonGenerator json = Jackson.createJsonFactory(writer);
writeJson(sites, json);
return writer.toString();
}
use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.
the class ReportGenerator method generateReport.
private void generateReport(User user, Report report, Filter inheritedFilter, DateRange dateRange) {
GeneratorUtils.resolveElementFilter(report, dateRange);
Filter effectiveFilter = GeneratorUtils.resolveEffectiveFilter(report, inheritedFilter, dateRange);
for (ReportElement element : report.getElements()) {
generateElement(user, element, effectiveFilter, dateRange);
}
ReportContent content = new ReportContent();
content.setFileName(generateFileName(report, dateRange, user));
content.setFilterDescriptions(generateFilterDescriptions(effectiveFilter, Collections.<DimensionType>emptySet(), user));
report.setContent(content);
}
use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.
the class PolygonLayerGenerator method query.
@Override
public void query(DispatcherSync dispatcher, Filter effectiveFilter) {
Filter layerFilter = new Filter(effectiveFilter, layer.getFilter());
layerFilter.addRestriction(DimensionType.Indicator, layer.getIndicatorIds());
queryBounds(dispatcher, layerFilter);
queryBuckets(dispatcher, layerFilter);
color();
}
use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.
the class FilterAdapter method unmarshal.
@Override
public Filter unmarshal(FilterElement element) throws Exception {
Filter filter = new Filter();
filter.setDateRange(element.dateRange);
for (Restriction r : element.restrictions) {
for (String s : r.categories) {
filter.addRestriction(findDimType(r.dimension), Integer.parseInt(s));
}
}
return filter;
}
use of org.activityinfo.shared.command.Filter in project activityinfo by bedatadriven.
the class DataEntryPlaceParserTest method activityFilteredAndGrouped.
@Test
public void activityFilteredAndGrouped() {
Filter filter = new Filter();
filter.addRestriction(DimensionType.Activity, 33);
AdminGroupingModel grouping = new AdminGroupingModel(1);
verifyCorrectSerde(new DataEntryPlace(grouping, filter));
}
Aggregations