本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.revokeAdHocRequests方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.revokeAdHocRequests方法的具体用法?Java WorkflowDocument.revokeAdHocRequests怎么用?Java WorkflowDocument.revokeAdHocRequests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.revokeAdHocRequests方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRevokeByUserAndGroup
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests revoking by user and workgroup.
*/
@Test public void testRevokeByUserAndGroup() throws Exception {
// ad hoc the document to dewey (twice) and the workgroup WorkflowAdmin
WorkflowDocument doc =WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADH0C_DOC);
docId = doc.getDocumentId();
String principalId = getPrincipalIdForName("dewey");
doc.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "annotationDewey1", principalId, "respDesc1", false);
doc.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "annotationDewey2", principalId, "respDesc1", false);
String groupId = getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "WorkflowAdmin");
doc.adHocToGroup(ActionRequestType.APPROVE, "AdHoc", "Annotation WorkflowAdmin", groupId, "respDesc2", true);
TestUtilities.assertNumberOfPendingRequests(docId, 3);
TestUtilities.assertUserHasPendingRequest(docId, "dewey");
TestUtilities.assertUserHasPendingRequest(docId, "quickstart");
// route the document, this should activate the ad hoc requests
doc.route("");
assertTrue(doc.isEnroute());
TestUtilities.assertAtNodeNew(doc, "AdHoc");
TestUtilities.assertNumberOfPendingRequests(docId, 3);
String testGroupId = getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "TestWorkgroup");
// try revoking by a user and workgroup without adhoc requests, it should effectively be a no-op
AdHocRevoke revoke = AdHocRevoke.createRevokeFromPrincipal(getPrincipalIdForName("ewestfal"));
doc.revokeAdHocRequests(revoke, "This should be a no-op");
revoke = AdHocRevoke.createRevokeFromGroup(testGroupId);
doc.revokeAdHocRequests(revoke, "This should be a no-op");
doc = getDocument("rkirkend");
TestUtilities.assertNumberOfPendingRequests(docId, 3);
TestUtilities.assertUserHasPendingRequest(docId, "dewey");
TestUtilities.assertUserHasPendingRequest(docId, "quickstart");
// now revoke each request in turn, after the second one is invoked the document should transition to it's next route level
// and route to user1
revoke = AdHocRevoke.createRevokeFromPrincipal(getPrincipalIdForName("dewey"));
doc.revokeAdHocRequests(revoke, "revokeUser");
TestUtilities.assertNumberOfPendingRequests(docId, 1);
doc = getDocument("dewey");
assertFalse("dewey should no longer have an approve request.", doc.isApprovalRequested());
revoke = AdHocRevoke.createRevokeFromGroup(groupId);
doc.revokeAdHocRequests(revoke, "revokeWorkgroup");
// the doc should now transition to the next node
doc = getDocument("user1");
TestUtilities.assertAtNodeNew(doc, "One");
assertTrue("user1 should have an approve request.", doc.isApprovalRequested());
doc.approve("");
// doc should now be final
assertTrue("doc should be final", doc.isFinal());
}
示例2: testRevokeByNodeName
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests revoking by node name.
*/
@Test public void testRevokeByNodeName() throws Exception {
// ad hoc requests at the AdHoc node and then revoke the entire node
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADH0C_DOC);
docId = doc.getDocumentId();
doc.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "annotationDewey1", getPrincipalIdForName("dewey"), "respDesc1", false);
String groupId = getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "WorkflowAdmin");
doc.adHocToGroup(ActionRequestType.APPROVE, "AdHoc", "Annotation WorkflowAdmin", groupId, "respDesc2", true);
TestUtilities.assertNumberOfPendingRequests(docId, 2);
// now revoke the node
doc.revokeAdHocRequests(AdHocRevoke.createRevokeAtNode("AdHoc"), "");
TestUtilities.assertNumberOfPendingRequests(docId, 0);
// send an Acknowledge to the AdHoc node prior to routing
doc.adHocToPrincipal(ActionRequestType.ACKNOWLEDGE, "AdHoc", "annotationEwestfal1", getPrincipalIdForName("ewestfal"), "respDesc1", false);
// route the document
doc = getDocument("rkirkend");
doc.route("");
TestUtilities.assertAtNodeNew(doc, "One");
// ewestfal should have an acknowledge request
doc = getDocument("ewestfal");
assertTrue(doc.isAcknowledgeRequested());
// approve the document, it should go PROCESSED
doc = getDocument("user1");
assertTrue(doc.isApprovalRequested());
doc.approve("");
assertTrue(doc.isProcessed());
// revoke at the "One" node where there are no requests, it should be a no-op (the document should stay processed)
doc.revokeAdHocRequests(AdHocRevoke.createRevokeAtNode("One"), "");
doc = getDocument("ewestfal");
assertTrue(doc.isProcessed());
// now revoke the ACKNOWLEDGE to ewestfal by revoking at the "AdHoc" node, the document should go FINAL
doc.revokeAdHocRequests(AdHocRevoke.createRevokeAtNode("AdHoc"), "");
doc = getDocument("ewestfal");
assertTrue(doc.isFinal());
}