private boolean save(SystemReportVo report, grdReportsRow selectedRow) { SystemReportVo savedReport; String[] errors = report.validate(); if (errors != null && errors.length > 0) { engine.showErrors(errors); return false; } try { savedReport = domain.saveReport(report); } catch (StaleObjectException e) { engine.showMessage(ims.configuration.gen.ConfigFlag.UI.STALE_OBJECT_MESSAGE.getValue()); return false; } selectedRow.setValue(domain.getReport(savedReport)); return true; }
private SystemReportVoCollection getReportsModifiedSinceLastDeployment() { SystemReportVoCollection reportsModified = new SystemReportVoCollection(); for (int i = 0; i < form.grdReports().getRows().size(); i++) { if (form.grdReports().getRows().get(i).getColDeploy()) { SystemReportVo report = form.grdReports().getRows().get(i).getValue(); boolean wasUpdatedSinceLastDeploy = report.getLastDeployment() != null && report.getLastUpdated() != null && report.getLastDeployment().isLessThan(report.getLastUpdated()); if (wasUpdatedSinceLastDeploy || hasTemplatesUpdatedSinceLastDeploy(report)) { reportsModified.add(report); } } } return reportsModified; }
@Override protected void onGrdReportsGridCheckBoxClicked(int column, grdReportsRow row, boolean isChecked) throws PresentationLogicException { SystemReportVo report = row.getValue(); if (CanEditQueryColumnSelected == column) { report.setQueryEditable(isChecked); if (report.getImsIdIsNotNull()) { if (isChecked) { row.setTextColor(Color.DodgerBlue); } else { row.setTextColor(Color.Blue); } } } else if (CanEditTemplateColumnSelected == column) { report.setTemplateEditable(isChecked); } if (!save(report, row)) { form.ccSearchReport().doSearch(); } }
private void populateRow(SystemReportVo report) { grdReportsRow newRow = form.grdReports().getRows().newRow(); newRow.setcolName(report.getReportName()); if (Boolean.TRUE.equals(report.getQueryEditable())) { newRow.setcolQuery(Boolean.TRUE); if (report.getImsIdIsNotNull()) { newRow.setTextColor(Color.DodgerBlue); } } else { newRow.setcolQuery(Boolean.FALSE); if (report.getImsIdIsNotNull()) { newRow.setTextColor(Color.Blue); } } if (Boolean.TRUE.equals(report.getTemplateEditable())) { newRow.setcolTemplate(Boolean.TRUE); } else { newRow.setcolTemplate(Boolean.FALSE); } newRow.setValue(report); }
private boolean hasTemplatesUpdatedSinceLastDeploy(SystemReportVo report) { if (report == null || report.getTemplates() == null) return false; for (TemplateBoLiteVo template : report.getTemplates()) { if (template.getLastUpdated() != null && template.getLastDeployment() != null && template.getLastDeployment().isLessThan(template.getLastUpdated())) return true; } return false; }
public ims.admin.vo.SystemReportVo saveReport(SystemReportVo report) throws ims.domain.exceptions.StaleObjectException { if (report == null) throw new CodingRuntimeException("Cannot save null Report"); if (!report.isValidated()) throw new DomainRuntimeException("SystemReportVo Not Validated."); DomainFactory factory = getDomainFactory(); ReportBo doReport = SystemReportVoAssembler.extractReportBo(factory, report); factory.save(doReport); return SystemReportVoAssembler.create(doReport); }
public SystemReportVo getReport(ReportBoRefVo reportRef) { if (reportRef == null) throw new CodingRuntimeException("Cannot get Report on null Id."); return SystemReportVoAssembler.create((ReportBo) getDomainFactory().getDomainObject(ReportBo.class, reportRef.getID_ReportBo())); }
private void populateReports(SystemReportVoCollection reports) { form.dyngrdReports().getRows().clear(); if (reports == null) return; for (SystemReportVo report : reports) { DynamicGridRow reportRow = form.dyngrdReports().getRows().newRow(); reportRow.setCollapsedImage(form.getImages().Admin.Audit); reportRow.setExpandedImage(form.getImages().Admin.Audit); if (report.getLastDeployment() != null && report.getLastUpdated() != null && report.getLastDeployment().isLessThan(report.getLastUpdated())) { reportRow.setTextColor(Color.Black); } else { reportRow.setTextColor(Color.Gray); } DynamicGridCell cellName = reportRow.getCells().newCell(form.dyngrdReports().getColumns().getByIdentifier(COL_NAME), DynamicCellType.STRING); cellName.setValue("<b>" + report.getReportName() + "</b>"); cellName.setReadOnly(true); cellName.setTooltip(getReportTemplate(report.getReportXml())); DynamicGridCell cellLastDeployed = reportRow.getCells().newCell(form.dyngrdReports().getColumns().getByIdentifier(COL_LAST_DEPLOY), DynamicCellType.DATETIME); cellLastDeployed.setValue(report.getLastDeployment()); cellLastDeployed.setReadOnly(true); DynamicGridCell cellLastModified = reportRow.getCells().newCell(form.dyngrdReports().getColumns().getByIdentifier(COL_LAST_MODIFY), DynamicCellType.DATETIME); cellLastModified.setValue(report.getLastUpdated()); cellLastModified.setReadOnly(true); reportRow.setValue(report); if (report.getTemplates() != null) populateTemplates(reportRow, report.getTemplates()); reportRow.setExpanded(true); } }
private void displayReports(SystemReportVoCollection coll) { form.grdReports().getRows().clear(); if (coll == null || coll.size() == 0) { engine.showMessage("No reports found."); //WDEV-16544 return; } String path = EnvironmentConfig.getBaseUri(); String fileSep = System.getProperty("file.separator"); String loadFolder = ""; String customerFolder = ""; //WDEV-12195 try { customerFolder = domain.getSiteName(); } catch (DomainInterfaceException e) { e.printStackTrace(); engine.showMessage("Can't get the customer reports folder: " + e.toString()); } String pathFirst = ""; if(!path.endsWith(fileSep)) path += fileSep; path += "reports" + fileSep; if(customerFolder.length() > 0) pathFirst = path + customerFolder + fileSep; for (SystemReportVo report : coll) { boolean deployFromCustomerFolder = false; String firstFileName = pathFirst + report.getExportFileName(); loadFolder = "/reports/"; File file = new File(firstFileName); if(file.exists()) { loadFolder += customerFolder + "/"; deployFromCustomerFolder = true; } grdReportsRow row = form.grdReports().getRows().newRow(); row.setColDeploy(true); row.setColDeployReadOnly(false); row.setColName(report.getReportName()); row.setColImportFile(loadFolder + report.getExportFileName()); if(deployFromCustomerFolder) { row.setBackColor(Color.fromRGB(153, 255, 255)); } row.setValue(report); if(Boolean.TRUE.equals(report.getQueryEditable())) row.setTextColor(Color.DodgerBlue); else row.setTextColor(Color.Blue); } }