当前位置: 首页>>代码示例>>Java>>正文


Java TransitionEngineFactory类代码示例

本文整理汇总了Java中org.kuali.rice.kew.engine.transition.TransitionEngineFactory的典型用法代码示例。如果您正苦于以下问题:Java TransitionEngineFactory类的具体用法?Java TransitionEngineFactory怎么用?Java TransitionEngineFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TransitionEngineFactory类属于org.kuali.rice.kew.engine.transition包,在下文中一共展示了TransitionEngineFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: invokeTransition

import org.kuali.rice.kew.engine.transition.TransitionEngineFactory; //导入依赖的package包/类
/**
 * Invokes the transition and returns the next node instances to transition
 * to from the current node instance on the route context.
 *
 * This is a 3-step process:
 *
 * <pre>
 *  1) If the node instance already has next nodes, return those,
 *  2) otherwise, invoke the transition engine for the node, if the resulting node instances are not empty, return those,
 *  3) lastly, if our node is in a process and no next nodes were returned from it's transition engine, invoke the
 *     transition engine of the process node and return the resulting node instances.
 * </pre>
 */
private List<RouteNodeInstance> invokeTransition(RouteContext context, RouteNodeInstance nodeInstance, ProcessResult processResult, TransitionEngine transitionEngine) throws Exception {
	List<RouteNodeInstance> nextNodeInstances = nodeInstance.getNextNodeInstances();
	if (nextNodeInstances.isEmpty()) {
		Transition result = transitionEngine.transitionFrom(context, processResult);
		nextNodeInstances = result.getNextNodeInstances();
		if (nextNodeInstances.isEmpty() && nodeInstance.isInProcess()) {
			transitionEngine = TransitionEngineFactory.createTransitionEngine(nodeInstance.getProcess());
			context.setNodeInstance(nodeInstance);
			nextNodeInstances = invokeTransition(context, nodeInstance.getProcess(), processResult, transitionEngine);
		}
	}
       // if this nodeInstance already has next node instance we can just return them
       return nextNodeInstances;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:StandardWorkflowEngine.java

示例2: invokeTransition

import org.kuali.rice.kew.engine.transition.TransitionEngineFactory; //导入依赖的package包/类
/**
 * Invokes the transition and returns the next node instances to transition
 * to from the current node instance on the route context.
 *
 * This is a 3-step process:
 *
 * <pre>
 *  1) If the node instance already has next nodes, return those,
 *  2) otherwise, invoke the transition engine for the node, if the resulting node instances are not empty, return those,
 *  3) lastly, if our node is in a process and no next nodes were returned from it's transition engine, invoke the
 *     transition engine of the process node and return the resulting node instances.
 * </pre>
 */
/*
 * private List invokeTransition(RouteContext context, RouteNodeInstance
 * nodeInstance, ProcessResult processResult, TransitionEngine
 * transitionEngine) throws Exception { List nextNodeInstances =
 * nodeInstance.getNextNodeInstances(); if (nextNodeInstances.isEmpty()) {
 * Transition result = transitionEngine.transitionFrom(context,
 * processResult); nextNodeInstances = result.getNextNodeInstances(); if
 * (nextNodeInstances.isEmpty() && nodeInstance.isInProcess()) {
 * transitionEngine =
 * TransitionEngineFactory.createTransitionEngine(nodeInstance.getProcess());
 * nextNodeInstances = invokeTransition(context, nodeInstance.getProcess(),
 * processResult, transitionEngine); } } return nextNodeInstances; }
 */

private List invokeTransition(RouteContext context, RouteNodeInstance nodeInstance, ProcessResult processResult, TransitionEngine transitionEngine) throws Exception {
	List nextNodeInstances = nodeInstance.getNextNodeInstances();
	if (nextNodeInstances.isEmpty()) {
		Transition result = transitionEngine.transitionFrom(context, processResult);
		nextNodeInstances = result.getNextNodeInstances();
		if (nextNodeInstances.isEmpty() && nodeInstance.isInProcess()) {
			transitionEngine = TransitionEngineFactory.createTransitionEngine(nodeInstance.getProcess());
			context.setNodeInstance(nodeInstance);
			nextNodeInstances = invokeTransition(context, nodeInstance.getProcess(), processResult, transitionEngine);
		}
	}
	return nextNodeInstances;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:41,代码来源:StandardWorkflowEngine.java

示例3: processNodeInstance

import org.kuali.rice.kew.engine.transition.TransitionEngineFactory; //导入依赖的package包/类
protected ProcessContext processNodeInstance(RouteContext context, RouteHelper helper) throws Exception {
	RouteNodeInstance nodeInstance = context.getNodeInstance();
       // first, let's make sure this node instance is "managed" in our persistence context
       nodeInstance = saveNode(context, nodeInstance);
	if ( LOG.isDebugEnabled() ) {
		LOG.debug("Processing node instance: " + nodeInstance.getRouteNode().getRouteNodeName());
	}
	if (checkAssertions(context)) {
		// returning an empty context causes the outer loop to terminate
		return new ProcessContext();
	}
	TransitionEngine transitionEngine = TransitionEngineFactory.createTransitionEngine(nodeInstance);
	ProcessResult processResult = transitionEngine.isComplete(context);

       // we've executed the node at least once now, if the initial flag has not already been cleared, do so now
       if (nodeInstance.isInitial()) {
           nodeInstance.setInitial(false);
       }

       // if the node is complete, let's transition
	if (processResult.isComplete()) {
		if ( LOG.isDebugEnabled() ) {
			LOG.debug("Routing node has completed: " + nodeInstance.getRouteNode().getRouteNodeName());
		}

           // route node instance id could be null if a flush didn't happen properly, let's verify
           if (nodeInstance.getRouteNodeInstanceId() == null) {
               throw new IllegalStateException("Encountered a node instance in the engine with no id: " + nodeInstance);
           }
		context.getEngineState().getCompleteNodeInstances().add(nodeInstance.getRouteNodeInstanceId());
		List<RouteNodeInstance> nextNodeCandidates =
                   invokeTransition(context, nodeInstance, processResult, transitionEngine);

		// iterate over the next node candidates sending them through the
		// transition engine's transitionTo method
		// one at a time for a potential switch. Place the transition
		// engines result back in the 'actual' next node
		// list which we put in the next node before doing work.
		List<RouteNodeInstance> nodesToActivate = new ArrayList<RouteNodeInstance>();
           if (!nextNodeCandidates.isEmpty()) {
               for (RouteNodeInstance nextNodeInstance : nextNodeCandidates) {
				transitionEngine = TransitionEngineFactory.createTransitionEngine(nextNodeInstance);
				RouteNodeInstance currentNextNodeInstance = nextNodeInstance;
				nextNodeInstance = transitionEngine.transitionTo(nextNodeInstance, context);
				// if the next node has changed, we need to remove our
				// current node as a next node of the original node
				if (!currentNextNodeInstance.equals(nextNodeInstance)) {
                       nodeInstance.getNextNodeInstances().remove(currentNextNodeInstance);
					currentNextNodeInstance.getPreviousNodeInstances().remove(nodeInstance);
				}
                   RouteNodeInstance savedNextNodeInstance = saveNode(context, nextNodeInstance);
                   if (savedNextNodeInstance != nextNodeInstance) {
                       nodeInstance.getNextNodeInstances().remove(nextNodeInstance);
                   }
                   if (!nodeInstance.getNextNodeInstances().contains(savedNextNodeInstance)) {
                       nodeInstance.addNextNodeInstance(savedNextNodeInstance);
                   }
				handleBackwardCompatibility(context, savedNextNodeInstance);
				// call the post processor
				notifyNodeChange(context, savedNextNodeInstance);
				nodesToActivate.add(savedNextNodeInstance);
				}
			}

			// deactive the current active node
		nodeInstance.setComplete(true);
		nodeInstance.setActive(false);
		// active the nodes we're transitioning into
		for (RouteNodeInstance nodeToActivate : nodesToActivate) {
			nodeToActivate.setActive(true);
		}
	} else {
	    nodeInstance.setComplete(false);
       }

	nodeInstance = saveNode(context, nodeInstance);
       // always be sure that we are changes are flushed with the database after every node instance processing
       flushDatabaseWork(context);
	return new ProcessContext(nodeInstance.isComplete(), nodeInstance.getNextNodeInstances());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:81,代码来源:StandardWorkflowEngine.java


注:本文中的org.kuali.rice.kew.engine.transition.TransitionEngineFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。