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


Java WorkflowDocument.saveDocument方法代码示例

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


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

示例1: testGetFlattenedNodeInstances

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testGetFlattenedNodeInstances() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SeqDocType");
    document.saveDocument("");
    
    DocumentRouteHeaderValue serverDocument = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
    List routeNodeInstances = routeNodeService.getFlattenedNodeInstances(serverDocument, true);
    assertEquals(1, routeNodeInstances.size());
    assertEquals("AdHoc", ((RouteNodeInstance)routeNodeInstances.get(0)).getName());
    
    document.blanketApprove("");
    assertTrue(document.isProcessed());
    
    serverDocument = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
    routeNodeInstances = routeNodeService.getFlattenedNodeInstances(serverDocument, true);
    assertEquals(4, routeNodeInstances.size());
    assertEquals("AdHoc", ((RouteNodeInstance)routeNodeInstances.get(0)).getName());
    assertEquals("WorkflowDocument", ((RouteNodeInstance)routeNodeInstances.get(1)).getName());
    assertEquals("Acknowledge1", ((RouteNodeInstance)routeNodeInstances.get(2)).getName());
    assertEquals("Acknowledge2", ((RouteNodeInstance)routeNodeInstances.get(3)).getName());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:RouteNodeServiceTest.java

示例2: testSuperUserActionRoutesDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
private String testSuperUserActionRoutesDocument(String documentType) throws Exception {
	String ewestfalPrincipalId = getPrincipalIdForName("ewestfal");
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(ewestfalPrincipalId, documentType);
    document.saveDocument("");
    // doc should saved
    assertEquals("Document should be SAVED", DocumentStatus.SAVED, document.getStatus());

    document = WorkflowDocumentFactory.loadDocument(ewestfalPrincipalId, document.getDocumentId());
    assertTrue("ewestfal should have Complete request", document.isCompletionRequested());

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertFalse("rkirkend should not have Complete request", document.isCompletionRequested());
    assertFalse("rkirkend should not have Approve request", document.isApprovalRequested());
    assertTrue("rkirkend should be a super user of the document", document.isValidAction(ActionType.SU_APPROVE));
    
    List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findAllValidRequests(ewestfalPrincipalId, document.getDocumentId(), KewApiConstants.ACTION_REQUEST_COMPLETE_REQ);
    assertEquals("There should only be 1 complete request to ewestfal as result of the save.", 1, actionRequests.size());
    document.superUserTakeRequestedAction(actionRequests.get(0).getActionRequestId().toString(), "");

    // Complete should no longer be requested
    document = WorkflowDocumentFactory.loadDocument(ewestfalPrincipalId, document.getDocumentId());
    assertFalse("ewestfal should not have Complete request", document.isCompletionRequested());

    return document.getDocumentId();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:SuperUserActionRequestApproveEventTest.java

示例3: testFalseInitiatorMustSavePolicy

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests for when INITIATOR_MUST_SAVE policy is equal to false.  In this case if non-initiator user
 * attempts a save of a document with this policy an exception should NOT be thrown
 */
@Test public void testFalseInitiatorMustSavePolicy() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCUMENT_TYPE_NAME_NON_INITIATOR);
    document.saveDocumentData();
    
    // verify that there are no requests that have been generated
    List actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
    assertEquals("There should be no action requests.", 0, actionRequests.size());
    
    // try saving as a user who's not ewestfal
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue(document.isInitiated());
    document.saveDocument("");
    
    // ensure that the document was saved and the request was generated
    assertTrue(document.isSaved());
    actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
    assertEquals("There should be one action request.", 1, actionRequests.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:SaveActionEventTest.java

示例4: testOutboxItemNotSavedOnSavedDocumentStatus

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testOutboxItemNotSavedOnSavedDocumentStatus() 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.saveDocument("");

    Collection<OutboxItem> outbox = KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter());
    assertEquals("there should not be any outbox items", 0, outbox.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:OutboxTest.java

示例5: save

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Override
public void save(WorkflowDocument workflowDocument, String annotation) throws WorkflowException {
    if (workflowDocument.isValidAction(ActionType.SAVE)) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("saving document(" + workflowDocument.getDocumentId() + ",'" + annotation + "')");
    }

    workflowDocument.saveDocument(annotation);
}
    else {
        this.saveRoutingData(workflowDocument);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:WorkflowDocumentServiceImpl.java

示例6: routeTestDoc2

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * "Saves" a single instance of a "SearchDocType2" document and returns it's id.
 */
protected String routeTestDoc2() {
    // Route some test documents.
    String docTypeName = "SearchDocType2";
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId("ewestfal"), docTypeName);
    workflowDocument.setTitle("Search Doc Type 2!");
    workflowDocument.saveDocument("saving the document");
    return workflowDocument.getDocumentId();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:DocumentSearchTest.java

示例7: testSearchableAttributeWithQuickfinder

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests the resolution to issues EN-95, KULWF-757, KULOWF-52 whereby the use of a quickfinder is causing
 * NullPointers when searching for documents.
 */
@Test public void testSearchableAttributeWithQuickfinder() throws Exception {
    String documentTypeName = "AttributeWithQuickfinderDocType";
    String key = "chart";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
     WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), documentTypeName);

     // define the chart for the searchable attribute
     WorkflowAttributeDefinition.Builder chartDef = WorkflowAttributeDefinition.Builder.create("SearchableAttributeWithQuickfinder");
     chartDef.addPropertyDefinition(key, "BL");
     document.addSearchableDefinition(chartDef.build());

     // save the document
     document.setTitle("Routin' with style");
     document.saveDocument("Savin' this document.");

     // prepare to search
     DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
     Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");

     // execute the search by our chart, we should see one result
     DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
     criteria.setDocumentTypeName(documentTypeName);
     addSearchableAttribute(criteria, key, "BL");
     DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(),
             criteria.build());
     assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
     DocumentSearchResult result = results.getSearchResults().get(0);
     String documentId = result.getDocument().getDocumentId();
     assertEquals("Wrong document in search results.", document.getDocumentId(), documentId);

     // search with no searchable attribute criteria, should return our document as well
     criteria = DocumentSearchCriteria.Builder.create();
     criteria.setDocumentTypeName(documentTypeName);
     results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
     assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
     result = results.getSearchResults().get(0);
     assertEquals("Wrong document in search results.", document.getDocumentId(), result.getDocument().getDocumentId());

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

示例8: testRecallValidActionsTaken

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

    // save and complete
    document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_RESTRICTED_DOC);
    document.saveDocument("saving");
    document.route("routing");
    document.recall("recalling", true);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:RecallActionTest.java

示例9: testAdHocWhenDocumentIsSaved

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testAdHocWhenDocumentIsSaved() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TakeWorkgroupAuthorityDoc");
    document.saveDocument("");

    // TODO test adhocing of approve requests

    assertTrue("Document should be saved.", document.isSaved());
	document.adHocToPrincipal(ActionRequestType.FYI, "AdHoc", "", getPrincipalIdForName("rkirkend"), "", true);
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
	assertTrue("rkirkend should have an FYI request", document.isFYIRequested());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:AdHocRouteTest.java

示例10: testSavedDocumentSuperUserAdhocActionsApprove

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSavedDocumentSuperUserAdhocActionsApprove() throws Exception {
String initiatorNetworkId = "ewestfal";
       WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(initiatorNetworkId), "SuperUserApproveActionRequestFyiTest");
       String adhocActionUserNetworkId = "jhopf";
       document.adHocToPrincipal(ActionRequestType.APPROVE, "", getPrincipalIdForName(adhocActionUserNetworkId), "", true);
       document.saveDocument("");
       // doc should be saved
       assertEquals("Document should be SAVED", DocumentStatus.SAVED, document.getStatus());

       document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
       assertTrue("ewestfal should have Complete request", document.isCompletionRequested());

       document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
       assertFalse("rkirkend should not have Complete request", document.isCompletionRequested());
       assertFalse("rkirkend should not have Approve request", document.isApprovalRequested());
       assertTrue("rkirkend should be a super user of the document", document.isValidAction(ActionType.SU_APPROVE));
       String adhocPrincipalId = getPrincipalIdForName(adhocActionUserNetworkId);
       List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findAllValidRequests(adhocPrincipalId, document.getDocumentId(), ActionRequestType.APPROVE.getCode());
       assertEquals("There should only be 1 approve request to " + adhocActionUserNetworkId + ".", 1, actionRequests.size());
       document.superUserTakeRequestedAction(actionRequests.get(0).getActionRequestId().toString(), "");

       // approve should no longer be requested
       document = WorkflowDocumentFactory.loadDocument(adhocPrincipalId, document.getDocumentId());
       assertFalse(adhocPrincipalId + " should not have approve request", document.isApprovalRequested());

       // complete should no longer be requested
       document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(initiatorNetworkId), document.getDocumentId());
       assertTrue(initiatorNetworkId + " should not have complete request", document.isCompletionRequested());

       // doc should still be saved
       assertEquals("Document should be SAVED", DocumentStatus.SAVED, document.getStatus());
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:SuperUserActionRequestApproveEventTest.java

示例11: testDefaultInitiatorMustSavePolicy

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests for when INITIATOR_MUST_SAVE policy is equal to true (default value).  In this case if non-initiator user
 * attempts a save of a document with this policy an exception should be thrown
 */
@Test public void testDefaultInitiatorMustSavePolicy() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCUMENT_TYPE_NAME);
	document.saveDocumentData();
	
	// verify that there are no requests that have been generated
	List actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
	assertEquals("There should be no action requests.", 0, actionRequests.size());
	
	// try saving as a user who's not ewestfal
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
	assertTrue(document.isInitiated());
	try {
		document.saveDocument("");
		fail("A WorkflowException should have been thrown.");
	} catch (InvalidActionTakenException e) {
		e.printStackTrace();
	}
	
	// ensure that the request did not get generated
	actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
	assertEquals("There should be no action requests.", 0, actionRequests.size());
	
	// now save it as the intiator and it should be successful and generate a request
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
	document.saveDocument("");
	assertTrue(document.isSaved());
	actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
	assertEquals("There should be one action request.", 1, actionRequests.size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:34,代码来源:SaveActionEventTest.java

示例12: testIsUserInRouteLog

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testIsUserInRouteLog() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), SeqSetup.DOCUMENT_TYPE_NAME);
    document.route("");
    assertTrue(document.isEnroute());
    WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("ewestfal"), false));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), false));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("temay"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("jhopf"), false));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), true));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("temay"), true));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("jhopf"), true));

    // test that we can run isUserInRouteLog on a SAVED document
    document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), SeqSetup.DOCUMENT_TYPE_NAME);
    document.saveDocument("");
    assertTrue(document.isSaved());
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("ewestfal"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("temay"), false));
    assertFalse("User should not be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("jhopf"), false));

    // now look all up in the future of this saved document
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), true));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), true));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), true));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("temay"), true));
    assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("jhopf"), true));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:35,代码来源:WorkflowUtilityTest.java

示例13: testOnlyPersonWhoTookActionReceivesOutboxItem_BlanketApprove

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testOnlyPersonWhoTookActionReceivesOutboxItem_BlanketApprove() throws Exception {
    final String rkirkendPrincipalId = getPrincipalIdForName("rkirkend");
    final String user1PrincipalId = getPrincipalIdForName("user1");
    List<String> recipients = new ArrayList<String>();
    recipients.add(rkirkendPrincipalId);
    recipients.add(user1PrincipalId);
    TestRuleAttribute.setRecipientPrincipalIds("TestRole", "qualRole", recipients);

    turnOnOutboxForUser(rkirkendPrincipalId);
    turnOnOutboxForUser(user1PrincipalId);

    WorkflowDocument document = WorkflowDocumentFactory.createDocument(rkirkendPrincipalId, "TestDocumentType");
    document.blanketApprove("");
    // verify only user who took action has the outbox item
    assertEquals("Wrong number of outbox items found for rkirkend", 0, KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter()).size());
    assertEquals("Wrong number of outbox items found for user1", 0, KEWServiceLocator.getActionListService().getOutbox(user1PrincipalId, new ActionListFilter()).size());

    document = WorkflowDocumentFactory.createDocument(rkirkendPrincipalId, "TestDocumentType");
    document.saveDocument("");
    // verify test is sane and users have action items
    assertEquals("Wrong number of action items found for rkirkend", 1, KEWServiceLocator.getActionListService().getActionList(rkirkendPrincipalId, new ActionListFilter()).size());
    // verify that outboxes of two users are clear
    assertEquals("Wrong number of outbox items found for rkirkend", 0, KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter()).size());
    assertEquals("Wrong number of outbox items found for user1", 0, KEWServiceLocator.getActionListService().getOutbox(user1PrincipalId, new ActionListFilter()).size());

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    document.blanketApprove("");
    // verify only user who took action has the outbox item
    assertEquals("Wrong number of outbox items found for rkirkend", 1, KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter()).size());
    assertEquals("Wrong number of outbox items found for user1", 0, KEWServiceLocator.getActionListService().getOutbox(user1PrincipalId, new ActionListFilter()).size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:OutboxTest.java

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

示例15: testEmptyPostProcessor

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 test that an empty post processor works.  The empty post processor should be handled as a DefaultPostProcessor.
    */
   
@Test public void testEmptyPostProcessor() throws Exception {
       WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "testEmptyPostProcessor");
       document.saveDocument("");
       assertEquals("application content should be empty initially", "", document.getApplicationContent());
       assertTrue("Doc title should be empty initially", StringUtils.isBlank(document.getTitle()));
       
       assertTrue("Document should be final.", document.isFinal());
              
       DocumentType testEmptyDocType = KEWServiceLocator.getDocumentTypeService().findByName("testEmptyPostProcessor");
       assertTrue("Post Processor should be set to 'none'",  StringUtils.equals("none", testEmptyDocType.getPostProcessorName()));
       assertTrue("Post Processor should be of type DefaultPostProcessor", testEmptyDocType.getPostProcessor() instanceof org.kuali.rice.kew.postprocessor.DefaultPostProcessor);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:23,代码来源:PostProcessorTest.java


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