Activiti获得下一个节点

PvmTransition表示箭头的类。而这些类是从
List<PvmTransition> list = ActivityImpl.getOutgoingTransitions() ;


从任务id获得指向外面的连接线



ProcessDefinitionEntity.getActivities()




Task currentTask = (Task) taskService.createTaskQuery().taskId(taskId)
				.singleResult();



/**
	 * 
	 *@User :Test
	 *@date :2014-6-26 下午02:45:34
	 *@return :Execution 
	 *@userFor :获得执行节点 ExecutionEntity.getActivityId() 获得节点id
     *currentTask.getExecutionId()
	 */
  private ExecutionEntity getExecution(String executionId) {
		ExecutionEntity execution = (ExecutionEntity) (Execution) runtimeService
				.createExecutionQuery().executionId(executionId).singleResult();
		return execution;
	}




	/**
	 * 
	 *@User   :Test
	 *@date   :2014-6-26 下午02:38:39
	 *@return :ActivityImpl
	 *@userFor :根据flowId获得下一个节点 ExecutionEntity.getActivityId()
	 */
	private ActivityImpl getNextTask(ProcessDefinitionEntity processDefinition,
			String activitiId, String flowId) {
		ActivityImpl result = null;
		boolean breakFlag = false;
		List activitiList = processDefinition.getActivities();
		for (Iterator iterator = activitiList.iterator(); iterator.hasNext();) {
			ActivityImpl activityImpl = (ActivityImpl) iterator.next();
			if (breakFlag)
				break;
			String id = activityImpl.getId();
			if (activitiId.equals(id)) {
				List outTransitions = activityImpl.getOutgoingTransitions();
				for (Iterator iterator1 = outTransitions.iterator(); iterator1
						.hasNext();) {
					PvmTransition pvm = (PvmTransition) iterator1.next();
					if (flowId.length() > 0 && pvm.getId().equals(flowId)) {
						result = (ActivityImpl) pvm.getDestination();
						breakFlag = true;
						break;
					}
				}

			}
		}
		return result;
	}


从一个节点转向另一个节点 最后还是得需要执行taskService.complete(taskId,varies);

// 获取当前节点的所以出口(这个方法做的不好,应该返回List<TransitionImpl>才对的,这样就不用下面的强转换了,我想以后版本会改了这点)
		List<PvmTransition> pvmTransitionList = activeActivity
				.getOutgoingTransitions();
		for (PvmTransition pvmTransition : pvmTransitionList) {
			TransitionImpl transitionImpl = (TransitionImpl) pvmTransition;// 强转为TransitionImpl
			transitionImpl.setDestination(endActivity);
		}
        //最后还是得需要执行complete方法
	taskService.complete(taskId);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值