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


Java WorkflowDocument.setApplicationDocumentStatus方法代码示例

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


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

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

示例2: testInvalidAppDocStatusValue

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * 
 * This test attempts to set an invalid status value for a document that has a valid set
 * of statuses defined.
 * It expects to throw a WorkflowRuntimeException when attempting to set the invalid status value.
 * 
 * @throws Exception
 */
@Test public void testInvalidAppDocStatusValue() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TestAppDocStatusDoc2");
	document.saveDocumentData();
	assertNotNull(document.getDocumentId());
	assertTrue("Document should be initiatied", document.isInitiated());
	assertTrue("Invalid route level.", document.getNodeNames().contains("Initiated"));
	    	
	// update the AppDocStatus via client API
	boolean gotException = false;
	try {
		document.setApplicationDocumentStatus("BAD STATUS");
		document.saveDocumentData();
	} catch (Throwable t){
		gotException = true;
		WorkflowRuntimeException ex = new WorkflowRuntimeException();
		assertEquals("WrongExceptionType", t.getClass(), ex.getClass());
	} finally {
		assertTrue("Expected WorkflowRuntimeException not thrown.", gotException);
		
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:30,代码来源:AppDocStatusTest.java

示例3: testGetAppDocStatus

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

    String appDocStatus = KewApiServiceLocator.getWorkflowDocumentService().getApplicationDocumentStatus(document.getDocumentId());
    assertNull("appDocStatus should be null", appDocStatus);

    String appDocStatusValue = "Approved";
    document.setApplicationDocumentStatus(appDocStatusValue);
    document.saveDocumentData();

    appDocStatus = KewApiServiceLocator.getWorkflowDocumentService().getApplicationDocumentStatus(document.getDocumentId());
    assertEquals("Incorrect appDocStatus", appDocStatusValue, appDocStatus);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:WorkflowInfoTest.java

示例4: testRecallPermissionTemplate

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

    // nope, technical admins can't recall
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("admin"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));

    // create a recall permission for the RECALL_TEST_DOC doctype
    Permission perm = createRecallPermission(RECALL_TEST_DOC, PERM_APP_DOC_STATUS, ROUTE_NODE, ROUTE_STATUS);

    // assign the permission to Technical Administrator role
    Role techadmin = KimApiServiceLocator.getRoleService().getRoleByNamespaceCodeAndName("KR-SYS", "Technical Administrator");
    KimApiServiceLocator.getRoleService().assignPermissionToRole(perm.getId(), techadmin.getId());

    // our recall permission is assigned to the technical admin role

    // but the doc will not match...
    document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_NOTIFY_TEST_DOC);
    document.route(PERM_APP_DOC_STATUS);
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("admin"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));

    // .. the app doc status will not match...
    document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
    document.route("");
    // technical admins can't recall since the app doc status is not correct
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("admin"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));

    // ... the node will not match ...
    document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
    document.route("");
    WorkflowDocumentFactory.loadDocument(JHOPF, document.getDocumentId()).approve(""); // approve past notifyfirstnode
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("admin"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));

    // ... the doc status will not match (not recallable anyway) ...
    document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
    document.route("");
    document.cancel("cancelled");
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("admin"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
    assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));

    // everything should match
    document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
    document.setApplicationDocumentStatus(PERM_APP_DOC_STATUS);
    document.route("");
    // now technical admins can recall by virtue of having the recall permission on this doc
    assertTrue(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("admin"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
    assertTrue(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId()).getValidActions().getValidActions().contains(ActionType.RECALL));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:53,代码来源:RecallActionTest.java


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