use of org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder in project activityinfo by bedatadriven.
the class PivotTableBinder method generateElement.
private PivotContent generateElement() {
PivotTableReportElement model = (PivotTableReportElement) getModel();
PivotTableDataBuilder builder = new PivotTableDataBuilder();
PivotTableData data = builder.build(model.getRowDimensions(), model.getColumnDimensions(), cachedResult.getBuckets());
PivotContent content = new PivotContent();
content.setEffectiveFilter(cachedFilter);
content.setData(data);
return content;
}
use of org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method testMonthlyCalculatedIndicatorsByAttribute.
@Test
@OnDataSet("/dbunit/monthly-calc-indicators.db.xml")
public void testMonthlyCalculatedIndicatorsByAttribute() {
withIndicatorAsDimension();
filteringOnDatabases(1);
withAttributeGroupDim(1);
dimensions.add(new DateDimension(DateUnit.MONTH));
execute();
assertThat().forMonth(2009, 1).forIndicator(7003).forAttributeGroupLabeled(1, "B").thereIsOneBucketWithValue(500);
assertThat().forMonth(2009, 1).forIndicator(7003).forAttributeGroupLabeled(1, "A").thereIsOneBucketWithValue(37);
assertThat().forMonth(2009, 2).forIndicator(7003).forAttributeGroupLabeled(1, "B").thereIsOneBucketWithValue(480);
assertThat().forMonth(2009, 2).forIndicator(7003).forAttributeGroupLabeled(1, "A").thereIsOneBucketWithValue(154);
PivotTableReportElement report = new PivotTableReportElement();
report.setColumnDimensions(Arrays.asList(indicatorDim, new AttributeGroupDimension(1)));
report.setRowDimensions(Arrays.<Dimension>asList(yearDim, monthDim));
PivotTableDataBuilder tableDataBuilder = new PivotTableDataBuilder();
PivotTableData table = tableDataBuilder.build(report.getRowDimensions(), report.getColumnDimensions(), buckets);
}
use of org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder in project activityinfo by bedatadriven.
the class PivotSitesHandlerTest method testMonthlyCalculatedIndicatorsWithPartnerAndYear.
@Test
@OnDataSet("/dbunit/monthly-calc-indicators.db.xml")
public void testMonthlyCalculatedIndicatorsWithPartnerAndYear() {
filteringOnDatabases(1);
withIndicatorAsDimension();
withPartnerAsDimension();
dimensions.add(yearDim);
dimensions.add(monthDim);
execute();
assertThat().thereAre(6).buckets();
assertThat().forMonth(2009, 1).forIndicator(7003).thereIsOneBucketWithValue(537);
assertThat().forMonth(2009, 2).forIndicator(7003).thereIsOneBucketWithValue(634);
PivotTableReportElement report = new PivotTableReportElement();
report.setColumnDimensions(Arrays.asList(indicatorDim, partnerDim));
report.setRowDimensions(Arrays.<Dimension>asList(yearDim, monthDim));
PivotTableDataBuilder tableDataBuilder = new PivotTableDataBuilder();
PivotTableData table = tableDataBuilder.build(report.getRowDimensions(), report.getColumnDimensions(), buckets);
}
use of org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder in project activityinfo by bedatadriven.
the class PivotGenerator method generateData.
protected PivotTableData generateData(int userId, Locale locale, T element, Filter filter, List<Dimension> rowDims, List<Dimension> colDims) {
PivotSites command = new PivotSites(element.allDimensions(), filter);
PivotResult result = command.isTooBroad() ? new PivotResult() : getDispatcher().execute(command);
PivotTableDataBuilder builder = new PivotTableDataBuilder();
return builder.build(rowDims, colDims, result.getBuckets());
}
Aggregations