private void updateContextMenu() { boolean isRunning = false; boolean isPaused = false; ConfiguredJobVo currentConfiguredJob = form.getLocalContext().getSelectedConfiguredJob(); ISchedulerServlet servletInstance = getTaskSchedulerServlet(); if (servletInstance == null) { engine.showMessage("Cannot get SchedulerServletInstance"); return ; } try { isRunning = currentConfiguredJob != null ? (servletInstance.getStatus(currentConfiguredJob.getConfiguredScheduledJobID()).equals(SchedulerJobStatus.BLOCKED) ? true : false) : false; isPaused = currentConfiguredJob != null ? (servletInstance.getStatus(currentConfiguredJob.getConfiguredScheduledJobID()).equals(SchedulerJobStatus.PAUSED) ? true : false) : false; } catch (Exception e) { engine.showMessage("SchedulerServlet error: " + e.getMessage()); return; } form.getContextMenus().Admin.getSystemJobNewItem().setVisible(form.dyngrdSystemJobs().getSelectedRow() != null ? true: false); form.getContextMenus().Admin.getSystemJobEditItem().setVisible(form.dyngrdConfiguredJobs().getSelectedRow() != null ? true: false); form.getContextMenus().Admin.getSystemJobRunOnceItem().setVisible((form.dyngrdConfiguredJobs().getSelectedRow() != null ? true: false) && !isRunning && !isPaused); form.getContextMenus().Admin.getSystemJobPauseItem().setVisible((form.dyngrdConfiguredJobs().getSelectedRow() != null ? true: false) && isRunning && !isPaused); form.getContextMenus().Admin.getSystemJobResumeItem().setVisible((form.dyngrdConfiguredJobs().getSelectedRow() != null ? true: false) && isPaused); form.getContextMenus().Admin.getSystemJobDeleteItem().setVisible((form.dyngrdConfiguredJobs().getSelectedRow() != null ? true: false) && !isRunning && !isPaused); form.getContextMenus().Admin.getSystemJobViewHistoryItem().setVisible(form.dyngrdConfiguredJobs().getSelectedRow() != null ? true: false); }
@Override protected void onDyngrdConfiguredJobsRowSelectionChanged(ims.framework.controls.DynamicGridRow row) { form.getGlobalContext().Admin.setCurrentJobConfiguration((ConfiguredJobVo) form.dyngrdConfiguredJobs().getSelectedRow().getIdentifier()); form.getLocalContext().setSelectedConfiguredJob((ConfiguredJobVo) form.dyngrdConfiguredJobs().getSelectedRow().getIdentifier()); updateContextMenu(); }
private Integer getImsId() { if (form.dyngrdConfiguredJobs().getSelectedRow() != null) { return ((ConfiguredJobVo)form.dyngrdConfiguredJobs().getSelectedRow().getIdentifier()).getID_ConfiguredJob(); } return null; }
public ConfiguredJobVo saveSystemJobDetails(ConfiguredJobVo jobDetails) throws StaleObjectException { if (!jobDetails.isValidated()) { throw new DomainRuntimeException("This ConfiguredJobVo has not been validated"); } DomainFactory factory = getDomainFactory(); ConfiguredJob jobDetailsBo = ConfiguredJobVoAssembler.extractConfiguredJob(factory, jobDetails); factory.save(jobDetailsBo); return ConfiguredJobVoAssembler.create(jobDetailsBo); }
public ConfiguredJobVo getConfiguredJobVo(Integer id) { if(id == null) { throw new CodingRuntimeException("SystemJobVo id is null"); } DomainFactory factory = getDomainFactory(); ConfiguredJob doConfiguredJob = (ConfiguredJob) factory.getDomainObject(ConfiguredJob.class, id); return ConfiguredJobVoAssembler.create(doConfiguredJob); }
public ConfiguredJobVo getSystemJobDetailsByImsId(Integer imsId) { DomainFactory factory = getDomainFactory(); String hqlString = "from ConfiguredJob configuredJob where configuredJob.id = :imsID"; List jobDetails = factory.find(hqlString, new String[] {"imsID"}, new Object[] {new Integer(imsId)}); if (jobDetails != null && jobDetails.size() > 0) { return ConfiguredJobVoAssembler.createConfiguredJobVoCollectionFromConfiguredJob(jobDetails).get(0); } return null; }
@Override protected void onFormOpen(Object[] args) throws ims.framework.exceptions.PresentationLogicException { form.lyrConfiguration().tabScheduling().cmbFrequency().removeRow(JobRunningFrequency.CUSTOM); form.getLocalContext().setSystemJob(form.getGlobalContext().Admin.getSystemJob()); if (args != null && args.length > 0) { if (args[0] != null && args[0] instanceof ConfiguredJobVo) { form.getLocalContext().setConfiguredJob((ConfiguredJobVo)args[0]); form.getLocalContext().setNotificationOnSuccess(((ConfiguredJobVo)args[0]).getNotificationsOnSuccess()); form.getLocalContext().setNotificationOnFailure(((ConfiguredJobVo)args[0]).getNotificationsOnFailure()); form.getGlobalContext().Admin.setSystemJobNotification(null); if(form.getLocalContext().getConfiguredJob() != null && form.getLocalContext().getConfiguredJob().getScheduledJob() != null && form.getLocalContext().getConfiguredJob().getScheduledJob().getConfigFormId() != null && form.getLocalContext().getConfiguredJob().getScheduledJob().getConfigFormId() > 0) { showLyrConfigurationTabs(true, true, true); } else { showLyrConfigurationTabs(true, false, true); } form.lyrConfiguration().showtabScheduling(); form.getLocalContext().setCurrentSelectedTab(SCHEDULER_TAB); populateSchedulingTab((ConfiguredJobVo)args[0]); manageButtons(false, false, true, true); return; } } initialize(); open(); }
private void saveJobScheduler() { ConfiguredJobVo configuredJob = populateDataFromScreen(form.getLocalContext().getConfiguredJob()); form.getLocalContext().setConfiguredJob(configuredJob); }
private void loadData() { form.btnRefresh().setVisible(false); form.grdHistory().getRows().clear(); ISchedulerServlet servletInstance = getTaskSchedulerServlet(); ConfiguredJobVo currentJobConfiguration = form.getGlobalContext().Admin.getCurrentJobConfiguration(); ISchedulerJob instance = servletInstance.getJob(currentJobConfiguration.getID_ConfiguredJob()); if (instance != null) { form.btnRefresh().setVisible(true); ConfiguredJobExecutionSummaryVo executionSummary = new ConfiguredJobExecutionSummaryVo(); executionSummary.setMessage("Scheduled job is running."); executionSummary.setStartDateTime(instance.getJobStartDateTime()); if (instance.getExecutionTrace() != null) { List<ITraceRecord> traces = instance.getExecutionTrace().getTrace(); ConfiguredJobExecutionTraceVoCollection coll = new ConfiguredJobExecutionTraceVoCollection(); for (int i = 0; i < traces.size(); i++) { ConfiguredJobExecutionTraceVo vo = new ConfiguredJobExecutionTraceVo(); vo.setMessage(traces.get(i).getMessage()); vo.setDateTime(traces.get(i).getDateTime()); coll.add(vo); } executionSummary.setTraces(coll); } grdHistoryRow row = form.grdHistory().getRows().newRow(); row.setValue(executionSummary); row.setColImage(form.getImages().Core.Time); row.setColStartDateTime(executionSummary.getStartDateTime() == null ? "Unknown" : executionSummary.getStartDateTime().toString()); row.setColEndDateTime(null); row.setColStatus("In Progress"); row.setColMessage(executionSummary.getMessage() == null ? "No details." : executionSummary.getMessage()); } ConfiguredJobExecutionSummaryVoCollection list = domain.getHistory(form.getGlobalContext().Admin.getCurrentJobConfiguration()); for(int x = 0; x < list.size(); x++) { addItem(list.get(x)); } }
public ConfiguredJobVo getConfiguredScheduledJobVo(int id) { return ConfiguredJobVoAssembler.create((ConfiguredJob)getDomainFactory().getDomainObject(ConfiguredJob.class, id)); }
public ConfiguredJobVo getSystemJobDetailsByImsId(Integer imsId) { SystemJobs impl = (SystemJobs) getDomainImpl(SystemJobsImpl.class); return impl.getSystemJobDetailsByImsId(imsId); }
public ConfiguredJobVo saveSystemJobDetails(ConfiguredJobVo jobDetails) throws StaleObjectException { SystemJobDetails impl = (SystemJobDetails) getDomainImpl(SystemJobDetailsImpl.class); return impl.saveSystemJobDetails(jobDetails); }