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


Java WorkflowDocument.move方法代码示例

本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.move方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.move方法的具体用法?Java WorkflowDocument.move怎么用?Java WorkflowDocument.move使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kew.api.WorkflowDocument的用法示例。


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

示例1: testMoveDocumentParallel

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testMoveDocumentParallel() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), ParallelSetup.DOCUMENT_TYPE_NAME);
	document.blanketApprove("", new String[] { ParallelSetup.WORKFLOW_DOCUMENT_2_B2_NODE, ParallelSetup.WORKFLOW_DOCUMENT_3_B1_NODE, ParallelSetup.WORKFLOW_DOCUMENT_4_B3_NODE });
	Set nodeNames = TestUtilities.createNodeInstanceNameSet(KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document.getDocumentId()));
	assertEquals("There should be 3 active nodes.", 3, nodeNames.size());
	assertTrue("Should be at WorkflowDocument3-B1", nodeNames.contains(ParallelSetup.WORKFLOW_DOCUMENT_3_B1_NODE));
	assertTrue("Should be at WorkflowDocument2-B2", nodeNames.contains(ParallelSetup.WORKFLOW_DOCUMENT_2_B2_NODE));
	assertTrue("Should be at WorkflowDocument4-B3", nodeNames.contains(ParallelSetup.WORKFLOW_DOCUMENT_4_B3_NODE));
	
	// try to move the document from WorkflowDocument3-B1 to WorkflowDocument2-B1
	document.move(MovePoint.create(ParallelSetup.WORKFLOW_DOCUMENT_3_B1_NODE, -1), "");
	nodeNames = TestUtilities.createNodeInstanceNameSet(KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document.getDocumentId()));
	assertEquals("There should be 3 active nodes.", 3, nodeNames.size());
	assertTrue("Should be at WorkflowDocument2-B1", nodeNames.contains(ParallelSetup.WORKFLOW_DOCUMENT_2_B1_NODE));
	assertTrue("Should be at WorkflowDocument2-B2", nodeNames.contains(ParallelSetup.WORKFLOW_DOCUMENT_2_B2_NODE));
	assertTrue("Should be at WorkflowDocument4-B3", nodeNames.contains(ParallelSetup.WORKFLOW_DOCUMENT_4_B3_NODE));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:MoveDocumentTest.java

示例2: testMoveDocumentInsideProcess

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * This tests that we can invoke the move document command inside of a sub process.
 */
@Test public void testMoveDocumentInsideProcess() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "MoveInProcessTest");
    document.route("");
    
    // approve as bmcgough and rkirkend to move into process
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("bmcgough should have approve", document.isApprovalRequested());
    document.approve("");
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("rkirkend should have approve", document.isApprovalRequested());
    document.approve("");

    WorkflowDocumentService workflowDocumentService = KewApiServiceLocator.getWorkflowDocumentService();
    List<RouteNodeInstance> activeNodeInstances = workflowDocumentService.getActiveRouteNodeInstances(document.getDocumentId());
    assertEquals("Should be 1 active node instance.", 1, activeNodeInstances.size());
    RouteNodeInstance node2 = activeNodeInstances.get(0);
    assertEquals("Should be at the WorkflowDocument2 node.", SeqSetup.WORKFLOW_DOCUMENT_2_NODE, node2.getName());
    assertTrue("Node should be in a process.", node2.getProcessId() != null);
    
    // now try to move the document forward one which will keep us inside the subprocess
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_2_NODE, 1), "");
    
    activeNodeInstances = workflowDocumentService.getActiveRouteNodeInstances(document.getDocumentId());
    RouteNodeInstance node3 = activeNodeInstances.get(0);
    assertEquals("Should be at the WorkflowDocument3 node.", SeqSetup.WORKFLOW_DOCUMENT_3_NODE, node3.getName());
    assertTrue("Node should be in a process.", node3.getProcessId() != null);
    assertEquals("Node 2 and 3 should be in the same process.", node2.getProcessId(), node3.getProcessId());
    
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_3_NODE, 0), "");
    
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_3_NODE, -1), "");
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:36,代码来源:MoveDocumentTest.java

示例3: testMoveDocumentSequential

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests that we can move a sequential document forward and backward.
 *
 */
@Test public void testMoveDocumentSequential() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), SeqSetup.DOCUMENT_TYPE_NAME);
    document.route("");
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("Bmcgough should have an approve.", document.isApprovalRequested());
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("Rkirkend should have an approve.", document.isApprovalRequested());
    assertEquals("Should be at the WorkflowDocument Node.", SeqSetup.WORKFLOW_DOCUMENT_NODE, document.getNodeNames().iterator().next());
    
    // move the document forward one node
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_NODE, 1), "");
    
    List actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
    assertEquals("Should be only 1 pending approve request to pmckown.", 1, actionRequests.size());
    assertEquals("Should be at the WorkflowDocument2 Node.", SeqSetup.WORKFLOW_DOCUMENT_2_NODE, document.getNodeNames().iterator().next());
    
    // after moving the document forward, bmcgough and rkirkend should no longer have requests, but phil should
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertFalse("Bmcgough should NOT have an approve.", document.isApprovalRequested());
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertFalse("Rkirkend should NOT have an approve.", document.isApprovalRequested());
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pmckown"), document.getDocumentId());
    assertTrue("Pmckown should have an approve.", document.isApprovalRequested());
    ActionRequestValue pmckownRequest = (ActionRequestValue)actionRequests.get(0);
    
    // now try moving it to itself, effectively refreshing the node
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_2_NODE, 0), "");
    assertTrue("Pmckown should still have an approve.", document.isApprovalRequested());
    actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
    assertEquals("Should be only 1 pending approve request to pmckown.", 1, actionRequests.size());
    assertEquals("Should be at the WorkflowDocument2 Node.", SeqSetup.WORKFLOW_DOCUMENT_2_NODE, document.getNodeNames().iterator().next());
    
    // since this should have invoked a refresh, let's ensure that the action request ids are different after the move
    assertFalse("Action request ids should be different.", pmckownRequest.getActionRequestId().equals(((ActionRequestValue)actionRequests.get(0)).getActionRequestId()));
    
    // now try moving it back
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_2_NODE, -1), "");
    
    // document should now be back at the WorkflowDocumentNode with requests to rkirkend and brian
    actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
    assertEquals("Should be 2 pending requests.", 2, actionRequests.size());
    
    assertEquals("Should be at the WorkflowDocument Node.", SeqSetup.WORKFLOW_DOCUMENT_NODE, document.getNodeNames().iterator().next());
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("Bmcgough should have an approve.", document.isApprovalRequested());
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("Rkirkend should have an approve.", document.isApprovalRequested());
    
    
    // Let's do a sanity check to make sure we're still ENROUTE and move the doc to an ack node, rendering it PROCESSED,
    // also, we'll check that there are no permissions enforced on the move document action by moving as a random user
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("xqi"), document.getDocumentId());
    assertTrue("Doc should be ENROUTE.", document.isEnroute());
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_NODE, 2), "");
    assertTrue("Doc should be PROCESSED.", document.isProcessed());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:63,代码来源:MoveDocumentTest.java


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