本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity.setExecutionId方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricActivityInstanceEntity.setExecutionId方法的具体用法?Java HistoricActivityInstanceEntity.setExecutionId怎么用?Java HistoricActivityInstanceEntity.setExecutionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity
的用法示例。
在下文中一共展示了HistoricActivityInstanceEntity.setExecutionId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recordExecutionReplacedBy
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void recordExecutionReplacedBy(ExecutionEntity execution, InterpretableExecution replacedBy) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
// Update the cached historic activity instances that are open
List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = getDbSqlSession().findInCache(HistoricActivityInstanceEntity.class);
for (HistoricActivityInstanceEntity cachedHistoricActivityInstance : cachedHistoricActivityInstances) {
if ((cachedHistoricActivityInstance.getEndTime() == null)
&& (execution.getId().equals(cachedHistoricActivityInstance.getExecutionId()))) {
cachedHistoricActivityInstance.setExecutionId(replacedBy.getId());
}
}
// Update the persisted historic activity instances that are open
List<HistoricActivityInstanceEntity> historicActivityInstances = (List) new HistoricActivityInstanceQueryImpl(Context.getCommandContext())
.executionId(execution.getId())
.unfinished()
.list();
for (HistoricActivityInstanceEntity historicActivityInstance : historicActivityInstances) {
historicActivityInstance.setExecutionId(replacedBy.getId());
}
}
}
示例2: notify
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
public void notify(DelegateExecution execution) {
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
ExecutionEntity executionEntity = (ExecutionEntity) execution;
String processDefinitionId = executionEntity.getProcessDefinitionId();
String processInstanceId = executionEntity.getProcessInstanceId();
String executionId = execution.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(executionEntity.getActivityId());
historicActivityInstance.setActivityName((String) executionEntity.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) executionEntity.getActivity().getProperty("type"));
historicActivityInstance.setStartTime(ClockUtil.getCurrentTime());
Context
.getCommandContext()
.getDbSqlSession()
.insert(historicActivityInstance);
}
示例3: recordActivityStart
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
/**
* Record the start of an activitiy, if activity history is enabled.
*/
public void recordActivityStart(ExecutionEntity executionEntity) {
if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
String processDefinitionId = executionEntity.getProcessDefinitionId();
String processInstanceId = executionEntity.getProcessInstanceId();
String executionId = executionEntity.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(executionEntity.getActivityId());
historicActivityInstance.setActivityName((String) executionEntity.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) executionEntity.getActivity().getProperty("type"));
historicActivityInstance.setStartTime(ClockUtil.getCurrentTime());
getDbSqlSession().insert(historicActivityInstance);
}
}
示例4: recordExecutionReplacedBy
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
/**
* Replaces any open historic activityInstances' execution-id's to the id of the replaced
* execution, if activity history is enabled.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void recordExecutionReplacedBy(ExecutionEntity execution, InterpretableExecution replacedBy) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
// Update the cached historic activity instances that are open
List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = getDbSqlSession().findInCache(HistoricActivityInstanceEntity.class);
for (HistoricActivityInstanceEntity cachedHistoricActivityInstance: cachedHistoricActivityInstances) {
if ( (cachedHistoricActivityInstance.getEndTime()==null)
&& (execution.getId().equals(cachedHistoricActivityInstance.getExecutionId()))
) {
cachedHistoricActivityInstance.setExecutionId(replacedBy.getId());
}
}
// Update the persisted historic activity instances that are open
List<HistoricActivityInstanceEntity> historicActivityInstances = (List) new HistoricActivityInstanceQueryImpl(Context.getCommandContext())
.executionId(execution.getId())
.unfinished()
.list();
for (HistoricActivityInstanceEntity historicActivityInstance: historicActivityInstances) {
historicActivityInstance.setExecutionId(replacedBy.getId());
}
}
}
示例5: recordActivityStart
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
@Override
public void recordActivityStart(ExecutionEntity executionEntity) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
if (executionEntity.getActivity() != null) {
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
String processDefinitionId = executionEntity.getProcessDefinitionId();
String processInstanceId = executionEntity.getProcessInstanceId();
String executionId = executionEntity.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(executionEntity.getActivityId());
historicActivityInstance.setActivityName((String) executionEntity.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) executionEntity.getActivity().getProperty("type"));
historicActivityInstance.setStartTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime());
// Inherit tenant id (if applicable)
if (executionEntity.getTenantId() != null) {
historicActivityInstance.setTenantId(executionEntity.getTenantId());
}
getDbSqlSession().insert(historicActivityInstance);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_ACTIVITY_INSTANCE_CREATED, historicActivityInstance));
}
}
}
}
示例6: recordProcessInstanceStart
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
/**
* Record a process-instance started and record start-event if activity history is enabled.
*/
public void recordProcessInstanceStart(ExecutionEntity processInstance) {
if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity(processInstance);
// Insert historic process-instance
getDbSqlSession().insert(historicProcessInstance);
// Also record the start-event manually, as there is no "start" activity history listener for this
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
String processDefinitionId = processInstance.getProcessDefinitionId();
String processInstanceId = processInstance.getProcessInstanceId();
String executionId = processInstance.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(processInstance.getActivityId());
historicActivityInstance.setActivityName((String) processInstance.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) processInstance.getActivity().getProperty("type"));
Date now = ClockUtil.getCurrentTime();
historicActivityInstance.setStartTime(now);
getDbSqlSession()
.insert(historicActivityInstance);
}
}
示例7: recordProcessInstanceStart
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
@Override
public void recordProcessInstanceStart(ExecutionEntity processInstance) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity(processInstance);
// Insert historic process-instance
getDbSqlSession().insert(historicProcessInstance);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_PROCESS_INSTANCE_CREATED, historicProcessInstance));
}
// Also record the start-event manually, as there is no "start" activity history listener for this
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
String processDefinitionId = processInstance.getProcessDefinitionId();
String processInstanceId = processInstance.getProcessInstanceId();
String executionId = processInstance.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(processInstance.getActivityId());
historicActivityInstance.setActivityName((String) processInstance.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) processInstance.getActivity().getProperty("type"));
Date now = Context.getProcessEngineConfiguration().getClock().getCurrentTime();
historicActivityInstance.setStartTime(now);
// Inherit tenant id (if applicable)
if (processInstance.getTenantId() != null) {
historicActivityInstance.setTenantId(processInstance.getTenantId());
}
getDbSqlSession().insert(historicActivityInstance);
// Fire event
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_ACTIVITY_INSTANCE_CREATED, historicActivityInstance));
}
}
}
示例8: recordSubProcessInstanceStart
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入方法依赖的package包/类
@Override
public void recordSubProcessInstanceStart(ExecutionEntity parentExecution, ExecutionEntity subProcessInstance) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity(subProcessInstance);
ActivityImpl initialActivity = subProcessInstance.getActivity();
// Fix for ACT-1728: startActivityId not initialized with subprocess-instance
if (historicProcessInstance.getStartActivityId() == null) {
historicProcessInstance.setStartActivityId(subProcessInstance.getProcessDefinition().getInitial().getId());
initialActivity = subProcessInstance.getProcessDefinition().getInitial();
}
getDbSqlSession().insert(historicProcessInstance);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_PROCESS_INSTANCE_CREATED, historicProcessInstance));
}
HistoricActivityInstanceEntity activityInstance = findActivityInstance(parentExecution);
if (activityInstance != null) {
activityInstance.setCalledProcessInstanceId(subProcessInstance.getProcessInstanceId());
}
// Fix for ACT-1728: start-event not recorded for subprocesses
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
// Also record the start-event manually, as there is no "start" activity history listener for this
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(subProcessInstance.getProcessDefinitionId());
historicActivityInstance.setProcessInstanceId(subProcessInstance.getProcessInstanceId());
historicActivityInstance.setExecutionId(subProcessInstance.getId());
historicActivityInstance.setActivityId(initialActivity.getId());
historicActivityInstance.setActivityName((String) initialActivity.getProperty("name"));
historicActivityInstance.setActivityType((String) initialActivity.getProperty("type"));
Date now = Context.getProcessEngineConfiguration().getClock().getCurrentTime();
historicActivityInstance.setStartTime(now);
getDbSqlSession().insert(historicActivityInstance);
// Fire event
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_ACTIVITY_INSTANCE_CREATED, historicActivityInstance));
}
}
}