private void confirmWithDB(SLACalcStatus slaCalc) {
boolean ended = false, isEndMiss = false;
try {
switch (slaCalc.getAppType()) {
case WORKFLOW_JOB:
WorkflowJobBean wf = jpaService.execute(new WorkflowJobGetForSLAJPAExecutor(slaCalc.getId()));
if (wf.getEndTime() != null) {
ended = true;
if (wf.getStatus() == WorkflowJob.Status.KILLED || wf.getStatus() == WorkflowJob.Status.FAILED
|| wf.getEndTime().getTime() > slaCalc.getExpectedEnd().getTime()) {
isEndMiss = true;
}
}
slaCalc.setActualStart(wf.getStartTime());
slaCalc.setActualEnd(wf.getEndTime());
slaCalc.setJobStatus(wf.getStatusStr());
break;
case WORKFLOW_ACTION:
WorkflowActionBean wa = jpaService.execute(new WorkflowActionGetForSLAJPAExecutor(slaCalc.getId()));
if (wa.getEndTime() != null) {
ended = true;
if (wa.isTerminalWithFailure()
|| wa.getEndTime().getTime() > slaCalc.getExpectedEnd().getTime()) {
isEndMiss = true;
}
}
slaCalc.setActualStart(wa.getStartTime());
slaCalc.setActualEnd(wa.getEndTime());
slaCalc.setJobStatus(wa.getStatusStr());
break;
case COORDINATOR_ACTION:
CoordinatorActionBean ca = jpaService.execute(new CoordActionGetForSLAJPAExecutor(slaCalc.getId()));
if (ca.isTerminalWithFailure()) {
isEndMiss = ended = true;
slaCalc.setActualStart(null);
slaCalc.setActualEnd(ca.getLastModifiedTime());
}
if (ca.getExternalId() != null) {
wf = jpaService.execute(new WorkflowJobGetForSLAJPAExecutor(ca.getExternalId()));
if (wf.getEndTime() != null) {
ended = true;
if (wf.getEndTime().getTime() > slaCalc.getExpectedEnd().getTime()) {
isEndMiss = true;
}