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(); } }
@SuppressWarnings("unchecked") public ims.core.vo.ConfiguredJobExecutionSummaryVoCollection getHistory(ims.core.configuration.vo.ConfiguredJobRefVo job) { DomainFactory factory = getDomainFactory(); List history = factory.find("from ConfiguredJobExecutionSummary job where job.configuredJob.id = " + job.getID_ConfiguredJob() + " order by id desc", 200); return ConfiguredJobExecutionSummaryVoAssembler.createConfiguredJobExecutionSummaryVoCollectionFromConfiguredJobExecutionSummary(history); }
public ConfiguredJobExecutionSummaryVo getHistory(Integer id) { DomainFactory factory = getDomainFactory(); DomainObject summary = factory.findFirst("from ConfiguredJobExecutionSummary job where job.configuredJob.id = " + id + " order by id desc"); if (summary instanceof ConfiguredJobExecutionSummary) { return ConfiguredJobExecutionSummaryVoAssembler.create((ConfiguredJobExecutionSummary) summary); } return null; }