本文整理汇总了Java中org.activiti.engine.impl.pvm.PvmTransition类的典型用法代码示例。如果您正苦于以下问题:Java PvmTransition类的具体用法?Java PvmTransition怎么用?Java PvmTransition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PvmTransition类属于org.activiti.engine.impl.pvm包,在下文中一共展示了PvmTransition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: take
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
/**
* @param fireActivityCompletionEvent This method can be called from other places (like {@link #takeAll(List, List)}), where the event is already fired. In that case, false is passed an no second event is fired.
*/
@Override
public void take(PvmTransition transition, boolean fireActivityCompletionEvent) {
if (fireActivityCompletionEvent) {
fireActivityCompletedEvent();
}
if (this.transition != null) {
throw new PvmException("already taking a transition");
}
if (transition == null) {
throw new PvmException("transition is null");
}
setActivity((ActivityImpl) transition.getSource());
setTransition((TransitionImpl) transition);
performOperation(AtomicOperation.TRANSITION_NOTIFY_LISTENER_END);
}
示例2: turnTransition
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
public void turnTransition(String taskId, String activityId,
Map<String, Object> variables) throws Exception {
// 当前节点
ActivityImpl currActivity = findActivitiImpl(taskId, null);
// 清空当前流向
List<PvmTransition> oriPvmTransitionList = clearTransition(currActivity);
// 创建新流向
TransitionImpl newTransition = currActivity.createOutgoingTransition();
// 目标节点
ActivityImpl pointActivity = findActivitiImpl(taskId, activityId);
// 设置新流向的目标节点
newTransition.setDestination(pointActivity);
// 执行转向任务
taskService.complete(taskId, variables);
// 删除目标节点新流入
pointActivity.getIncomingTransitions().remove(newTransition);
// 还原以前流向
restoreTransition(currActivity, oriPvmTransitionList);
}
示例3: getNextActivityImpl
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
@Override
public Map<PvmTransition, ActivityImpl> getNextActivityImpl(String bizKey) {
ProcessInstance pi = getProcessInstancsByBizKey(bizKey);
// 获取该全部的流程活动实例
List<Execution> excutionList = runtimeService.createExecutionQuery()
.processInstanceId(pi.getId()).list();
Map<String, String> map = new HashMap<String, String>();
for (Execution execution : excutionList) {
if (execution.getActivityId() != null)
map.put(execution.getActivityId(), execution.getActivityId());
}
List<String> excutionActivitId = new ArrayList<String>(map.values());
ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((org.activiti.engine.impl.RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(pi.getProcessDefinitionId());
List<ActivityImpl> activitiList = def.getActivities();
// 遍历所有节点找到当前节点的下一个节点
for (ActivityImpl activityDef : activitiList) {
for (String ActivitId : excutionActivitId) {
if (ActivitId.equals(activityDef.getId())) {
return nextActivityImpl(activityDef);
}
}
}
return null;
}
示例4: findFirstActivity
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
/**
* 获得第一个节点.
*/
public PvmActivity findFirstActivity(String processDefinitionId) {
ProcessDefinitionEntity processDefinitionEntity = Context
.getProcessEngineConfiguration().getProcessDefinitionCache()
.get(processDefinitionId);
ActivityImpl startActivity = processDefinitionEntity.getInitial();
if (startActivity.getOutgoingTransitions().size() != 1) {
throw new IllegalStateException(
"start activity outgoing transitions cannot more than 1, now is : "
+ startActivity.getOutgoingTransitions().size());
}
PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
.get(0);
PvmActivity targetActivity = pvmTransition.getDestination();
if (!"userTask".equals(targetActivity.getProperty("type"))) {
logger.debug("first activity is not userTask, just skip");
return null;
}
return targetActivity;
}
示例5: getHighlightedFlows
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
private void getHighlightedFlows(List<ActivityImpl> activityList) {
for (ActivityImpl activity : activityList) {
if (activity.getProperty("type").equals("subProcess")) {
// get flows for the subProcess
getHighlightedFlows(activity.getActivities());
}
if (historicActivityInstanceList.contains(activity.getId())) {
List<PvmTransition> pvmTransitionList = activity
.getOutgoingTransitions();
for (PvmTransition pvmTransition : pvmTransitionList) {
String destinationFlowId = pvmTransition.getDestination()
.getId();
if (historicActivityInstanceList
.contains(destinationFlowId)) {
highLightedFlows.add(pvmTransition.getId());
}
}
}
}
}
示例6: getPreviousActivities
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
public List<PvmActivity> getPreviousActivities(PvmActivity pvmActivity) {
List<PvmActivity> pvmActivities = new ArrayList<PvmActivity>();
for (PvmTransition pvmTransition : pvmActivity.getIncomingTransitions()) {
PvmActivity targetActivity = pvmTransition.getDestination();
if ("userTask".equals(targetActivity.getProperty("type"))) {
pvmActivities.add(targetActivity);
} else {
pvmActivities
.addAll(this.getPreviousActivities(targetActivity));
}
}
return pvmActivities;
}
示例7: getNextActivities
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
@Override
public List<TaskDefinition> getNextActivities(String procDefId, String activityId) {
ActivityImpl activity;
if (activityId != null) {
activity = getActivityById(procDefId, activityId);
} else {
activity = getStartEvent(procDefId);
}
List<PvmTransition> pvmTransitions = activity.getOutgoingTransitions();
return pvmTransitions.stream()
.map(PvmTransition::getDestination)
.map(ActivityImpl.class::cast) //强转为ActivityImpl
.filter(Objects::nonNull)
.map(act -> getTaskDefinition(act, "")) //获取TaskDefinition集合
.flatMap(Collection::stream) //合并集合
.collect(Collectors.toList());
// List<TaskDefinition> taskDefinitions = new ArrayList<>();
// for (PvmTransition pvmTransition : pvmTransitions) {
// PvmActivity pvmActivity = pvmTransition.getDestination();
// taskDefinitions.addAll(getTaskDefinition((ActivityImpl) pvmActivity, ""));
// }
// return taskDefinitions;
}
示例8: getNextEvent
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
@Override
public List<ActivityImpl> getNextEvent(ActivityImpl activity) {
return activity.getOutgoingTransitions()
.stream()
.map(PvmTransition::getDestination)
.map(ActivityImpl.class::cast)
.collect(Collectors.toList());
// List<ActivityImpl> activities = new ArrayList<>();
// List<PvmTransition> pvmTransitions = activity.getOutgoingTransitions();
// for (PvmTransition pvmTransition : pvmTransitions) {
// activities.add((ActivityImpl) pvmTransition.getDestination());
// }
// return activities;
}
示例9: execute
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
PvmActivity activity = activityExecution.getActivity();
List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions();
execution.inactivate();
List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);
int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size();
int nbrOfExecutionsJoined = joinedExecutions.size();
if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {
LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
activityExecution.takeAll(outgoingTransitions, joinedExecutions);
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
}
}
示例10: lastExecutionEnded
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void lastExecutionEnded(ActivityExecution execution) {
ActivityExecution outgoingExecution = execution.getParent().createExecution();
outgoingExecution.setConcurrent(false);
((InterpretableExecution) outgoingExecution).setActivity((ActivityImpl) execution.getActivity());
// eventscope execution
execution.setConcurrent(false);
execution.setActive(false);
((InterpretableExecution) execution).setEventScope(true);
List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
if (outgoingTransitions.isEmpty()) {
outgoingExecution.end();
} else {
outgoingExecution.takeAll(outgoingTransitions, Collections.EMPTY_LIST);
}
}
示例11: execute
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
PvmTransition more = activityExecution.getActivity().findOutgoingTransition("more");
PvmTransition done = activityExecution.getActivity().findOutgoingTransition("done");
Integer value = (Integer) execution.getVariable(variableName);
if (value == null) {
execution.setVariable(variableName, from);
activityExecution.take(more);
} else {
value = value + 1;
if (value < to) {
execution.setVariable(variableName, value);
activityExecution.take(more);
} else {
activityExecution.take(done);
}
}
}
示例12: testParseNamespaceInConditionExpressionType
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
@Deployment
public void testParseNamespaceInConditionExpressionType() {
ProcessDefinition processDefinition = processEngineConfiguration.getFlowable5CompatibilityHandler().getProcessDefinitionByKey("resolvableNamespacesProcess");
ProcessDefinitionEntity rawEntity = (ProcessDefinitionEntity) processDefinition;
// Test that the process definition has been deployed
assertNotNull(rawEntity);
ActivityImpl activity = rawEntity.findActivity("ExclusiveGateway_1");
assertNotNull(activity);
// Test that the conditions has been resolved
for (PvmTransition transition : activity.getOutgoingTransitions()) {
if (transition.getDestination().getId().equals("Task_2")) {
assertEquals("#{approved}", transition.getProperty("conditionText"));
} else if (transition.getDestination().getId().equals("Task_3")) {
assertEquals("#{!approved}", transition.getProperty("conditionText"));
} else {
fail("Something went wrong");
}
}
}
示例13: execute
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
ActivityExecution activityExecution = (ActivityExecution) execution;
// Join
PvmActivity activity = activityExecution.getActivity();
List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions();
execution.inactivate();
lockConcurrentRoot(activityExecution);
List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);
int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size();
int nbrOfExecutionsJoined = joinedExecutions.size();
Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution);
if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {
// Fork
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
}
activityExecution.takeAll(outgoingTransitions, joinedExecutions);
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
}
}
示例14: findNextUserTask
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
/**
* 递归查找下一个用户任务
*
* @param tranistion
* @return
*/
public List<PvmActivity> findNextUserTask(PvmTransition tranistion) {
List<PvmActivity> activities = new ArrayList<>();
PvmActivity nextActivity = tranistion.getDestination();
if (nextActivity == null)
return activities;
else if ("userTask".equals(nextActivity.getProperty("type"))) {
activities.add(nextActivity);
return activities;
} else {
List<PvmTransition> transitions = nextActivity.getOutgoingTransitions();
for (PvmTransition transition1 : transitions) {
activities.addAll(findNextUserTask(transition1));
}
return activities;
}
}
示例15: execute
import org.activiti.engine.impl.pvm.PvmTransition; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception {
// Join
PvmActivity activity = execution.getActivity();
List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
execution.inactivate();
lockConcurrentRoot(execution);
List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size();
int nbrOfExecutionsJoined = joinedExecutions.size();
if (nbrOfExecutionsJoined==nbrOfExecutionsToJoin) {
// Fork
log.fine("parallel gateway '"+activity.getId()+"' activates: "+nbrOfExecutionsJoined+" of "+nbrOfExecutionsToJoin+" joined");
execution.takeAll(outgoingTransitions, joinedExecutions);
} else if (log.isLoggable(Level.FINE)){
log.fine("parallel gateway '"+activity.getId()+"' does not activate: "+nbrOfExecutionsJoined+" of "+nbrOfExecutionsToJoin+" joined");
}
}