本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.acknowledge方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.acknowledge方法的具体用法?Java WorkflowDocument.acknowledge怎么用?Java WorkflowDocument.acknowledge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.acknowledge方法的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: testPopulateRouteLogFutureRequests_HasNoExistingRequests
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Test that existing action requests don't show up in future list (KULRICE-2641)
*/
@SuppressWarnings("unchecked")
@Test public void testPopulateRouteLogFutureRequests_HasNoExistingRequests() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), getClass().getSimpleName());
document.route("1 - user1 route");
verifyFutureRequestState(document);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.approve("2 - ewestfal approve");
verifyFutureRequestState(document);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), document.getDocumentId());
document.approve("3 - user2 approve");
verifyFutureRequestState(document);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), document.getDocumentId());
document.acknowledge("4 - user3 acknowledge");
verifyFutureRequestState(document);
}
示例3: testPreapprovals
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testPreapprovals() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "PreApprovalTest");
doc.route("");
//rock some preapprovals and other actions...
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
doc.approve("");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
doc.acknowledge("");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
doc.complete("");
//approve as the person the doc is routed to so we can move the documen on and hopefully to final
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
doc.approve("");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
assertTrue("the document should be final", doc.isFinal());
}
示例4: testInitiatorRole
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testInitiatorRole() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "InitiatorRoleApprovalTest");
doc.route("");
//rock some preapprovals and other actions...
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
doc.approve("");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
doc.acknowledge("");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
doc.complete("");
assertFalse("the document should NOT be final", doc.isFinal());
//approve as the person the doc is routed (initiator) to so we can move the document on and hopefully to final
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
doc.approve("");
assertTrue("the document should be final", doc.isFinal());
}
示例5: acknowledge
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Override
public void acknowledge(WorkflowDocument workflowDocument, String annotation, List<AdHocRouteRecipient> adHocRecipients) throws WorkflowException {
if (LOG.isDebugEnabled()) {
LOG.debug("acknowleding document(" + workflowDocument.getDocumentId() + ",'" + annotation + "')");
}
handleAdHocRouteRequests(workflowDocument, annotation, filterAdHocRecipients(adHocRecipients, new String[] { KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KewApiConstants.ACTION_REQUEST_FYI_REQ }));
workflowDocument.acknowledge(annotation);
}
示例6: administerEventNotificationMessage
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* This method handles approval/disapproval/acknowledgement of the notification request
* @param request the HttpServletRequest
* @param response the HttpServletResponse
* @param command the command object bound for this MultiActionController
* @throws ServletException
*/
private void administerEventNotificationMessage(HttpServletRequest request, HttpServletResponse response, AdministerNotificationRequestCommand command, String action) throws ServletException {
LOG.debug("remoteUser: " + request.getRemoteUser());
BindException bindException = new BindException(command, "command");
ValidationUtils.rejectIfEmpty(bindException, "docId", "Document id must be specified");
if (bindException.hasErrors()) {
throw new ServletRequestBindingException("Document id must be specified", bindException);
}
// obtain a workflow user object first
//WorkflowIdDTO user = new WorkflowIdDTO(request.getRemoteUser());
String userId = request.getRemoteUser();
try {
// now construct the workflow document, which will interact with workflow
WorkflowDocument document = NotificationWorkflowDocument.loadNotificationDocument(userId, command.getDocId());
NotificationBo notification = retrieveNotificationForWorkflowDocument(document);
String initiatorPrincipalId = document.getInitiatorPrincipalId();
Person initiator = KimApiServiceLocator.getPersonService().getPerson(initiatorPrincipalId);
String notificationBlurb = notification.getContentType().getName() + " notification submitted by " + initiator.getName() + " for channel " + notification.getChannel().getName();
if ("disapprove".equals(action)) {
document.disapprove("User " + userId + " disapproving " + notificationBlurb);
} else if ("approve".equals(action)) {
document.approve("User " + userId + " approving " + notificationBlurb);
} else if ("acknowledge".equals(action)) {
document.acknowledge("User " + userId + " acknowledging " + notificationBlurb);
}
} catch (Exception e) {
LOG.error("Exception occurred taking action on notification request", e);
throw new ServletException("Exception occurred taking action on notification request", e);
}
}
示例7: testOrphanedAcknowledgeFromBlanketApprovalFix
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* This tests verifies that bug KULWF-507 has been fixed:
*
* https://test.kuali.org/jira/browse/KULWF-507
*
* To fix this, we implemented the system so that multiple action items are generated rather then just
* one which gets reassigned across multiple requests as needed.
*
* This test verifies that after the blanket approval, there should no longer be an orphaned Acknowledge
* request. The workgroup used here is the TestWorkgroup and "user1" is ewestfal with "user2" as rkirkend.
*
* The routing is configured in the BAOrphanedRequestDocumentType.
*/
@Test public void testOrphanedAcknowledgeFromBlanketApprovalFix() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "BAOrphanedRequestDocumentType");
document.blanketApprove("");
assertTrue("Document should be processed.", document.isProcessed());
// after the document has blanket approved there should be 2 action items since the blanket approver
// is in the final workgroup. These action items should be the acknowledges generated to both
// rkirkend and user1
int numActionItems = actionListService.findByDocumentId(document.getDocumentId()).size();
assertEquals("Incorrect number of action items.", 2, numActionItems);
String user1PrincipalId = getPrincipalIdForName("user1");
String rkirkendPrincipalId = getPrincipalIdForName("rkirkend");
// check that user1 has 1 action item
Collection actionItems = actionListService.findByWorkflowUserDocumentId(user1PrincipalId, document.getDocumentId());
assertEquals("user1 should have one action item.", 1, actionItems.size());
// check that rkirkend still has 1, the is where the bug would have manifested itself before, rkirkend would have had
// no action item (hence the orphaned request)
actionItems = actionListService.findByWorkflowUserDocumentId(rkirkendPrincipalId, document.getDocumentId());
assertEquals("rkirkend should have one action item.", 1, actionItems.size());
// lets go ahead and take it to final for funsies
document = WorkflowDocumentFactory.loadDocument(rkirkendPrincipalId, document.getDocumentId());
assertTrue("Should have ack request.", document.isAcknowledgeRequested());
document.acknowledge("");
assertTrue("Should still be PROCESSED.", document.isProcessed());
document = WorkflowDocumentFactory.loadDocument(user1PrincipalId, document.getDocumentId());
assertTrue("Should have ack request.", document.isAcknowledgeRequested());
document.acknowledge("");
assertTrue("Should now be FINAL.", document.isFinal());
}
示例8: dismissMessageDelivery
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* @see org.kuali.rice.ken.deliverer.NotificationMessageDeliverer#dismissMessageDelivery(org.kuali.rice.ken.bo.NotificationMessageDelivery,
* java.lang.String, java.lang.String)
*/
public void dismissMessageDelivery(NotificationMessageDelivery messageDelivery, String user, String cause) {
// TODO: move hardcoded web controller actions here...
LOG.info("Dismissing as user '" + user + "' workflow document '" + messageDelivery.getDeliverySystemId()
+ "' corresponding to message delivery #" + messageDelivery.getId() + " due to cause: " + cause);
if (NotificationConstants.AUTO_REMOVE_CAUSE.equals(cause)) {
// perform an auto-remove
// XXX: currently auto-removes are going through autoremove method
} else {
WorkflowDocument nwd;
nwd = notificationWorkflowDocumentService.getNotificationWorkflowDocumentByDocumentId(user,
messageDelivery.getDeliverySystemId());
flagWorkflowDocument(nwd);
if (NotificationConstants.ACK_CAUSE.equals(cause)) {
// moved from NotificationController, ack command
/*
* acknowledge using workflow docId
*/
if (nwd.isAcknowledgeRequested()) {
nwd.acknowledge("This notification has been acknowledged.");
LOG.debug("acknowledged " + nwd.getTitle());
LOG.debug("status display value: " + nwd.getStatus().getLabel());
} else {
LOG.debug("Acknowledgement was not needed for document " + nwd.getDocumentId());
}
} else if (NotificationConstants.FYI_CAUSE.equals(cause)) {
// moved from NotificationController, fyi command
/*
* FYI using workflow docId
*/
if (nwd.isFYIRequested()) {
nwd.fyi();
LOG.debug("fyi " + nwd.getTitle());
LOG.debug("status display value: " + nwd.getStatus().getLabel());
} else {
LOG.debug("FYI was not needed for document " + nwd.getDocumentId());
}
}
}
}
示例9: testSubProcessRoute
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSubProcessRoute() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCUMENT_TYPE_NAME);
document.saveDocumentData();
assertTrue("Document should be initiated", document.isInitiated());
assertEquals("Should be no action requests.", 0, document.getRootActionRequests().size());
TestUtilities.assertAtNode(document, "Initial");
document.route("");
assertTrue("Document shoule be ENROUTE.", document.isEnroute());
List actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
assertEquals("Incorrect pending action requests.", 2, actionRequests.size());
boolean isAck = false;
boolean isApprove = false;
for (Iterator iterator = actionRequests.iterator(); iterator.hasNext();) {
ActionRequestValue request = (ActionRequestValue) iterator.next();
org.kuali.rice.kew.engine.node.RouteNodeInstance nodeInstance = request.getNodeInstance();
assertNotNull("Node instance should be non null.", nodeInstance);
if (request.getPrincipalId().equals(getPrincipalIdForName("bmcgough"))) {
isAck = true;
assertEquals("Wrong request type.", KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, request.getActionRequested());
assertEquals("Wrong node.", ACKNOWLEDGE_NODE, nodeInstance.getRouteNode().getRouteNodeName());
assertNotNull("Should be in a sub process.", nodeInstance.getProcess());
assertEquals("Wrong sub process.", SUB_PROCESS_NODE, nodeInstance.getProcess().getRouteNode().getRouteNodeName());
assertFalse("Sub process should be non-initial.", nodeInstance.getProcess().isInitial());
assertFalse("Sub process should be non-active.", nodeInstance.getProcess().isActive());
assertFalse("Sub process should be non-complete.", nodeInstance.getProcess().isComplete());
} else if (request.getPrincipalId().equals(getPrincipalIdForName("temay"))) {
isApprove = true;
assertEquals("Wrong request type.", KewApiConstants.ACTION_REQUEST_APPROVE_REQ, request.getActionRequested());
assertEquals("Wrong node.", APPROVE_NODE, request.getNodeInstance().getRouteNode().getRouteNodeName());
assertNotNull("Should be in a sub process.", request.getNodeInstance().getProcess());
assertEquals("Wrong sub process.", SUB_PROCESS_NODE, request.getNodeInstance().getProcess().getRouteNode().getRouteNodeName());
assertFalse("Sub process should be non-initial.", nodeInstance.getProcess().isInitial());
assertFalse("Sub process should be non-active.", nodeInstance.getProcess().isActive());
assertFalse("Sub process should be non-complete.", nodeInstance.getProcess().isComplete());
}
}
assertTrue(isAck);
assertTrue(isApprove);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
assertTrue("Should have acknowledge.", document.isAcknowledgeRequested());
document.acknowledge("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), document.getDocumentId());
document.approve("");
// find the subprocess and assert it is complete, not active, and not initial
boolean foundSubProcess = false;
List<RouteNodeInstance> nodeInstances = document.getRouteNodeInstances();
for (int index = 0; index < nodeInstances.size(); index++) {
RouteNodeInstance instanceVO = nodeInstances.get(index);
if (instanceVO.getName().equals(SUB_PROCESS_NODE)) {
foundSubProcess = true;
assertFalse("Sub process should be non-initial.", instanceVO.isInitial());
assertFalse("Sub process should be non-active.", instanceVO.isActive());
assertTrue("Sub process should be complete.", instanceVO.isComplete());
}
}
assertTrue("Could not locate sub process node.", foundSubProcess);
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
assertTrue("Document should be final.", document.isFinal());
}
示例10: testHierarchyRoutingNodeUnevenApprovalDisapprove
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testHierarchyRoutingNodeUnevenApprovalDisapprove() throws WorkflowException {
loadXmlFile("HierarchyRoutingNodeConfig.xml");
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "HierarchyDocType");
doc.setApplicationContent(HIERARCHY);
doc.route("initial route");
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user2", "user1", "temay", "jhopf" }, true);
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "quickstart", "dewey" }, false);
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
doc.approve("approving as user2");
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "temay", "jhopf" }, true);
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user2", "user3", "quickstart", "dewey" }, false);
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), doc.getDocumentId());
doc.approve("approving as jhopf");
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "temay" }, true);
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "jhopf", "user2", "user3", "quickstart", "dewey" }, false);
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
doc.approve("approving as user1");
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "temay" }, true);
TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "jhopf", "user2", "quickstart", "dewey" }, false);
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
doc.disapprove("disapproving as user3");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), doc.getDocumentId());
//TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "temay", "user1", "jhopf", "user2", "quickstart", "dewey" }, false);
assertTrue(doc.isDisapproved());
TestUtilities.logActionRequests(doc.getDocumentId());
// these are ok, these are the ACKs for the previous approvers
int numActionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(doc.getDocumentId()).size();
assertEquals("Incorrect number of action requests", 4, numActionRequests);
int numActionItems = KEWServiceLocator.getActionListService().findByDocumentId(doc.getDocumentId()).size();
assertEquals("Incorrect number of action items.", 4, numActionItems);
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
doc.acknowledge("acknowledging disapproval as user2");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), doc.getDocumentId());
doc.acknowledge("acknowledging disapproval as jhopf");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
doc.acknowledge("acknowledging disapproval as user1");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), doc.getDocumentId());
doc.acknowledge("acknowledging disapproval as arh14");
assertTrue(doc.isDisapproved());
numActionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(doc.getDocumentId()).size();
assertEquals("Incorrect number of action requests", 0, numActionRequests);
numActionItems = KEWServiceLocator.getActionListService().findByDocumentId(doc.getDocumentId()).size();
assertEquals("Incorrect number of action items.", 0, numActionItems);
}
示例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: testRoleRequestGeneration
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testRoleRequestGeneration() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
assertTrue("This user should have an approve request", document.isApprovalRequested());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
assertTrue("This user should have an approve request", document.isApprovalRequested());
document.approve("");//ewestfal had force action rule
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue("This user should have an approve request", document.isApprovalRequested());
document.approve("");
//this be the role delegate of jitrue
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("natjohns"), document.getDocumentId());
assertTrue("This user should have an approve request", document.isApprovalRequested());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("xqi"), document.getDocumentId());
document.acknowledge("");
assertTrue("Document should be final", document.isFinal());
List requests = KEWServiceLocator.getActionRequestService().findAllActionRequestsByDocumentId(document.getDocumentId());
List rootRequests = KEWServiceLocator.getActionRequestService().getRootRequests(requests);
//verify our requests have been made correctly
for (Iterator iter = rootRequests.iterator(); iter.hasNext();) {
ActionRequestValue request = (ActionRequestValue) iter.next();
if (request.isRoleRequest()) {
//direct children should not be role requests
iterateChildrenRequests(request.getChildrenRequests(), new String[] {"U", "W"}, request);
}
}
}
示例13: testVariables
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testVariables() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "VariablesTest");
doc.route("");
//rock some preapprovals and other actions...
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), doc.getDocumentId());
dumpInfoAboutDoc(doc);
doc.setVariable("myexcellentvariable", "righton");
doc.approve("");
assertEquals("startedVariableValue", doc.getVariableValue("started"));
assertEquals("startedVariableValue", doc.getVariableValue("copiedVar"));
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
assertEquals("righton", doc.getVariableValue("myexcellentvariable"));
doc.setVariable("vartwo", "two");
doc.setVariable("myexcellentvariable", "ichangedit");
doc.acknowledge("");
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
assertEquals("ichangedit", doc.getVariableValue("myexcellentvariable"));
assertEquals("two", doc.getVariableValue("vartwo"));
doc.setVariable("another", "another");
doc.setVariable("vartwo", null);
doc.complete("");
//approve as the person the doc is routed to so we can move the documen on and hopefully to final
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
assertEquals("ichangedit", doc.getVariableValue("myexcellentvariable"));
assertEquals(null, doc.getVariableValue("vartwo"));
assertEquals("another", doc.getVariableValue("another"));
doc.approve("");
assertEquals("endedVariableValue", doc.getVariableValue("ended"));
assertNotNull(doc.getVariableValue("google"));
LOG.info(doc.getVariableValue("google"));
assertEquals("documentContentendedVariableValue", doc.getVariableValue("xpath"));
LOG.info(doc.getVariableValue("xpath"));
assertEquals("aNewStartedVariableValue", doc.getVariableValue("started"));
assertTrue("the document should be final", doc.isFinal());
}
示例14: testBlanketApproveThroughRoleAndWorkgroup
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Tests the behavior of blanket approve through a role node and then through a node with a Workgroup including
* the individual(s) in the role. Verifies that the Action List contains the proper entries in this case.
*/
@Test public void testBlanketApproveThroughRoleAndWorkgroup() throws Exception {
String jitruePrincipalId = getPrincipalIdForName(TEST_USER_JITRUE);
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(TEST_USER_USER1), "BlanketApproveThroughRoleAndWorkgroupTest");
document.saveDocument("");
assertTrue(document.isSaved());
TestUtilities.assertNotInActionList(jitruePrincipalId, document.getDocumentId());
document.blanketApprove("");
// document should now be processed
document = WorkflowDocumentFactory.loadDocument(jitruePrincipalId, document.getDocumentId());
assertTrue(document.isProcessed());
assertTrue(document.isAcknowledgeRequested());
// there should be 3 root acknowledge requests, one to the WorkflowAdmin workgroup, one to jitrue in the Notify role and one to jitrue in the Notify2 role
List actionRequests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocId(document.getDocumentId());
assertEquals("There should be 3 root requests.", 3, actionRequests.size());
// now check that the document is in jitrue's action list
TestUtilities.assertInActionList(jitruePrincipalId, document.getDocumentId());
// acknowledge as a member of the workgroup who is not jitrue
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), document.getDocumentId());
assertTrue(document.isAcknowledgeRequested());
document.acknowledge("");
// document should still be processed
document = WorkflowDocumentFactory.loadDocument(jitruePrincipalId, document.getDocumentId());
assertTrue(document.isProcessed());
assertTrue(document.isAcknowledgeRequested());
// there should now be 2 root acknowledge requests, one to jitrue in the Notify role and one to jitrue in the Notify2 role
actionRequests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocId(document.getDocumentId());
assertEquals("There should be 2 root requests.", 2, actionRequests.size());
// jitrue should still have this in his action list
TestUtilities.assertInActionList(jitruePrincipalId, document.getDocumentId());
document.acknowledge("");
// document should now be final
assertTrue(document.isFinal());
}
示例15: runDocumentWillHaveApproveOrCompleteRequestAtNode
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
private void runDocumentWillHaveApproveOrCompleteRequestAtNode(String documentType,ReportCriteriaGenerator generator) throws Exception {
/*
name="WorkflowDocument"
- bmcgough - Approve - false
- rkirkend - Approve - false
name="WorkflowDocument2"
- pmckown - Approve - false
name="Acknowledge1"
- temay - Ack - false
name="Acknowledge2"
- jhopf - Ack - false
*/
WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), documentType);
RoutingReportCriteria.Builder builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
builder.setRoutingPrincipalId(getPrincipalIdForName("bmcgough"));
assertTrue("Document should have one unfulfilled approve/complete request", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder.setTargetPrincipalIds(Collections.singletonList(getPrincipalIdForName("bmcgough")));
assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
builder.setRoutingPrincipalId(getPrincipalIdForName("bmcgough"));
List<RoutingReportActionToTake.Builder> actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
// actionsToTake[0] = new ReportActionToTakeDTO(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("rkirkend"),"WorkflowDocument");
actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("pmckown"),"WorkflowDocument2"));
builder.setActionsToTake(actionsToTake);
assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
actionsToTake = new ArrayList<RoutingReportActionToTake.Builder>();
actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("bmcgough"),"WorkflowDocument"));
actionsToTake.add(RoutingReportActionToTake.Builder.create(KewApiConstants.ACTION_TAKEN_APPROVED_CD,getPrincipalIdForName("rkirkend"),"WorkflowDocument"));
builder.setActionsToTake(actionsToTake);
builder.setRoutingPrincipalId(getPrincipalIdForName("pmckown"));
assertFalse("Document should not have any unfulfilled approve/complete requests", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), documentType);
document.route("");
assertTrue(document.isEnroute());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
document.approve("");
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("WorkflowDocument2");
assertTrue("Document should have one unfulfilled approve/complete request", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pmckown"), document.getDocumentId());
document.approve("");
assertTrue(document.isProcessed());
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("Acknowledge1");
assertFalse("Document should not have any unfulfilled approve/complete requests when in processed status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_APPROVE_REQ,KewApiConstants.ACTION_REQUEST_COMPLETE_REQ}), false));
builder = RoutingReportCriteria.Builder.createByDocumentId(document.getDocumentId());
builder.setXmlContent(document.getDocumentContent().getApplicationContent());
builder.setTargetNodeName("Acknowledge1");
assertTrue("Document should have one unfulfilled Ack request when in final status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ}), false));
if (generator.isCriteriaRouteHeaderBased()) {
assertFalse("Document should have no unfulfilled Ack request generated when in final status", wdas.documentWillHaveAtLeastOneActionRequest(builder.build(), Arrays.asList(new String[]{KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ}), true));
}
// if temay acknowledges the document here it will move to processed and no more simulations would need to be tested
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), document.getDocumentId());
document.acknowledge("");
assertTrue(document.isProcessed());
}