private void addTraceItem(ConfiguredJobExecutionTraceVo item) { grdTraceRow row = form.lyrDetails().tabTrace().grdTrace().getRows().newRow(); row.setColImage(form.getImages().Core.Time); row.setColDateTime(item.getDateTime() == null ? "Unknown" : item.getDateTime().toString()); row.setColMessage(item.getMessage() == null ? "No message" : item.getMessage()); }
public void saveExecutionSummaryAndTrace(IConfiguredScheduledJob job, SchedulerJobExecutionSummary summary, SchedulerJobExecutionTrace trace) { ConfiguredJobExecutionSummaryVo record = new ConfiguredJobExecutionSummaryVo(); record.setConfiguredJob(getConfiguredScheduledJobVo(job.getConfiguredScheduledJobID())); record.setStartDateTime(summary.getStartDateTime()); record.setEndDateTime(summary.getEndDateTime()); record.setMessage(summary.getMessage()); record.setStatus(summary.getStatus().getId()); ConfiguredJobExecutionTraceVoCollection traces = new ConfiguredJobExecutionTraceVoCollection(); if(trace != null) { for(int x = 0; x < trace.getTrace().size(); x++) { ITraceRecord traceRecord = trace.getTrace().get(x); ConfiguredJobExecutionTraceVo item = new ConfiguredJobExecutionTraceVo(); item.setDateTime(traceRecord.getDateTime()); item.setMessage(traceRecord.getMessage()); traces.add(item); } } record.setTraces(traces); String[] errors = record.validate(); if(errors != null && errors.length > 0) { throw new RuntimeException("Unable to save the scheduled job execution summary due to validation errors"); } DomainFactory factory = getDomainFactory(); try { factory.save(ConfiguredJobExecutionSummaryVoAssembler.extractConfiguredJobExecutionSummary(factory, record)); } catch (StaleObjectException e) { e.printStackTrace(); } }
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)); } }