本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity类的典型用法代码示例。如果您正苦于以下问题:Java HistoricActivityInstanceEntity类的具体用法?Java HistoricActivityInstanceEntity怎么用?Java HistoricActivityInstanceEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HistoricActivityInstanceEntity类属于org.activiti.engine.impl.persistence.entity包,在下文中一共展示了HistoricActivityInstanceEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHistoricActivityInstanceEntity
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
/**
* 查询历史节点.
*/
public HistoricActivityInstanceEntity getHistoricActivityInstanceEntity(
String historyTaskId) {
logger.info("historyTaskId : {}", historyTaskId);
JdbcTemplate jdbcTemplate = ApplicationContextHelper
.getBean(JdbcTemplate.class);
String historicActivityInstanceId = jdbcTemplate.queryForObject(
"SELECT ID_ FROM ACT_HI_ACTINST WHERE TASK_ID_=?",
String.class, historyTaskId);
logger.info("historicActivityInstanceId : {}",
historicActivityInstanceId);
HistoricActivityInstanceQueryImpl historicActivityInstanceQueryImpl = new HistoricActivityInstanceQueryImpl();
historicActivityInstanceQueryImpl
.activityInstanceId(historicActivityInstanceId);
HistoricActivityInstanceEntity historicActivityInstanceEntity = (HistoricActivityInstanceEntity) Context
.getCommandContext()
.getHistoricActivityInstanceEntityManager()
.findHistoricActivityInstancesByQueryCriteria(
historicActivityInstanceQueryImpl, new Page(0, 1))
.get(0);
return historicActivityInstanceEntity;
}
示例2: getHistoricActivityInstanceEntity
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
public HistoricActivityInstanceEntity getHistoricActivityInstanceEntity(
String historyTaskId) {
logger.info("historyTaskId : {}", historyTaskId);
JdbcTemplate jdbcTemplate = ApplicationContextHelper
.getBean(JdbcTemplate.class);
String historicActivityInstanceId = jdbcTemplate.queryForObject(
"select id_ from ACT_HI_ACTINST where task_id_=?",
String.class, historyTaskId);
logger.info("historicActivityInstanceId : {}",
historicActivityInstanceId);
HistoricActivityInstanceQueryImpl historicActivityInstanceQueryImpl = new HistoricActivityInstanceQueryImpl();
historicActivityInstanceQueryImpl
.activityInstanceId(historicActivityInstanceId);
HistoricActivityInstanceEntity historicActivityInstanceEntity = (HistoricActivityInstanceEntity) Context
.getCommandContext()
.getHistoricActivityInstanceEntityManager()
.findHistoricActivityInstancesByQueryCriteria(
historicActivityInstanceQueryImpl, new Page(0, 1))
.get(0);
return historicActivityInstanceEntity;
}
示例3: findTargetHistoricActivity
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
/**
* 找到想要回退对应的节点历史.
*/
public HistoricActivityInstanceEntity findTargetHistoricActivity(
CommandContext commandContext, TaskEntity taskEntity,
ActivityImpl activityImpl) {
HistoricActivityInstanceQueryImpl historicActivityInstanceQueryImpl = new HistoricActivityInstanceQueryImpl();
historicActivityInstanceQueryImpl.activityId(activityImpl.getId());
historicActivityInstanceQueryImpl.processInstanceId(taskEntity
.getProcessInstanceId());
historicActivityInstanceQueryImpl
.orderByHistoricActivityInstanceEndTime().desc();
HistoricActivityInstanceEntity historicActivityInstanceEntity = (HistoricActivityInstanceEntity) commandContext
.getHistoricActivityInstanceEntityManager()
.findHistoricActivityInstancesByQueryCriteria(
historicActivityInstanceQueryImpl, new Page(0, 1))
.get(0);
return historicActivityInstanceEntity;
}
示例4: 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());
}
}
}
示例5: notify
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
String executionId = execution.getId();
String activityId = ((ExecutionEntity)execution).getActivityId();
CommandContext commandContext = Context.getCommandContext();
// search for the historic activity instance in the dbsqlsession cache
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = dbSqlSession.findInCache(HistoricActivityInstanceEntity.class);
for (HistoricActivityInstanceEntity cachedHistoricActivityInstance: cachedHistoricActivityInstances) {
if ( executionId.equals(cachedHistoricActivityInstance.getExecutionId())
&& (activityId.equals(cachedHistoricActivityInstance.getActivityId()))
&& (cachedHistoricActivityInstance.getEndTime()==null)
) {
cachedHistoricActivityInstance.markEnded(null);
return;
}
}
}
示例6: 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);
}
示例7: notify
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
public void notify(DelegateExecution execution) throws Exception {
String executionId = execution.getId();
String activityId = ((ExecutionEntity)execution).getActivityId();
// interrupted executions might not have an activityId set.
if(activityId == null) {
return;
}
CommandContext commandContext = Context.getCommandContext();
// search for the historic activity instance in the dbsqlsession cache
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = dbSqlSession.findInCache(HistoricActivityInstanceEntity.class);
for (HistoricActivityInstanceEntity cachedHistoricActivityInstance: cachedHistoricActivityInstances) {
if ( executionId.equals(cachedHistoricActivityInstance.getExecutionId())
&& (activityId.equals(cachedHistoricActivityInstance.getActivityId()))
&& (cachedHistoricActivityInstance.getEndTime()==null)
) {
cachedHistoricActivityInstance.markEnded(null);
return;
}
}
}
示例8: 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);
}
}
示例9: recordStartEventEnded
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
/**
* Record the end of a start-task, if activity history is enabled.
*/
public void recordStartEventEnded(String executionId, String activityId) {
if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
// Interrupted executions might not have an activityId set, skip recording history.
if(activityId == null) {
return;
}
// Search for the historic activity instance in the dbsqlsession cache, since process hasn't been persisted to db yet
List<HistoricActivityInstanceEntity> cachedHistoricActivityInstances = getDbSqlSession().findInCache(HistoricActivityInstanceEntity.class);
for (HistoricActivityInstanceEntity cachedHistoricActivityInstance: cachedHistoricActivityInstances) {
if ( executionId.equals(cachedHistoricActivityInstance.getExecutionId())
&& (activityId.equals(cachedHistoricActivityInstance.getActivityId()))
&& (cachedHistoricActivityInstance.getEndTime()==null)
) {
cachedHistoricActivityInstance.markEnded(null);
return;
}
}
}
}
示例10: 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());
}
}
}
示例11: getActivity
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
/**
* 获得历史节点对应的节点信息.
*/
public ActivityImpl getActivity(
HistoricActivityInstanceEntity historicActivityInstanceEntity) {
ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd(
historicActivityInstanceEntity.getProcessDefinitionId())
.execute(Context.getCommandContext());
return processDefinitionEntity
.findActivity(historicActivityInstanceEntity.getActivityId());
}
示例12: execute
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
/**
* 撤销流程.
*
* @return 0-撤销成功 1-流程结束 2-下一结点已经通过,不能撤销
*/
public Integer execute(CommandContext commandContext) {
// 获得历史任务
HistoricTaskInstanceEntity historicTaskInstanceEntity = Context
.getCommandContext().getHistoricTaskInstanceEntityManager()
.findHistoricTaskInstanceById(historyTaskId);
// 获得历史节点
HistoricActivityInstanceEntity historicActivityInstanceEntity = getHistoricActivityInstanceEntity(historyTaskId);
Graph graph = new ActivitiHistoryGraphBuilder(
historicTaskInstanceEntity.getProcessInstanceId()).build();
Node node = graph.findById(historicActivityInstanceEntity.getId());
if (!checkCouldWithdraw(node)) {
logger.info("cannot withdraw {}", historyTaskId);
return 2;
}
// 删除所有活动中的task
this.deleteActiveTasks(historicTaskInstanceEntity
.getProcessInstanceId());
// 获得期望撤销的节点后面的所有节点历史
List<String> historyNodeIds = new ArrayList<String>();
this.collectNodes(node, historyNodeIds);
this.deleteHistoryActivities(historyNodeIds);
// 恢复期望撤销的任务和历史
this.processHistoryTask(historicTaskInstanceEntity,
historicActivityInstanceEntity);
logger.info("activiti is withdraw {}",
historicTaskInstanceEntity.getName());
return 0;
}
示例13: getActivity
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
public ActivityImpl getActivity(
HistoricActivityInstanceEntity historicActivityInstanceEntity) {
ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd(
historicActivityInstanceEntity.getProcessDefinitionId())
.execute(Context.getCommandContext());
return processDefinitionEntity
.findActivity(historicActivityInstanceEntity.getActivityId());
}
示例14: validateTargetActivity
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntity; //导入依赖的package包/类
/**
* 校验目标节点是否可以回退.
*/
public boolean validateTargetActivity(String targetActivityId) {
JdbcTemplate jdbcTemplate = ApplicationContextHelper
.getBean(JdbcTemplate.class);
String historyTaskId = jdbcTemplate
.queryForObject(
"select id_ from ACT_HI_TASKINST where act_id_=? order by END_TIME_ desc",
String.class, targetActivityId);
// 先找到历史任务
HistoricTaskInstanceEntity historicTaskInstanceEntity = Context
.getCommandContext().getHistoricTaskInstanceEntityManager()
.findHistoricTaskInstanceById(historyTaskId);
// 再反向查找历史任务对应的历史节点
HistoricActivityInstanceEntity historicActivityInstanceEntity = getHistoricActivityInstanceEntity(historyTaskId);
logger.info("historic activity instance is : {}",
historicActivityInstanceEntity.getId());
Graph graph = new ActivitiHistoryGraphBuilder(
historicTaskInstanceEntity.getProcessInstanceId()).build();
Node node = graph.findById(historicActivityInstanceEntity.getId());
if (!this.checkCouldRollback(node)) {
logger.info("cannot rollback {}", taskId);
return false;
}
return true;
}
示例15: 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));
}
}
}
}