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


Java Branch类代码示例

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


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

示例1: getVariables

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
@Override
public Map<String, String> getVariables() {
    Map<String, String> documentVariables = new HashMap<String, String>();
    /* populate the routeHeaderVO with the document variables */
    // FIXME: we assume there is only one for now
    Branch routeNodeInstanceBranch = getRootBranch();
    // Ok, we are using the "branch state" as the arbitrary convenient repository for flow/process/edoc variables
    // so we need to stuff them into the VO
    if (routeNodeInstanceBranch != null) {
        List<BranchState> listOfBranchStates = routeNodeInstanceBranch.getBranchState();
        for (BranchState bs : listOfBranchStates) {
            if (bs.getKey() != null && bs.getKey().startsWith(BranchState.VARIABLE_PREFIX)) {
                if ( LOG.isDebugEnabled() ) {
                    if ( LOG.isDebugEnabled() ) {
                        LOG.debug("Setting branch state variable on vo: " + bs.getKey() + "=" + bs.getValue());
                    }
                }
                documentVariables.put(bs.getKey().substring(BranchState.VARIABLE_PREFIX.length()), bs.getValue());
            }
        }
    }
    return documentVariables;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:DocumentRouteHeaderValue.java

示例2: transitioningInto

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
public DynamicResult transitioningInto(RouteContext context, RouteNodeInstance process, RouteHelper helper) throws Exception {
    List<RouteNodeInstance> nextNodeInstances = new ArrayList<RouteNodeInstance>();
    for (int index = 0; index < ROLES.length; index++) {
        String roleName = ROLES[index];
        RouteNode node = helper.getNodeFactory().getRouteNode(context, NEXT_NODE_NAME);
        if (node == null) {
            throw new WorkflowException("Couldn't locate node for name: " + NEXT_NODE_NAME);
        }
        RouteNodeInstance nextNodeInstance = helper.getNodeFactory().createRouteNodeInstance(context.getDocument().getDocumentId(), node);
        Branch branch = helper.getNodeFactory().createBranch(roleName, context.getNodeInstance().getBranch(), nextNodeInstance);
        branch.addBranchState(new BranchState("role", roleName));
        branch.setSplitNode(context.getNodeInstance());
        nextNodeInstances.add(nextNodeInstance);
    }
    //return new DynamicResult(true, nextNodeInstances);
    throw new UnsupportedOperationException("No!!!!");
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:DynamicSplitTestNode.java

示例3: testSystemBranchState

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
 * Tests that the proper state is set up on the root branch in the document
 * to indicate that both PROCESSED and FINAL callbacks have been made into
 * the post processor.
 */
@Test public void testSystemBranchState() throws Exception {
	// route the document to final
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SimpleDocType");
	document.route("");
	assertTrue("Document should be final.", document.isFinal());

	// now look at the branch state
	DocumentRouteHeaderValue routeHeader = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
	Branch rootBranch = routeHeader.getRootBranch();
	assertNotNull(rootBranch);
	BranchState processedBranchState = rootBranch.getBranchState(KewApiConstants.POST_PROCESSOR_PROCESSED_KEY);
	BranchState finalBranchState = rootBranch.getBranchState(KewApiConstants.POST_PROCESSOR_FINAL_KEY);
	assertNotNull(processedBranchState);
	assertNotNull(finalBranchState);
	assertEquals("true", processedBranchState.getValue());
	assertEquals("true", finalBranchState.getValue());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:StandardWorkflowEngineTest.java

示例4: getVariables

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
@Override
public Map<String, String> getVariables() {
    Map<String, String> documentVariables = new HashMap<String, String>();
    /* populate the routeHeaderVO with the document variables */
    // FIXME: we assume there is only one for now
    Branch routeNodeInstanceBranch = getRootBranch();
    // Ok, we are using the "branch state" as the arbitrary convenient repository for flow/process/edoc variables
    // so we need to stuff them into the VO
    if (routeNodeInstanceBranch != null) {
        List<BranchState> listOfBranchStates = routeNodeInstanceBranch.getBranchState();
        for (BranchState bs : listOfBranchStates) {
            if (bs.getKey() != null && bs.getKey().startsWith(BranchState.VARIABLE_PREFIX)) {
                LOG.debug("Setting branch state variable on vo: " + bs.getKey() + "=" + bs.getValue());
                documentVariables.put(bs.getKey().substring(BranchState.VARIABLE_PREFIX.length()), bs.getValue());
            }
        }
    }
    return documentVariables;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:20,代码来源:DocumentRouteHeaderValue.java

示例5: createBranch

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
public Branch createBranch(String name, Branch parentBranch, RouteNodeInstance initialNodeInstance) {
    Branch branch = new Branch();
    branch.setName(name);
    branch.setParentBranch(parentBranch);
    branch.setInitialNode(initialNodeInstance);
    initialNodeInstance.setBranch(branch);
    return branch;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:RoutingNodeFactory.java

示例6: getRevokedNodeInstances

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
    * Queries the list of revoked node instances from the root BranchState of the Document
    * and returns a List of revoked RouteNodeInstances.
    */
public List getRevokedNodeInstances(DocumentRouteHeaderValue document) {
	if (document == null) {
   		throw new IllegalArgumentException("Document must not be null.");
   	}
	List<RouteNodeInstance> revokedNodeInstances = new ArrayList<RouteNodeInstance>();

   	Branch rootBranch = document.getRootBranch();
   	BranchState state = null;
   	if (rootBranch != null) {
   	    state = rootBranch.getBranchState(REVOKED_NODE_INSTANCES_STATE_KEY);
   	}
   	if (state == null || org.apache.commons.lang.StringUtils.isEmpty(state.getValue())) {
   		return revokedNodeInstances;
   	}
   	String[] revokedNodes = state.getValue().split(",");
   	for (int index = 0; index < revokedNodes.length; index++) {
		String revokedNodeInstanceId = revokedNodes[index];
		RouteNodeInstance revokedNodeInstance = findRouteNodeInstanceById(revokedNodeInstanceId);
		if (revokedNodeInstance == null) {
			LOG.warn("Could not locate revoked RouteNodeInstance with the given id: " + revokedNodeInstanceId);
		} else {
			revokedNodeInstances.add(revokedNodeInstance);
		}
	}
   	return revokedNodeInstances;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:RouteNodeServiceImpl.java

示例7: getRootBranch

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
 * Convenience method that returns the branch of the first (and presumably only?) initial node
 * @return the branch of the first (and presumably only?) initial node
 */
public Branch getRootBranch() {
    if (!this.initialRouteNodeInstances.isEmpty()) {
        return getInitialRouteNodeInstance(0).getBranch();
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:DocumentRouteHeaderValue.java

示例8: findVariable

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
 * Looks up a variable (embodied in a "BranchState" key/value pair) in the
 * branch state table.
 */
private BranchState findVariable(String name) {
    Branch rootBranch = getRootBranch();
    if (rootBranch != null) {
        List<BranchState> branchState = rootBranch.getBranchState();
        Iterator<BranchState> it = branchState.iterator();
        while (it.hasNext()) {
            BranchState state = it.next();
            if (ObjectUtils.equals(state.getKey(), BranchState.VARIABLE_PREFIX + name)) {
                return state;
            }
        }
    }
    return null;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:DocumentRouteHeaderValue.java

示例9: testBranchState

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
@Test
public void testBranchState() throws Exception {
    Branch branch = setupRouteBranch();
    branch = setupRouteBranchState(branch);
    assertTrue("BranchState persisted", branch != null &&
           branch.getBranchState() != null &&
                StringUtils.isNotBlank(branch.getBranchState().get(0).getBranchStateId()));
    branch= KradDataServiceLocator.getDataObjectService().find(
            Branch.class,branch.getBranchId());
    assertTrue("BranchState fetched",branch != null && branch.getBranchState().get(0) != null);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:KewDocumentDataJpaTest.java

示例10: setupRouteBranchState

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
private Branch setupRouteBranchState(Branch branch){
    BranchState bs = new BranchState();
    bs.setKey("KEY");
    bs.setValue("VAL");
    bs.setBranch(branch);

    branch.getBranchState().add(bs);
    return KradDataServiceLocator.getDataObjectService().save(branch);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:KewDocumentDataJpaTest.java

示例11: save

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
 * This overridden method ...
 * 
 * @see org.kuali.rice.kew.engine.node.dao.BranchDAO#save(org.kuali.rice.kew.engine.node.Branch)
 */
public void save(Branch branch) {
	  if (branch.getBranchId() == null) {
            entityManager.persist(branch);
        } else {
            OrmUtils.merge(entityManager, branch);
        }

}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:14,代码来源:BranchDAOJpaImpl.java

示例12: save

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
public void save(Branch branch) {   	
	if (branch.getBranchId() == null){
		entityManager.persist(branch);
	} else {
		OrmUtils.merge(entityManager, branch);
	}
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:8,代码来源:RouteNodeDAOJpaImpl.java

示例13: getRevokedNodeInstances

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
    * Queries the list of revoked node instances from the root BranchState of the Document
    * and returns a List of revoked RouteNodeInstances.
    */
public List getRevokedNodeInstances(DocumentRouteHeaderValue document) {
	if (document == null) {
   		throw new IllegalArgumentException("Document must not be null.");
   	}
	List<RouteNodeInstance> revokedNodeInstances = new ArrayList<RouteNodeInstance>();
   	
   	Branch rootBranch = document.getRootBranch();
   	BranchState state = null;
   	if (rootBranch != null) {
   	    state = rootBranch.getBranchState(REVOKED_NODE_INSTANCES_STATE_KEY);
   	}
   	if (state == null || org.apache.commons.lang.StringUtils.isEmpty(state.getValue())) {
   		return revokedNodeInstances;
   	}
   	String[] revokedNodes = state.getValue().split(",");
   	for (int index = 0; index < revokedNodes.length; index++) {
		String revokedNodeInstanceId = revokedNodes[index];
		RouteNodeInstance revokedNodeInstance = findRouteNodeInstanceById(revokedNodeInstanceId);
		if (revokedNodeInstance == null) {
			LOG.warn("Could not locate revoked RouteNodeInstance with the given id: " + revokedNodeInstanceId);
		} else {
			revokedNodeInstances.add(revokedNodeInstance);
		}
	}
   	return revokedNodeInstances;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:31,代码来源:RouteNodeServiceImpl.java

示例14: getRootBranch

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
 * Convenience method that returns the branch of the first (and presumably only?) initial node
 * @return the branch of the first (and presumably only?) initial node
 */
public Branch getRootBranch() {
    if (!this.initialRouteNodeInstances.isEmpty()) {
        return ((RouteNodeInstance) getInitialRouteNodeInstance(0)).getBranch();
    } 
    return null;
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:11,代码来源:DocumentRouteHeaderValue.java

示例15: _importRouteNodeInstanceDTO

import org.kuali.rice.kew.engine.node.Branch; //导入依赖的package包/类
/**
* helper method for {@link #importRouteNodeInstanceDTO(org.kuali.rice.kew.api.document.node.RouteNodeInstance)} which does all
* the work.  The public method just wraps this one but hides the returned RouteNodeInstance,
* which is used for the recursive call to populate the nextNodeInstanceS inside our 
* RouteNodeInstanceS.
* 
* @param nodeInstanceDTO
* @return
*/
 	private RouteNodeInstance _importRouteNodeInstanceDTO(org.kuali.rice.kew.api.document.node.RouteNodeInstance nodeInstanceDTO) {
 		if (nodeInstanceDTO == null) {
 			return null;
 		}
 		RouteNodeInstance nodeInstance = new RouteNodeInstance();
 		nodeInstance.setActive(nodeInstanceDTO.isActive());

 		nodeInstance.setComplete(nodeInstanceDTO.isComplete());
 		nodeInstance.setDocumentId(nodeInstanceDTO.getDocumentId());
 		nodeInstance.setInitial(nodeInstanceDTO.isInitial());

 		Branch branch = getBranch(nodeInstanceDTO.getBranchId());
 		nodeInstance.setBranch(branch);

 		if (nodeInstanceDTO.getRouteNodeId() != null) {
 			RouteNode routeNode = routeNodeService.findRouteNodeById(nodeInstanceDTO.getRouteNodeId());

 			if (routeNode == null) {
 				routeNode = getRouteNode(nodeInstanceDTO.getRouteNodeId());
 				routeNode.setNodeType(nodeInstanceDTO.getName());
 			}

 			nodeInstance.setRouteNode(routeNode);

 			if (routeNode.getBranch() != null) {
     			branch.setName(routeNode.getBranch().getName());
     		} 
 		}

 		RouteNodeInstance process = getRouteNodeInstance(nodeInstanceDTO.getProcessId());
 		nodeInstance.setProcess(process);

 		nodeInstance.setRouteNodeInstanceId(nodeInstanceDTO.getId());

 		List<NodeState> nodeState = new ArrayList<NodeState>();
 		if (nodeInstanceDTO.getState() != null) {
	for (RouteNodeInstanceState stateDTO : nodeInstanceDTO.getState()) {
		NodeState state = getNodeState(stateDTO.getId());
		if (state != null) {
			state.setKey(stateDTO.getKey());
			state.setValue(stateDTO.getValue());
			state.setStateId(stateDTO.getId());
			state.setNodeInstance(nodeInstance);
			nodeState.add(state);
		}
	}
}
 		nodeInstance.setState(nodeState);

 		List<RouteNodeInstance> nextNodeInstances = new ArrayList<RouteNodeInstance>();


 		for (org.kuali.rice.kew.api.document.node.RouteNodeInstance nextNodeInstanceVO : nodeInstanceDTO.getNextNodeInstances()) {
 			// recurse to populate nextNodeInstances
 			nextNodeInstances.add(_importRouteNodeInstanceDTO(nextNodeInstanceVO));
 		}
         nodeInstance.setNextNodeInstances(nextNodeInstances);

 		routeNodeInstances.put(nodeInstance.getRouteNodeInstanceId(), nodeInstance);
 		return nodeInstance;
 	}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:71,代码来源:RouteLogAction.java


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