本文整理汇总了Java中org.activiti.engine.impl.pvm.process.TransitionImpl.setDestination方法的典型用法代码示例。如果您正苦于以下问题:Java TransitionImpl.setDestination方法的具体用法?Java TransitionImpl.setDestination怎么用?Java TransitionImpl.setDestination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.pvm.process.TransitionImpl
的用法示例。
在下文中一共展示了TransitionImpl.setDestination方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: turnTransition
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的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);
}
示例2: executeParse
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
@Override
protected void executeParse(BpmnParse bpmnParse, SequenceFlow sequenceFlow) {
ScopeImpl scope = bpmnParse.getCurrentScope();
ActivityImpl sourceActivity = scope.findActivity(sequenceFlow.getSourceRef());
ActivityImpl destinationActivity = scope.findActivity(sequenceFlow.getTargetRef());
Expression skipExpression;
if (StringUtils.isNotEmpty(sequenceFlow.getSkipExpression())) {
ExpressionManager expressionManager = bpmnParse.getExpressionManager();
skipExpression = expressionManager.createExpression(sequenceFlow.getSkipExpression());
} else {
skipExpression = null;
}
TransitionImpl transition = sourceActivity.createOutgoingTransition(sequenceFlow.getId(), skipExpression);
bpmnParse.getSequenceFlows().put(sequenceFlow.getId(), transition);
transition.setProperty("name", sequenceFlow.getName());
transition.setProperty("documentation", sequenceFlow.getDocumentation());
transition.setDestination(destinationActivity);
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
Condition expressionCondition = new UelExpressionCondition(sequenceFlow.getConditionExpression());
transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression());
transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition);
}
createExecutionListenersOnTransition(bpmnParse, sequenceFlow.getExecutionListeners(), transition);
}
示例3: turnTransition
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
/**
* 流程转向操作
*
* @param taskId
* 当前任务ID
* @param activityId
* 目标节点任务ID
* @param variables
* 流程变量
* @throws Exception
*/
private static 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);
}
示例4: turnTransition
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
/**
* 流程转向操作
* @param taskId 当前任务ID
* @param activityId 目标节点任务ID
* @param variables 流程变量
* @throws Exception
*/
private 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);
}
示例5: buildProcessDefinition
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
public PvmProcessDefinition buildProcessDefinition() {
for (Object[] unresolvedTransition : unresolvedTransitions) {
TransitionImpl transition = (TransitionImpl) unresolvedTransition[0];
String destinationActivityName = (String) unresolvedTransition[1];
ActivityImpl destination = processDefinition.findActivity(destinationActivityName);
if (destination == null) {
throw new ActivitiException("destination '" + destinationActivityName + "' not found. (referenced from transition in '" + transition.getSource().getId() + "')");
}
transition.setDestination(destination);
}
return processDefinition;
}
示例6: buildProcessDefinition
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
public PvmProcessDefinition buildProcessDefinition() {
for (Object[] unresolvedTransition: unresolvedTransitions) {
TransitionImpl transition = (TransitionImpl) unresolvedTransition[0];
String destinationActivityName = (String) unresolvedTransition[1];
ActivityImpl destination = processDefinition.findActivity(destinationActivityName);
if (destination == null) {
throw new RuntimeException("destination '"+destinationActivityName+"' not found. (referenced from transition in '"+transition.getSource().getId()+"')");
}
transition.setDestination(destination);
}
return processDefinition;
}
示例7: parseSequenceFlow
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
/**
* Parses all sequence flow of a scope.
*
* @param processElement
* The 'process' element wherein the sequence flow are defined.
* @param scope
* The scope to which the sequence flow must be added.
*/
public void parseSequenceFlow(Element processElement, ScopeImpl scope) {
for (Element sequenceFlowElement : processElement.elements("sequenceFlow")) {
String id = sequenceFlowElement.attribute("id");
String sourceRef = sequenceFlowElement.attribute("sourceRef");
String destinationRef = sequenceFlowElement.attribute("targetRef");
// Implicit check: sequence flow cannot cross (sub) process boundaries: we
// don't do a processDefinition.findActivity here
ActivityImpl sourceActivity = scope.findActivity(sourceRef);
ActivityImpl destinationActivity = scope.findActivity(destinationRef);
if (sourceActivity != null && destinationActivity != null) {
TransitionImpl transition = sourceActivity.createOutgoingTransition(id);
sequenceFlows.put(id, transition);
transition.setProperty("name", sequenceFlowElement.attribute("name"));
transition.setProperty("documentation", parseDocumentation(sequenceFlowElement));
transition.setDestination(destinationActivity);
parseSequenceFlowConditionExpression(sequenceFlowElement, transition);
parseExecutionListenersOnTransition(sequenceFlowElement, transition);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseSequenceFlow(sequenceFlowElement, scope, transition);
}
} else if (sourceActivity == null) {
addError("Invalid source '" + sourceRef + "' of sequence flow '" + id + "'", sequenceFlowElement);
} else if (destinationActivity == null) {
addError("Invalid destination '" + destinationRef + "' of sequence flow '" + id + "'", sequenceFlowElement);
}
}
}
示例8: parseSequenceFlow
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
/**
* Parses all sequence flow of a scope.
*
* @param processElement
* The 'process' element wherein the sequence flow are defined.
* @param scope
* The scope to which the sequence flow must be added.
*/
public void parseSequenceFlow(Element processElement, ScopeImpl scope) {
for (Element sequenceFlowElement : processElement.elements("sequenceFlow")) {
String id = sequenceFlowElement.attribute("id");
String sourceRef = sequenceFlowElement.attribute("sourceRef");
String destinationRef = sequenceFlowElement.attribute("targetRef");
// Implicit check: sequence flow cannot cross (sub) process boundaries: we
// don't do a processDefinition.findActivity here
ActivityImpl sourceActivity = scope.findActivity(sourceRef);
ActivityImpl destinationActivity = scope.findActivity(destinationRef);
if (sourceActivity == null) {
addError("Invalid source '" + sourceRef + "' of sequence flow '" + id + "'", sequenceFlowElement);
} else if (destinationActivity == null) {
addError("Invalid destination '" + destinationRef + "' of sequence flow '" + id + "'", sequenceFlowElement);
} else if(sourceActivity.getActivityBehavior() instanceof EventBasedGatewayActivityBehavior) {
// ignore
} else if(destinationActivity.getActivityBehavior() instanceof IntermediateCatchEventActivitiBehaviour
&& (destinationActivity.getParentActivity() != null)
&& (destinationActivity.getParentActivity().getActivityBehavior() instanceof EventBasedGatewayActivityBehavior)) {
addError("Invalid incoming sequenceflow for intermediateCatchEvent with id '"+destinationActivity.getId()+"' connected to an event-based gateway.", sequenceFlowElement);
} else {
TransitionImpl transition = sourceActivity.createOutgoingTransition(id);
sequenceFlows.put(id, transition);
transition.setProperty("name", sequenceFlowElement.attribute("name"));
transition.setProperty("documentation", parseDocumentation(sequenceFlowElement));
transition.setDestination(destinationActivity);
parseSequenceFlowConditionExpression(sequenceFlowElement, transition);
parseExecutionListenersOnTransition(sequenceFlowElement, transition);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseSequenceFlow(sequenceFlowElement, scope, transition);
}
}
}
}
示例9: signal
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
@Override
public <T extends BaseBpDataEx> void signal(String taskId, String userId,
String targetTaskDefKey, T bpDataEx) {
TaskEx taskEx = bpmTaskService.getTask(taskId);
String pdId = taskEx.getTask().getProcessDefinitionId();
ActivityImpl sourceActivity = null;
ActivityImpl destActivity = null;
ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((org.activiti.engine.impl.RepositoryServiceImpl) repositoryService)
.getDeployedProcessDefinition(pdId);
List<ActivityImpl> activitiList = def.getActivities();
if (activitiList != null && !activitiList.isEmpty()) {
for (ActivityImpl activityImpl : activitiList) {
if (activityImpl.getId().equals(targetTaskDefKey)) {
destActivity = activityImpl;
}
if (activityImpl.getId().equals(
taskEx.getTask().getTaskDefinitionKey())) {
sourceActivity = activityImpl;
}
}
}
if (destActivity == null || sourceActivity == null) {
return;
}
// 清空当前节点的出线
List<PvmTransition> outTrans = bpmEngineService
.clearOutTransition(sourceActivity);
// 创建新流向出线
TransitionImpl newTrans = sourceActivity.createOutgoingTransition();
newTrans.setDestination(destActivity);
// 流转节点
complete(taskId, userId, bpDataEx);
// 恢复出线
bpmEngineService.restoreOutTransition(sourceActivity, outTrans);
}
示例10: executeParse
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, SequenceFlow sequenceFlow) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
ScopeImpl scope = bpmnParse.getCurrentScope();
// Implicit check: sequence flow cannot cross (sub) process boundaries: we
// don't do a processDefinition.findActivity here
ActivityImpl sourceActivity = scope.findActivity(sequenceFlow.getSourceRef());
ActivityImpl destinationActivity = scope.findActivity(sequenceFlow.getTargetRef());
if (sourceActivity == null) {
bpmnModel.addProblem("Invalid source '" + sequenceFlow.getSourceRef() + "' of sequence flow '" + sequenceFlow.getId() + "'", sequenceFlow);
} else if (destinationActivity == null) {
throw new ActivitiException("Invalid destination '" + sequenceFlow.getTargetRef() + "' of sequence flow '" + sequenceFlow.getId() + "'");
} else if (!(sourceActivity.getActivityBehavior() instanceof EventBasedGatewayActivityBehavior)
&& destinationActivity.getActivityBehavior() instanceof IntermediateCatchEventActivityBehavior && (destinationActivity.getParentActivity() != null)
&& (destinationActivity.getParentActivity().getActivityBehavior() instanceof EventBasedGatewayActivityBehavior)) {
bpmnModel.addProblem("Invalid incoming sequenceflow " + sequenceFlow.getId() + " for intermediateCatchEvent with id '" + destinationActivity.getId()
+ "' connected to an event-based gateway.", sequenceFlow);
} else {
TransitionImpl transition = sourceActivity.createOutgoingTransition(sequenceFlow.getId());
bpmnParse.getSequenceFlows().put(sequenceFlow.getId(), transition);
transition.setProperty("name", sequenceFlow.getName());
transition.setProperty("documentation", sequenceFlow.getDocumentation());
transition.setDestination(destinationActivity);
if (StringUtils.isNotEmpty(sequenceFlow.getConditionExpression())) {
Condition expressionCondition = new UelExpressionCondition(bpmnParse.getExpressionManager().createExpression(sequenceFlow.getConditionExpression()));
transition.setProperty(PROPERTYNAME_CONDITION_TEXT, sequenceFlow.getConditionExpression());
transition.setProperty(PROPERTYNAME_CONDITION, expressionCondition);
}
createExecutionListenersOnTransition(bpmnParse, sequenceFlow.getExecutionListeners(), transition);
}
}
示例11: reject
import org.activiti.engine.impl.pvm.process.TransitionImpl; //导入方法依赖的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);
}