use of org.activityinfo.legacy.shared.reports.content.PivotContent in project activityinfo by bedatadriven.
the class PivotTableBinder method executeLoad.
@Override
protected void executeLoad(final AsyncCallback<PivotContent> callback) {
final Filter filter = new Filter(getModel().getFilter());
final Set<Dimension> dimensions = new HashSet<>(getModel().allDimensions());
if (filter.equals(cachedFilter) && dimensions.equals(cachedDimensions)) {
try {
callback.onSuccess(generateElement());
} catch (Exception e) {
callback.onFailure(e);
}
} else {
PivotSites query = new PivotSites(dimensions, filter);
if (query.isTooBroad()) {
callback.onSuccess(new PivotContent());
return;
}
dispatcher.execute(query, new AsyncCallback<PivotSites.PivotResult>() {
@Override
public void onFailure(Throwable throwable) {
callback.onFailure(throwable);
}
@Override
public void onSuccess(PivotSites.PivotResult pivotResult) {
cachedFilter = filter;
cachedDimensions = dimensions;
cachedResult = pivotResult;
try {
callback.onSuccess(generateElement());
} catch (Exception e) {
callback.onFailure(e);
}
}
});
}
}
use of org.activityinfo.legacy.shared.reports.content.PivotContent 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.reports.content.PivotContent in project activityinfo by bedatadriven.
the class PivotTableGenerator method generate.
@Override
public void generate(User user, PivotTableReportElement element, Filter inheritedFilter, DateRange dateRange) {
Filter filter = GeneratorUtils.resolveElementFilter(element, dateRange);
Filter effectiveFilter = inheritedFilter == null ? filter : new Filter(inheritedFilter, filter);
PivotTableData data = generateData(user.getId(), user.getLocaleObject(), element, effectiveFilter, element.getRowDimensions(), element.getColumnDimensions());
PivotContent content = new PivotContent();
content.setEffectiveFilter(effectiveFilter);
content.setFilterDescriptions(generateFilterDescriptions(filter, element.allDimensionTypes(), user));
content.setData(data);
element.setContent(content);
}
use of org.activityinfo.legacy.shared.reports.content.PivotContent in project activityinfo by bedatadriven.
the class DummyPivotTableData2 method testElement.
public PivotTableReportElement testElement() {
PivotTableReportElement element = new PivotTableReportElement();
element.setTitle("Foobar 1612");
element.setRowDimensions(rowDims);
element.setColumnDimensions(colDims);
element.setContent(new PivotContent(table, new ArrayList<FilterDescription>()));
return element;
}
Aggregations