@Override public com.haulmont.yarg.structure.ReportOutputType getOutputType() { return getReportOutputType() != null ? getReportOutputType().getOutputType() : null; }
protected void checkReportOutputType(ReportTemplate reportTemplate) { if (reportTemplate != null) { ReportOutputType outputType = reportTemplate.getReportOutputType(); if (outputType == ReportOutputType.CHART || outputType == ReportOutputType.TABLE || outputType == ReportOutputType.PIVOT_TABLE) { throw new RestAPIException("Run report error", String.format("%s report output type is not supported by Reporting REST API", outputType.toString()), HttpStatus.BAD_REQUEST); } } }
public boolean supportAlterableForTemplate(ReportTemplate template) { if (BooleanUtils.isTrue(template.getCustom())) { return false; } if (template.getReportOutputType() == ReportOutputType.CHART || template.getReportOutputType() == ReportOutputType.TABLE) { return false; } return BooleanUtils.isTrue(template.getAlterable()); } }
public void setChartDescription(@Nullable AbstractChartDescription chartDescription) { if (chartDescription != null && getReportOutputType() == ReportOutputType.CHART) { String jsonString = AbstractChartDescription.toJsonString(chartDescription); setContent(jsonString.getBytes(StandardCharsets.UTF_8)); setName(".chart"); } }
protected boolean validateInputOutputFormats() { ReportTemplate template = getItem().getDefaultTemplate(); if (template != null && !template.isCustom() && template.getReportOutputType() != ReportOutputType.CHART && template.getReportOutputType() != ReportOutputType.TABLE && template.getReportOutputType() != ReportOutputType.PIVOT_TABLE) { String inputType = template.getExt(); if (!ReportPrintHelper.getInputOutputTypesMapping().containsKey(inputType) || !ReportPrintHelper.getInputOutputTypesMapping().get(inputType).contains(template.getReportOutputType())) { showNotification(getMessage("inputOutputTypesError"), NotificationType.TRAY); return false; } } return true; }
public void setPivotTableDescription(PivotTableDescription description) { if (description != null && getReportOutputType() == ReportOutputType.PIVOT_TABLE) { setContent(PivotTableDescription.toJsonString(description).getBytes(StandardCharsets.UTF_8)); setName(".pivot"); } } }
protected TemplateInfo mapTemplateInfo(ReportTemplate template) { TemplateInfo templateInfo = new TemplateInfo(); templateInfo.code = template.getCode(); templateInfo.outputType = template.getReportOutputType().toString(); return templateInfo; }
protected String findTableCode(Report report) { for (ReportTemplate reportTemplate : report.getTemplates()) { if (ReportOutputType.TABLE.equals(reportTemplate.getReportOutputType())) return reportTemplate.getCode(); } return null; }
protected FileDescriptor createAndSaveReportDocument(Report report, ReportTemplate template, Map<String, Object> params, String fileName) { byte[] reportData = createReportDocument(report, template, params).getContent(); String ext = template.getReportOutputType().toString().toLowerCase(); return saveReport(reportData, fileName, ext); }
protected boolean validateInputOutputFormats() { ReportTemplate reportTemplate = getItem(); String name = reportTemplate.getName(); if (!Boolean.TRUE.equals(reportTemplate.getCustom()) && hasTemplateOutput(reportTemplate.getReportOutputType()) && name != null) { String inputType = name.contains(".") ? name.substring(name.lastIndexOf(".") + 1) : ""; ReportOutputType outputTypeValue = outputType.getValue(); if (!ReportPrintHelper.getInputOutputTypesMapping().containsKey(inputType) || !ReportPrintHelper.getInputOutputTypesMapping().get(inputType).contains(outputTypeValue)) { showNotification(getMessage("inputOutputTypesError"), NotificationType.TRAY); return false; } } return true; }
protected boolean validateTemplateFile() { ReportTemplate template = getItem(); if (!Boolean.TRUE.equals(template.getCustom()) && hasTemplateOutput(template.getReportOutputType()) && template.getContent() == null) { StringBuilder notification = new StringBuilder(getMessage("template.uploadTemplate")); if (StringUtils.isEmpty(template.getCode())) { notification.append("\n").append(getMessage("template.codeMsg")); } if (template.getOutputType() == null) { notification.append("\n").append(getMessage("template.outputTypeMsg")); } showNotification(getMessage("validationFail.caption"), notification.toString(), NotificationType.TRAY); return false; } return true; } }
public void printReport() { if (inputParametersFrame != null && inputParametersFrame.getReport() != null) { if (validateAll()) { Map<String, Object> parameters = inputParametersFrame.collectParameters(); Report report = inputParametersFrame.getReport(); templateCode = report.getTemplates().stream() .filter(template -> template.getReportOutputType() == ReportOutputType.CHART) .findFirst().get().getCode(); ReportOutputDocument reportResult = reportGuiManager.getReportResult(report, parameters, templateCode); openChart(new String(reportResult.getContent(), StandardCharsets.UTF_8)); } } } }
@Override public void ready() { super.ready(); ReportTemplate reportTemplate = getItem(); initTemplateEditor(reportTemplate); getDescriptionEditFrames().forEach(controller -> controller.setItem(reportTemplate)); setupVisibility(reportTemplate.getCustom(), reportTemplate.getReportOutputType()); }
if (frame.isApplicable(reportTemplate.getReportOutputType())) { if (!frame.applyChanges()) { return false; if (reportTemplate.getReportOutputType() == ReportOutputType.TABLE) { reportTemplate.setName(".table");
@Override public void setItem(ReportTemplate reportTemplate) { super.setItem(reportTemplate); setBands(reportTemplate.getReport().getBands()); if (isApplicable(reportTemplate.getReportOutputType())) { setChartDescription(reportTemplate.getChartDescription()); sortSeriesByOrder(); } }
@Override protected void postInit() { super.postInit(); initUploadField(); templateDs.addItemPropertyChangeListener(e -> { ReportTemplate reportTemplate = getItem(); if ("reportOutputType".equals(e.getProperty())) { ReportOutputType prevOutputType = (ReportOutputType) e.getPrevValue(); ReportOutputType newOutputType = (ReportOutputType) e.getValue(); setupVisibility(reportTemplate.getCustom(), newOutputType); if (hasHtmlCsvTemplateOutput(prevOutputType) && !hasTemplateOutput(newOutputType)) { showMessageDialog(getMessage("templateEditor.warning"), getMessage("templateEditor.clearTemplateMessage"), MessageType.CONFIRMATION); } } else if ("custom".equals(e.getProperty())) { setupVisibility(Boolean.TRUE.equals(e.getValue()), reportTemplate.getReportOutputType()); } }); initOutputTypeList(); }
protected void updateOutputTypes() { if (!reportGuiManager.containsAlterableTemplate(report)) { setOutputTypeVisible(false); return; } ReportTemplate template; if (report.getTemplates() != null && report.getTemplates().size() > 1) { template = templateField.getValue(); } else { template = report.getDefaultTemplate(); } if (template != null && reportGuiManager.supportAlterableForTemplate(template)) { List<ReportOutputType> outputTypes = ReportPrintHelper.getInputOutputTypesMapping().get(template.getExt()); if (outputTypes != null && !outputTypes.isEmpty()) { outputTypeField.setOptionsList(outputTypes); if (outputTypeField.getValue() == null) { outputTypeField.setValue(template.getReportOutputType()); } setOutputTypeVisible(true); } else { outputTypeField.setValue(null); setOutputTypeVisible(false); } } else { outputTypeField.setValue(null); setOutputTypeVisible(false); } }
@Override public void setItem(ReportTemplate reportTemplate) { super.setItem(reportTemplate); setBands(reportTemplate.getReport().getBands()); if (isApplicable(reportTemplate.getReportOutputType())) { if (reportTemplate.getPivotTableDescription() == null) { pivotTableDs.setItem(createDefaultPivotTableDescription()); } else { pivotTableDs.setItem(reportTemplate.getPivotTableDescription()); } } initRendererTypes(); propertyTable.expandAll(); }