本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.getRouteNodeInstances方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.getRouteNodeInstances方法的具体用法?Java WorkflowDocument.getRouteNodeInstances怎么用?Java WorkflowDocument.getRouteNodeInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.getRouteNodeInstances方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWorkflowDocument
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testWorkflowDocument() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "UnitTestDocument");
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
document.approve("");
boolean containsInitiated = false;
boolean containsTemplate1 = false;
boolean containsTemplate2 = false;
for (RouteNodeInstance routeNodeInstance : document.getRouteNodeInstances()) {
if (routeNodeInstance.getName().equals("Initiated")) {
containsInitiated = true;
} else if (routeNodeInstance.getName().equals("Template1")) {
containsTemplate1 = true;
} else if (routeNodeInstance.getName().equals("Template2")) {
containsTemplate2 = true;
}
}
assertTrue("Should have gone through initiated node", containsInitiated);
assertTrue("Should have gone through template1 node", containsTemplate1);
assertTrue("Should have gone through template2 node", containsTemplate2);
}
示例2: testSubProcessRoute
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSubProcessRoute() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCUMENT_TYPE_NAME);
document.saveDocumentData();
assertTrue("Document should be initiated", document.isInitiated());
assertEquals("Should be no action requests.", 0, document.getRootActionRequests().size());
TestUtilities.assertAtNode(document, "Initial");
document.route("");
assertTrue("Document shoule be ENROUTE.", document.isEnroute());
List actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
assertEquals("Incorrect pending action requests.", 2, actionRequests.size());
boolean isAck = false;
boolean isApprove = false;
for (Iterator iterator = actionRequests.iterator(); iterator.hasNext();) {
ActionRequestValue request = (ActionRequestValue) iterator.next();
org.kuali.rice.kew.engine.node.RouteNodeInstance nodeInstance = request.getNodeInstance();
assertNotNull("Node instance should be non null.", nodeInstance);
if (request.getPrincipalId().equals(getPrincipalIdForName("bmcgough"))) {
isAck = true;
assertEquals("Wrong request type.", KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, request.getActionRequested());
assertEquals("Wrong node.", ACKNOWLEDGE_NODE, nodeInstance.getRouteNode().getRouteNodeName());
assertNotNull("Should be in a sub process.", nodeInstance.getProcess());
assertEquals("Wrong sub process.", SUB_PROCESS_NODE, nodeInstance.getProcess().getRouteNode().getRouteNodeName());
assertFalse("Sub process should be non-initial.", nodeInstance.getProcess().isInitial());
assertFalse("Sub process should be non-active.", nodeInstance.getProcess().isActive());
assertFalse("Sub process should be non-complete.", nodeInstance.getProcess().isComplete());
} else if (request.getPrincipalId().equals(getPrincipalIdForName("temay"))) {
isApprove = true;
assertEquals("Wrong request type.", KewApiConstants.ACTION_REQUEST_APPROVE_REQ, request.getActionRequested());
assertEquals("Wrong node.", APPROVE_NODE, request.getNodeInstance().getRouteNode().getRouteNodeName());
assertNotNull("Should be in a sub process.", request.getNodeInstance().getProcess());
assertEquals("Wrong sub process.", SUB_PROCESS_NODE, request.getNodeInstance().getProcess().getRouteNode().getRouteNodeName());
assertFalse("Sub process should be non-initial.", nodeInstance.getProcess().isInitial());
assertFalse("Sub process should be non-active.", nodeInstance.getProcess().isActive());
assertFalse("Sub process should be non-complete.", nodeInstance.getProcess().isComplete());
}
}
assertTrue(isAck);
assertTrue(isApprove);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
assertTrue("Should have acknowledge.", document.isAcknowledgeRequested());
document.acknowledge("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), document.getDocumentId());
document.approve("");
// find the subprocess and assert it is complete, not active, and not initial
boolean foundSubProcess = false;
List<RouteNodeInstance> nodeInstances = document.getRouteNodeInstances();
for (int index = 0; index < nodeInstances.size(); index++) {
RouteNodeInstance instanceVO = nodeInstances.get(index);
if (instanceVO.getName().equals(SUB_PROCESS_NODE)) {
foundSubProcess = true;
assertFalse("Sub process should be non-initial.", instanceVO.isInitial());
assertFalse("Sub process should be non-active.", instanceVO.isActive());
assertTrue("Sub process should be complete.", instanceVO.isComplete());
}
}
assertTrue("Could not locate sub process node.", foundSubProcess);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
assertTrue("Document should be final.", document.isFinal());
}