use of org.pentaho.actionsequence.dom.ActionResource in project pentaho-platform by pentaho.
the class JFreeReportComponent method getReportFromResource.
private MasterReport getReportFromResource() throws ResourceException, IOException {
JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
MasterReport report = null;
Object reportDefinition = jFreeReportAction.getReportDefinition();
IActionSequenceResource resource = null;
if (reportDefinition instanceof ActionResource) {
resource = getResource(((ActionResource) reportDefinition).getName());
}
if (resource != null) {
if (resource.getSourceType() == IActionResource.XML) {
String repDef = resource.getAddress();
ReportGenerator generator = ReportGenerator.createInstance();
// add the runtime context so that PentahoResourceData class can get access to the solution repo
// generator.setObject(PentahoResourceData.PENTAHO_RUNTIME_CONTEXT_KEY, getRuntimeContext());
// Read the encoding from the XML file - see BISERVER-895
final String encoding = XmlHelper.getEncoding(repDef, null);
ByteArrayInputStream inStream = new ByteArrayInputStream(repDef.getBytes(encoding));
InputSource repDefInputSource = new InputSource(inStream);
repDefInputSource.setEncoding(encoding);
report = generator.parseReport(repDefInputSource, getDefinedResourceURL(null));
} else {
report = parseReport(resource);
}
}
return report;
}
Aggregations