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


Java WorkflowDocument.approve方法代码示例

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


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

示例1: testKimExceptionRoutingWithDocHierarchy

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Checks to make sure that the KIM routing is working with hierarchical documents.
 * Based upon the test method org.kuali.rice.kew.doctype.DocumentTypeTest.testFinalApproverRouting()
 */
@Test public void testKimExceptionRoutingWithDocHierarchy() throws Exception {
	loadXmlFile("RouteExceptionTestDoc.xml");
	String[] docNames = {"TestFinalApproverDocumentType_Child", "TestFinalApproverDocumentType_GrandChild"};
	// Test the child doc and then the grandchild doc.
	for (int i = 0; i < docNames.length; i++) {
		// Perform the same steps as in the previous unit test.
		WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("admin"), docNames[i]);
        document.setTitle("");
        document.route("");
        document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
        try {
            document.approve("");
            fail("document should have thrown routing exception");
        } catch (Exception e) {
            //deal with single transaction issue in test.
        	TestUtilities.getExceptionThreader().join();
        	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
            assertTrue("Document should be in exception routing", document.isException());
        }
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:ExceptionRoutingServiceTest.java

示例2: routeTestDocs

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Routes some test docs for searching
 * @return String[] of doc ids
 */
protected String[] routeTestDocs() {
    // Route some test documents.
    String[] docIds = new String[TestDocData.titles.length];

    for (int i = 0; i < TestDocData.titles.length; i++) {
        WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(
                getPrincipalId(TestDocData.principalNames[i]), TestDocData.docTypeName);
        workflowDocument.setTitle(TestDocData.titles[i]);
        workflowDocument.setApplicationDocumentId(TestDocData.appDocIds[i]);
        workflowDocument.route("routing this document.");

        docIds[i] = workflowDocument.getDocumentId();

        if (TestDocData.approverNames[i] != null) {
            workflowDocument.switchPrincipal(getPrincipalId(TestDocData.approverNames[i]));
            workflowDocument.approve("approving this document.");
        }

        workflowDocument.setApplicationDocumentStatus(TestDocData.appDocStatuses[i]);
        workflowDocument.saveDocumentData();
    }

    return docIds;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentSearchTest.java

示例3: testSuperUserApproveExceptionCasesWithNotifications

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSuperUserApproveExceptionCasesWithNotifications() throws Exception {
  	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "SUApproveDocumentNotifications");
      document.route("");
      document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), document.getDocumentId());
      try {
      	document.approve("");
      } catch (Exception e) {
      }
      TestUtilities.getExceptionThreader().join();
      document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
      assertEquals("Document status incorrect", DocumentStatus.EXCEPTION, document.getStatus());
      document.superUserBlanketApprove("");
      document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
      assertEquals("Document status incorrect after blanket approve", DocumentStatus.PROCESSED, document.getStatus());
      
      List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
      assertFalse("Should be active requests for SU Approved document", actionRequests.isEmpty());
      for (ActionRequestValue request: actionRequests) {
	assertEquals("Should be an ack notification request", ActionType.ACKNOWLEDGE, ActionType.fromCode(request.getActionRequested()) );
}
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:SuperUserActionTest.java

示例4: testKimExceptionRoutingWithRiceDocumentChild

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Checks to make sure that the KIM routing is working for a RiceDocument child.
 * Based upon the test method org.kuali.rice.kew.doctype.DocumentTypeTest.testFinalApproverRouting()
 */
@Test public void testKimExceptionRoutingWithRiceDocumentChild() throws Exception {
	loadXmlFile("RouteExceptionTestDoc.xml");
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("admin"), "DocumentTypeDocument_New");
       document.setTitle("");
       document.route("");
       document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
       try {
           document.approve("");
           fail("document should have thrown routing exception");
       } catch (Exception e) {
           //deal with single transaction issue in test.
       	TestUtilities.getExceptionThreader().join();
       	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
           assertTrue("Document should be in exception routing", document.isException());
       }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:ExceptionRoutingServiceTest.java

示例5: approve

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Override
public void approve(WorkflowDocument workflowDocument, String annotation, List<AdHocRouteRecipient> adHocRecipients) throws WorkflowException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("approving document(" + workflowDocument.getDocumentId() + ",'" + annotation + "')");
    }

    handleAdHocRouteRequests(workflowDocument, annotation, filterAdHocRecipients(adHocRecipients, new String[] { KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KewApiConstants.ACTION_REQUEST_FYI_REQ, KewApiConstants.ACTION_REQUEST_APPROVE_REQ }));
    workflowDocument.approve(annotation);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:10,代码来源:WorkflowDocumentServiceImpl.java

示例6: testModifyDocumentInPostProcessor

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests that modifying a document in the post processor works.  This test will do a few things:
 * 
 * 1) Change the document content in the post processor
 * 2) Send an app specific FYI request to the initiator of the document
 * 3) Modify the document title.
 * 
 * This test is meant to expose the bug KULWF-668 where it appears an OptimisticLockException is
 * being thrown after returning from the EPIC post processor.
 */
@Test public void testModifyDocumentInPostProcessor() throws Exception {
       XMLUnit.setIgnoreWhitespace(true);
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "testModifyDocumentInPostProcessor");
	document.saveDocument("");
       assertEquals("application content should be empty initially", "", document.getApplicationContent());
	assertTrue("Doc title should be empty initially", StringUtils.isBlank(document.getTitle()));

       document.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "", "2002", "", true);
	document.complete("");
       document = WorkflowDocumentFactory.loadDocument("2002", document.getDocumentId());

       // now approve the document, it should through a 2 nodes, then go PROCESSED then FINAL
       document.approve("");

       assertEquals("Should have transitioned nodes twice", 2, DocumentModifyingPostProcessor.levelChanges);
	assertTrue("SHould have called the processed status change", DocumentModifyingPostProcessor.processedChange);
	assertTrue("Document should be final.", document.isFinal());
	XMLAssert.assertXMLEqual("Application content should have been sucessfully modified.", APPLICATION_CONTENT, document.getApplicationContent());
			
	// check that the title was modified successfully
	assertEquals("Wrong doc title", DOC_TITLE, document.getTitle());
	
	// check that the document we routed from the post processor exists
	assertNotNull("SHould have routed a document from the post processor.", DocumentModifyingPostProcessor.routedDocumentId);
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), DocumentModifyingPostProcessor.routedDocumentId);
	assertTrue("document should be enroute", document.isEnroute());
	assertEquals("Document should have 1 pending request.", 1, KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId()).size());
	assertTrue("ewestfal should have an approve request.", document.isApprovalRequested());
	document.approve("");
	assertTrue("Document should be final.", document.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:42,代码来源:PostProcessorTest.java

示例7: testEmptyParallelBranches

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests that the document route past the join properly when there are parallel branches that don't generate requests.
 * This was coded in response to a bug found while testing with ERA in order to track it down and fix it.
 */
@Test public void testEmptyParallelBranches() throws Exception {
    
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), PARALLEL_EMPTY_DOCUMENT_TYPE_NAME);
    document.saveDocumentData();
    assertTrue("Document should be initiated", document.isInitiated());
    assertEquals("Should be no action requests.", 0, document.getRootActionRequests().size());
    Collection<? extends Object> nodeInstances = KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document.getDocumentId());
    assertEquals("Wrong number of active nodes.", 1, nodeInstances.size());
    document.route("");
    
    // should have generated a request to "bmcgough"
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("Document should be enroute", document.isEnroute());
    List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
    assertEquals("Incorrect pending action requests.", 1, actionRequests.size());
    ActionRequestValue bRequest = actionRequests.get(0);
    assertNotNull("Should have been routed through node instance.", bRequest.getNodeInstance());
    assertTrue(document.isApprovalRequested());
    
    document.approve("");
    
    // now the document should have split, passed through nodes in each branch which didn't generate requests,
    // and then passed the join node and generated requests at WorkflowDocumentFinal
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("xqi"), document.getDocumentId());
    assertTrue("Document should be enroute", document.isEnroute());
    assertTrue(document.isApprovalRequested());
    
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:ParallelRoutingTest.java

示例8: testFutureRequestsWithRouting

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests future requests work with routing and force action rules
 *
 * @throws Exception
 */
@Test
public void testFutureRequestsWithRouting() throws Exception {
    this.loadXmlFile(this.getClass(), "FutureRequestsConfig.xml");

    String user1PrincipalId = getPrincipalIdForName("user1");
    String user2PrincipalId = getPrincipalIdForName("user2");

    // Node 1 - user1 approval (forceAction true)
    //          user2 approval (forceAction false)
    // Node 2 - NonSIT approval (forceAction false)
    //          user1 approval (forceAction true)
    // Node 3 - user2 approval (forceAction false)
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(user1PrincipalId, "FutureRequestsDoc");
    document.setDoNotReceiveFutureRequests();
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
    assertFalse(document.isApprovalRequested());

    document = WorkflowDocumentFactory.loadDocument(user2PrincipalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    document.setReceiveFutureRequests();
    document.approve("");

    // should have another request from second rule that is not force action because
    // of policy
    document = WorkflowDocumentFactory.loadDocument(user2PrincipalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());

    // user2 should have action items. user1 should not
    assertEquals(1, KEWServiceLocator.getActionListService().getActionList(user2PrincipalId, new ActionListFilter()).size());
    assertEquals(1, KEWServiceLocator.getActionListService().getActionList(user1PrincipalId, new ActionListFilter()).size());

    document.approve("");

    // test for request to user2 and not a workgroup
    document = WorkflowDocumentFactory.loadDocument(user2PrincipalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:45,代码来源:FutureRequestsTest.java

示例9: testRecallInvalidActionsTaken

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testRecallInvalidActionsTaken() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_RESTRICTED_DOC);
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(JHOPF, document.getDocumentId());
    document.approve("");

    try {
        document.recall("recalling", true);
        fail("Recall should NOT have succeeded.  Expected InvalidActionTakenException due to invalid 'APROVE' prior action taken.");
    } catch (InvalidActionTakenException iate) {
        assertTrue(iate.getMessage().contains("Invalid prior action taken: 'APPROVE'"));
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:RecallActionTest.java

示例10: testTakeActionsOnOutboxItem

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testTakeActionsOnOutboxItem() throws Exception {

    final String rkirkendPrincipalId = getPrincipalIdForName("rkirkend");
    List<String> recipients = new ArrayList<String>();
    recipients.add(rkirkendPrincipalId);
    TestRuleAttribute.setRecipientPrincipalIds("TestRole", "qualRole", recipients);

    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("quickstart"),
            "TestDocumentType");
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(rkirkendPrincipalId, document.getDocumentId());
    assertTrue("approve should be requested", document.isApprovalRequested());

    turnOnOutboxForUser(rkirkendPrincipalId);

    document.approve("");

    Collection<OutboxItem> outbox = KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter());
    assertEquals("there should be an outbox item", 1, outbox.size());

    outbox = KEWServiceLocator.getActionListService().getOutboxItemsByDocumentType(document.getDocumentTypeName());
    assertEquals("there should be an outbox item", 1, outbox.size());

    List<String> outBoxItemIds = new ArrayList<String>();
    OutboxItem actionItem = null;
    for (Iterator<OutboxItem> iterator = outbox.iterator(); iterator.hasNext(); ) {
        actionItem = iterator.next();
        outBoxItemIds.add(actionItem.getId());
    }

    KEWServiceLocator.getActionListService().removeOutboxItems(rkirkendPrincipalId, outBoxItemIds);
    outbox = KEWServiceLocator.getActionListService().getOutboxItemsByDocumentType(document.getDocumentTypeName());
    assertEquals("there should be zero outbox item", 0, outbox.size());

    KEWServiceLocator.getActionListService().saveOutboxItem(actionItem);
    outbox = KEWServiceLocator.getActionListService().getOutboxItemsByDocumentType(document.getDocumentTypeName());
    assertEquals("there should be 1 outbox item", 1, outbox.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:41,代码来源:OutboxTest.java

示例11: testRecallDoesNotRecallDocumentWhenFinal

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testRecallDoesNotRecallDocumentWhenFinal() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
    document.route("");

    for (String user: new String[] { JHOPF, EWESTFAL, RKIRKEND, NATJOHNS, BMCGOUGH }) {
        document = WorkflowDocumentFactory.loadDocument(user, document.getDocumentId());
        document.approve("");
    }
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("xqi"), document.getDocumentId());
    document.acknowledge("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jthomas"), document.getDocumentId());
    document.fyi();

    for (ActionRequest a: document.getRootActionRequests()) {
        System.err.println(a);
        if (a.isAcknowledgeRequest() || a.isFyiRequest()) {
            System.err.println(a.getPrincipalId());
            System.err.println(KimApiServiceLocator.getIdentityService().getPrincipal(a.getPrincipalId()).getPrincipalName());
        }
    }

    assertFalse("Document should not be processed", document.isProcessed());
    assertTrue("Document should be approved", document.isApproved());
    assertTrue("Document should be final", document.isFinal());

    document = WorkflowDocumentFactory.loadDocument(EWESTFAL, document.getDocumentId());
    document.recall("recalling when final should not recall the document", true);

    Map<String, List<ErrorMessage>> errorMessages =  GlobalVariables.getMessageMap().getErrorMessages();
    assertTrue(errorMessages.size() == 1);
    for (Map.Entry<String, List<ErrorMessage>> errorMessage : errorMessages.entrySet()) {
        assertTrue(errorMessage.getValue().get(0).getErrorKey().equals(RiceKeyConstants.MESSAGE_RECALL_NOT_SUPPORTED));
    }

    // Verify the document status is still FINAL
    assertFalse("Document should not be processed", document.isProcessed());
    assertTrue("Document should be approved", document.isApproved());
    assertTrue("Document should be final", document.isFinal());

    GlobalVariables.getMessageMap().clearErrorMessages();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:44,代码来源:RecallActionTest.java

示例12: testWorkgroupActionItemGenerationWhenMultipleWorkgroupRequests

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * addresses the following bug http://fms.dfa.cornell.edu:8080/browse/KULWF-428
 *
 * @throws Exception
 */
@Test public void testWorkgroupActionItemGenerationWhenMultipleWorkgroupRequests() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "ActionItemDocumentType");
    document.setTitle("");
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jitrue"), document.getDocumentId());

    Group testGroup = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
            KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "AIWG-Test");
    Group adminGroup = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
            KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "AIWG-Admin");

    List<ActionRequest> ars = document.getRootActionRequests();
    boolean routedWorkflowAdmin = false;
    boolean routedTestWorkgroup = false;
    for (ActionRequest request : ars) {
        if (request.isGroupRequest() && testGroup.getId().equals(request.getGroupId())) {
            routedTestWorkgroup = true;
        } else if (request.isGroupRequest() && adminGroup.getId().equals(request.getGroupId())) {
            routedWorkflowAdmin = true;
        }
    }

    //verify that our test is sane
    assertTrue("Should have routed to 'AIWG-Test'", routedTestWorkgroup);
    assertTrue("Should have routed to 'AIWG-Admin'", routedWorkflowAdmin);
    assertTrue("Approve should be requested to member of 'AIWG-Test'", document.isApprovalRequested());

    document.approve("");

    Collection actionItems = KEWServiceLocator.getActionListService().findByDocumentId(document.getDocumentId());

    assertEquals("There should be 6 action items to the AIWG-Admin.", 6, actionItems.size());

    for (Iterator iter = actionItems.iterator(); iter.hasNext();) {
        ActionItem actionItem = (ActionItem)iter.next();
        //don't worry about which workgroup - they can get activated in any order
        assertNotNull("this should be a workgroup request", actionItem.getGroup());
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:46,代码来源:ActionItemServiceTest.java

示例13: testDocumentStatusSearching

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests searching on document status and document status category
 */
@Test public void testDocumentStatusSearching() {
    String dt = "SearchDocType";
    String pid = getPrincipalIdForName("quickstart");
    WorkflowDocument initiated = WorkflowDocumentFactory.createDocument(pid, dt);
    WorkflowDocument saved = WorkflowDocumentFactory.createDocument(pid, dt);
    saved.saveDocument("saved");
    assertEquals(DocumentStatus.SAVED, saved.getStatus());

    WorkflowDocument enroute = WorkflowDocumentFactory.createDocument(pid, dt);
    enroute.route("routed");
    assertEquals(DocumentStatus.ENROUTE, enroute.getStatus());

    WorkflowDocument exception = WorkflowDocumentFactory.createDocument(pid, dt);
    exception.route("routed");
    exception.placeInExceptionRouting("placed in exception routing");
    assertEquals(DocumentStatus.EXCEPTION, exception.getStatus());

    // no acks on this doc, can't test?
    //WorkflowDocument processed = WorkflowDocumentFactory.createDocument(pid, dt);
    //processed.route("routed");

    WorkflowDocument finl = WorkflowDocumentFactory.createDocument(pid, dt);
    finl.route("routed");
    finl.switchPrincipal(getPrincipalId("jhopf"));
    finl.approve("approved");
    assertEquals(DocumentStatus.FINAL, finl.getStatus());

    WorkflowDocument canceled = WorkflowDocumentFactory.createDocument(pid, dt);
    canceled.cancel("canceled");
    assertEquals(DocumentStatus.CANCELED, canceled.getStatus());

    WorkflowDocument disapproved = WorkflowDocumentFactory.createDocument(pid, dt);
    disapproved.route("routed");
    disapproved.switchPrincipal(getPrincipalId("jhopf"));
    RequestedActions ra = disapproved.getRequestedActions();
    disapproved.disapprove("disapproved");
    assertEquals(DocumentStatus.DISAPPROVED, disapproved.getStatus());

    assertDocumentStatuses(dt, pid, 1, 1, 1, 1, 0, 1, 1, 1);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:44,代码来源:DocumentSearchTest.java

示例14: testGetUserActionItemCount

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testGetUserActionItemCount() throws Exception {
    String principalId = getPrincipalIdForName("ewestfal");
    ActionListService als = KewApiServiceLocator.getActionListService();
    assertEquals("Count (test start) is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(principalId));

    WorkflowDocument document = WorkflowDocumentFactory.createDocument(principalId, SeqSetup.DOCUMENT_TYPE_NAME);
    document.route("");
    assertTrue(document.isEnroute());

    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(principalId));
    principalId = getPrincipalIdForName("bmcgough");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
            principalId));
    principalId = getPrincipalIdForName("rkirkend");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
            principalId));

    TestUtilities.assertAtNode(document, "WorkflowDocument");
    document.returnToPreviousNode("", "AdHoc");
    TestUtilities.assertAtNode(document, "AdHoc");
    // verify count after return to previous
    principalId = getPrincipalIdForName("ewestfal");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    // expect one action item for approval request
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
            principalId));
    principalId = getPrincipalIdForName("bmcgough");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertFalse(document.isApprovalRequested());
    assertTrue(document.isFYIRequested());
    // expect one action item for fyi action request
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
            principalId));
    principalId = getPrincipalIdForName("rkirkend");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertFalse(document.isApprovalRequested());
    // expect no action items
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(
            principalId));

    principalId = getPrincipalIdForName("ewestfal");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    document.approve("");
    TestUtilities.assertAtNode(document, "WorkflowDocument");

    // we should be back where we were
    principalId = getPrincipalIdForName("ewestfal");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertFalse(document.isApprovalRequested());
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(
            principalId));
    principalId = getPrincipalIdForName("bmcgough");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
            principalId));
    principalId = getPrincipalIdForName("rkirkend");
    document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
            principalId));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:68,代码来源:WorkflowUtilityTest.java

示例15: testSearching

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSearching() throws InterruptedException {
    String documentTypeName = "TestAppDocStatusDoc1";

    String initiatorNetworkId = "rkirkend";
    Person initiator = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(initiatorNetworkId);
    String approverNetworkId = "bmcgough";
    Person approver = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(approverNetworkId);
    String travelerNetworkId = "temay";
    Person traveler = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(travelerNetworkId);

    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(initiator.getPrincipalId(), documentTypeName);
    workflowDocument.setTitle("Routing style");

    // no status, not routed
    assertAppDocStatuses(workflowDocument.getDocumentId(), new String [] { });
    assertSearchStatus(documentTypeName, initiator, "Approval in Progress", 0, 0);
    assertSearchStatus(documentTypeName, initiator, "Submitted", 0, 0);

    workflowDocument.route("routing this document.");

    DocumentRouteHeaderValue drhv = KEWServiceLocator.getRouteHeaderService().getRouteHeader(workflowDocument.getDocumentId());
    
    // should be in approval status
    assertAppDocStatuses(workflowDocument.getDocumentId(), new String [] { "Approval in Progress" });
    assertSearchStatus(documentTypeName, initiator, "Approval in Progress", 1, 0); // one document currently in "Approval in Progress" status
    assertSearchStatus(documentTypeName, initiator, "Approval in Progress", 1, drhv.getRouteStatusDate().getTime()); // one transition to "Approval in Progress" status around the time of routing
    assertSearchStatus(documentTypeName, initiator, "Submitted", 0, 0); // none in "Submitted" status

    // approve it out of the "Approval in Progress" state
    workflowDocument = WorkflowDocumentFactory.loadDocument(approver.getPrincipalId(), workflowDocument.getDocumentId());
    RequestedActions actions = workflowDocument.getRequestedActions();
    assertTrue(actions.isApproveRequested());
    workflowDocument.approve("destination approval");

    assertAppDocStatuses(workflowDocument.getDocumentId(), new String [] { "Approval in Progress", "Submitted" });
    assertSearchStatus(documentTypeName, approver, "Approval in Progress", 0, 0); // no documents currently in "Approval in Progress" status
    assertSearchStatus(documentTypeName, approver, "Approval in Progress", 1, drhv.getRouteStatusDate().getTime()); // one transition to "Approval in Progress" status around the time of routing
    assertSearchStatus(documentTypeName, approver, "Submitted", 1, 0); // one document currently in "Submitted" status
    assertSearchStatus(documentTypeName, approver, "Submitted", 1, drhv.getDateLastModified().getMillis()); // one transition to "Submitted" status around the time of approval

    // approve it out of the "Approval in Progress" state
    workflowDocument = WorkflowDocumentFactory.loadDocument(traveler.getPrincipalId(), workflowDocument.getDocumentId());
    actions = workflowDocument.getRequestedActions();
    assertTrue(actions.isApproveRequested());
    workflowDocument.approve("travel approval");

    // no final status, so no transition
    assertAppDocStatuses(workflowDocument.getDocumentId(), new String [] { "Approval in Progress", "Submitted" });
    assertSearchStatus(documentTypeName, traveler, "Approval in Progress", 0, 0); // no documents currently in "Approval in Progress" status
    assertSearchStatus(documentTypeName, traveler, "Approval in Progress", 1, drhv.getRouteStatusDate().getTime()); // one transition to "Approval in Progress" status around the time of routing
    assertSearchStatus(documentTypeName, traveler, "Submitted", 1, 0); // one document currently in "Submitted" status
    assertSearchStatus(documentTypeName, traveler, "Submitted", 1, drhv.getDateLastModified().getMillis()); // one transition to "Submitted" status around the time of approval
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:54,代码来源:AppDocStatusTest.java


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