@Test public void testTemplateStream() throws Exception { assertNotNull("Test to retrieve sample-report", m_localJasperReportsDao.getTemplateStream("sample-report")); assertNotNull("Test to retrieve online-sample-report", m_localJasperReportsDao.getTemplateStream("online-sample-report")); assertNotNull("Test to retrieve not-online-sample-report", m_localJasperReportsDao.getTemplateStream("not-online-sample-report")); }
@Override public InputStream getTemplateStream(String id) { InputStream reportTemplateStream = null; try { String reportTemplateFolder = m_jrTemplateResource.getFile().getPath(); for (JasperReportDefinition report : m_LocalJasperReports.getReportList()) { if (id.equals(report.getId())) { try { reportTemplateStream = new FileInputStream( new File( reportTemplateFolder + "/" + report.getTemplate())); } catch (FileNotFoundException e) { logger.error("Template file '{}' at folder '{}' not found.", report.getTemplate(), reportTemplateFolder); e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } return reportTemplateStream; }
LegacyLocalJasperReportsDao implements LocalJasperReportsDao { @Override public InputStream getTemplateStream(String id) { InputStream reportTemplateStream = null; try { String reportTemplateFolder = m_jrTemplateResource.getFile().getPath(); for (JasperReportDefinition report : m_LocalJasperReports.getReportList()) { if (id.equals(report.getId())) { try { reportTemplateStream = new FileInputStream( new File( reportTemplateFolder + "/" + report.getTemplate())); } catch (FileNotFoundException e) { logger.error("Template file '{}' at folder '{}' not found.", report.getTemplate(), reportTemplateFolder); e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } return reportTemplateStream; } }
LegacyLocalJasperReportsDao implements LocalJasperReportsDao { @Override public InputStream getTemplateStream(String id) { InputStream reportTemplateStream = null; try { String reportTemplateFolder = m_jrTemplateResource.getFile().getPath(); for (JasperReportDefinition report : m_LocalJasperReports.getReportList()) { if (id.equals(report.getId())) { try { reportTemplateStream = new FileInputStream( new File( reportTemplateFolder + "/" + report.getTemplate())); } catch (FileNotFoundException e) { logger.error("Template file '{}' at folder '{}' not found.", report.getTemplate(), reportTemplateFolder); e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } return reportTemplateStream; } LegacyLocalJasperReportsDao(Resource configResource, Resource jrTemplateResource); }
LegacyLocalJasperReportsDao implements LocalJasperReportsDao { @Override public InputStream getTemplateStream(String id) { InputStream reportTemplateStream = null; try { String reportTemplateFolder = m_jrTemplateResource.getFile().getPath(); for (JasperReportDefinition report : m_LocalJasperReports.getReportList()) { if (id.equals(report.getId())) { try { reportTemplateStream = new FileInputStream( new File( reportTemplateFolder + "/" + report.getTemplate())); } catch (FileNotFoundException e) { logger.error("Template file '{}' at folder '{}' not found.", report.getTemplate(), reportTemplateFolder); e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } return reportTemplateStream; } LegacyLocalJasperReportsDao(Resource configResource, Resource jrTemplateResource); @Override void loadConfiguration(); @Override void setConfigResource(Resource configResource); @Override Resource getConfigResource(); @Override void setJrTemplateResource(Resource jrTemplateResource); @Override Resource getJrTemplateResource(); @Override String getTemplateLocation(String id); @Override String getEngine(String id); @Override InputStream getTemplateStream(String id); LocalJasperReports getLocalJasperReports(); void setLocalJasperReports(LocalJasperReports localJasperReports); }
LegacyLocalJasperReportsDao implements LocalJasperReportsDao { @Override public InputStream getTemplateStream(String id) { InputStream reportTemplateStream = null; try { String reportTemplateFolder = m_jrTemplateResource.getFile().getPath(); for (JasperReportDefinition report : m_LocalJasperReports.getReportList()) { if (id.equals(report.getId())) { try { reportTemplateStream = new FileInputStream( new File( reportTemplateFolder + "/" + report.getTemplate())); } catch (FileNotFoundException e) { logger.error("Template file '{}' at folder '{}' not found.", report.getTemplate(), reportTemplateFolder); e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } return reportTemplateStream; } LegacyLocalJasperReportsDao(Resource configResource, Resource jrTemplateResource); @Override void loadConfiguration(); @Override void setConfigResource(Resource configResource); @Override Resource getConfigResource(); @Override void setJrTemplateResource(Resource jrTemplateResource); @Override Resource getJrTemplateResource(); @Override String getTemplateLocation(String id); @Override String getEngine(String id); @Override InputStream getTemplateStream(String id); LocalJasperReports getLocalJasperReports(); void setLocalJasperReports(LocalJasperReports localJasperReports);  }