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


Java WorkflowDocument.cancel方法代码示例

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


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

示例1: cancel

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

    workflowDocument.cancel(annotation);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:9,代码来源:WorkflowDocumentServiceImpl.java

示例2: testInitiatorOnlyCancel

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testInitiatorOnlyCancel() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), document.getDocumentId());
    try {
        document.cancel("");
        fail("Document should not be allowed to be cancelled due to initiator check.");
    } catch (Exception e) {
        
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:CancelActionTest.java

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

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

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

示例6: testCancel

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testCancel() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
    document.route("");
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
    document.approve("");
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
    document.approve("");//ewestfal had force action rule
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    document.approve("");
    
    //this be the role delegate of jitrue
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("natjohns"), document.getDocumentId());
    document.approve("");
    
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    document.cancel("");
    
    assertTrue("Document should be disapproved", document.isCanceled());

    //verify that the document is truly dead - no more action requests or action items.
    
    List requests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
    assertEquals("Should not have any active requests", 0, requests.size());
    
    Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().findByDocumentId(document.getDocumentId());
    assertEquals("Should not have any action items", 0, actionItems.size());
    
    
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:CancelActionTest.java


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