Search in sources :

Example 6 with ReportElement

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);
}
Also used : DimensionType(org.activityinfo.shared.report.model.DimensionType) ReportContent(org.activityinfo.shared.report.content.ReportContent) Filter(org.activityinfo.shared.command.Filter) PivotChartReportElement(org.activityinfo.shared.report.model.PivotChartReportElement) TextReportElement(org.activityinfo.shared.report.model.TextReportElement) MapReportElement(org.activityinfo.shared.report.model.MapReportElement) ReportElement(org.activityinfo.shared.report.model.ReportElement) PivotTableReportElement(org.activityinfo.shared.report.model.PivotTableReportElement)

Example 7 with ReportElement

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);
    }
}
Also used : MapReportElement(org.activityinfo.shared.report.model.MapReportElement) Report(org.activityinfo.shared.report.model.Report) SlideShow(org.apache.poi.hslf.usermodel.SlideShow) ReportElement(org.activityinfo.shared.report.model.ReportElement) PivotChartReportElement(org.activityinfo.shared.report.model.PivotChartReportElement) MapReportElement(org.activityinfo.shared.report.model.MapReportElement) PivotChartReportElement(org.activityinfo.shared.report.model.PivotChartReportElement)

Example 8 with ReportElement

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);
    }
}
Also used : Report(org.activityinfo.shared.report.model.Report) PivotChartReportElement(org.activityinfo.shared.report.model.PivotChartReportElement) TextReportElement(org.activityinfo.shared.report.model.TextReportElement) MapReportElement(org.activityinfo.shared.report.model.MapReportElement) ImageReportElement(org.activityinfo.shared.report.model.ImageReportElement) ReportElement(org.activityinfo.shared.report.model.ReportElement) PivotTableReportElement(org.activityinfo.shared.report.model.PivotTableReportElement)

Example 9 with ReportElement

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");
}
Also used : Report(org.activityinfo.shared.report.model.Report) PivotContent(org.activityinfo.shared.report.content.PivotContent) MapReportElement(org.activityinfo.shared.report.model.MapReportElement) ReportElement(org.activityinfo.shared.report.model.ReportElement) Test(org.junit.Test)

Aggregations

ReportElement (org.activityinfo.shared.report.model.ReportElement)9 MapReportElement (org.activityinfo.shared.report.model.MapReportElement)7 PivotChartReportElement (org.activityinfo.shared.report.model.PivotChartReportElement)6 PivotTableReportElement (org.activityinfo.shared.report.model.PivotTableReportElement)5 Report (org.activityinfo.shared.report.model.Report)4 JsonObject (com.google.gson.JsonObject)2 Filter (org.activityinfo.shared.command.Filter)2 TextReportElement (org.activityinfo.shared.report.model.TextReportElement)2 Component (com.extjs.gxt.ui.client.widget.Component)1 Label (com.extjs.gxt.ui.client.widget.Label)1 JsonArray (com.google.gson.JsonArray)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 MapReportView (org.activityinfo.client.report.view.MapReportView)1 ReportView (org.activityinfo.client.report.view.ReportView)1 LogException (org.activityinfo.server.util.logging.LogException)1 HtmlResult (org.activityinfo.shared.command.result.HtmlResult)1 CommandException (org.activityinfo.shared.exception.CommandException)1 Content (org.activityinfo.shared.report.content.Content)1