use of org.activityinfo.shared.report.model.ReportElement in project activityinfo by bedatadriven.
the class ReportGenerator method generateReport.
private void generateReport(User user, Report report, Filter inheritedFilter, DateRange dateRange) {
GeneratorUtils.resolveElementFilter(report, dateRange);
Filter effectiveFilter = GeneratorUtils.resolveEffectiveFilter(report, inheritedFilter, dateRange);
for (ReportElement element : report.getElements()) {
generateElement(user, element, effectiveFilter, dateRange);
}
ReportContent content = new ReportContent();
content.setFileName(generateFileName(report, dateRange, user));
content.setFilterDescriptions(generateFilterDescriptions(effectiveFilter, Collections.<DimensionType>emptySet(), user));
report.setContent(content);
}
use of org.activityinfo.shared.report.model.ReportElement in project activityinfo by bedatadriven.
the class PPTRenderer method render.
@Override
public void render(ReportElement element, OutputStream os) throws IOException {
if (element instanceof Report) {
SlideShow ppt = new SlideShow();
Report report = (Report) element;
for (ReportElement child : report.getElements()) {
if (child instanceof MapReportElement) {
mapRenderer.render((MapReportElement) child, ppt);
} else if (child instanceof PivotChartReportElement) {
chartRenderer.render((PivotChartReportElement) child, ppt);
}
}
ppt.write(os);
} else if (element instanceof MapReportElement) {
mapRenderer.render((MapReportElement) element, os);
} else if (element instanceof PivotChartReportElement) {
chartRenderer.render((PivotChartReportElement) element, os);
}
}
use of org.activityinfo.shared.report.model.ReportElement in project activityinfo by bedatadriven.
the class ItextReportRenderer method renderReport.
private void renderReport(DocWriter writer, Document document, ReportElement element) throws DocumentException {
Report report = (Report) element;
document.add(ThemeHelper.reportTitle(report.getTitle()));
ItextRendererHelper.addFilterDescription(document, report.getContent().getFilterDescriptions());
ItextRendererHelper.addDateFilterDescription(document, report.getFilter().getDateRange());
for (ReportElement childElement : report.getElements()) {
renderElement(writer, document, childElement);
}
}
use of org.activityinfo.shared.report.model.ReportElement in project activityinfo by bedatadriven.
the class ReportsTest method testApplesReport.
@Test
public void testApplesReport() throws Throwable {
Report report = getReport("realworld/ApplesReport.xml");
reportGenerator.generate(user, report, null, null);
ReportElement element = report.getElements().get(0);
element.getContent();
assertEquals("Expected different report title", report.getTitle(), "Phase one apple report");
assertEquals("Expected different report description", report.getDescription(), "Apples come in different shapes, colors and taste");
assertEquals("Expected only one filter", report.getFilter().getRestrictedDimensions().size(), 1);
assertEquals("Expected one element", report.getElements().size(), 1);
assertTrue("Expected pivottable element", element.getContent() instanceof PivotContent);
assertEquals("Expected title: 'Apples, bananas and oranges'", element.getTitle(), "Apples, bananas and oranges");
}
Aggregations