本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.returnToPreviousNode方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.returnToPreviousNode方法的具体用法?Java WorkflowDocument.returnToPreviousNode怎么用?Java WorkflowDocument.returnToPreviousNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kew.api.WorkflowDocument
的用法示例。
在下文中一共展示了WorkflowDocument.returnToPreviousNode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReturnToPreviousCorrectlyUpdatingDocumentStatus
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* Test that the document is being updated appropriately after a return to previous call
*
* @throws Exception
*/
@Test public void testReturnToPreviousCorrectlyUpdatingDocumentStatus() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "UnitTestDocument");
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.returnToPreviousNode("", "Initiated");
assertFalse("ewestfal should no longer have approval status", document.isApprovalRequested());
assertFalse("ewestfal should no long have blanket approve status", document.isBlanketApproveCapable());
//just for good measure
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue("rkirkend should now have an approve request", document.isApprovalRequested());
}
示例2: testGetPreviousRouteNodeNames
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testGetPreviousRouteNodeNames() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "UnitTestDocument");
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
List<String> previousNodeNames = document.getPreviousNodeNames();
assertEquals("Should have 2 previous Node Names", 2, previousNodeNames.size());
assertEquals("Last node name should be the first visisted", "Initiated", previousNodeNames.get(0));
assertEquals("First node name should be last node visited", "Template1", previousNodeNames.get(1));
Set<String> currentNodes = document.getNodeNames();
assertEquals("Should have 1 current node name", 1, currentNodes.size());
assertEquals("Current node name incorrect", "Template2", currentNodes.iterator().next());
document.returnToPreviousNode("", "Template1");
previousNodeNames = document.getPreviousNodeNames();
assertEquals("Should have 1 previous Node Name", 1, previousNodeNames.size());
assertEquals("Previous Node name incorrect", "Initiated", previousNodeNames.get(0));
}
示例3: testReturnToPreviousFromFinalNode
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
* This test was implemented to address issue KULWF-495.
*
* Effectively, we want to ensure that we can return from a Final Approval node and then pass back
* through it without blowing the Final Approval Policy and sending the document into exception routing.
*/
@Test public void testReturnToPreviousFromFinalNode() throws Exception {
// the BlanketApproveMandatoryNodeTest document type defined in ActionsConfig.xml defines WorkflowDocument2
// as a final approval node.
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdByName("ewestfal"), "BlanketApproveMandatoryNodeTest");
// blanket approve to the final approver node
document.blanketApprove("", "WorkflowDocument2");
// the document should now be routed to Sir pmckown
assertTrue("Document should be enroute.", document.isEnroute());
TestUtilities.assertAtNodeNew("Should be at ye old WorkflowDocument2 node.", document, "WorkflowDocument2");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdByName("pmckown"), document.getDocumentId());
assertTrue("Document should be to pmckown.", document.isApprovalRequested());
List activeNodeInstances = KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document.getDocumentId());
assertEquals(1, activeNodeInstances.size());
RouteNodeInstance nodeInstance = (RouteNodeInstance)activeNodeInstances.get(0);
assertTrue("Active node instance should be a final approval node.", nodeInstance.getRouteNode().getFinalApprovalInd().booleanValue());
// return back to initial node, ewestfal should end up with a complete request
document.returnToPreviousNode("", "AdHoc");
assertTrue("Document should be enroute.", document.isEnroute());
TestUtilities.assertAtNodeNew("We should be at the AdHoc node.", document, "AdHoc");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdByName("ewestfal"), document.getDocumentId());
// now blanket approve back to WorkflowDocument2 again, before the bug fix this is where the policy failure would happen
document.blanketApprove("", "WorkflowDocument2");
assertTrue("Document should be enroute.", document.isEnroute());
TestUtilities.assertAtNodeNew("Should be at ye old WorkflowDocument2 node.", document, "WorkflowDocument2");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdByName("pmckown"), document.getDocumentId());
assertTrue("Document should be to pmckown.", document.isApprovalRequested());
// now return it back one node to WorkflowDocument, this should send approve requests to bmcgough and rkirkend
document.returnToPreviousNode("", "WorkflowDocument");
assertTrue("Document should be enroute.", document.isEnroute());
TestUtilities.assertAtNodeNew("Should be at ye old WorkflowDocument node.", document, "WorkflowDocument");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdByName("bmcgough"), document.getDocumentId());
assertTrue("Bmcgough should have an approve.", document.isApprovalRequested());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdByName("rkirkend"), document.getDocumentId());
assertTrue("Rkirkend should have an approve.", document.isApprovalRequested());
// now blanket approve it to the end and the document should be processed
document.blanketApprove("");
assertTrue("Document should be processed.", document.isProcessed());
}
示例4: testIsUserInRouteLogAfterReturnToPrevious
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testIsUserInRouteLogAfterReturnToPrevious() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), SeqSetup.DOCUMENT_TYPE_NAME);
document.route("");
assertTrue(document.isEnroute());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
// bmcgough and rkirkend should be in route log
WorkflowDocumentActionsService wdas = KewApiServiceLocator.getWorkflowDocumentActionsService();
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), true));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), true));
assertFalse("User should NOT be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), false));
// Phil of the future
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), true));
TestUtilities.assertAtNode(document, "WorkflowDocument");
document.returnToPreviousNode("", "AdHoc");
TestUtilities.assertAtNode(document, "AdHoc");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
document.approve("");
// we should be back where we were
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
TestUtilities.assertAtNode(document, "WorkflowDocument");
// now verify that is route log authenticated still works
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), true));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), true));
assertFalse("User should NOT be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), true));
// let's look at the revoked node instances
List revokedNodeInstances = KEWServiceLocator.getRouteNodeService().getRevokedNodeInstances(KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId()));
assertNotNull(revokedNodeInstances);
assertEquals(2, revokedNodeInstances.size());
// let's approve past this node and another
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
document.approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
document.approve("");
// should be at WorkflowDocument2
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pmckown"), document.getDocumentId());
TestUtilities.assertAtNode(document, "WorkflowDocument2");
assertTrue(document.isApprovalRequested());
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), true));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), true));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), true));
// now return back to WorkflowDocument
document.returnToPreviousNode("", "WorkflowDocument");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
assertTrue(document.isApprovalRequested());
// Phil should no longer be non-future route log authenticated
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("bmcgough"), true));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("rkirkend"), true));
assertFalse("User should NOT be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), false));
assertTrue("User should be authenticated.", wdas.isUserInRouteLog(document.getDocumentId(), getPrincipalIdForName("pmckown"), true));
}
示例5: testGetUserActionItemCount
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testGetUserActionItemCount() throws Exception {
String principalId = getPrincipalIdForName("ewestfal");
ActionListService als = KewApiServiceLocator.getActionListService();
assertEquals("Count (test start) is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(principalId));
WorkflowDocument document = WorkflowDocumentFactory.createDocument(principalId, SeqSetup.DOCUMENT_TYPE_NAME);
document.route("");
assertTrue(document.isEnroute());
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(principalId));
principalId = getPrincipalIdForName("bmcgough");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertTrue(document.isApprovalRequested());
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
principalId));
principalId = getPrincipalIdForName("rkirkend");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertTrue(document.isApprovalRequested());
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
principalId));
TestUtilities.assertAtNode(document, "WorkflowDocument");
document.returnToPreviousNode("", "AdHoc");
TestUtilities.assertAtNode(document, "AdHoc");
// verify count after return to previous
principalId = getPrincipalIdForName("ewestfal");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertTrue(document.isApprovalRequested());
// expect one action item for approval request
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
principalId));
principalId = getPrincipalIdForName("bmcgough");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertFalse(document.isApprovalRequested());
assertTrue(document.isFYIRequested());
// expect one action item for fyi action request
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
principalId));
principalId = getPrincipalIdForName("rkirkend");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertFalse(document.isApprovalRequested());
// expect no action items
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(
principalId));
principalId = getPrincipalIdForName("ewestfal");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
document.approve("");
TestUtilities.assertAtNode(document, "WorkflowDocument");
// we should be back where we were
principalId = getPrincipalIdForName("ewestfal");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertFalse(document.isApprovalRequested());
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(0), als.getUserActionItemCount(
principalId));
principalId = getPrincipalIdForName("bmcgough");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertTrue(document.isApprovalRequested());
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
principalId));
principalId = getPrincipalIdForName("rkirkend");
document = WorkflowDocumentFactory.loadDocument(principalId, document.getDocumentId());
assertTrue(document.isApprovalRequested());
assertEquals("Count is incorrect for user " + principalId, Integer.valueOf(1), als.getUserActionItemCount(
principalId));
}
示例6: takeAction
import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
public static void takeAction(WorkflowDocument document, Document dom, EDLContext edlContext)
throws WorkflowException {
RequestParser requestParser = edlContext.getRequestParser();
UserAction userAction = edlContext.getUserAction();
String annotation = requestParser.getParameterValue("annotation");
String action = userAction.getAction();
String previousNodeName = requestParser.getParameterValue("previousNode");
if (!userAction.isValidatableAction()) {
// if the action's not validatable, clear the attribute definitions because we don't want to end up executing validateClientRoutingData()
// TODO the problem here is that the XML is still updated on a cancel so we end up without any attribute content in the document content
document.clearAttributeDefinitions();
}
boolean actionTaken = true;
if (UserAction.ACTION_ROUTE.equals(action)) {
document.route(annotation);
}else if(UserAction.ACTION_CREATE.equals(action)){
document.saveDocumentData();
}
else if (UserAction.ACTION_APPROVE.equals(action)) {
document.approve(annotation);
} else if (UserAction.ACTION_DISAPPROVE.equals(action)) {
document.disapprove(annotation);
} else if (UserAction.ACTION_CANCEL.equals(action)) {
document.cancel(annotation);
} else if (UserAction.ACTION_BLANKETAPPROVE.equals(action)) {
document.blanketApprove(annotation);
} else if (UserAction.ACTION_FYI.equals(action)) {
document.fyi();
} else if (UserAction.ACTION_ACKNOWLEDGE.equals(action)) {
document.acknowledge(annotation);
} else if (UserAction.ACTION_SAVE.equals(action)) {
if (document.getStatus().equals(DocumentStatus.INITIATED)) {
document.saveDocument(annotation);
} else {
document.saveDocumentData();
}
} else if (UserAction.ACTION_COMPLETE.equals(action)) {
document.complete(annotation);
} else if (UserAction.ACTION_DELETE.equals(action)) {
document.delete();
} else if (UserAction.ACTION_RETURN_TO_PREVIOUS.equals(action)) {
document.returnToPreviousNode(annotation, previousNodeName);
} else {
actionTaken = false;
}
if (actionTaken) {
Element actionTakenElement = EDLXmlUtils.getOrCreateChildElement(dom.getDocumentElement(), ACTION_TAKEN,
true);
actionTakenElement.appendChild(dom.createTextNode(action));
}
}