Search in sources :

Example 1 with BirtUtils

use of com.dexels.navajo.birt.BirtUtils in project navajo by Dexels.

the class BIRTXmlMap method executeReport.

private Binary executeReport(Navajo input) throws IOException {
    int top = 15;
    int right = 15;
    int bottom = 15;
    int left = 15;
    BirtUtils b = new BirtUtils();
    File rep = File.createTempFile("generic", ".rptdesign", new File(getViewerReportDir()));
    Property marginProperty = inNavajo.getProperty("/__ReportDefinition/Margin");
    String margin = null;
    if (marginProperty != null) {
        margin = marginProperty.getValue();
    }
    if (margin != null) {
        logger.debug("Margin: {}", margin);
        StringTokenizer st = new StringTokenizer(margin, ",");
        top = Integer.parseInt(st.nextToken());
        right = Integer.parseInt(st.nextToken());
        bottom = Integer.parseInt(st.nextToken());
        left = Integer.parseInt(st.nextToken());
    }
    Property landscapeProperty = inNavajo.getProperty("/__ReportDefinition/Orientation");
    boolean landscape = extractLandscape(landscapeProperty);
    File templateDir = new File(getReportDir() + "template/");
    if (!templateDir.exists()) {
        templateDir.mkdirs();
    }
    File reportTemplateFile = new File(templateDir, "template.rptdesign");
    InputStream reportTemplateStream = new FileInputStream(reportTemplateFile);
    b.createTableReport(reportTemplateStream, rep, input, left, top, right, bottom, landscape);
    return processReport(rep, input);
}
Also used : StringTokenizer(java.util.StringTokenizer) BirtUtils(com.dexels.navajo.birt.BirtUtils) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) File(java.io.File) Property(com.dexels.navajo.document.Property) FileInputStream(java.io.FileInputStream)

Example 2 with BirtUtils

use of com.dexels.navajo.birt.BirtUtils in project navajo by Dexels.

the class BIRTXmlMap method executeReport.

/*
	 * For 'defined' reports, so the master page is left alone
	 */
private Binary executeReport(String reportName, Navajo input) throws IOException {
    Binary reportDef = null;
    Property outputFormatProperty = inNavajo.getProperty("/__ReportDefinition/OutputFormat");
    if (outputFormatProperty != null) {
        outputFormat = outputFormatProperty.getValue();
    }
    if (outputFormat == null || "".equals(outputFormat)) {
        outputFormat = DEFAULT_OUTPUT_FORMAT;
    }
    Property reportDefinitionProperty = inNavajo.getProperty("/__ReportDefinition/Report");
    if (reportDefinitionProperty != null) {
        reportDef = (Binary) reportDefinitionProperty.getTypedValue();
    }
    BirtUtils b = new BirtUtils();
    File lzfile = b.createDataSource(input);
    InputStream reportIs = null;
    if (reportDef == null) {
        File reportFile = new File(reportDir + reportName + ".rptdesign");
        logger.debug("No definition defined. Using reportname: {}", reportFile.getAbsolutePath());
        if (!reportFile.exists()) {
            throw NavajoFactory.getInstance().createNavajoException("Report: " + reportFile + " not found.");
        }
        reportIs = new FileInputStream(reportFile);
    } else {
        logger.debug("Using supplied definition. Size: {}", reportDef.getLength());
        reportIs = reportDef.getDataAsStream();
    }
    File fixedFile = b.createFixedReportDefinition(reportIs, lzfile, new File(getViewerReportDir()));
    reportIs.close();
    return processReport(fixedFile, inNavajo);
}
Also used : BirtUtils(com.dexels.navajo.birt.BirtUtils) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Binary(com.dexels.navajo.document.types.Binary) Property(com.dexels.navajo.document.Property) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 3 with BirtUtils

use of com.dexels.navajo.birt.BirtUtils in project navajo by Dexels.

the class CreateBirtMap method getEmptyReport.

public Binary getEmptyReport() throws IOException {
    BirtUtils b = new BirtUtils();
    emptyReport = b.createEmptyReport(myNavajo, getReportTemplate());
    return emptyReport;
}
Also used : BirtUtils(com.dexels.navajo.birt.BirtUtils)

Aggregations

BirtUtils (com.dexels.navajo.birt.BirtUtils)3 Property (com.dexels.navajo.document.Property)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 Binary (com.dexels.navajo.document.types.Binary)1 StringTokenizer (java.util.StringTokenizer)1