Package com.haulmont.yarg.structure.impl

Examples of com.haulmont.yarg.structure.impl.ReportBuilder


        testDatabase.stop();
    }

    private Report createReport() throws IOException {
        ReportBuilder report = new ReportBuilder()
                .band(new BandBuilder()
                        .name("Band1")
                        .query("", "select 'myFileName.txt' as file_name,login as col1, password as col2 from user", "sql")
                        .build()
                );
        report.template(
                new ReportTemplateBuilder()
                        .code("XLS")
                        .documentName("result.xls")
                        .documentPath("./modules/core/test/smoketest/test.xls").readFileFromPath()
                        .outputType(ReportOutputType.xls)
                        .outputNamePattern("${Band1.FILE_NAME}")
                        .build())
                .name("report");

        return report.build();
    }
View Full Code Here


        testDatabase.stop();
    }

    private Report createReport() throws IOException {
        ReportBuilder report = new ReportBuilder()
                .band(new BandBuilder()
                        .name("Band1")
                        .query("", "select 'myFileName.txt' as file_name,login as col1, password as col2 from user", "sql")
                        .build()
                );
        report.template(
                new ReportTemplateBuilder()
                        .code(ReportTemplate.DEFAULT_TEMPLATE_CODE)
                        .documentName("result.none")
                        .outputType(ReportOutputType.custom)
                        .outputNamePattern("${Band1.FILE_NAME}")
                        .custom(new CustomReport() {
                            @Override
                            public byte[] createReport(Report report, BandData rootBand, Map<String, Object> params) {
                                return "Generated by custom report".getBytes();
                            }
                        })
                        .build())
                .name("report");

        return report.build();
    }
View Full Code Here

        rootBand.setFirstLevelBandDefinitionNames(new HashSet<String>());
        return rootBand;
    }

    private Report createReport() throws IOException {
        ReportBuilder report = new ReportBuilder()
                .band(new BandBuilder()
                        .name("Band1")
                        .query("", "return null", "groovy")
                        .child(new BandBuilder().name("Band11").query("", "return null", "groovy").build())
                        .build()
                );
        report.template(
                new ReportTemplateBuilder()
                        .code("XLS")
                        .documentName("result.xls")
                        .documentPath("./modules/core/test/smoketest/test.xls").readFileFromPath()
                        .outputType(ReportOutputType.xls)
                        .outputNamePattern("${Band1.FILE_NAME}")
                        .build())
                .name("report");

        return report.build();
    }
View Full Code Here

    }


    @Test
    public void testInvoiceReportRaw() throws Exception {
        ReportBuilder reportBuilder = new ReportBuilder();
        ReportTemplateBuilder reportTemplateBuilder = new ReportTemplateBuilder()
                .documentPath("./modules/core/test/sample/invoice/invoice.docx")
                .documentName("invoice.docx")
                .outputType(ReportOutputType.docx)
                .readFileFromPath();
        reportBuilder.template(reportTemplateBuilder.build());
        BandBuilder bandBuilder = new BandBuilder();
        ReportBand main= bandBuilder.name("Main").query("Main", "return [\n" +
                "                              [\n" +
                "                               'invoiceNumber':99987,\n" +
                "                               'client' : 'Google Inc.',\n" +
                "                               'date' : new Date(),\n" +
                "                               'addLine1': '1600 Amphitheatre Pkwy',\n" +
                "                               'addLine2': 'Mountain View, USA',\n" +
                "                               'addLine3':'CA 94043',\n" +
                "                               'signature':'<html><body><b><font color=\"red\">Mr. Yarg</font></b></body></html>'\n" +
                "                            ]]", "groovy").build();


        bandBuilder = new BandBuilder();
        ReportBand items = bandBuilder.name("Items").query("Items", "return [\n" +
                "                                ['name':'Java Concurrency in practice', 'price' : 15000],\n" +
                "                                ['name':'Clear code', 'price' : 13000],\n" +
                "                                ['name':'Scala in action', 'price' : 12000]\n" +
                "                            ]", "groovy").build();

        reportBuilder.band(main);
        reportBuilder.band(items);
        reportBuilder.format(new ReportFieldFormatImpl("Main.signature", "${html}"));

        Report report = reportBuilder.build();

        Reporting reporting = new Reporting();
        reporting.setFormatterFactory(new DefaultFormatterFactory());
        reporting.setLoaderFactory(
                new DefaultLoaderFactory().setGroovyDataLoader(new GroovyDataLoader(new DefaultScriptingImpl())));
View Full Code Here

        }

    }

    private Report createReport() throws IOException {
        ReportBuilder report = new ReportBuilder()
                .band(new BandBuilder()
                        .name("Band1")
                        .query("q1", " return [['col1':1, 'link': 1], ['col1':2, 'link': 2]]", "groovy", "link")
                        .query("q2", " return [['col2':10, 'link': 1], ['col2':20, 'link': 2]]", "groovy", "link")
                        .query("q3", " return [['col3':100, 'link': 1], ['col3':200, 'link': 2]]", "groovy", "link")
                        .build()
                ).name("report");

        return report.build();
    }
View Full Code Here

TOP

Related Classes of com.haulmont.yarg.structure.impl.ReportBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.