Search in sources :

Example 1 with TableContent

use of org.activityinfo.shared.report.content.TableContent in project activityinfo by bedatadriven.

the class TableGenerator method generate.

@Override
public void generate(User user, TableElement element, Filter inheritedFilter, DateRange dateRange) {
    Filter filter = GeneratorUtils.resolveElementFilter(element, dateRange);
    Filter effectiveFilter = inheritedFilter == null ? filter : new Filter(inheritedFilter, filter);
    TableContent content = new TableContent();
    content.setFilterDescriptions(generateFilterDescriptions(filter, Collections.<DimensionType>emptySet(), user));
    TableData data = generateData(element, effectiveFilter);
    content.setData(data);
    if (element.getMap() != null) {
        mapGenerator.generate(user, element.getMap(), effectiveFilter, dateRange);
        Map<Integer, String> siteLabels = element.getMap().getContent().siteLabelMap();
        for (SiteDTO row : data.getRows()) {
            row.set("map", siteLabels.get(row.getId()));
        }
    }
    element.setContent(content);
}
Also used : DimensionType(org.activityinfo.shared.report.model.DimensionType) Filter(org.activityinfo.shared.command.Filter) SiteDTO(org.activityinfo.shared.dto.SiteDTO) TableData(org.activityinfo.shared.report.content.TableData) TableContent(org.activityinfo.shared.report.content.TableContent)

Aggregations

Filter (org.activityinfo.shared.command.Filter)1 SiteDTO (org.activityinfo.shared.dto.SiteDTO)1 TableContent (org.activityinfo.shared.report.content.TableContent)1 TableData (org.activityinfo.shared.report.content.TableData)1 DimensionType (org.activityinfo.shared.report.model.DimensionType)1