public ReportSpec getReportSpec() throws FileNotFoundException { ReportSpec reportSpec = null; if (isDefinedResource(AbstractJFreeReportComponent.REPORTGENERATEDEFN_REPORTSPECINPUT)) { IActionSequenceResource resource = getResource(AbstractJFreeReportComponent.REPORTGENERATEDEFN_REPORTSPECINPUT); reportSpec = loadFromZip(resource); if (reportSpec == null) { InputStream reportSpecInputStream = resource.getInputStream(ISolutionRepository.ACTION_EXECUTE, LocaleHelper.getLocale()); reportSpec = (ReportSpec) CastorUtility.getInstance() .readCastorObject(reportSpecInputStream, ReportSpec.class); } } return reportSpec; }
@SuppressWarnings("deprecation") private ReportSpec loadFromZip(final InputStream reportSpecInputStream) { try { ZipInputStream zis = new ZipInputStream(reportSpecInputStream); ZipEntry reportSpecEntry = findReportSpec(zis); if (reportSpecEntry == null) { return null; } // is this really sane? Blindly using the first zip entry is ... argh! // maybe you should use GZipped streams instead... return (ReportSpec) CastorUtility.getInstance().readCastorObject(zis, ReportSpec.class); } catch (Exception e) { return null; } }
@SuppressWarnings("deprecation") public ReportSpec getReportSpec() throws IOException { JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition(); DataSource dataSource = new ActivationHelper.PentahoStreamSourceWrapper( jFreeReportAction.getReportDefinitionDataSource()); ReportSpec reportSpec = null; reportSpec = loadFromZip(dataSource.getInputStream()); if (reportSpec == null) { dataSource = new ActivationHelper.PentahoStreamSourceWrapper( jFreeReportAction.getReportDefinitionDataSource()); reportSpec = (ReportSpec) CastorUtility.getInstance() .readCastorObject(dataSource.getInputStream(), ReportSpec.class); } return reportSpec; }
private ReportSpec loadFromZip(final IActionSequenceResource resource) { try { InputStream reportSpecInputStream = resource.getInputStream(ISolutionRepository.ACTION_EXECUTE, LocaleHelper.getLocale()); ZipInputStream zis = new ZipInputStream(reportSpecInputStream); ZipEntry reportSpecEntry = findReportSpec(zis); if (reportSpecEntry == null) { return null; } // is this really sane? Blindly using the first zip entry is ... argh! // maybe you should use GZipped streams instead... return (ReportSpec) CastorUtility.getInstance().readCastorObject(zis, ReportSpec.class); } catch (Exception e) { return null; } }