private void populateScreenFromData(AttendanceReqContractSettingsVo record) { clear(); if(record == null) return; form.dtimFrom().setValue(record.getFromDate()); form.dtimTo().setValue(record.getToDate()); }
public void saveData() throws Exception { AttendanceReqContractSettingsVo record = getData(); String[] errors = record.validate(getUIErrors()); if(errors != null && errors.length > 0) throw new Exception("Validation Errors"); domain.saveConfiguration(record); }
public AttendanceReqContractSettingsVo getData() { AttendanceReqContractSettingsVo record = populateDataFromScreen(form.getLocalContext().getRecord()); record.setConfiguredJob(form.getGlobalContext().Admin.getCurrentJobConfiguration()); return record; }
public void loadData() { AttendanceReqContractSettingsVo record = domain.getConfiguration(form.getGlobalContext().Admin.getCurrentJobConfiguration()); form.getLocalContext().setRecord(record); populateScreenFromData(record); }
@Override public SchedulerJobExecutionSummary doExecute() throws JobExecutionException { StringBuilder summaryMessage = new StringBuilder(); if (!Boolean.TRUE.equals(ConfigFlag.UI.USE_HEARTS_CONTRACTING.getValue())) { trace("Scheduled job not started because USE_HEARTS_CONTRACTING flag is set to false."); summaryMessage.append("Scheduled job not started because USE_HEARTS_CONTRACTING flag is set to false."); return new SchedulerJobExecutionSummary(SchedulerJobExecutionStatus.FAILED, summaryMessage.toString()); } // use trace method to log various execution points and state long start = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); summaryMessage.append("Start job at " + calendar.getTime()); summaryMessage.append("\n"); AttendanceReqContractSettingsVo job = getJobDetails(); if (job == null) { throw new JobExecutionException("Job configuration missing"); } DateTime fromDate = job.getFromDate(); DateTime toDate = job.getToDate(); List listAttendances = getAllAttendances(fromDate,toDate); if (listAttendances!=null && listAttendances.size()>0) { for (int i=0;i<listAttendances.size();i++) { save((EmergencyAttendance)listAttendances.get(i)); reqAllocations++; } } try { getDomainFactory().commitTransaction(); } catch (StaleObjectException e) { trace("Attendance Requiring Contracting save failed! " + e.getMessage()); failed++; } long end = System.currentTimeMillis(); calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); summaryMessage.append("End job at " + calendar.getTime()); summaryMessage.append("\n"); int d = (int) (((end - start) / 1000) / 86400); int h = (int) (((end - start) / 1000) / 3600); int m = (int) ((((end - start) / 1000) / 60) % 60); int s = (int) (((end - start) / 1000) % 60); summaryMessage.append("Total time for execution : " + d + " days, " + h + " hours, " + m + " minutes, " + s + " seconds"); summaryMessage.append("\n"); summaryMessage.append("Total records failed : " + failed); summaryMessage.append("\n"); summaryMessage.append("Total records processed : " + reqAllocations); summaryMessage.append("\n"); trace("Scheduled job ended"); summaryMessage.append("Scheduled job completed successfully."); // Return the execution summary // This should include a summary text along with the job execution status return new SchedulerJobExecutionSummary(SchedulerJobExecutionStatus.SUCCEEDED, summaryMessage.toString()); }
private AttendanceReqContractSettingsVo getJobDetails() { AttendanceReqContractSettings doAttendanceReqContractSettings = AttendanceReqContractSettings.getAttendanceReqContractSettingsFromConfiguredJob(getDomainFactory(), super.getConfiguredJob().getConfiguredScheduledJobID()); return AttendanceReqContractSettingsVoAssembler.create(doAttendanceReqContractSettings); }