Search in sources :

Example 1 with PivotTableDataBuilder

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;
}
Also used : PivotTableData(org.activityinfo.legacy.shared.reports.content.PivotTableData) PivotContent(org.activityinfo.legacy.shared.reports.content.PivotContent) PivotTableReportElement(org.activityinfo.legacy.shared.reports.model.PivotTableReportElement) PivotTableDataBuilder(org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder)

Example 2 with PivotTableDataBuilder

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);
}
Also used : PivotTableDataBuilder(org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder) OnDataSet(org.activityinfo.server.database.OnDataSet)

Example 3 with PivotTableDataBuilder

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);
}
Also used : PivotTableDataBuilder(org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder) OnDataSet(org.activityinfo.server.database.OnDataSet)

Example 4 with PivotTableDataBuilder

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());
}
Also used : PivotSites(org.activityinfo.legacy.shared.command.PivotSites) PivotResult(org.activityinfo.legacy.shared.command.PivotSites.PivotResult) PivotTableDataBuilder(org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder)

Aggregations

PivotTableDataBuilder (org.activityinfo.legacy.shared.impl.pivot.PivotTableDataBuilder)4 OnDataSet (org.activityinfo.server.database.OnDataSet)2 PivotSites (org.activityinfo.legacy.shared.command.PivotSites)1 PivotResult (org.activityinfo.legacy.shared.command.PivotSites.PivotResult)1 PivotContent (org.activityinfo.legacy.shared.reports.content.PivotContent)1 PivotTableData (org.activityinfo.legacy.shared.reports.content.PivotTableData)1 PivotTableReportElement (org.activityinfo.legacy.shared.reports.model.PivotTableReportElement)1