本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument类的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument类的具体用法?Java WorkflowDocument怎么用?Java WorkflowDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkflowDocument类属于org.kuali.rice.kew.api包,在下文中一共展示了WorkflowDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doPostProcessWork
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
private void doPostProcessWork(Document dom, EDLContext edlContext) throws Exception {
RequestParser requestParser = edlContext.getRequestParser();
// if the document is in error then we don't want to execute the action!
if (edlContext.isInError()) {
return;
}
WorkflowDocument document = (WorkflowDocument) edlContext.getRequestParser().getAttribute(
RequestParser.WORKFLOW_DOCUMENT_SESSION_KEY);
if (document == null) {
return;
}
//strip out the data element
Element dataElement = (Element) dom.getElementsByTagName(EDLXmlUtils.DATA_E).item(0);
String docContent = XmlJotter.jotNode(dataElement);//use the transformer on edlcontext
document.setApplicationContent(docContent);
takeAction(document, dom, edlContext);
}
示例2: 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());
}
示例3: superUserInitiatorDisapprove
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
protected void superUserInitiatorDisapprove(boolean notify) throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), notify ? DOC_TYPE_WITH_NOTIFY: DOC_TYPE);
document.route("");
WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId()).approve("");
WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId()).approve("");
WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId()).approve("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
assertTrue("WorkflowDocument should indicate ewestfal as SuperUser", document.isValidAction(ActionType.SU_DISAPPROVE));
document.superUserDisapprove("");
assertTrue("Document should be final after Super User Disapprove", document.isDisapproved());
if (notify) {
assertTrue(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId()).isAcknowledgeRequested());
assertTrue(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId()).isAcknowledgeRequested());
// initiator doesn't get Ack for their own action
assertFalse(WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId()).isAcknowledgeRequested());
}
}
示例4: testGroupDelegator
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* This method tests that
*
* @throws Exception
*/
@Test
public void testGroupDelegator() throws Exception {
RuleTestUtils.createDelegationToGroup("EmailTestWorkgroupDocType", "WorkflowDocumentTemplate", "EmailTestDelegateWorkgroup");
String user1PrincipalId = getPrincipalIdForName("user1");
// this document type has a group responsibility
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "EmailTestWorkgroupDocType");
doc.route("");
ActionListFilter actionListFilter = new ActionListFilter();
actionListFilter.setDocumentType(doc.getDocumentTypeName());
Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().getActionList(user1PrincipalId, actionListFilter);
EmailContentService emailContentService = KEWServiceLocator.getEmailContentService();
Person person = KimApiServiceLocator.getPersonService().getPerson(user1PrincipalId);
EmailContent emailContent = emailContentService.generateDailyReminder(person, ActionItem.to(new ArrayList<ActionItem>(actionItems)));
}
示例5: testDocSearchSecurityPermissionDocType
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* Test for https://test.kuali.org/jira/browse/KULRICE-1968 - Document search fails when users are missing
* Tests that we can safely search on docs whose initiator no longer exists in the identity management system
* This test searches by doc type name criteria.
* @throws Exception
*/
@Test public void testDocSearchSecurityPermissionDocType() throws Exception {
String documentTypeName = "SecurityDoc_PermissionOnly";
String userNetworkId = "arh14";
// route a document to enroute and route one to final
WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId(userNetworkId), documentTypeName);
workflowDocument.setTitle("testDocSearch_PermissionSecurity");
workflowDocument.route("routing this document.");
Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("edna");
DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
criteria.setDocumentTypeName(documentTypeName);
DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
assertEquals(0, results.getNumberOfSecurityFilteredResults());
assertEquals("Search returned invalid number of documents", 1, results.getSearchResults().size());
}
示例6: testNewDelegationTriggersRequeue
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
*
* Tests that adding a delegation for a rule for which a document has a pending action request causes
* the document to be requeued. See KULRICE-3575
*
* @throws Exception
*/
@Test public void testNewDelegationTriggersRequeue() throws Exception {
String docType = "RiceDocument.testNewDelegationTriggersRequeue";
// route a document of this type
WorkflowDocument wd = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), DOCTYPE);
wd.route("");
// clear the current set of requeued document ids
MockDocumentRefreshQueueImpl.clearRequeuedDocumentIds();
// create and save a rule delegation
RuleTestUtils.createDelegationToUser(DOCTYPE, RULE_TEMPLATE, DELEGATE_USER);
assertTrue("our document should have been requeued!",
MockDocumentRefreshQueueImpl.getRequeuedDocumentIds().contains(wd.getDocumentId()));
}
示例7: testKimExceptionRoutingWithDocHierarchy
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* Checks to make sure that the KIM routing is working with hierarchical documents.
* Based upon the test method org.kuali.rice.kew.doctype.DocumentTypeTest.testFinalApproverRouting()
*/
@Test public void testKimExceptionRoutingWithDocHierarchy() throws Exception {
loadXmlFile("RouteExceptionTestDoc.xml");
String[] docNames = {"TestFinalApproverDocumentType_Child", "TestFinalApproverDocumentType_GrandChild"};
// Test the child doc and then the grandchild doc.
for (int i = 0; i < docNames.length; i++) {
// Perform the same steps as in the previous unit test.
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("admin"), docNames[i]);
document.setTitle("");
document.route("");
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
try {
document.approve("");
fail("document should have thrown routing exception");
} catch (Exception e) {
//deal with single transaction issue in test.
TestUtilities.getExceptionThreader().join();
document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
assertTrue("Document should be in exception routing", document.isException());
}
}
}
示例8: testGetSearchableAttributeDateTimeValuesByKey
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
@Test public void testGetSearchableAttributeDateTimeValuesByKey() throws Exception {
String documentTypeName = SeqSetup.DOCUMENT_TYPE_NAME;
String userNetworkId = "ewestfal";
WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(userNetworkId), documentTypeName);
workflowDocument.setTitle("Respect my Authoritah");
workflowDocument.route("routing this document.");
userNetworkId = "rkirkend";
WorkflowDocument workflowDocument2 = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(userNetworkId), documentTypeName);
workflowDocument2.setTitle("Routing Style");
workflowDocument2.route("routing this document.");
WorkflowDocumentService wds = KewApiServiceLocator.getWorkflowDocumentService();
List<DateTime> dateTimes = wds.getSearchableAttributeDateTimeValuesByKey(workflowDocument.getDocumentId(), TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY);
assertNotNull("dateTimes should not be null", dateTimes);
assertTrue("dateTimes should not be empty", !dateTimes.isEmpty());
verifyTimestampToSecond(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE_IN_MILLS, dateTimes.get(0).getMillis());
dateTimes = wds.getSearchableAttributeDateTimeValuesByKey(workflowDocument2.getDocumentId(), TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY);
assertNotNull("dateTimes should not be null", dateTimes);
assertTrue("dateTimes should not be empty", !dateTimes.isEmpty());
verifyTimestampToSecond(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE_IN_MILLS, dateTimes.get(0).getMillis());
}
示例9: getByDocumentHeaderIdSessionless
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* @see org.kuali.rice.krad.service.DocumentService#getByDocumentHeaderIdSessionless(java.lang.String)
*/
@Override
public Document getByDocumentHeaderIdSessionless(String documentHeaderId) throws WorkflowException {
if (documentHeaderId == null) {
throw new IllegalArgumentException("invalid (null) documentHeaderId");
}
WorkflowDocument workflowDocument = null;
if (LOG.isDebugEnabled()) {
LOG.debug("Retrieving doc id: " + documentHeaderId + " from workflow service.");
}
Person person = getPersonService().getPersonByPrincipalName(KRADConstants.SYSTEM_USER);
workflowDocument = workflowDocumentService.loadWorkflowDocument(documentHeaderId, person);
Class<? extends Document> documentClass = getDocumentClassByTypeName(workflowDocument.getDocumentTypeName());
// retrieve the Document
Document document = getLegacyDataAdapter().findByDocumentHeaderId(documentClass, documentHeaderId);
return postProcessDocument(documentHeaderId, workflowDocument, document);
}
示例10: testAdHocWithRequestLabel_ToGroup
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
@Test
public void testAdHocWithRequestLabel_ToGroup() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), ADHOC_DOC);
String label = "MY GROUP LABEL";
Group workflowAdmin = KEWServiceLocator.getIdentityHelperService().getGroupByName("KR-WKFLW", "WorkflowAdmin");
doc.adHocToGroup(ActionRequestType.APPROVE, null, "", workflowAdmin.getId(), "", true, label);
List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocId(doc.getDocumentId());
assertEquals("Should 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 action items
doc.route("");
Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().getActionListForSingleDocument(doc.getDocumentId());
assertTrue("Should have more than 1 action item.", actionItems.size() > 1);
for (ActionItem actionItem : actionItems) {
assertEquals("ActionItem should be constructed from request.", actionRequest.getActionRequestId(), actionItem.getActionRequestId());
assertEquals("ActionItem should have same label", label, actionItem.getRequestLabel());
}
}
示例11: testNonMatchingExtensionKey
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* Tests SGXA attribute matching behavior with extension value keys that do not necessarily match
* a field defined in the attribute
*/
@Test public void testNonMatchingExtensionKey() throws WorkflowException {
loadXmlFile("TestExtensionValueMatching.xml");
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "TestDocument");
WorkflowAttributeDefinition.Builder attr = WorkflowAttributeDefinition.Builder.create(StandardGenericXMLRuleAttribute.class.getName());
attr.setAttributeName("Attr1");
// expected to match RuleTemplate with extension value: value='1' with xpath expression /xmlRouting/field[@name=attr1] = wf:ruledata('value')
attr.addPropertyDefinition("attr1", "2");
doc.addAttributeDefinition(attr.build());
doc.route("");
String id = doc.getDocumentId();
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), id);
assertTrue("Request should have been generated to user1", doc.isApprovalRequested());
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), id);
assertTrue("Expected approval request to user2", doc.isApprovalRequested());
}
示例12: 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.");
}
}
}
示例13: testRecallAsInitiatorBeforeAnyApprovals
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
@Test public void testRecallAsInitiatorBeforeAnyApprovals() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(EWESTFAL, RECALL_TEST_DOC);
document.route("");
document.recall("recalling", true);
assertTrue("Document should be recalled", document.isRecalled());
assertAfterActionTakenCalled(ActionType.RECALL, ActionType.RECALL);
//verify that the document is truly dead - no more action requests or action items.
List requests = KEWServiceLocator.getActionRequestService().findPendingByDoc(document.getDocumentId());
assertEquals("Should not have any active requests", 0, requests.size());
Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().findByDocumentId(document.getDocumentId());
assertEquals("Should not have any action items", 0, actionItems.size());
}
示例14: testGroup
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* This method specifically exercises a group responsibility to assure that the
* {@link StyleableEmailContentServiceImpl} can handle that case.
* See KULRICE-3659.
*/
@Test
public void testGroup() throws Exception {
String ewestfalPrincipalId = getPrincipalIdForName("ewestfal");
// this document type has a group responsibility
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "EmailTestWorkgroupDocType");
doc.route("");
ActionListFilter actionListFilter = new ActionListFilter();
actionListFilter.setDocumentType(doc.getDocumentTypeName());
Collection<ActionItem> actionItems = KEWServiceLocator.getActionListService().getActionList(ewestfalPrincipalId, actionListFilter);
EmailContentService emailContentService = KEWServiceLocator.getEmailContentService();
Person person = KimApiServiceLocator.getPersonService().getPerson(ewestfalPrincipalId);
// this would blow up before the fix
EmailContent emailContent = emailContentService.generateDailyReminder(person, ActionItem.to(new ArrayList<ActionItem>(actionItems)));
}
示例15: testExceptionInTransitionFromStart
import org.kuali.rice.kew.api.WorkflowDocument; //导入依赖的package包/类
/**
* this tests that the document appropriately gets to exception routing if there is a
* problem when transitioning out of first node
*
* @throws Exception
*/
@Test public void testExceptionInTransitionFromStart() throws Exception {
WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "AdhocTransitionTestDocument");
//blow chunks transitioning out of adhoc to the first route node
ExceptionRoutingTestPostProcessor.THROW_ROUTE_STATUS_LEVEL_EXCEPTION = true;
try {
doc.route("");
fail("We should be in exception routing");
} catch (Exception e) {
}
TestUtilities.getExceptionThreader().join();//this is necessary to ensure that the exception request will be generated.
doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
assertEquals("document should be in exception routing", DocumentStatus.EXCEPTION, doc.getStatus());
}