当前位置: 首页>>代码示例>>Java>>正文


Java WorkflowDocument.getDocumentId方法代码示例

本文整理汇总了Java中org.kuali.rice.kew.api.WorkflowDocument.getDocumentId方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowDocument.getDocumentId方法的具体用法?Java WorkflowDocument.getDocumentId怎么用?Java WorkflowDocument.getDocumentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kew.api.WorkflowDocument的用法示例。


在下文中一共展示了WorkflowDocument.getDocumentId方法的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.");
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:NotificationWorkflowDocumentServiceImpl.java

示例2: routeTestDocs

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Routes some test docs for searching
 * @return String[] of doc ids
 */
protected String[] routeTestDocs() {
    // Route some test documents.
    String[] docIds = new String[TestDocData.titles.length];

    for (int i = 0; i < TestDocData.titles.length; i++) {
        WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(
                getPrincipalId(TestDocData.principalNames[i]), TestDocData.docTypeName);
        workflowDocument.setTitle(TestDocData.titles[i]);
        workflowDocument.setApplicationDocumentId(TestDocData.appDocIds[i]);
        workflowDocument.route("routing this document.");

        docIds[i] = workflowDocument.getDocumentId();

        if (TestDocData.approverNames[i] != null) {
            workflowDocument.switchPrincipal(getPrincipalId(TestDocData.approverNames[i]));
            workflowDocument.approve("approving this document.");
        }

        workflowDocument.setApplicationDocumentStatus(TestDocData.appDocStatuses[i]);
        workflowDocument.saveDocumentData();
    }

    return docIds;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DocumentSearchTest.java

示例3: 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()));
	}
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:AdHocRouteTest.java

示例4: testGetRouteHeader

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests the loading of a RouteHeaderVO using the WorkflowInfo.
 * 
 * Verifies that an NPE no longer occurrs as mentioned in KULRICE-765.
 */
@Test
public void testGetRouteHeader() throws Exception {
    // ensure the UserSession is cleared out (could have been set up by other tests)
    GlobalVariables.setUserSession(null);
    String ewestfalPrincipalId = KimApiServiceLocator.getIdentityService().getPrincipalByPrincipalName("ewestfal")
            .getPrincipalId();
    GlobalVariables.setUserSession(new UserSession("ewestfal"));
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(ewestfalPrincipalId,
            "TestDocumentType");
    String documentId = workflowDocument.getDocumentId();
    assertNotNull(documentId);

    Document document = KewApiServiceLocator.getWorkflowDocumentService().getDocument(documentId);
    assertNotNull(document);

    assertEquals(documentId, document.getDocumentId());
    assertEquals(DocumentStatus.INITIATED, document.getStatus());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:24,代码来源:WorkflowInfoTest.java

示例5: testSerialAdHocRouting

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testSerialAdHocRouting() throws Exception {
   	WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADHOC_DOC);
   	docId = doc.getDocumentId();
   	doc.route("");
   	doc = getDocument("user1");
   	doc.adHocToPrincipal(ActionRequestType.APPROVE, "One", "annotation1", getPrincipalIdForName("user2"), "", false);
   	doc.adHocToPrincipal(ActionRequestType.APPROVE, "One", "annotation1", getPrincipalIdForName("rkirkend"), "", true);
   	doc.approve("");
   	doc = getDocument("rkirkend");
   	assertFalse("rkirkend should not have the document at this point 'S' activation", doc.isApprovalRequested());
   	doc = getDocument("user2");
   	assertTrue("user2 should have an approve request", doc.isApprovalRequested());
   	doc.approve("");
   	doc = getDocument("rkirkend");
   	doc.approve("");
   	assertTrue("The document should be final", doc.isFinal());
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:AdHocRouteTest.java

示例6: 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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:StandardGenericXMLRuleAttributeTest.java

示例7: testSuperUserActionRoutesDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
private String testSuperUserActionRoutesDocument(String documentType) throws Exception {
	String ewestfalPrincipalId = getPrincipalIdForName("ewestfal");
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(ewestfalPrincipalId, documentType);
    document.saveDocument("");
    // doc should saved
    assertEquals("Document should be SAVED", DocumentStatus.SAVED, document.getStatus());

    document = WorkflowDocumentFactory.loadDocument(ewestfalPrincipalId, 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));
    
    List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findAllValidRequests(ewestfalPrincipalId, document.getDocumentId(), KewApiConstants.ACTION_REQUEST_COMPLETE_REQ);
    assertEquals("There should only be 1 complete request to ewestfal as result of the save.", 1, actionRequests.size());
    document.superUserTakeRequestedAction(actionRequests.get(0).getActionRequestId().toString(), "");

    // Complete should no longer be requested
    document = WorkflowDocumentFactory.loadDocument(ewestfalPrincipalId, document.getDocumentId());
    assertFalse("ewestfal should not have Complete request", document.isCompletionRequested());

    return document.getDocumentId();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:SuperUserActionRequestApproveEventTest.java

示例8: routeTestDoc2

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * "Saves" a single instance of a "SearchDocType2" document and returns it's id.
 */
protected String routeTestDoc2() {
    // Route some test documents.
    String docTypeName = "SearchDocType2";
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId("ewestfal"), docTypeName);
    workflowDocument.setTitle("Search Doc Type 2!");
    workflowDocument.saveDocument("saving the document");
    return workflowDocument.getDocumentId();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:DocumentSearchTest.java

示例9: testSpawnDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSpawnDocument() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("jitrue"), DOCUMENT_TYPE_THAT_SPAWNS);
	document.saveDocumentData();
	assertNotNull(document.getDocumentId());
	assertTrue("Document should be initiatied", document.isInitiated());
	document.route("Route");

    // should have generated a request to "bmcgough"
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("Document should be enroute", document.isEnroute());
    assertEquals("Document should be enroute.", KewApiConstants.ROUTE_HEADER_ENROUTE_CD, document.getStatus().getCode());
    assertTrue(document.isApprovalRequested());
    document.approve("Test approve by bmcgough");
    
    String originalDocumentId = document.getDocumentId();
	Long originalDocumentIdLong = Long.parseLong(originalDocumentId.trim());
    Long spawnedDocumentIdLong = (originalDocumentIdLong + 1);
    String spawnedDocumentId = spawnedDocumentIdLong.toString();
    
	// get spawned document (should be next document id)
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), spawnedDocumentId);
    assertEquals("Document should be final.", KewApiConstants.ROUTE_HEADER_FINAL_CD, document.getStatus().getCode());

	// get original document
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), originalDocumentId);
    assertEquals("Document should be final.", KewApiConstants.ROUTE_HEADER_FINAL_CD, document.getStatus().getCode());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:28,代码来源:PostProcessorSpawnedDocumentTest.java

示例10: testGetApplicationIdByDocumentId

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testGetApplicationIdByDocumentId() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TestDocumentType2");
	String documentId = document.getDocumentId();
	String applicationId = routeHeaderService.getApplicationIdByDocumentId(documentId);
	assertEquals("applicationId should be KEWNEW", "KEWNEW", applicationId);

	// now check TestDocumentType
	document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TestDocumentType");
	documentId = document.getDocumentId();
	applicationId = routeHeaderService.getApplicationIdByDocumentId(documentId);
	assertEquals("applicationId should be KUALI", "KUALI", applicationId);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:RouteHeaderServiceTest.java

示例11: 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());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:33,代码来源:RevokeAdHocActionTest.java

示例12: testParallelAdHocRouting

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testParallelAdHocRouting() throws Exception {
   	WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), ADHOC_DOC);
   	docId = doc.getDocumentId();
   	doc.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "annotation1", getPrincipalIdForName("dewey"), "respDesc1", false);

   	doc = getDocument("dewey");
   	assertFalse("User andlee should not have an approve request yet.  Document not yet routed.", doc.isApprovalRequested());

   	doc.adHocToGroup(ActionRequestType.APPROVE, "AdHoc", "annotation2", getGroupIdForName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "WorkflowAdmin"), "respDesc2", true);

   	doc = getDocument("quickstart");
   	assertFalse("User should not have approve request yet.  Document not yet routed.", doc.isApprovalRequested());

   	doc = getDocument("rkirkend");
   	doc.route("");

   	// there should be two adhoc requests
   	List<ActionRequest> actionRequests = doc.getRootActionRequests();
   	for (ActionRequest actionRequest : actionRequests) {
   		assertTrue("Request should be an adhoc request.", actionRequest.isAdHocRequest());
   	}

   	//all users should now have active approvals
   	WorkflowDocument deweyDoc = getDocument("dewey");
   	assertTrue("Dewey should have an approve request", deweyDoc.isApprovalRequested());

	doc = getDocument("ewestfal");// test that more than 1 member got
									// requests
   	assertTrue("WorkflowAdmin should have an approve request", doc.isApprovalRequested());

   	deweyDoc.approve("");
   	doc.approve("");
   	doc = getDocument("user1");//this dude has a rule in ActionsConfig.xml
   	doc.approve("");
   	assertTrue("The document should be final", doc.isFinal());
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:38,代码来源:AdHocRouteTest.java

示例13: testChainedBlanketApproval

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Test the blanket approval of a document chained by the post processor
 *
 * @throws Exception
 */
@Ignore
@Test
public void testChainedBlanketApproval() throws Exception {
    // Generate child document
    WorkflowDocument childDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), ChainedChildSetup.DOCUMENT_TYPE_NAME);
    WorkflowAttributeDefinition.Builder childDocAttribute = WorkflowAttributeDefinition.Builder.create(ChainedParentSetup.CHILD_DOC_ATTRIBUTE);
    PropertyDefinition docIdProperty = PropertyDefinition.create(
            ChainedParentSetup.DOC_ID_PROPERTY, childDocument.getDocumentId());
    childDocAttribute.addPropertyDefinition(docIdProperty);

    // Generate a parent document, apply child attribute
    WorkflowDocument parentDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), ChainedParentSetup.DOCUMENT_TYPE_NAME);
    //parentDocument.addAttributeDefinition(childDocAttribute.build());
    //parentDocument.saveDocumentData();

    // Issue with attribute definition save
    String fullContent = parentDocument.getDocumentContent().getFullContent();
    String newContent = "<documentContent><attributeContent><documentId>" + childDocument.getDocumentId() + "</documentId></attributeContent></documentContent>";
    DocumentContentUpdate.Builder documentContentUpdateBuilder = DocumentContentUpdate.Builder.create();
    documentContentUpdateBuilder.setAttributeContent(newContent);
    parentDocument.updateDocumentContent(documentContentUpdateBuilder.build());
    parentDocument.saveDocumentData();

    parentDocument.blanketApprove("");
    parentDocument = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), parentDocument.getDocumentId());
    assertTrue("Parent Document should be processed.", parentDocument.isProcessed());

    childDocument = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(TEST_USER_EWESTFAL), childDocument.getDocumentId());
    assertTrue("Child Document should be processed.", childDocument.isProcessed());

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:37,代码来源:BlanketApproveTest.java

示例14: routeRuleWithDelegate

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Override
    public String routeRuleWithDelegate(String documentId, RuleBaseValues parentRule, RuleBaseValues delegateRule, PrincipalContract principal, String annotation, boolean blanketApprove) throws Exception {
        if (parentRule == null) {
            throw new IllegalArgumentException("Cannot route a delegate without a parent rule.");
        }
        if (parentRule.getDelegateRule().booleanValue()) {
            throw new IllegalArgumentException("Parent rule cannot be a delegate.");
        }
        if (parentRule.getPreviousRuleId() == null && delegateRule.getPreviousRuleId() == null) {
            throw new IllegalArgumentException("Previous rule version required.");
        }

        // if the parent rule is new, unsaved, then save it
//      boolean isRoutingParent = parentRule.getId() == null;
//      if (isRoutingParent) {
//      // it's very important that we do not save delegations here (that's what the false parameter is for)
//      // this is because, if we save the delegations, the existing delegations on our parent rule will become
//      // saved as "non current" before the rule is approved!!!
//      save2(parentRule, null, false);
//      //save2(parentRule, null, true);
//      }

        // XXX: added when the RuleValidation stuff was added, basically we just need to get the RuleDelegation
        // that points to our delegate rule, this rule code is scary...
        RuleDelegationBo ruleDelegation = getRuleDelegation(parentRule, delegateRule);

        save2(delegateRule, ruleDelegation, true);

//      if the parent rule is new, unsaved, then save it
        // It's important to save the parent rule after the delegate rule is saved, that way we can ensure that any new rule
        // delegations have a valid, saved, delegation rule to point to (otherwise we end up with a null constraint violation)
        boolean isRoutingParent = parentRule.getId() == null;
        if (isRoutingParent) {
            // it's very important that we do not save delegations here (that's what the false parameter is for)
            // this is because, if we save the delegations, the existing delegations on our parent rule will become
            // saved as "non current" before the rule is approved!!!
            save2(parentRule, null, false);
            //save2(parentRule, null, true);
        }

        WorkflowDocument workflowDocument = null;
        if (documentId != null) {
            workflowDocument = WorkflowDocumentFactory.loadDocument(principal.getPrincipalId(), documentId);
        } else {
            List<RuleBaseValues> rules = new ArrayList<RuleBaseValues>();
            rules.add(delegateRule);
            rules.add(parentRule);
            workflowDocument = WorkflowDocumentFactory.createDocument(principal.getPrincipalId(), getRuleDocumentTypeName(
                    rules));
        }
        workflowDocument.setTitle(generateTitle(parentRule, delegateRule));
        delegateRule.setDocumentId(workflowDocument.getDocumentId());
        workflowDocument.addAttributeDefinition(RuleRoutingDefinition.createAttributeDefinition(parentRule.getDocTypeName()));
        getRuleDAO().save(delegateRule);
        if (isRoutingParent) {
            parentRule.setDocumentId(workflowDocument.getDocumentId());
            getRuleDAO().save(parentRule);
        }
        if (blanketApprove) {
            workflowDocument.blanketApprove(annotation);
        } else {
            workflowDocument.route(annotation);
        }
        return workflowDocument.getDocumentId();
    }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:66,代码来源:RuleServiceInternalImpl.java

示例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();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:65,代码来源:NotificationWorkflowDocumentServiceImpl.java


注:本文中的org.kuali.rice.kew.api.WorkflowDocument.getDocumentId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。