public HistoryEvent createProcessInstanceEndEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = loadProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_END); determineEndState(executionEntity, evt); // set end activity id evt.setEndActivityId(executionEntity.getActivityId()); evt.setEndTime(ClockUtil.getCurrentTime()); if(evt.getStartTime() != null) { evt.setDurationInMillis(evt.getEndTime().getTime()-evt.getStartTime().getTime()); } if (isRootProcessInstance(evt) && isHistoryRemovalTimeStrategyEnd()) { Date removalTime = calculateRemovalTime(evt); if (removalTime != null) { addRemovalTimeToHistoricProcessInstances(evt.getRootProcessInstanceId(), removalTime); if (isDmnEnabled()) { addRemovalTimeToHistoricDecisions(evt.getRootProcessInstanceId(), removalTime); } } } // set delete reason (if applicable). if (executionEntity.getDeleteReason() != null) { evt.setDeleteReason(executionEntity.getDeleteReason()); } return evt; }
public HistoryEvent createProcessInstanceEndEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = loadProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_END); determineEndState(executionEntity, evt); // set end activity id evt.setEndActivityId(executionEntity.getActivityId()); evt.setEndTime(ClockUtil.getCurrentTime()); if(evt.getStartTime() != null) { evt.setDurationInMillis(evt.getEndTime().getTime()-evt.getStartTime().getTime()); } if (isRootProcessInstance(evt) && isHistoryRemovalTimeStrategyEnd()) { Date removalTime = calculateRemovalTime(evt); if (removalTime != null) { addRemovalTimeToHistoricProcessInstances(evt.getRootProcessInstanceId(), removalTime); if (isDmnEnabled()) { addRemovalTimeToHistoricDecisions(evt.getRootProcessInstanceId(), removalTime); } } } // set delete reason (if applicable). if (executionEntity.getDeleteReason() != null) { evt.setDeleteReason(executionEntity.getDeleteReason()); } return evt; }
public HistoryEvent createProcessInstanceEndEvt(DelegateExecution execution) { final ExecutionEntity executionEntity = (ExecutionEntity) execution; // create event instance HistoricProcessInstanceEventEntity evt = loadProcessInstanceEventEntity(executionEntity); // initialize event initProcessInstanceEvent(evt, executionEntity, HistoryEventTypes.PROCESS_INSTANCE_END); determineEndState(executionEntity, evt); // set end activity id evt.setEndActivityId(executionEntity.getActivityId()); evt.setEndTime(ClockUtil.getCurrentTime()); if(evt.getStartTime() != null) { evt.setDurationInMillis(evt.getEndTime().getTime()-evt.getStartTime().getTime()); } if (isRootProcessInstance(evt) && isHistoryRemovalTimeStrategyEnd()) { Date removalTime = calculateRemovalTime(evt); if (removalTime != null) { addRemovalTimeToHistoricProcessInstances(evt.getRootProcessInstanceId(), removalTime); if (isDmnEnabled()) { addRemovalTimeToHistoricDecisions(evt.getRootProcessInstanceId(), removalTime); } } } // set delete reason (if applicable). if (executionEntity.getDeleteReason() != null) { evt.setDeleteReason(executionEntity.getDeleteReason()); } return evt; }