@Override protected void initNewItem(ReportTemplate template) { if (StringUtils.isEmpty(template.getCode())) { Report report = template.getReport(); if (report != null) { if (report.getTemplates() == null || report.getTemplates().isEmpty()) template.setCode(ReportService.DEFAULT_TEMPLATE_CODE); else template.setCode("Template_" + Integer.toString(report.getTemplates().size())); } } }
@Override public void setItem(ReportTemplate reportTemplate) { super.setItem(reportTemplate); setBands(reportTemplate.getReport().getBands()); if (isApplicable(reportTemplate.getReportOutputType())) { setChartDescription(reportTemplate.getChartDescription()); sortSeriesByOrder(); } }
@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(); }
@Override public EntitySet commit(CommitContext context) { Set<Entity> result = new HashSet<>(); ReportService reportService = AppBeans.get(ReportService.NAME, ReportService.class); Report reportToStore = null; for (Entity entity : context.getCommitInstances()) { if (entity instanceof Report) { reportToStore = (Report) entity; } else if (entity instanceof ReportTemplate) { reportToStore = ((ReportTemplate) entity).getReport(); } } if (reportToStore != null) { result.add(reportService.storeReportEntity(reportToStore)); } return EntitySet.of(result); } }
private String convertSerialChart(SerialChartDescription description) { List<Map<String, Object>> data = new ArrayList<>(); List<BandData> childrenByName = rootBand.getChildrenByName(description.getBandName()); for (BandData bandData : childrenByName) { data.add(bandData.getData()); } return new ChartToJsonConverter(((ReportTemplate) reportTemplate).getReport().getLocName()) .convertSerialChart(description, data); }
protected String convertPieChart(PieChartDescription description) { List<Map<String, Object>> data = new ArrayList<>(); List<BandData> childrenByName = rootBand.getChildrenByName(description.getBandName()); for (BandData bandData : childrenByName) { data.add(bandData.getData()); } return new ChartToJsonConverter(((ReportTemplate) reportTemplate).getReport().getLocName()) .convertPieChart(description, data); } }