本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.getRootActionRequests方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.getRootActionRequests方法的具体用法?Java WorkflowDocument.getRootActionRequests怎么用?Java WorkflowDocument.getRootActionRequests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.getRootActionRequests方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearAllFyisAndAcknowledgeNotificationWorkflowDocument
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.ken.service.NotificationWorkflowDocumentService#clearAllFyisAndAcknowledgeNotificationWorkflowDocument(java.lang.String,
* org.kuali.rice.ken.document.kew.NotificationWorkflowDocument, java.lang.String)
*/
public void clearAllFyisAndAcknowledgeNotificationWorkflowDocument(String initiatorUserId,
WorkflowDocument workflowDocument, String annotation) {
List<ActionRequest> reqs = workflowDocument.getRootActionRequests();
for (int i = 0; i < reqs.size(); i++) {
LOG.info("Action Request[" + i + "] = " + reqs.get(i).getActionRequested());
if (reqs.get(i).getActionRequested().equals(ActionRequestType.ACKNOWLEDGE)) {
workflowDocument.acknowledge(annotation);
} else if (reqs.get(i).getActionRequested().equals(ActionRequestType.FYI)) {
workflowDocument.logAnnotation(annotation);
workflowDocument.fyi();
} else {
throw new WorkflowRuntimeException("Invalid notification action request in workflow document ("
+ workflowDocument.getDocumentId()
+ ") was encountered. Should be either an acknowledge or fyi and was not.");
}
}
}
示例2: testCreateActionItemForActionRequest
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testCreateActionItemForActionRequest() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"),
"ActionListDocumentType");
document.route("");
List<ActionRequest> requests = document.getRootActionRequests();
assertTrue("there must be ActionRequestDTOs to test!", requests != null && requests.size() > 0);
for (ActionRequest reqDTO : requests) {
if (reqDTO.getParentActionRequestId() == null) {
ActionRequestValue reqVal = ActionRequestValue.from(reqDTO);
List<ActionItem> actionItems = new ArrayList<ActionItem>();
actionItems.add(getActionListService().createActionItemForActionRequest(reqVal));
assertTrue(actionItems.size() > 0);
}
}
}
示例3: testRoleDelegate
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testRoleDelegate() throws Exception{
this.createDelegate();
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "RoleRouteModuleTest2");
document.route("");
String ewestfalPrincipalId = getPrincipalIdForName("ewestfal");
// now our fancy new delegate should have an action request
document = WorkflowDocumentFactory.loadDocument(ewestfalPrincipalId, document.getDocumentId());
assertTrue("ewestfal should be able to approve", document.isApprovalRequested());
// let's look at the action requests, there should be 3 root requests, each one should have a delegation to ewestfal
List<ActionRequest> actionRequests = document.getRootActionRequests();
assertEquals(3, actionRequests.size());
for (ActionRequest actionRequest : actionRequests) {
// none of the root requests should be to ewestfal
assertFalse(ewestfalPrincipalId.equals(actionRequest.getPrincipalId()));
// but all of the delegate requests should!
assertEquals(1, actionRequest.getChildRequests().size());
ActionRequest delegateRequest = actionRequest.getChildRequests().get(0);
assertEquals(ewestfalPrincipalId, delegateRequest.getPrincipalId());
assertEquals("Delegation type should been PRIMARY", DelegationType.PRIMARY, delegateRequest.getDelegationType());
}
}
示例4: testRoutingToEmptyWorkgroup
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testRoutingToEmptyWorkgroup() throws Exception {
String user1PrincipalId = getPrincipalIdForName("user1");
String user2PrincipalId = getPrincipalIdForName("user2");
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(user1PrincipalId, "EmptyWorkgroupDocType");
doc = WorkflowDocumentFactory.loadDocument("user1", doc.getDocumentId());
doc.route("");
// the document should skip node 1 because it is routing to user1, it should
// skip node 2 (effectively) because that node is using a group with no members,
// and then it should land on node 3 being in user 2's action list
doc = WorkflowDocumentFactory.loadDocument(user2PrincipalId, doc.getDocumentId());
assertTrue("Document should be enroute", doc.isEnroute());
TestUtilities.assertAtNode(doc, "Node3");
TestUtilities.assertInActionList(user2PrincipalId, doc.getDocumentId());
// verify that an action request was generated at Node 2 to the "EmptyWorkgroup" but was immediately deactivated
List<ActionRequest> actionRequests = doc.getRootActionRequests();
for (ActionRequest actionRequest : actionRequests) {
if ("Node2".equals(actionRequest.getNodeName())) {
assertTrue("action request should be for a group", actionRequest.isGroupRequest());
assertTrue("action request should be marked as \"done\"", actionRequest.isDone());
assertTrue("Group should have no members.", KimApiServiceLocator.getGroupService().getMemberPrincipalIds(
actionRequest.getGroupId()).isEmpty());
}
}
}
示例5: testParallelAdHocRouting
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testParallelAdHocRouting() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADHOC_DOC);
docId = doc.getDocumentId();
doc.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "annotation1", getPrincipalIdForName("dewey"), "respDesc1", false);
doc = getDocument("dewey");
assertFalse("User andlee should not have an approve request yet. Document not yet routed.", doc.isApprovalRequested());
doc.adHocToGroup(ActionRequestType.APPROVE, "AdHoc", "annotation2", getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "WorkflowAdmin"), "respDesc2", true);
doc = getDocument("quickstart");
assertFalse("User should not have approve request yet. Document not yet routed.", doc.isApprovalRequested());
doc = getDocument("rkirkend");
doc.route("");
// there should be two adhoc requests
List<ActionRequest> actionRequests = doc.getRootActionRequests();
for (ActionRequest actionRequest : actionRequests) {
assertTrue("Request should be an adhoc request.", actionRequest.isAdHocRequest());
}
//all users should now have active approvals
WorkflowDocument deweyDoc = getDocument("dewey");
assertTrue("Dewey should have an approve request", deweyDoc.isApprovalRequested());
doc = getDocument("ewestfal");// test that more than 1 member got
// requests
assertTrue("WorkflowAdmin should have an approve request", doc.isApprovalRequested());
deweyDoc.approve("");
doc.approve("");
doc = getDocument("user1");//this dude has a rule in ActionsConfig.xml
doc.approve("");
assertTrue("The document should be final", doc.isFinal());
}
示例6: dumpInfoAboutDoc
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
private void dumpInfoAboutDoc(WorkflowDocument doc) throws WorkflowException {
LOG.info("\tDoc: class=" + doc.getDocumentTypeName() + " title=" + doc.getTitle() + " status=" + doc.getStatus());
LOG.info("\tActionRequests:");
for (ActionRequest ar: doc.getRootActionRequests()) {
LOG.info("\t\tId: " + ar.getId() + " PrincipalId: " + ar.getPrincipalId() + " ActionRequested: " + ar.getActionRequested() + " ActionTaken: " + (ar.getActionTaken() != null ? ar.getActionTaken().getActionTaken() : null) + " NodeName: " + ar.getNodeName() + " Status:" + ar.getStatus());
}
LOG.info("\tActionTakens:");
for (ActionTaken at: doc.getActionsTaken()) {
LOG.info("\t\tId: " + at.getId() + " PrincipalId: " + at.getPrincipalId() + " ActionTaken: " + at.getActionTaken());
}
LOG.info("\tNodeNames:");
for (String name: doc.getNodeNames()) {
LOG.info("\t\t" + name);
}
}
示例7: testNotificationSuppressionKeys
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests that the notification suppression keys work equivalently for ActionRequestDTO and
* ActionRequestValue
*
* @throws Exception
*/
@Test
public void testNotificationSuppressionKeys() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"),
TEST_DOC_TYPE);
document.route("");
List<ActionRequest> requests = document.getRootActionRequests();
assertTrue("there must be ActionRequestDTOs to test!", requests != null && requests.size() > 0);
NotificationSuppression notificationSuppression = new NotificationSuppression();
boolean atLeastOne = false;
for (ActionRequest reqDTO : requests)
if (reqDTO.getParentActionRequestId() == null) {
atLeastOne = true;
ActionRequestValue reqVal = ActionRequestValue.from(reqDTO);
assertTrue(CollectionUtils.isEqualCollection(
notificationSuppression.getSuppressNotifyNodeStateKeys(reqVal),
notificationSuppression.getSuppressNotifyNodeStateKeys(reqDTO)));
// test that changing the responsible party changes the key
ActionRequest.Builder builder = ActionRequest.Builder.create(reqDTO);
builder.setPrincipalId("asdf");
reqDTO = builder.build();
assertFalse(CollectionUtils.isEqualCollection(
notificationSuppression.getSuppressNotifyNodeStateKeys(reqVal),
notificationSuppression.getSuppressNotifyNodeStateKeys(reqDTO)));
}
assertTrue(atLeastOne);
}
示例8: testActionItemFiltering
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* test that ActionItemS are filtered when a corresponding notification suppression NodeState is
* present in the related RouteNodeInstance
*
* @throws Exception
*/
@Test
public void testActionItemFiltering() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"),
TEST_DOC_TYPE);
document.route("");
List<ActionRequest> requests = document.getRootActionRequests();
assertTrue("there must be ActionRequestDTOs to test!", requests != null && requests.size() > 0);
NotificationSuppression notificationSuppression = new NotificationSuppression();
boolean atLeastOne = false;
for (ActionRequest reqDTO : requests) {
if (reqDTO.getParentActionRequestId() == null) {
atLeastOne = true;
ActionRequestValue reqVal = ActionRequestValue.from(reqDTO);
List<ActionItem> actionItems = new ArrayList<ActionItem>();
actionItems.add(KEWServiceLocator.getActionListService().createActionItemForActionRequest(reqVal));
RouteNodeInstance routeNodeInstance = new RouteNodeInstance();
// if there is no notification suppression state, nothing should be filtered
int actionItemsCount = actionItems.size();
notificationSuppression.filterNotificationSuppressedActionItems(actionItems, routeNodeInstance);
assertTrue(actionItemsCount == actionItems.size());
// if there is a suppression state for this ActionRequestValue, the ActionItem(s) should be filtered
notificationSuppression.addNotificationSuppression(routeNodeInstance, reqVal);
notificationSuppression.filterNotificationSuppressedActionItems(actionItems, routeNodeInstance);
assertTrue(actionItems.size() == 0);
}
}
assertTrue(atLeastOne);
}
示例9: testFindByActionRequestId
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testFindByActionRequestId() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("jhopf"),
"ActionListDocumentType");
document.route("");
Collection<ActionRequest> actionRequests = document.getRootActionRequests();
for (Iterator<ActionRequest> iterator = actionRequests.iterator(); iterator.hasNext(); ) {
ActionRequest actionRequest = iterator.next();
if (actionRequest.getActionRequested().getCode().equals(KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ)) {
Collection<ActionItem> actionItems = getActionListService().findByActionRequestId(
actionRequest.getId());
assertTrue(actionItems.size() == 1);
}
}
}
示例10: testWorkgroupActionItemGenerationWhenMultipleWorkgroupRequests
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* addresses the following bug http://fms.dfa.cornell.edu:8080/browse/KULWF-428
*
* @throws Exception
*/
@Test public void testWorkgroupActionItemGenerationWhenMultipleWorkgroupRequests() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "ActionItemDocumentType");
document.setTitle("");
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jitrue"), document.getDocumentId());
Group testGroup = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "AIWG-Test");
Group adminGroup = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "AIWG-Admin");
List<ActionRequest> ars = document.getRootActionRequests();
boolean routedWorkflowAdmin = false;
boolean routedTestWorkgroup = false;
for (ActionRequest request : ars) {
if (request.isGroupRequest() && testGroup.getId().equals(request.getGroupId())) {
routedTestWorkgroup = true;
} else if (request.isGroupRequest() && adminGroup.getId().equals(request.getGroupId())) {
routedWorkflowAdmin = true;
}
}
//verify that our test is sane
assertTrue("Should have routed to 'AIWG-Test'", routedTestWorkgroup);
assertTrue("Should have routed to 'AIWG-Admin'", routedWorkflowAdmin);
assertTrue("Approve should be requested to member of 'AIWG-Test'", document.isApprovalRequested());
document.approve("");
Collection actionItems = KEWServiceLocator.getActionListService().findByDocumentId(document.getDocumentId());
assertEquals("There should be 6 action items to the AIWG-Admin.", 6, actionItems.size());
for (Iterator iter = actionItems.iterator(); iter.hasNext();) {
ActionItem actionItem = (ActionItem)iter.next();
//don't worry about which workgroup - they can get activated in any order
assertNotNull("this should be a workgroup request", actionItem.getGroup());
}
}
示例11: testRecallDoesNotRecallDocumentWhenFinal
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testRecallDoesNotRecallDocumentWhenFinal() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
document.route("");
for (String user: new String[] { JHOPF, EWESTFAL, RKIRKEND, NATJOHNS, BMCGOUGH }) {
document = WorkflowDocumentFactory.loadDocument(user, document.getDocumentId());
document.approve("");
}
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("xqi"), document.getDocumentId());
document.acknowledge("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jthomas"), document.getDocumentId());
document.fyi();
for (ActionRequest a: document.getRootActionRequests()) {
System.err.println(a);
if (a.isAcknowledgeRequest() || a.isFyiRequest()) {
System.err.println(a.getPrincipalId());
System.err.println(KimApiServiceLocator.getIdentityService().getPrincipal(a.getPrincipalId()).getPrincipalName());
}
}
assertFalse("Document should not be processed", document.isProcessed());
assertTrue("Document should be approved", document.isApproved());
assertTrue("Document should be final", document.isFinal());
document = WorkflowDocumentFactory.loadDocument(EWESTFAL, document.getDocumentId());
document.recall("recalling when final should not recall the document", true);
Map<String, List<ErrorMessage>> errorMessages = GlobalVariables.getMessageMap().getErrorMessages();
assertTrue(errorMessages.size() == 1);
for (Map.Entry<String, List<ErrorMessage>> errorMessage : errorMessages.entrySet()) {
assertTrue(errorMessage.getValue().get(0).getErrorKey().equals(RiceKeyConstants.MESSAGE_RECALL_NOT_SUPPORTED));
}
// Verify the document status is still FINAL
assertFalse("Document should not be processed", document.isProcessed());
assertTrue("Document should be approved", document.isApproved());
assertTrue("Document should be final", document.isFinal());
GlobalVariables.getMessageMap().clearErrorMessages();
}
示例12: test_SinglePeopleFlow_Sequential_Approve
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void test_SinglePeopleFlow_Sequential_Approve() throws Exception {
createSimplePeopleFlow();
// now route a document to it
WorkflowDocument document = WorkflowDocumentFactory.createDocument(user3, SINGLE_PEOPLE_FLOW_SEQUENTIAL_APPROVE);
document.route("");
assertTrue("Document should be enroute.", document.isEnroute());
// user3 should not have an approval request since they initiated the document
document.switchPrincipal(user3);
// document should be routed to user1, user2, and TestWorkgroup (of which "ewestfal" is a member) but only
// user1 request should be activated
List<ActionRequest> rootActionRequests = document.getRootActionRequests();
assertEquals("Should have 3 root action requests", 3, rootActionRequests.size());
ActionRequest user1Request = null;
ActionRequest user2Request = null;
ActionRequest testWorkgroupRequest = null;
for (ActionRequest actionRequest : rootActionRequests) {
RecipientType recipientType = actionRequest.getRecipientType();
if (recipientType == RecipientType.PRINCIPAL) {
if (user1.equals(actionRequest.getPrincipalId())) {
user1Request = actionRequest;
} else if (user2.equals(actionRequest.getPrincipalId())) {
user2Request = actionRequest;
}
} else if (recipientType == RecipientType.GROUP) {
if (testWorkgroup.equals(actionRequest.getGroupId())) {
testWorkgroupRequest = actionRequest;
}
}
}
// now let's ensure we got the requests we wanted
assertNotNull(user1Request);
assertEquals(ActionRequestStatus.ACTIVATED, user1Request.getStatus());
assertNotNull(user2Request);
assertEquals(ActionRequestStatus.INITIALIZED, user2Request.getStatus());
assertNotNull(testWorkgroupRequest);
assertEquals(ActionRequestStatus.INITIALIZED, testWorkgroupRequest.getStatus());
// let's double-check that before we start approving
assertApproveNotRequested(document, user2, ewestfal);
// user1 should have the request for approval, however
assertApproveRequested(document, user1);
// approve as user1
document.switchPrincipal(user1);
document.approve("");
// should still be enroute
assertTrue(document.isEnroute());
// now user1 should no longer have it, it should be activated approve to user2 with TestWorkgroup still initialized but not activated
assertApproveNotRequested(document, user1, ewestfal);
assertApproveRequested(document, user2);
// approve as user2
document.switchPrincipal(user2);
document.approve("");
// should still be enroute
assertTrue(document.isEnroute());
// now user1 and user2 have approved, should be activated to TestWorkgroup of which ewestfal is a member
assertApproveNotRequested(document, user2, user1);
// ewestfal should have an approve request because he is a member of TestWorkgroup
assertApproveRequested(document, ewestfal);
document.switchPrincipal(ewestfal);
document.approve("");
// now document should be final!
assertTrue(document.isFinal());
}
示例13: test_PrincipalMember_roleDelegate
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Defines a PeopleFlow as follows:
*
* <pre>
*
* Priority 1:
* -> testuser3
* ----> ppfTestRole2 - primary delegate
*
* </pre>
*
* this test will ensure that the delegate, a role, is properly delegated to when the primary responsible party is
* a principal.
*/
@Test
public void test_PrincipalMember_roleDelegate() throws Exception {
PeopleFlowMember.Builder member = PeopleFlowMember.Builder.create(testuser3, MemberType.PRINCIPAL);
PeopleFlowDelegate.Builder delegate = PeopleFlowDelegate.Builder.create(ppfTestRole2, MemberType.ROLE);
delegate.setDelegationType(DelegationType.PRIMARY);
delegate.setActionRequestPolicy(ActionRequestPolicy.FIRST);
createSimplePeopleFlow(PEOPLE_FLOW_8, member, delegate);
// now route a document to it
WorkflowDocument document = WorkflowDocumentFactory.createDocument(user3, ROLE_DELEGATE_PEOPLE_FLOW_PRINCIPAL_MEMBER_HAS_ROLE_DELEGATE);
document.route("");
assertTrue("Document should be enroute.", document.isEnroute());
// testuser3 and delegate user2 (as member of ppfTestRole2) should have
// activated requests, make sure the requests look correct
List<ActionRequest> rootActionRequests = document.getRootActionRequests();
assertEquals("Should have 1 root action requests", 1, rootActionRequests.size());
ActionRequest testuser3Request = null;
for (ActionRequest actionRequest : rootActionRequests) {
RecipientType recipientType = actionRequest.getRecipientType();
if (recipientType == RecipientType.PRINCIPAL) {
if (testuser3.equals(actionRequest.getPrincipalId())) {
testuser3Request = actionRequest;
}
}
}
// now let's ensure we got the requests we wanted
assertNotNull(testuser3Request);
assertEquals(ActionRequestStatus.ACTIVATED, testuser3Request.getStatus());
// check delegate requests on testuser3Request now
assertEquals(1, testuser3Request.getChildRequests().size());
ActionRequest user2Request = testuser3Request.getChildRequests().get(0);
assertEquals(user2, user2Request.getPrincipalId());
assertEquals(DelegationType.PRIMARY, user2Request.getDelegationType());
assertEquals(ActionRequestStatus.ACTIVATED, user2Request.getStatus());
// let's run through the approvals for this peopleflow
assertApproveRequested(document, user2, testuser3);
assertApproveNotRequested(document, user1, user3, testuser1, testuser2, ewestfal);
// approve as user2 who is the lone member of testrole2
document.switchPrincipal(user2);
document.approve("");
// at this point all priorty1 folks should have approvals
assertApproveNotRequested(document, user2, testuser3);
// document should now be FINAL!
assertTrue(document.isFinal());
}
示例14: test_RoleMember_principalDelegate
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Defines a PeopleFlow as follows:
*
* <pre>
*
* Priority 1:
* -> ppfTestRole2
* ----> testuser3 - primary delegate
*
* </pre>
*
* ensure that the delegate, a principal, gets the requests when the member is a role
*/
@Test
public void test_RoleMember_principalDelegate() throws Exception {
PeopleFlowMember.Builder member = PeopleFlowMember.Builder.create(ppfTestRole2, MemberType.ROLE);
member.setActionRequestPolicy(ActionRequestPolicy.FIRST);
PeopleFlowDelegate.Builder delegate = PeopleFlowDelegate.Builder.create(testuser3, MemberType.PRINCIPAL);
delegate.setDelegationType(DelegationType.PRIMARY);
createSimplePeopleFlow(PEOPLE_FLOW_9, member, delegate);
// now route a document to it
WorkflowDocument document = WorkflowDocumentFactory.createDocument(user3, ROLE_DELEGATE_PEOPLE_FLOW_ROLE_MEMBER_HAS_PRINCIPAL_DELEGATE);
document.route("");
assertTrue("Document should be enroute.", document.isEnroute());
// user2 (as member of ppfTestRole2) and delegate testuser3 should have
// activated requests, make sure the requests look correct
List<ActionRequest> rootActionRequests = document.getRootActionRequests();
assertEquals("Should have 1 root action requests", 1, rootActionRequests.size());
ActionRequest user2Request = null;
for (ActionRequest actionRequest : rootActionRequests) {
RecipientType recipientType = actionRequest.getRecipientType();
if (recipientType == RecipientType.PRINCIPAL) {
if (user2.equals(actionRequest.getPrincipalId())) {
user2Request = actionRequest;
}
}
}
// now let's ensure we got the requests we wanted
assertNotNull(user2Request);
assertEquals(ActionRequestStatus.ACTIVATED, user2Request.getStatus());
// check delegate requests on testuser3Request now
assertEquals(1, user2Request.getChildRequests().size());
ActionRequest testuser3Request = user2Request.getChildRequests().get(0);
assertEquals(testuser3, testuser3Request.getPrincipalId());
assertEquals(DelegationType.PRIMARY, testuser3Request.getDelegationType());
assertEquals(ActionRequestStatus.ACTIVATED, testuser3Request.getStatus());
// let's run through the approvals for this peopleflow
assertApproveRequested(document, user2, testuser3);
assertApproveNotRequested(document, user1, user3, testuser1, testuser2, ewestfal);
// approve as testuser3, the delegate
document.switchPrincipal(testuser3);
document.approve("");
// at this point all priorty1 folks should have approvals
assertApproveNotRequested(document, user2, testuser3);
// document should now be FINAL!
assertTrue(document.isFinal());
}
示例15: test_RoleDelegate_justKimDelegate
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Defines a PeopleFlow as follows:
*
* <pre>
*
* Priority 1:
* -> ppfTestRole1 (has delegate ewestfal defined in KIM)
*
* </pre>
*
* The desired behavior is that the KIM delegate gets requests
*/
@Test
public void test_RoleDelegate_justKimDelegate() throws Exception {
createSimpleRoleDelegatePeopleFlow(PEOPLE_FLOW_4, // PeopleFlow name
ppfTestRole1, // member role ID
null, // no delegate
null // ^^ so no DelegationType
);
// now route a document to it
WorkflowDocument document = WorkflowDocumentFactory.createDocument(user3, ROLE_DELEGATE_PEOPLE_FLOW_JUST_KIM_DELEGATE);
document.route("");
assertTrue("Document should be enroute.", document.isEnroute());
// user1 (as member of ppfTestRole1) and ewestfal (as user1's primary KIM delegate for ppfTestRole1) should have
// activated requests, make sure the requests look correct
List<ActionRequest> rootActionRequests = document.getRootActionRequests();
assertEquals("Should have 1 root action requests", 1, rootActionRequests.size());
ActionRequest user1Request = null;
for (ActionRequest actionRequest : rootActionRequests) {
RecipientType recipientType = actionRequest.getRecipientType();
if (recipientType == RecipientType.PRINCIPAL) {
if (user1.equals(actionRequest.getPrincipalId())) {
user1Request = actionRequest;
}
}
}
// now let's ensure we got the requests we wanted
assertNotNull(user1Request);
assertEquals(ActionRequestStatus.ACTIVATED, user1Request.getStatus());
// check delegate requests on user1Request now
assertEquals(1, user1Request.getChildRequests().size());
ActionRequest ewestfalDelegateRequest = user1Request.getChildRequests().get(0);
assertEquals(ewestfal, ewestfalDelegateRequest.getPrincipalId());
assertEquals(DelegationType.PRIMARY, ewestfalDelegateRequest.getDelegationType());
assertEquals(ActionRequestStatus.ACTIVATED, ewestfalDelegateRequest.getStatus());
// let's run through the approvals for this peopleflow
assertApproveRequested(document, user1, ewestfal);
assertApproveNotRequested(document, user2, user3, testuser1, testuser2, testuser3);
// approve as ewestfal who is user1's primary KIM delegate for testrole1
document.switchPrincipal(ewestfal);
document.approve("");
// at this point all priorty1 folks should have approvals
assertApproveNotRequested(document, user1, ewestfal);
// document should now be FINAL!
assertTrue(document.isFinal());
}