protected ReportTemplate getDefaultTemplate(Report report) { ReportTemplate defaultTemplate = report.getDefaultTemplate(); if (defaultTemplate == null) throw new ReportingException(String.format("No default template specified for report [%s]", report.getName())); return defaultTemplate; }
protected ReportInputParameter getParameterAlias(Report report, MetaClass inputValueMetaClass) { for (ReportInputParameter parameter : report.getInputParameters()) { if (reportGuiManager.parameterMatchesMetaClass(parameter, inputValueMetaClass)) { return parameter; } } throw new ReportingException(String.format("Selected report [%s] doesn't have parameter with class [%s].", report.getName(), inputValueMetaClass)); }
protected byte[] generateReportWithClass(BandData rootBand, String customDefinition) { Class clazz = scripting.loadClassNN(customDefinition); try { CustomReport customReport = (CustomReport) clazz.newInstance(); return customReport.createReport(report, rootBand, params); } catch (InstantiationException | IllegalAccessException e) { throw new ReportingException( format("Could not instantiate class for custom template [%s]. Report name [%s]", template.getCustomDefinition(), report.getName()), e); } }
protected ReportInfo mapToReportInfo(Report report) { ReportInfo reportInfo = new ReportInfo(); reportInfo.id = report.getId().toString(); reportInfo.code = report.getCode(); reportInfo.name = report.getName(); if (entityStates.isLoaded(report, "templates")) { if (report.getTemplates() != null) { reportInfo.templates = report.getTemplates().stream() .map(this::mapTemplateInfo) .collect(Collectors.toList()); } } if (entityStates.isLoaded(report, "xml")) { if (report.getInputParameters() != null) { reportInfo.inputParameters = report.getInputParameters().stream() .map(this::mapInputParameterInfo) .collect(Collectors.toList()); } } return reportInfo; }
@Override public byte[] exportReports(Collection<Report> reports) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ZipArchiveOutputStream zipOutputStream = new ZipArchiveOutputStream(byteArrayOutputStream); try { zipOutputStream.setMethod(ZipArchiveOutputStream.STORED); zipOutputStream.setEncoding(ENCODING); for (Report report : reports) { try { byte[] reportBytes = exportReport(report); ArchiveEntry singleReportEntry = newStoredEntry(replaceForbiddenCharacters(report.getName()) + ".zip", reportBytes); zipOutputStream.putArchiveEntry(singleReportEntry); zipOutputStream.write(reportBytes); zipOutputStream.closeArchiveEntry(); } catch (IOException e) { throw new ReportingException(String.format("Exception occurred while exporting report [%s]", report.getName()), e); } } } finally { IOUtils.closeQuietly(zipOutputStream); } return byteArrayOutputStream.toByteArray(); }
executions.startExecution(report.getId().toString(), "Reporting"); try { stopWatch = new Slf4JStopWatch("Reporting#" + report.getName()); List<String> prototypes = new LinkedList<>(); for (Map.Entry<String, Object> param : params.entrySet()) {
.filter(report -> { if (nameFilterValue != null && !report.getName().toLowerCase().contains(nameFilterValue)) { return false;
@Override public Report copyReport(Report source) { source = reloadEntity(source, REPORT_EDIT_VIEW_NAME); Report copiedReport = metadata.getTools().deepCopy(source); copiedReport.setId(uuidSource.createUuid()); copiedReport.setName(generateReportName(source.getName())); copiedReport.setCode(null); for (ReportTemplate copiedTemplate : copiedReport.getTemplates()) { copiedTemplate.setId(uuidSource.createUuid()); } storeReportEntity(copiedReport); return copiedReport; }
exportDisplay.show(provider, "Reports", ExportFormat.ZIP); } else if (reports.size() == 1) { exportDisplay.show(provider, reports.iterator().next().getName(), ExportFormat.ZIP);