Search in sources :

Example 1 with TableContent

use of org.activityinfo.legacy.shared.reports.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.legacy.shared.command.DimensionType) Filter(org.activityinfo.legacy.shared.command.Filter) SiteDTO(org.activityinfo.legacy.shared.model.SiteDTO) TableData(org.activityinfo.legacy.shared.reports.content.TableData) TableContent(org.activityinfo.legacy.shared.reports.content.TableContent)

Aggregations

DimensionType (org.activityinfo.legacy.shared.command.DimensionType)1 Filter (org.activityinfo.legacy.shared.command.Filter)1 SiteDTO (org.activityinfo.legacy.shared.model.SiteDTO)1 TableContent (org.activityinfo.legacy.shared.reports.content.TableContent)1 TableData (org.activityinfo.legacy.shared.reports.content.TableData)1