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;
}
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();
}
}
Aggregations