本文整理汇总了Java中org.activiti.engine.impl.pvm.delegate.ActivityExecution.isConcurrent方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityExecution.isConcurrent方法的具体用法?Java ActivityExecution.isConcurrent怎么用?Java ActivityExecution.isConcurrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.pvm.delegate.ActivityExecution
的用法示例。
在下文中一共展示了ActivityExecution.isConcurrent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findScopeExecution
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
/**
* Find the next scope execution in the parent execution hierarchy That method works different than
* {@link #findScopeExecutionForScope(org.activiti.engine.impl.persistence.entity.ExecutionEntity, org.activiti.engine.impl.pvm.PvmScope)} which returns the most outer scope execution.
*
* @param execution
* the execution from which to start the search
* @return the next scope execution in the parent execution hierarchy
*/
public static ActivityExecution findScopeExecution(ActivityExecution execution) {
while (execution.getParentId() != null && !execution.isScope()) {
execution = execution.getParent();
}
if (execution != null && execution.isConcurrent()) {
execution = execution.getParent();
}
return execution;
}
示例2: activeConcurrentExecutionsExist
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
public boolean activeConcurrentExecutionsExist(ActivityExecution execution) {
PvmActivity activity = execution.getActivity();
if (execution.isConcurrent()) {
for (ActivityExecution concurrentExecution : getLeaveExecutions(execution.getParent())) {
if (concurrentExecution.isActive() && !concurrentExecution.getId().equals(execution.getId())) {
// TODO: when is transitionBeingTaken cleared? Should we clear it?
boolean reachable = false;
PvmTransition pvmTransition = ((ExecutionEntity) concurrentExecution).getTransitionBeingTaken();
if (pvmTransition != null) {
reachable = isReachable(pvmTransition.getDestination(), activity, new HashSet<PvmActivity>());
} else {
reachable = isReachable(concurrentExecution.getActivity(), activity, new HashSet<PvmActivity>());
}
if (reachable) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("an active concurrent execution found: '{}'", concurrentExecution.getActivity());
}
return true;
}
}
}
} else if (execution.isActive()) { // is this ever true?
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("an active concurrent execution found: '{}'", execution.getActivity());
}
return true;
}
return false;
}
示例3: lockConcurrentRoot
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
protected void lockConcurrentRoot(ActivityExecution execution) {
ActivityExecution concurrentRoot = null;
if (execution.isConcurrent()) {
concurrentRoot = execution.getParent();
} else {
concurrentRoot = execution;
}
((ExecutionEntity) concurrentRoot).forceUpdate();
}
示例4: reject
import org.activiti.engine.impl.pvm.delegate.ActivityExecution; //导入方法依赖的package包/类
@Override
public void reject(String taskId) {
// 先判定是否存在历史环节
String oldTaskId = selectVariableLocalByTaskId(taskId, "oldTaskId").toString();
HistoricTaskInstance taskInstance = historyService.createHistoricTaskInstanceQuery().taskId(oldTaskId).singleResult();
if (taskInstance == null) {
throw new NotFoundException("历史任务环节不存在,taskId:" + oldTaskId);
}
Task task = selectTaskByTaskId(taskId);
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(task.getProcessInstanceId()).singleResult();
if (processInstance == null) {
throw new NotFoundException("流程已经结束");
}
Map<String, Object> variables = processInstance.getProcessVariables();
ProcessDefinitionEntity definition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(task.getProcessDefinitionId());
if (definition == null) {
throw new NotFoundException("流程定义未找到");
}
ActivityExecution execution = (ActivityExecution) runtimeService.createExecutionQuery()
.executionId(task.getExecutionId()).singleResult();
// 是否并行节点
if (execution.isConcurrent()) {
throw new NotFoundException("并行节点不允许驳回,taskId:" + task.getId());
}
// 是否存在定时任务
long num = managementService.createJobQuery().executionId(task.getExecutionId()).count();
if (num > 0) {
throw new NotFoundException("当前环节不允许驳回");
}
// 驳回
// 取得上一步活动
ActivityImpl currActivity = definition.findActivity(task.getTaskDefinitionKey());
List<PvmTransition> nextTransitionList = currActivity.getIncomingTransitions();
// 清除当前活动的出口
List<PvmTransition> oriPvmTransitionList = new ArrayList<>();
List<PvmTransition> pvmTransitionList = currActivity.getOutgoingTransitions();
oriPvmTransitionList.addAll(pvmTransitionList);
pvmTransitionList.clear();
// 建立新出口
List<TransitionImpl> newTransitions = new ArrayList<>();
for (PvmTransition nextTransition : nextTransitionList) {
PvmActivity nextActivity = nextTransition.getSource();
ActivityImpl nextActivityImpl = definition.findActivity(nextActivity.getId());
TransitionImpl newTransition = currActivity.createOutgoingTransition();
newTransition.setDestination(nextActivityImpl);
newTransitions.add(newTransition);
}
// 完成任务
List<Task> tasks = taskService.createTaskQuery()
.processInstanceId(processInstance.getId())
.taskDefinitionKey(task.getTaskDefinitionKey()).list();
for (Task t : tasks) {
taskService.complete(t.getId(), variables);
historyService.deleteHistoricTaskInstance(t.getId());
}
// 恢复方向
for (TransitionImpl transitionImpl : newTransitions) {
currActivity.getOutgoingTransitions().remove(transitionImpl);
}
pvmTransitionList.addAll(oriPvmTransitionList);
}