Search in sources :

Example 6 with AttributeGroupDimension

use of org.activityinfo.legacy.shared.reports.model.AttributeGroupDimension in project activityinfo by bedatadriven.

the class CustomerCalcIndicatorTest method pivotByAttributeGroup.

private PivotSites pivotByAttributeGroup(int activityId) {
    AttributeGroupDTO group = getAttributeGroup(activityId);
    PivotSites pivot = new PivotSites();
    pivot.setDimensions(INDICATOR_DIMENSION, new AttributeGroupDimension(group.getId()));
    pivot.setFilter(Filter.filter().onActivity(activityId));
    List<Bucket> buckets = execute(pivot).getBuckets();
    System.out.println(Joiner.on("\n").join(buckets));
    // assertThat(buckets, hasItem(total("Total Value of Initial Cost", 48500)));
    return pivot;
}
Also used : Bucket(org.activityinfo.legacy.shared.command.result.Bucket) AttributeGroupDimension(org.activityinfo.legacy.shared.reports.model.AttributeGroupDimension)

Example 7 with AttributeGroupDimension

use of org.activityinfo.legacy.shared.reports.model.AttributeGroupDimension in project activityinfo by bedatadriven.

the class DimensionPruner method pruneModel.

private void pruneModel(ActivityFormResults schema) {
    Map<Integer, String> valid = validDimensions(schema);
    Set<String> validLabels = new HashSet<>(valid.values());
    // Store group labels so that we can match by name of those
    // dimensions which might no longer be returned by GetActivityForms(filter)
    groupNames.putAll(valid);
    boolean dirty = false;
    for (AttributeGroupDimension selectedDim : getSelectedAttributes()) {
        String label = groupNames.get(selectedDim.getAttributeGroupId());
        if (!validLabels.contains(label)) {
            LOGGER.fine("Removing attribute group " + selectedDim.getAttributeGroupId());
            model.getRowDimensions().remove(selectedDim);
            model.getColumnDimensions().remove(selectedDim);
            dirty = true;
        }
    }
    if (dirty) {
        reportEventBus.fireChange();
    }
}
Also used : AttributeGroupDimension(org.activityinfo.legacy.shared.reports.model.AttributeGroupDimension) HashSet(java.util.HashSet)

Aggregations

AttributeGroupDimension (org.activityinfo.legacy.shared.reports.model.AttributeGroupDimension)7 Dimension (org.activityinfo.legacy.shared.reports.model.Dimension)5 AdminDimension (org.activityinfo.legacy.shared.reports.model.AdminDimension)3 DateDimension (org.activityinfo.legacy.shared.reports.model.DateDimension)2 PivotTableReportElement (org.activityinfo.legacy.shared.reports.model.PivotTableReportElement)2 ReportChangeEvent (org.activityinfo.ui.client.page.report.ReportChangeEvent)2 Test (org.junit.Test)2 SqlResultCallback (com.bedatadriven.rebar.sql.client.SqlResultCallback)1 SqlResultSet (com.bedatadriven.rebar.sql.client.SqlResultSet)1 SqlResultSetRow (com.bedatadriven.rebar.sql.client.SqlResultSetRow)1 SqlTransaction (com.bedatadriven.rebar.sql.client.SqlTransaction)1 HashSet (java.util.HashSet)1 Bucket (org.activityinfo.legacy.shared.command.result.Bucket)1 EntityCategory (org.activityinfo.legacy.shared.reports.content.EntityCategory)1