本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.adHocToPrincipal方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.adHocToPrincipal方法的具体用法?Java WorkflowDocument.adHocToPrincipal怎么用?Java WorkflowDocument.adHocToPrincipal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.adHocToPrincipal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRequestLabel
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testRequestLabel() throws Exception{
String note = "test note";
Person per = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(per.getPrincipalId(), ADHOC_DOC);
docId = doc.getDocumentId();
doc.adHocToPrincipal(ActionRequestType.FYI, "AdHoc", "annotation1", getPrincipalIdForName("dewey"), "respDesc1", false, note);
doc = getDocument(per.getPrincipalId(), docId);
List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(docId);
for(ActionRequestValue arv : actionRequests){
assertTrue("The note we passed in should equal the one we get out. note=["+ note +"]", note.equals(arv.getRequestLabel()));
}
}
示例2: testSuperUserActionsOnFinal
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSuperUserActionsOnFinal() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SuperUserApproveActionRequestFyiTest");
document.adHocToPrincipal(ActionRequestType.FYI, "", getPrincipalIdForName("rkirkend"), "", true);
document.route("");
// doc should still be final
assertEquals("Document should be FINAL", DocumentStatus.FINAL, document.getStatus());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue("rkirkend should have an FYI request.", document.isFYIRequested());
String rkirkendPrincipalId = getPrincipalIdForName("rkirkend");
List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findAllValidRequests(rkirkendPrincipalId, document.getDocumentId(), KewApiConstants.ACTION_REQUEST_FYI_REQ);
assertEquals("There should only be 1 fyi request to rkirkend.", 1, actionRequests.size());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.superUserTakeRequestedAction(actionRequests.get(0).getActionRequestId().toString(), "");
// FYI should no longer be requested
document = WorkflowDocumentFactory.loadDocument(rkirkendPrincipalId, document.getDocumentId());
assertFalse("rkirkend should no longer have an FYI request.", document.isFYIRequested());
}
示例3: testAdHocWhenDocumentIsInitiated
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testAdHocWhenDocumentIsInitiated() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TakeWorkgroupAuthorityDoc");
document.saveDocumentData();
assertTrue(document.isInitiated());
document.adHocToPrincipal(ActionRequestType.APPROVE, "My Annotation", getPrincipalIdForName("rkirkend"), "", true);
document.adHocToPrincipal(ActionRequestType.FYI, "My Annotation", getPrincipalIdForName("user1"), "", true);
// this is an initiated document, the requests should not be activated yet
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertFalse(document.isApprovalRequested());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), document.getDocumentId());
assertFalse(document.isFYIRequested());
// now route the document, the requests should be activated
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), document.getDocumentId());
assertTrue(document.isFYIRequested());
}
示例4: testAdHocWithRequestLabel_ToPrincipal
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testAdHocWithRequestLabel_ToPrincipal() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), ADHOC_DOC);
String label = "MY PRINCIPAL LABEL";
doc.adHocToPrincipal(ActionRequestType.APPROVE, null, "", getPrincipalIdForName("ewestfal"), "", true, label);
List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocId(doc.getDocumentId());
assertEquals("Shoudl have 1 request.", 1, actionRequests.size());
ActionRequestValue actionRequest = actionRequests.get(0);
assertEquals("Should be an approve request", ActionRequestType.APPROVE.getCode(), actionRequest.getActionRequested());
assertEquals("Invalid request label", label, actionRequest.getRequestLabel());
assertEquals("Request should be initialized", ActionRequestStatus.INITIALIZED.getCode(), actionRequest.getStatus());
// now route the document, it should activate the request and create an action item
doc.route("");
Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().getActionListForSingleDocument(doc.getDocumentId());
assertEquals("Should have 1 action item.", 1, actionItems.size());
ActionItem actionItem = actionItems.iterator().next();
assertEquals("ActionItem should be constructed from request.", actionRequest.getActionRequestId(), actionItem.getActionRequestId());
assertEquals("ActionItem should have same label", label, actionItem.getRequestLabel());
}
示例5: 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());
}
示例6: testDynamicRoleCacheability
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testDynamicRoleCacheability() {
RoleService roleService = KimApiServiceLocator.getRoleService();
Role r = roleService.getRoleByNamespaceCodeAndName("KR-WKFLW", "Approve Request Recipient");
assertTrue(roleService.isDynamicRoleMembership(r.getId()));
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "ActionRequestDerivedRoleTypeServiceImplTest");
// let's send an adhoc request to rkirkend
String rkirkend = getPrincipalIdForName("rkirkend");
document.adHocToPrincipal(ActionRequestType.APPROVE, "ad-hoc-ing will result in request to member of derive role",
rkirkend, "approve this ad-hoc'd doc responsibility", true);
document.route("");
RoleTypeService roleTypeService = new ActionRequestDerivedRoleTypeServiceImpl();
Map<String, String> qualifications = Collections.singletonMap(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document.getDocumentId());
// rkirkend should have role as an approver
assertTrue("rkirkend should have role.", roleTypeService.hasDerivedRole(rkirkend, null, null, APPROVE_REQUEST_RECIPIENT_ROLE_NAME, qualifications));
boolean firstResult = roleService.principalHasRole(rkirkend, Arrays.asList(new String[]{r.getId()}), qualifications);
assertTrue(firstResult);
document = WorkflowDocumentFactory.loadDocument(rkirkend, document.getDocumentId());
document.approve("approved ad-hoc request. rkirkend is no longer a derived approver!");
// rkirkend should no longer have role as an approver
assertFalse("rkirkend should have NO LONGER have derived approver role.", roleTypeService.hasDerivedRole(rkirkend, null, null, APPROVE_REQUEST_RECIPIENT_ROLE_NAME, qualifications));
boolean afterApprove = roleService.principalHasRole(rkirkend, Arrays.asList(new String[]{r.getId()}), qualifications);
assertFalse(afterApprove);
}
示例7: testRecallOnlyAdhocRouting
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testRecallOnlyAdhocRouting() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_ONLYADHOC_DOC);
// adhoc it to someone to prevent doc from going final - final is itself an invalid state for recall
document.adHocToPrincipal(ActionRequestType.APPROVE, "adhoc approve to JHOPF", JHOPF, "adhocing to prevent finalization", true);
document.route("routing");
try {
document.recall("recalling", true);
fail("Recall should NOT have succeeded. Expected InvalidActionTakenException due to absence of non-adhoc route nodes.");
} catch (InvalidActionTakenException iate) {
assertTrue(iate.getMessage().contains("No non-adhoc route nodes defined"));
}
}
示例8: testRevokeAfterBlanketApprove
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests the revocation of ad hoc requests after a blanket approve. The goal of this test is to verify that revocation of
* ad hoc requests doesn't have any adverse effects on the notification requests
*/
@Test public void testRevokeAfterBlanketApprove() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADH0C_DOC);
docId = doc.getDocumentId();
// send an FYI to the AdHoc node prior to blanket approving
doc.adHocToPrincipal(ActionRequestType.FYI, "AdHoc", "annotationEwestfal1", getPrincipalIdForName("ewestfal"), "respDesc1", false);
// blanket approve the document
doc.blanketApprove("");
assertTrue(doc.isProcessed());
// ewestfal should have his ad hoc FYI and user1 should have an ack from the blanket approve
doc = getDocument("ewestfal");
assertTrue(doc.isFYIRequested());
doc = getDocument("user1");
assertTrue(doc.isAcknowledgeRequested());
// revoke all ad hoc requests
doc.revokeAllAdHocRequests("revoking all adhocs");
assertTrue(doc.isProcessed());
TestUtilities.assertNumberOfPendingRequests(docId, 1);
// user1 should still have acknowledge request
assertTrue(doc.isAcknowledgeRequested());
// ewestfal should no longer have an fyi
doc = getDocument("ewestfal");
assertFalse(doc.isFYIRequested());
}
示例9: testSuperUserActionsOnProcessed
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSuperUserActionsOnProcessed() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SuperUserApproveActionRequestFyiTest");
document.adHocToPrincipal(ActionRequestType.ACKNOWLEDGE, "", getPrincipalIdForName("jhopf"), "", true);
document.adHocToPrincipal(ActionRequestType.FYI, "", getPrincipalIdForName("rkirkend"), "", true);
document.route("");
// doc should still be processed
assertEquals("Document should be PROCESSED", DocumentStatus.PROCESSED, document.getStatus());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue("rkirkend should have an FYI request.", document.isFYIRequested());
String rkirkendPrincipalId = getPrincipalIdForName("rkirkend");
List<ActionRequestValue> fyiActionRequests = KEWServiceLocator.getActionRequestService().findAllValidRequests(rkirkendPrincipalId, document.getDocumentId(), KewApiConstants.ACTION_REQUEST_FYI_REQ);
assertEquals("There should only be 1 fyi request to rkirkend.", 1, fyiActionRequests.size());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.superUserTakeRequestedAction(fyiActionRequests.get(0).getActionRequestId().toString(), "");
// FYI should no longer be requested
document = WorkflowDocumentFactory.loadDocument(rkirkendPrincipalId, document.getDocumentId());
assertFalse("rkirkend should no longer have an FYI request.", document.isFYIRequested());
// doc should still be processed
assertEquals("Document should be PROCESSED", DocumentStatus.PROCESSED, document.getStatus());
String jhopfPrincipalId = getPrincipalIdForName("jhopf");
List<ActionRequestValue> ackActionRequests = KEWServiceLocator.getActionRequestService().findAllValidRequests(jhopfPrincipalId, document.getDocumentId(), KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ);
assertEquals("There should only be 1 ACK request to jhopf.", 1, ackActionRequests.size());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.superUserTakeRequestedAction(ackActionRequests.get(0).getActionRequestId().toString(), "");
// ACK should no longer be requested
document = WorkflowDocumentFactory.loadDocument(jhopfPrincipalId, document.getDocumentId());
assertFalse("jhopf should no longer have an ACK request.", document.isAcknowledgeRequested());
// doc should be final
assertEquals("Document should be FINAL", DocumentStatus.FINAL, document.getStatus());
}
示例10: testAdHocToInitiator
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Test generation of an initial ad-hoc request to initiator prior to
* routing.
*
* This test will fail until EN-643 is resolved.
*/
@Test
public void testAdHocToInitiator() throws Exception {
final String ADHOC_NODE = "AdHoc";
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADHOC_DOC);
docId = doc.getDocumentId();
doc.adHocToPrincipal(ActionRequestType.APPROVE, ADHOC_NODE, "annotation1", getPrincipalIdForName("rkirkend"), "", true);
doc.route("");
assertTrue(doc.isEnroute());
doc = getDocument("rkirkend");
assertTrue("rkirkend should have an approval request on the document", doc.isApprovalRequested());
TestUtilities.assertAtNodeNew(doc, ADHOC_NODE);
// now try it with force action=false
doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADHOC_DOC);
docId = doc.getDocumentId();
doc.adHocToPrincipal(ActionRequestType.APPROVE, ADHOC_NODE, "annotation1", getPrincipalIdForName("rkirkend"), "", false);
doc.route("");
assertTrue(doc.isEnroute());
doc = getDocument("rkirkend");
assertFalse("rkirkend should NOT have an approval request on the document", doc.isApprovalRequested());
TestUtilities.assertAtNodeNew(doc, "One");
doc = getDocument("user1");
assertTrue("user1 should have an approval request on the document", doc.isApprovalRequested());
}
示例11: testSingleOutboxItemPerDocument
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testSingleOutboxItemPerDocument() 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);
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.adHocToPrincipal(ActionRequestType.APPROVE, "", user1PrincipalId, "", true);
document.approve("");
Collection<OutboxItem> outbox = KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter());
assertEquals("there should be an outbox item", 1, outbox.size());
document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
assertTrue("approve should be requested", document.isApprovalRequested());
document.adHocToPrincipal(ActionRequestType.APPROVE, "", rkirkendPrincipalId, "", true);
document = WorkflowDocumentFactory.loadDocument(rkirkendPrincipalId, document.getDocumentId());
assertTrue("approve should be requested", document.isApprovalRequested());
document.approve("");
outbox = KEWServiceLocator.getActionListService().getOutbox(rkirkendPrincipalId, new ActionListFilter());
assertEquals("there should be an outbox item", 1, outbox.size());
}
示例12: 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());
}
示例13: testDocumentTypeNotificationFromAddress
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests that the fromNotificationAddress on the document type works properly. Used to test implementation of KULWF-628.
*/
@Test public void testDocumentTypeNotificationFromAddress() throws Exception {
String user1PrincipalId = getPrincipalIdForName("user1");
// first test that the notification from addresses are configured correctly
DocumentType documentType = KEWServiceLocator.getDocumentTypeService().findByName("NotificationTest");
assertNull("Wrong notification from address, should be null.", documentType.getNotificationFromAddress());
assertNull("Wrong actual notification from address, should be null.", documentType.getActualNotificationFromAddress());
// test the parent document type
documentType = KEWServiceLocator.getDocumentTypeService().findByName("NotificationFromAddressParent");
assertEquals("Wrong notification from address.", "[email protected]", documentType.getNotificationFromAddress());
// test a child document type which overrides the parent's address
documentType = KEWServiceLocator.getDocumentTypeService().findByName("NotificationFromAddressChild");
assertEquals("Wrong notification from address.", "[email protected]", documentType.getNotificationFromAddress());
// test a child document type which doesn't override the parent's address
documentType = KEWServiceLocator.getDocumentTypeService().findByName("NotificationFromAddressChildInherited");
assertEquals("Wrong notification from address.", "[email protected]", documentType.getNotificationFromAddress());
// Do an app specific route to a document which should send an email to [email protected]
WorkflowDocument document = WorkflowDocumentFactory.createDocument(user1PrincipalId, "NotificationFromAddressChild");
document.adHocToPrincipal(ActionRequestType.APPROVE, "Initial", "", getPrincipalIdForName("ewestfal"), "", true);
document.route("");
// verify that ewestfal was sent an email
assertEquals("ewestfal should have an email.", 1, getMockEmailService().immediateReminderEmailsSent("ewestfal", document.getDocumentId(), KewApiConstants.ACTION_REQUEST_APPROVE_REQ));
// we currently have no way from this test to determine the email address used for notification
}
示例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());
}
示例15: createAndAdHocRouteNotificationWorkflowDocument
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Implements by instantiating a NotificationWorkflowDocument, which in turn interacts with
* Workflow to set it up with an initiator of the passed in user id.
* @see org.kuali.rice.ken.service.NotificationWorkflowDocumentService#createAndAdHocRouteNotificationWorkflowDocument(org.kuali.rice.ken.bo.NotificationMessageDelivery,
* java.lang.String, java.lang.String, java.lang.String)
*/
public String createAndAdHocRouteNotificationWorkflowDocument(NotificationMessageDelivery messageDelivery,
String initiatorUserId,
String recipientUserId, String annotation) {
// obtain a workflow user object first
//WorkflowIdDTO initiator = new WorkflowIdDTO(initiatorUserId);
// now construct the workflow document, which will interact with workflow
WorkflowDocument document;
if (StringUtils.isNotBlank(messageDelivery.getNotification().getDocTypeName())) {
document = NotificationWorkflowDocument.createNotificationDocument(initiatorUserId,
messageDelivery.getNotification().getDocTypeName());
} else {
document = NotificationWorkflowDocument.createNotificationDocument(initiatorUserId);
}
// this is our loose foreign key to our message delivery record in notification
document.setApplicationDocumentId(messageDelivery.getId().toString());
//document.setAppDocId(messageDelivery.getId().toString());
// now add the content of the notification as XML to the document
document.setApplicationContent(messageContentService.generateNotificationMessage(
messageDelivery.getNotification(), messageDelivery.getUserRecipientId()));
if (!StringUtils.isBlank(messageDelivery.getNotification().getTitle())) {
document.setTitle(messageDelivery.getNotification().getTitle());
} else {
LOG.error("Encountered notification with no title set: Message Delivery #" + messageDelivery.getId()
+ ", Notification #" + messageDelivery.getNotification().getId());
}
// now set up the ad hoc route
String actionRequested;
if (NotificationConstants.DELIVERY_TYPES.ACK.equals(messageDelivery.getNotification().getDeliveryType())) {
actionRequested = NotificationConstants.KEW_CONSTANTS.ACK_AD_HOC_ROUTE;
} else {
actionRequested = NotificationConstants.KEW_CONSTANTS.FYI_AD_HOC_ROUTE;
}
// Clarification of ad hoc route call
// param 1 - actionRequested will be either ACK or FYI
// param 2 - annotation is whatever text we pass in to describe the transaction - this will be system generated
// param 3 - recipient is the person who will receive this request
// param 4 - this is the responsibilityParty (a.k.a the system that produced this request), so we'll put the producer name in there
// param 5 - this is the "force action" requests - if set to true, this will be delivered to the recipients list regardless of
// whether the recipient has already taken action on this request; in our case, this doesn't really apply at this point in time,
// so we'll set to true just to be safe
// recipientUserId will always be a principal ID due to code changes in NotificationMessageDeliveryResolverServiceImpl.buildCompleteRecipientList()
Principal principal = KimApiServiceLocator.getIdentityService().getPrincipal(recipientUserId);
document.adHocToPrincipal(ActionRequestType.fromCode(actionRequested), annotation, principal.getPrincipalId(),
messageDelivery.getNotification().getProducer().getName(), true);
// now actually route it along its way
document.route(annotation);
return document.getDocumentId();
}