public Date calculateRemovalTime(HistoricProcessInstanceEventEntity historicRootProcessInstance, ProcessDefinition processDefinition) { Integer historyTimeToLive = processDefinition.getHistoryTimeToLive(); if (historyTimeToLive != null) { if (isProcessInstanceRunning(historicRootProcessInstance)) { Date startTime = historicRootProcessInstance.getStartTime(); return determineRemovalTime(startTime, historyTimeToLive); } else if (isProcessInstanceEnded(historicRootProcessInstance)) { Date endTime = historicRootProcessInstance.getEndTime(); return determineRemovalTime(endTime, historyTimeToLive); } } return null; }
public Date calculateRemovalTime(HistoricProcessInstanceEventEntity historicRootProcessInstance, ProcessDefinition processDefinition) { Integer historyTimeToLive = processDefinition.getHistoryTimeToLive(); if (historyTimeToLive != null) { if (isProcessInstanceRunning(historicRootProcessInstance)) { Date startTime = historicRootProcessInstance.getStartTime(); return determineRemovalTime(startTime, historyTimeToLive); } else if (isProcessInstanceEnded(historicRootProcessInstance)) { Date endTime = historicRootProcessInstance.getEndTime(); return determineRemovalTime(endTime, historyTimeToLive); } } return null; }
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 Date calculateRemovalTime(HistoricProcessInstanceEventEntity historicRootProcessInstance, ProcessDefinition processDefinition) { Integer historyTimeToLive = processDefinition.getHistoryTimeToLive(); if (historyTimeToLive != null) { if (isProcessInstanceRunning(historicRootProcessInstance)) { Date startTime = historicRootProcessInstance.getStartTime(); return determineRemovalTime(startTime, historyTimeToLive); } else if (isProcessInstanceEnded(historicRootProcessInstance)) { Date endTime = historicRootProcessInstance.getEndTime(); return determineRemovalTime(endTime, historyTimeToLive); } } return null; }
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; }