protected void storeIndexFields(Report report) { if (PersistenceHelper.isLoaded(report, "xml")) { StringBuilder entityTypes = new StringBuilder(IDX_SEPARATOR); if (report.getInputParameters() != null) { for (ReportInputParameter parameter : report.getInputParameters()) { if (isNotBlank(parameter.getEntityMetaClass())) { entityTypes.append(parameter.getEntityMetaClass()) .append(IDX_SEPARATOR); } } } report.setInputEntityTypesIdx(entityTypes.length() > 1 ? entityTypes.toString() : null); StringBuilder screens = new StringBuilder(IDX_SEPARATOR); if (report.getReportScreens() != null) { for (ReportScreen reportScreen : report.getReportScreens()) { screens.append(reportScreen.getScreenId()) .append(IDX_SEPARATOR); } } report.setScreensIdx(screens.length() > 1 ? screens.toString() : null); StringBuilder roles = new StringBuilder(IDX_SEPARATOR); if (report.getRoles() != null) { for (Role role : report.getRoles()) { roles.append(role.getId().toString()) .append(IDX_SEPARATOR); } } report.setRolesIdx(roles.length() > 1 ? roles.toString() : null); } }
protected void setRelevantReferencesToReport(Report entity) { for (ReportValueFormat reportValueFormat : entity.getValuesFormats()) { reportValueFormat.setReport(entity); } for (BandDefinition bandDefinition : entity.getBands()) { bandDefinition.setReport(entity); } for (ReportInputParameter reportInputParameter : entity.getInputParameters()) { reportInputParameter.setReport(entity); } for (ReportScreen reportScreen : entity.getReportScreens()) { reportScreen.setReport(entity); } } }
@Override public void onBeforeDetach(Report entity, EntityManager entityManager) { if (persistence.getTools().isLoaded(entity, "xml") && StringUtils.isNotBlank(entity.getXml())) { Report reportFromXml = reportingApi.convertToReport(entity.getXml()); entity.setBands(reportFromXml.getBands()); entity.setInputParameters(reportFromXml.getInputParameters()); entity.setReportScreens(reportFromXml.getReportScreens()); entity.setRoles(reportFromXml.getRoles()); entity.setValuesFormats(reportFromXml.getValuesFormats()); entity.setValidationOn(reportFromXml.getValidationOn()); entity.setValidationScript(reportFromXml.getValidationScript()); setRelevantReferencesToReport(entity); sortRootChildrenBands(entity); } }