use of org.activityinfo.shared.report.content.PivotContent in project activityinfo by bedatadriven.
the class SearchHandler method processFilter.
private void processFilter(final ExecutionContext context, final AsyncCallback<SearchResult> callback, final Filter resultFilter) {
final SearchResult searchResult = new SearchResult();
if (resultFilter.getRestrictedDimensions().size() > 0) {
// pivot data query
final PivotTableReportElement pivotTable = createSearchPivotTableElement();
pivotTable.setFilter(resultFilter);
GenerateElement<PivotContent> zmd = new GenerateElement<PivotContent>(pivotTable);
context.execute(zmd, new AsyncCallback<PivotContent>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(PivotContent content) {
content.setEffectiveFilter(resultFilter);
searchResult.setPivotTabelData(content);
// recent sites query
GetSites getSites = createGetSitesCommand(resultFilter);
context.execute(getSites, new AsyncCallback<SiteResult>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}
@Override
public void onSuccess(SiteResult resultSites) {
searchResult.setRecentAdditions(resultSites.getData());
callback.onSuccess(searchResult);
}
});
}
});
} else {
// Return empty searchresult when no filtered entities found
callback.onSuccess(searchResult);
}
}
use of org.activityinfo.shared.report.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(), LocaleHelper.getLocaleObject(user), 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.shared.report.content.PivotContent in project activityinfo by bedatadriven.
the class DummyPivotTableData method Foobar1612Element.
public PivotTableReportElement Foobar1612Element() {
PivotTableReportElement element = new PivotTableReportElement();
element.setTitle("Foobar 1612");
element.setRowDimensions(rowDims);
element.setColumnDimensions(colDims);
element.setContent(new PivotContent(table, new ArrayList<FilterDescription>()));
return element;
}
use of org.activityinfo.shared.report.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;
}
use of org.activityinfo.shared.report.content.PivotContent in project activityinfo by bedatadriven.
the class ItextReportRendererTest method manyColumns.
@Test
public void manyColumns() throws IOException {
PivotTableData data = new PivotTableData();
Dimension partner = new Dimension(DimensionType.Partner);
Dimension year = new DateDimension(DateUnit.YEAR);
EntityCategory avsi = new EntityCategory(100, "AVSI RRMP");
Axis avsiRow = data.getRootRow().addChild(partner, avsi, avsi.getLabel(), comparator);
for (int y = 2011; y < 2030; ++y) {
Axis col = data.getRootColumn().addChild(year, new SimpleCategory("" + y), "" + y, comparator);
avsiRow.setValue(col, (double) y);
}
PivotContent tableContent = new PivotContent(data, Lists.<FilterDescription>newArrayList());
PivotTableReportElement table = new PivotTableReportElement();
table.addRowDimension(partner);
table.addColDimension(year);
table.setContent(tableContent);
ReportContent content = new ReportContent();
content.setFilterDescriptions(Collections.EMPTY_LIST);
Report report = new Report();
report.setContent(content);
report.addElement(table);
renderToPdf(report, "narrowColumns.pdf");
renderToRtf(report, "narrowColumns.rtf");
}
Aggregations