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


Java WorkflowDocument.complete方法代码示例

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


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

示例1: testRecallToActionListAsInitiatorBeforeAnyApprovals

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

    document.recall("recalling", false);

    assertTrue("Document should be saved", document.isSaved());
    assertEquals(1, document.getCurrentNodeNames().size());
    assertTrue(document.getCurrentNodeNames().contains("AdHoc"));
    assertAfterActionTakenCalled(ActionType.RECALL, ActionType.COMPLETE);

    // initiator has completion request
    assertTrue(document.isCompletionRequested());
    // can't recall saved doc
    assertFalse(document.getValidActions().getValidActions().contains(ActionType.RECALL));

    // first approver has FYI
    assertTrue(WorkflowDocumentFactory.loadDocument(JHOPF, document.getDocumentId()).isFYIRequested());

    document.complete("completing");

    assertTrue("Document should be enroute", document.isEnroute());

    assertTrue(WorkflowDocumentFactory.loadDocument(JHOPF, document.getDocumentId()).isApprovalRequested());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:RecallActionTest.java

示例2: testPreapprovals

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testPreapprovals() throws Exception {
	WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "PreApprovalTest");
	doc.route("");
	
	//rock some preapprovals and other actions... 
	doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
	doc.approve("");
	
	doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
	doc.acknowledge("");
	
	doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
	doc.complete("");
	
	//approve as the person the doc is routed to so we can move the documen on and hopefully to final
	doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
	doc.approve("");
	
	doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
	assertTrue("the document should be final", doc.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:ApproveActionTest.java

示例3: testInitiatorRole

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testInitiatorRole() throws Exception {
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "InitiatorRoleApprovalTest");
    doc.route("");
    //rock some preapprovals and other actions... 
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
    doc.approve("");
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
    doc.acknowledge("");
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
    doc.complete("");

    assertFalse("the document should NOT be final", doc.isFinal());

    //approve as the person the doc is routed (initiator) to so we can move the document on and hopefully to final
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
    doc.approve("");
    
    assertTrue("the document should be final", doc.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:ApproveActionTest.java

示例4: complete

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
    * Completes workflow document
    *
    * @see WorkflowDocumentService#complete(org.kuali.rice.kew.api.WorkflowDocument, String, java.util.List)
    */
   @Override
public void complete(WorkflowDocument workflowDocument, String annotation, List adHocRecipients) throws WorkflowException {
       if (LOG.isDebugEnabled()) {
           LOG.debug("routing flexDoc(" + workflowDocument.getDocumentId() + ",'" + annotation + "')");
       }
       handleAdHocRouteRequests(workflowDocument, annotation, filterAdHocRecipients(adHocRecipients, new String[] { KewApiConstants.ACTION_REQUEST_COMPLETE_REQ,KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KewApiConstants.ACTION_REQUEST_FYI_REQ, KewApiConstants.ACTION_REQUEST_APPROVE_REQ }));
       workflowDocument.complete(annotation);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:WorkflowDocumentServiceImpl.java

示例5: 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

示例6: testParallelExceptionRouting

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testParallelExceptionRouting() throws Exception {
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "ExceptionRoutingParallelDoc");
    doc.route("");
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
    assertTrue("User should have an approve request", doc.isApprovalRequested());
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), doc.getDocumentId());
    assertTrue("User should have an approve request", doc.isApprovalRequested());
    List<RouteNodeInstance> nodes = KewApiServiceLocator.getWorkflowDocumentService().getActiveRouteNodeInstances(
            doc.getDocumentId());

    // at this point we should be at RouteNode1 and RouteNode3
    assertEquals("There should be two active nodes", 2, nodes.size());
    TestUtilities.assertAtNode(doc, "RouteNode1");
    TestUtilities.assertAtNode(doc, "RouteNode3");

    try {
        doc.approve("");
        fail("should have generated routing exception");
    } catch (Exception e) {
    }

    TestUtilities.getExceptionThreader().join();//this is necessary to ensure that the exception request will be generated.
    List<ActionRequest> actionRequests = KewApiServiceLocator.getWorkflowDocumentService().getRootActionRequests(doc.getDocumentId());
    RouteNodeInstance routeNode1 = null;
    for (RouteNodeInstance nodeInstanceVO : nodes) {
    	if (nodeInstanceVO.getName().equals("RouteNode1")) {
    		routeNode1 = nodeInstanceVO;
    	}
    }
    assertNotNull("Could not locate the routeNode1 node instance.", routeNode1);

    boolean hasCompleteRequest = false;
    for (ActionRequest actionRequest : actionRequests) {
        if (actionRequest.isCompleteRequest()) {
        	Group group = KimApiServiceLocator.getGroupService().getGroup(actionRequest.getGroupId());
            assertTrue("Complete should be requested", actionRequest.isCompleteRequest());
            assertTrue("Request should be a workgroup request", actionRequest.isGroupRequest());
            assertNull("For exception routing, node instance should have a null id.", actionRequest.getRouteNodeInstanceId());
            //assertEquals("Node instance id should be id of routeNode1", routeNode1.getRouteNodeInstanceId(), actionRequest.getNodeInstanceId());
            assertEquals("Request should be to 'ExceptionRoutingGroup'", "ExceptionRoutingGroup", group.getName());
            hasCompleteRequest = true;
        }
    }
    assertTrue("Document should have had a complete request", hasCompleteRequest);
    ExplodingRuleAttribute.dontExplode=true;

    //there should be a single action item to our member of the exception workgroup
    Collection actionItems = KEWServiceLocator.getActionListService().findByDocumentId(doc.getDocumentId());
    assertEquals("There should only be action items for the member of our exception workgroup", 1, actionItems.size());

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
    assertTrue("Document should be routing for completion to member of exception workgroup", doc.isCompletionRequested());
    assertTrue("Document should be in exception status", doc.isException());
    doc.complete("");

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), doc.getDocumentId());
    doc.approve("");

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
    doc.approve("");

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
    doc.approve("");

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), doc.getDocumentId());
    doc.approve("");

    assertTrue("Document should be final", doc.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:70,代码来源:ExceptionRoutingTest.java

示例7: testRequeueOfExceptionDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Test to verify the fix for KULWF-669.
 *
 * This tests that if we requeue an exception document (through the RouteQueueService) that it doesn't transition
 * out of exception routing.  Then check that, if we complete it, it properly transitions out of exception routing.
 */
@Test public void testRequeueOfExceptionDocument() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "AdhocTransitionTestDocument");
	document.route("");
    assertFalse("Document should not be in exception routing.", document.isException());

    // in fact, at this point it should be routed to jhopf
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
    assertTrue("Jhopf should have an approve.", document.isApprovalRequested());

    // let's tell it to blow up on level change
    ExceptionRoutingTestPostProcessor.THROW_ROUTE_STATUS_CHANGE_EXCEPTION = true;
    try {
    	document.approve("");
    	fail("We should be in exception routing");
	} catch (Exception e) {
	}

	TestUtilities.waitForExceptionRouting();
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertEquals("document should be in exception routing", DocumentStatus.EXCEPTION, document.getStatus());

	// now requeue the document it should stay at exception routing and the status change callback should not
	// indicate a transition out of exception routing (this is to make sure it's not going out of exception
	// routing and then right back in)
	ExceptionRoutingTestPostProcessor.THROW_ROUTE_STATUS_CHANGE_EXCEPTION = false;
	assertFalse("Should not have transitioned out of exception routing yet.", ExceptionRoutingTestPostProcessor.TRANSITIONED_OUT_OF_EXCEPTION_ROUTING);
	// the requeue here should happen synchronously because we are using the SynchronousRouteQueue
	DocumentRouteHeaderValue routeHeaderValue = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
    String applicationId = routeHeaderValue.getDocumentType().getApplicationId();
    DocumentProcessingQueue documentProcessingQueue = KewApiServiceLocator.getDocumentProcessingQueue(document.getDocumentId(), applicationId);
	documentProcessingQueue.process(String.valueOf(document.getDocumentId()));

	// the document should still be in exception routing
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertEquals("document should be in exception routing", DocumentStatus.EXCEPTION, document.getStatus());
    assertFalse("document shouldn't have transitioned out of exception routing.", ExceptionRoutingTestPostProcessor.TRANSITIONED_OUT_OF_EXCEPTION_ROUTING);

    // now turn status change exceptions off and complete the exception request
    ExceptionRoutingTestPostProcessor.THROW_ROUTE_STATUS_CHANGE_EXCEPTION = false;
    assertTrue("rkirkend should be in the exception workgroup.", document.isCompletionRequested());
    document.complete("Completing out of exception routing.");

    // Note: The behavior here will be a bit different then in a real setting because in these tests the route queue is synchronous so jhopf's original
    // Approve never actually took place because the transaction was rolled back (because of the exception in the post process).  Therefore, we still
    // need to take action as him again to push the document to FINAL
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
    assertTrue(document.isApprovalRequested());
    document.approve("");

    // document should now be FINAL
    assertTrue("Document should be FINAL.", document.isFinal());

    // the status change out of exception routing should have happened
    assertTrue("Document should have transitioned out of exception routing.", ExceptionRoutingTestPostProcessor.TRANSITIONED_OUT_OF_EXCEPTION_ROUTING);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:62,代码来源:ExceptionRoutingTest.java

示例8: testFinalDocumentExceptionRoutingRecovery

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests that a FINAL document can go into exception routing and recover
 * properly while only calling the PROCESSED and FINAL callbacks once.
 */
@Test public void testFinalDocumentExceptionRoutingRecovery() throws Exception {

	// route the document to final
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SimpleDocType");
	document.route("");
	assertTrue("Document should be final.", document.isFinal());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);

	// now queue up an exploder which should push the document into
	// exception routing
	JavaServiceDefinition serviceDef = new JavaServiceDefinition();
	serviceDef.setPriority(new Integer(1));
	serviceDef.setQueue(true);
	serviceDef.setRetryAttempts(0);
	serviceDef.setServiceInterface(KSBJavaService.class.getName());
	serviceDef.setServiceName(new QName("KEW", "exploader"));
	serviceDef.setService(new ImTheExploderProcessor());

	serviceDef.setMessageExceptionHandler(DocumentMessageExceptionHandler.class.getName());
	serviceDef.validate();
	KsbApiServiceLocator.getServiceBus().publishService(serviceDef, true);

       DocumentRouteHeaderValue routeHeader = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
       String applicationId = routeHeader.getDocumentType().getApplicationId();

       KSBJavaService exploderAsService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(new QName(
               "KEW", "exploader"), null, null, routeHeader.getDocumentId(), null);
       exploderAsService.invoke("");
	TestUtilities.waitForExceptionRouting();

	// the document should be in exception routing now
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
	assertTrue("Document should be in exception routing.", document.isException());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);

	assertTrue("ewestfal should have a complete request.", document.isCompletionRequested());
	document.complete("");

	// the document should be final once again
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
	assertTrue("Document should be final.", document.isFinal());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:51,代码来源:StandardWorkflowEngineTest.java

示例9: testVariables

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testVariables() throws Exception {
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "VariablesTest");
    doc.route("");

    //rock some preapprovals and other actions...
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
    dumpInfoAboutDoc(doc);
    doc.setVariable("myexcellentvariable", "righton");
    doc.approve("");
    assertEquals("startedVariableValue", doc.getVariableValue("started"));
    assertEquals("startedVariableValue", doc.getVariableValue("copiedVar"));

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
    assertEquals("righton", doc.getVariableValue("myexcellentvariable"));
    doc.setVariable("vartwo", "two");
    doc.setVariable("myexcellentvariable", "ichangedit");
    doc.acknowledge("");

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
    assertEquals("ichangedit", doc.getVariableValue("myexcellentvariable"));
    assertEquals("two", doc.getVariableValue("vartwo"));
    doc.setVariable("another", "another");
    doc.setVariable("vartwo", null);
    doc.complete("");

    //approve as the person the doc is routed to so we can move the documen on and hopefully to final
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
    assertEquals("ichangedit", doc.getVariableValue("myexcellentvariable"));
    assertEquals(null, doc.getVariableValue("vartwo"));
    assertEquals("another", doc.getVariableValue("another"));
    doc.approve("");

    assertEquals("endedVariableValue", doc.getVariableValue("ended"));
    assertNotNull(doc.getVariableValue("google"));
    LOG.info(doc.getVariableValue("google"));
    assertEquals("documentContentendedVariableValue", doc.getVariableValue("xpath"));
    LOG.info(doc.getVariableValue("xpath"));

    assertEquals("aNewStartedVariableValue", doc.getVariableValue("started"));

    assertTrue("the document should be final", doc.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:43,代码来源:VariablesTest.java

示例10: takeAction

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
public static void takeAction(WorkflowDocument document, Document dom, EDLContext edlContext)
        throws WorkflowException {
    RequestParser requestParser = edlContext.getRequestParser();
    UserAction userAction = edlContext.getUserAction();
    String annotation = requestParser.getParameterValue("annotation");
    String action = userAction.getAction();
    String previousNodeName = requestParser.getParameterValue("previousNode");

    if (!userAction.isValidatableAction()) {
        // if the action's not validatable, clear the attribute definitions because we don't want to end up executing validateClientRoutingData()
        // TODO the problem here is that the XML is still updated on a cancel so we end up without any attribute content in the document content
        document.clearAttributeDefinitions();
    }

    boolean actionTaken = true;

    if (UserAction.ACTION_ROUTE.equals(action)) {
        document.route(annotation);
    }else if(UserAction.ACTION_CREATE.equals(action)){
           document.saveDocumentData();
    }
    else if (UserAction.ACTION_APPROVE.equals(action)) {
        document.approve(annotation);
    } else if (UserAction.ACTION_DISAPPROVE.equals(action)) {
        document.disapprove(annotation);
    } else if (UserAction.ACTION_CANCEL.equals(action)) {
        document.cancel(annotation);
    } else if (UserAction.ACTION_BLANKETAPPROVE.equals(action)) {
        document.blanketApprove(annotation);
    } else if (UserAction.ACTION_FYI.equals(action)) {
        document.fyi();
    } else if (UserAction.ACTION_ACKNOWLEDGE.equals(action)) {
        document.acknowledge(annotation);
    } else if (UserAction.ACTION_SAVE.equals(action)) {
        if (document.getStatus().equals(DocumentStatus.INITIATED)) {
            document.saveDocument(annotation);
        } else {
            document.saveDocumentData();
        }
    } else if (UserAction.ACTION_COMPLETE.equals(action)) {
        document.complete(annotation);
    } else if (UserAction.ACTION_DELETE.equals(action)) {
        document.delete();
    } else if (UserAction.ACTION_RETURN_TO_PREVIOUS.equals(action)) {
        document.returnToPreviousNode(annotation, previousNodeName);
    } else {
        actionTaken = false;
    }

    if (actionTaken) {
        Element actionTakenElement = EDLXmlUtils.getOrCreateChildElement(dom.getDocumentElement(), ACTION_TAKEN,
                true);
        actionTakenElement.appendChild(dom.createTextNode(action));
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:56,代码来源:WorkflowDocumentActions.java


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