protected void onGrdJobsSelectionChanged() throws PresentationLogicException { PrintAgentVo printAgentVo = form.grdJobs().getValue(); form.getLocalContext().setJobSettings(printAgentVo); ReportVoCollection coll = form.getLocalContext().getReportsAvailable(); displayAvailableReports(coll, printAgentVo); displaySelectedTemplates(printAgentVo); displayJobDetails(printAgentVo); //WDEV-17946 form.getLocalContext().setLastId(printAgentVo != null ? printAgentVo.getID_PrintAgent() : null); form.btnPrintNow().setEnabled(printAgentVo != null && Boolean.TRUE.equals(printAgentVo.getIsActive())); updateControlsState(); }
public int compare(Object ob1, Object ob2) { DateTime date1 = null; DateTime date2 = null; if(ob1 instanceof PrintAgentVo ) { PrintAgentVo pa1 = (PrintAgentVo)ob1; date1 = pa1.getSysInfo().getCreationDateTime(); } if(ob2 instanceof PrintAgentVo) { PrintAgentVo pa2 = (PrintAgentVo)ob2; date2 = pa2.getSysInfo().getCreationDateTime(); } if(date1 == null) return -1*direction; if(date2 == null) return direction; return date1.compareTo(date2)*direction; }
public int compare(Object ob1, Object ob2) { DateTime date1 = null; DateTime date2 = null; if(ob1 instanceof PrintAgentVo ) { PrintAgentVo pa1 = (PrintAgentVo)ob1; date1 = pa1.getLastRunDateTime(); } if(ob2 instanceof PrintAgentVo) { PrintAgentVo pa2 = (PrintAgentVo)ob2; date2 = pa2.getLastRunDateTime(); } if(date1 == null) return -1*direction; if(date2 == null) return direction; return date1.compareTo(date2)*direction; }
public int compare(Object ob1, Object ob2) { DateTime date1 = null; DateTime date2 = null; if(ob1 instanceof PrintAgentVo ) { PrintAgentVo pa1 = (PrintAgentVo)ob1; date1 = pa1.getLastSuccessfulRunDateTime(); } if(ob2 instanceof PrintAgentVo) { PrintAgentVo pa2 = (PrintAgentVo)ob2; date2 = pa2.getLastSuccessfulRunDateTime(); } if(date1 == null) return -1*direction; if(date2 == null) return direction; return date1.compareTo(date2)*direction; }
public PrintAgentVo savePrintAgent(PrintAgentVo printAgent) throws StaleObjectException { if (!printAgent.isValidated()) { throw new DomainRuntimeException("PrintAgentVo has not been validated"); } DomainFactory factory = getDomainFactory(); PrintAgent doPrintAgent = PrintAgentVoAssembler.extractPrintAgent(factory, printAgent); Iterator it = doPrintAgent.getTemplatePrinters().iterator(); while (it.hasNext()) factory.save((TemplatePrinter) it.next()); factory.save(doPrintAgent); return PrintAgentVoAssembler.create(doPrintAgent); }
private void displayJobs(PrintAgentVoCollection collPrintAgentVo) { form.grdJobs().getRows().clear(); for (int i = 0; i < collPrintAgentVo.size(); i++) { PrintAgentVo job = collPrintAgentVo.get(i); grdJobsRow row = form.grdJobs().getRows().newRow(); fillJobRow(job, row); } }
private void fillJobRow(PrintAgentVo job, grdJobsRow row) { row.setValue(job); row.setColumnDescription(job.getDescription()); if(job.getSysInfoIsNotNull()) row.setColumnDate(job.getSysInfo().getCreationDateTime().toString()); row.setColumnLastRun(job.getLastRunDateTimeIsNotNull() ? job.getLastRunDateTime().toString() : ""); row.setColumnLastSuccessfulRun(job.getLastSuccessfulRunDateTimeIsNotNull() ? job.getLastSuccessfulRunDateTime().toString() : ""); row.setColumnAppointmentsUpdated(job.getNoOfRecordsUpdatedIsNotNull() ? job.getNoOfRecordsUpdated().toString() : ""); if (job.getIsActive() == null || job.getIsActive().booleanValue() == false) row.setTextColor(Color.DarkGray); if (job.getLastRunDateTimeIsNotNull() && job.getLastSuccessfulRunDateTimeIsNotNull() && !job.getLastRunDateTime().equals(job.getLastSuccessfulRunDateTime())) row.setTextColor(Color.Red); else if (job.getLastRunDateTimeIsNotNull() && !job.getLastSuccessfulRunDateTimeIsNotNull()) row.setTextColor(Color.Red); else if (!job.getLastRunDateTimeIsNotNull() && job.getLastSuccessfulRunDateTimeIsNotNull()) row.setTextColor(Color.Red); Trigger trigger = new Trigger(job.getTrigger()); String html = trigger.getHtmlTranslation(); row.setColumnTrigger(trigger.getTextTranslation()); row.setTooltipForColumnTrigger(html); row.setTooltipForColumnClock(html); if (trigger.getFrequency().equals(daily)) { row.setColumnClock(form.getImages().Admin.Calendar_Select_Day); } else if (trigger.getFrequency().equals(weekly)) { row.setColumnClock(form.getImages().Admin.Calendar_Select_Week); } else if (trigger.getFrequency().equals(monthly)) { row.setColumnClock(form.getImages().Admin.Calendar_Select_Month); } }
private void displayAvailableReports(ReportVoCollection coll, PrintAgentVo printAgentVo) { form.grdReportsAvailable().getRows().clear(); for (int i = 0; i < coll.size(); i++) { ReportVo rep = coll.get(i); if (rep.getTemplatesIsNotNull() && bHasActiveTemplates(rep)) { grdReportsAvailableRow row = form.grdReportsAvailable().getRows().newRow(); row.setColumnReport(rep.getReportName()); row.setTooltip(rep.getReportDescription()); row.setBold(true); row.setBackColor(Color.Beige); row.setValue(rep); for (int j = 0; j < rep.getTemplates().size(); j++) { if (rep.getTemplates().get(j).getIsActiveIsNotNull() && rep.getTemplates().get(j).getIsActive().equals(Boolean.TRUE) && isTemplateAlreadySelected(rep.getTemplates().get(j), printAgentVo) == false) { grdReportsAvailableRow child = row.getRows().newRow(); child.setColumnReport(rep.getTemplates().get(j).getName()); child.setTooltip(rep.getTemplates().get(j).getDescription()); child.setValue(rep.getTemplates().get(j)); } } row.setExpanded(true); if (row.getRows().size() == 0) { form.grdReportsAvailable().setValue(row.getValue()); form.grdReportsAvailable().removeSelectedRow(); } } } }
private boolean isTemplateAlreadySelected(ReportTemplateVo templateVo, PrintAgentVo printAgentVo) { if (printAgentVo == null) return false; for (int i = 0; i < printAgentVo.getTemplatesToPrint().size(); i++) { if (templateVo.getID_TemplateBo().equals(printAgentVo.getTemplatesToPrint().get(i).getTemplate().getID_TemplateBo())) return true; } return false; }
private void removeAllTemplates() { PrintAgentVo agent = form.getLocalContext().getJobSettings(); if(agent == null) return; agent.getTemplatesToPrint().clear(); form.getLocalContext().setJobSettings(agent); displayAvailableReports(form.getLocalContext().getReportsAvailable(), agent); displaySelectedTemplates(agent); }
protected void onBtnRemoveReportClick() throws ims.framework.exceptions.PresentationLogicException { if (form.grdReportsToPrint().getValue() == null || !(form.grdReportsToPrint().getValue() instanceof TemplatePrinterVo)) { engine.showMessage("Please select a template !"); return; } PrintAgentVo agent = form.getLocalContext().getJobSettings(); TemplatePrinterVo repTemplate = (TemplatePrinterVo) form.grdReportsToPrint().getValue(); for (int i = 0; i < agent.getTemplatesToPrint().size(); i++) { TemplatePrinterVo tp = agent.getTemplatesToPrint().get(i); if (tp.getTemplate().getID_TemplateBo().equals(repTemplate.getTemplate().getID_TemplateBo())) { agent.getTemplatesToPrint().remove(tp); form.getLocalContext().setJobSettings(agent); break; } } displayAvailableReports(form.getLocalContext().getReportsAvailable(), agent); displaySelectedTemplates(agent); }
private void displaySelectedTemplates(PrintAgentVo agent) { form.grdReportsToPrint().getRows().clear(); if (agent == null || agent.getTemplatesToPrintIsNotNull() == false) return; for (int i = 0; i < agent.getTemplatesToPrint().size(); i++) { TemplatePrinterVo tp = agent.getTemplatesToPrint().get(i); grdReportsToPrintRow parentRow = getParentRowById(tp.getTemplate().getReport()); if (parentRow == null) { ReportVo rep = tp.getTemplate().getReport(); parentRow = form.grdReportsToPrint().getRows().newRow(); parentRow.setColumnReport(rep.getReportName()); parentRow.setTooltip(rep.getReportDescription()); parentRow.setBold(true); parentRow.setBackColor(Color.Beige); parentRow.setValue(rep); parentRow.setExpanded(true); } grdReportsToPrintRow child = parentRow.getRows().newRow(); child.setColumnReport(tp.getTemplate().getName()); child.setColumnPrintTo(tp.getPrinterName()); child.setColumnPrintToReadOnly(false); child.setTooltip(tp.getTemplate().getDescription()); child.setValue(tp); } }
public PrintAgentVo getPrintAgent(Integer jobId) { DomainFactory factory = getDomainFactory(); PrintAgent obj = (PrintAgent) factory.getDomainObject(PrintAgent.class, jobId); factory.refresh(obj); return PrintAgentVoAssembler.create(obj); }
private void fillJobRow(PrintAgentVo job, grdJobsRow row) { row.setValue(job); row.setColumnDescription(job.getDescription()); if(job.getSysInfoIsNotNull()) row.setColumnDate(job.getSysInfo().getCreationDateTime().toString()); row.setColumnLastRun(job.getLastRunDateTimeIsNotNull() ? job.getLastRunDateTime().toString() : ""); row.setColumnLastSuccessfulRun(job.getLastSuccessfulRunDateTimeIsNotNull() ? job.getLastSuccessfulRunDateTime().toString() : ""); if (job.getIsActive() == null || job.getIsActive().booleanValue() == false) row.setTextColor(Color.DarkGray); if (job.getLastRunDateTimeIsNotNull() && job.getLastSuccessfulRunDateTimeIsNotNull() && !job.getLastRunDateTime().equals(job.getLastSuccessfulRunDateTime())) row.setTextColor(Color.Red); else if (job.getLastRunDateTimeIsNotNull() && !job.getLastSuccessfulRunDateTimeIsNotNull()) row.setTextColor(Color.Red); else if (!job.getLastRunDateTimeIsNotNull() && job.getLastSuccessfulRunDateTimeIsNotNull()) row.setTextColor(Color.Red); Trigger trigger = new Trigger(job.getTrigger(), engine); String html = trigger.getHtmlTranslation(); row.setColumnTrigger(trigger.getTextTranslation()); row.setTooltipForColumnTrigger(html); row.setTooltipForColumnClock(html); if (trigger.getFrequency().equals(daily)) { row.setColumnClock(form.getImages().Admin.Calendar_Select_Day); } else if (trigger.getFrequency().equals(weekly)) { row.setColumnClock(form.getImages().Admin.Calendar_Select_Week); } else if (trigger.getFrequency().equals(monthly)) { row.setColumnClock(form.getImages().Admin.Calendar_Select_Month); } }