Java Code Examples for org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity#markEnded()

The following examples show how to use org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity#markEnded() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TerminateEndEventActivityBehavior.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected void endAllHistoricActivities(String processInstanceId, String deleteReason) {

    if (!Context.getProcessEngineConfiguration().getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
      return;
    }

    List<HistoricActivityInstanceEntity> historicActivityInstances = Context.getCommandContext().getHistoricActivityInstanceEntityManager()
      .findUnfinishedHistoricActivityInstancesByProcessInstanceId(processInstanceId);

    for (HistoricActivityInstanceEntity historicActivityInstance : historicActivityInstances) {
      historicActivityInstance.markEnded(deleteReason);

      // Fire event
      ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
      if (config != null && config.getEventDispatcher().isEnabled()) {
        config.getEventDispatcher().dispatchEvent(
            ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
      }
    }

  }
 
Example 2
Source File: DefaultHistoryManager.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
@Override
public void recordActivityEnd(ExecutionEntity executionEntity, String deleteReason) {
  if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
    HistoricActivityInstanceEntity historicActivityInstance = findActivityInstance(executionEntity, false, true);
    if (historicActivityInstance != null) {
      historicActivityInstance.markEnded(deleteReason);
      
      // Fire event
      ActivitiEventDispatcher activitiEventDispatcher = getEventDispatcher();
      if (activitiEventDispatcher != null && activitiEventDispatcher.isEnabled()) {
        activitiEventDispatcher.dispatchEvent(
            ActivitiEventBuilder.createEntityEvent(ActivitiEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
      }
    }
  }
}
 
Example 3
Source File: DefaultHistoryManager.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void endHistoricActivityInstance(HistoricActivityInstanceEntity historicActivityInstance) {
    historicActivityInstance.markEnded(null);

    // Fire event
    ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
    if (config != null && config.getEventDispatcher().isEnabled()) {
        config.getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_ACTIVITY_INSTANCE_ENDED, historicActivityInstance));
    }
}