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);
}
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);
}
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;
}
Aggregations