protected void onActTerminated(Act act, Audit audit) { this.audit = audit; Date endDate = new Date(); act.setEndDate(endDate); if (audit.getStatus().equals(AuditStatus.COMPLETED)) { act.setStatus(ActStatus.COMPLETED); } else { act.setStatus(ActStatus.ERROR); } act = actDataService.saveOrUpdate(act); if (exception != null) { sendKrashAuditEmail(act, locale, exception); actDataService.delete(act.getId()); auditDataService.delete(audit.getId()); this.audit = null; } }
/** * This method initializes an act instance and persists it. * * @param contract * @param scope * @return */ private Act createAct(Contract contract, ScopeEnum scope, String clientIp) { Date beginDate = new Date(); Act act = actFactory.createAct(beginDate, contract); act.setStatus(ActStatus.RUNNING); act.setScope(scopeMap.get(scope)); act.setClientIp(clientIp); actDataService.saveOrUpdate(act); return act; }