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


Java WorkflowDocument.setTitle方法代码示例

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


在下文中一共展示了WorkflowDocument.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

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

示例2: testDocSearch_MissingInitiator

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 testDocSearch_MissingInitiator() throws Exception {
    String documentTypeName = "SearchDocType";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
    String userNetworkId = "arh14";
    // route a document to enroute and route one to final
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId(userNetworkId), documentTypeName);
    workflowDocument.setTitle("testDocSearch_MissingInitiator");
    workflowDocument.route("routing this document.");

    // verify the document is enroute for jhopf
    workflowDocument = WorkflowDocumentFactory.loadDocument(getPrincipalId("jhopf"),workflowDocument.getDocumentId());
    assertTrue(workflowDocument.isEnroute());
    assertTrue(workflowDocument.isApprovalRequested());

    // now nuke the initiator...
    new JdbcTemplate(TestHarnessServiceLocator.getDataSource()).execute("update " + KREW_DOC_HDR_T + " set " + INITIATOR_COL + " = 'bogus user' where DOC_HDR_ID = " + workflowDocument.getDocumentId());


    Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("jhopf");
    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
    assertEquals("Search returned invalid number of documents", 1, results.getSearchResults().size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:DocumentSearchTest.java

示例3: testKimExceptionRouting

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Checks to make sure that the KIM routing is working.
 * Based upon the test method org.kuali.rice.kew.doctype.DocumentTypeTest.testFinalApproverRouting()
 */
@Test public void testKimExceptionRouting() throws Exception {
	loadXmlFile("RouteExceptionTestDoc.xml");
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("admin"), "TestFinalApproverDocumentType");
       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());
       }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:21,代码来源:ExceptionRoutingServiceTest.java

示例4: testRouteDocumentWithMalformedSearchableAttributeContent

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests searching with client-generated documentContent which is just malformed XML.
 * @throws WorkflowException
 */
@Test public void testRouteDocumentWithMalformedSearchableAttributeContent() throws WorkflowException {
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "SearchDocType");

    workflowDocument.setApplicationContent("hey, <I'm Not ] Even & XML");

    workflowDocument.setTitle("Routing style");
    try {
        workflowDocument.route("routing this document.");
        fail("routeDocument succeeded with malformed XML");
    } catch (Exception we) {
        // An exception is thrown in DTOConverter/XmlUtils.appendXml at the time of this writing
        // so I will just assume that is the expected behavior
    }
    TestUtilities.waitForExceptionRouting();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例5: testChangingDocumentTypeOnEnrouteDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Verify that enroute documents are not affected if you edit their document type.
 * @throws Exception
 */
@Test public void testChangingDocumentTypeOnEnrouteDocument() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "DocumentType");
    document.setTitle("");
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("rkirkend should have an approve request", document.isApprovalRequested());

    org.kuali.rice.kew.api.doctype.DocumentTypeService docTypeService = KewApiServiceLocator.getDocumentTypeService();
    Integer version1 = docTypeService.getDocumentTypeByName(document.getDocumentTypeName()).getDocumentTypeVersion();

    //update the document type
    loadXmlFile("DoctypeSecondVersion.xml");

    //verify that we have a new documenttypeid and its a newer version
    Integer version2 = docTypeService.getDocumentTypeByName(document.getDocumentTypeName()).getDocumentTypeVersion();

    assertTrue("Version2 should be larger than verison1", version2.intValue() > version1.intValue());

    //the new version would take the document final
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("rkirkend should have an approve request", document.isApprovalRequested());

    document.approve("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), document.getDocumentId());

    Integer versionDocument = docTypeService.getDocumentTypeById(document.getDocument().getDocumentTypeId()).getDocumentTypeVersion();

    assertTrue("user2 should have an approve request", document.isApprovalRequested());
    //make sure our document still represents the accurate version
    assertEquals("Document has the wrong document type version", version1, versionDocument);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:38,代码来源:DocumentTypeTest.java

示例6: testMultipleActionItemGeneration

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * This test verifies that if someone gets more than one request routed to them then they will get
 * multiple Action Items but only one of them will show up in their Action List.
 */
@Test public void testMultipleActionItemGeneration() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "ActionItemDocumentType");
    document.setTitle("");
    document.route("");

    // now the document should be at both the AIWG-Admin workgroup and the AIWG-Test
    // ewestfal is a member of both Workgroups so verify that he has two action items
    String ewestfalPrincipalId = getPrincipalIdForName("ewestfal");
    String jitruePrincipalId = getPrincipalIdForName("jitrue");

    Collection actionItems = KEWServiceLocator.getActionListService().findByWorkflowUserDocumentId(ewestfalPrincipalId, document.getDocumentId());
    assertEquals("Ewestfal should have two action items.", 2, actionItems.size());

    // now check the action list, there should be only one entry
    actionItems = KEWServiceLocator.getActionListService().getActionList(ewestfalPrincipalId, null);
    assertEquals("Ewestfal should have one action item in his action list.", 1, actionItems.size());
    document = WorkflowDocumentFactory.loadDocument(ewestfalPrincipalId, document.getDocumentId());
    assertTrue("Ewestfal should have an approval requested.", document.isApprovalRequested());

    // approve as a member from the first workgroup
    document = WorkflowDocumentFactory.loadDocument(jitruePrincipalId, document.getDocumentId());
    assertTrue("Jitrue should have an approval requested.", document.isApprovalRequested());
    document.approve("");

    // now ewestfal should have only one action item in both his action items and his action list
    actionItems = KEWServiceLocator.getActionListService().findByWorkflowUserDocumentId(ewestfalPrincipalId, document.getDocumentId());
    assertEquals("Ewestfal should have one action item.", 1, actionItems.size());
    String actionItemId = ((ActionItem)actionItems.iterator().next()).getId();
    actionItems = KEWServiceLocator.getActionListService().getActionList(ewestfalPrincipalId, null);
    assertEquals("Ewestfal should have one action item in his action list.", 1, actionItems.size());
    assertEquals("The two action items should be the same.", actionItemId, ((ActionItem)actionItems.iterator().next()).getId());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:37,代码来源:ActionItemServiceTest.java

示例7: testAttributeRangeFieldGeneration

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testAttributeRangeFieldGeneration() {
    String documentTypeName = "SearchDocType";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
    String userNetworkId = "rkirkend";
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalId(userNetworkId), documentTypeName);
    workflowDocument.setTitle("Routing style");
    workflowDocument.route("routing this document.");

    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    criteria.setDateApprovedFrom(new DateTime(2010, 1, 1, 0, 0));
    criteria.setDateApprovedTo(new DateTime(2011, 1, 1, 0, 0));
    String fieldValue = ">= " + DocumentSearchInternalUtils.getDisplayValueWithDateOnly(new Timestamp(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE_IN_MILLS));
    addSearchableAttribute(criteria, TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, fieldValue);

    Map<String, String[]> fields = new DocumentSearchCriteriaTranslatorImpl().translateCriteriaToFields(criteria.build());
    System.err.println(fields);
    String lowerBoundField = KewApiConstants.DOCUMENT_ATTRIBUTE_FIELD_PREFIX + KRADConstants.LOOKUP_RANGE_LOWER_BOUND_PROPERTY_PREFIX + TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY;
    String upperBoundField = KewApiConstants.DOCUMENT_ATTRIBUTE_FIELD_PREFIX + TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY;

    assertNotNull(fields.get(lowerBoundField));
    assertNotNull(fields.get(upperBoundField));
    assertNotNull(fields.get(lowerBoundField)[0]);
    assertNull(fields.get(upperBoundField)[0]);

    assertEquals(DocumentSearchInternalUtils.getDisplayValueWithDateOnly(new Timestamp(new DateTime(2007, 3, 15, 0, 0).toDateTime().getMillis())), fields.get(lowerBoundField)[0]);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:SearchableAttributeTest.java

示例8: testDuplicateNodeNameInRoutePath

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testDuplicateNodeNameInRoutePath() throws Exception {
    loadXmlFile("DocTypeConfig_duplicateNodes.xml");
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "TestDoubleNodeDocumentType");
    document.setTitle("");
    document.route("");
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("rkirkend should have an approve request", document.isApprovalRequested());
    document.approve("");
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), document.getDocumentId());
    assertTrue("user2 should have an approve request", document.isApprovalRequested());
    document.approve("");
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), document.getDocumentId());
    assertTrue("user3 should have an approve request", document.isApprovalRequested());
    document.approve("");
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:DocumentTypeTest.java

示例9: testSetApplicationContentXMLRoutedDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSetApplicationContentXMLRoutedDocument() throws Exception {
    String documentTypeName = "SearchDocType";
    String key = "givenname";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), documentTypeName);
    workflowDocument.setApplicationContent("<documentContent><searchableContent><putWhateverWordsIwantInsideThisTag>" +
                                           "<givenname><value>jack</value></givenname>" +
                                           "</putWhateverWordsIwantInsideThisTag></searchableContent></documentContent>");

    workflowDocument.setTitle("Routing style");
    workflowDocument.route("routing this document.");

    DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);

    Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");
    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    addSearchableAttribute(criteria, key, "jack");
    DocumentSearchResults results =  docSearchService.lookupDocuments(user.getPrincipalId(),
            criteria.build());

    assertEquals("Search results should be empty.", 1, results.getSearchResults().size());

    criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    addSearchableAttribute(criteria, key, "fred");
    results =  docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());

    assertEquals("Search results should be empty.", 0, results.getSearchResults().size());

    criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    addSearchableAttribute(criteria, "fakeproperty", "doesntexist");
    try {
        results =  docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
        fail("Search results should be throwing a validation exception for use of non-existant searchable attribute");
    } catch (RuntimeException wsee) {
        assertTrue(wsee.getMessage().contains("LookupException"));
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:41,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例10: setUpSearchableDoc

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Sets up a doc for searching with ranged queries
 */
protected WorkflowDocument setUpSearchableDoc() {
    String documentTypeName = "SearchDocTypeRangeSearchDataType";
	DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
    String userNetworkId = "rkirkend";
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(userNetworkId), documentTypeName);

    /*
     *   Below we are using the keys and values from the custom searchable attribute classes' static constants but
     *   this is only for convenience as those should always be valid values to test for.
     */
    // adding string searchable attribute
    WorkflowAttributeDefinition.Builder stringXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStringRange");
    stringXMLDef.addPropertyDefinition(TestXMLSearchableAttributeString.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeString.SEARCH_STORAGE_VALUE);
    workflowDocument.addSearchableDefinition(stringXMLDef.build());
    // adding long searchable attribute
    WorkflowAttributeDefinition.Builder longXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdLongRangeInclusive");
    longXMLDef.addPropertyDefinition(TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeLong.SEARCH_STORAGE_VALUE.toString());
    workflowDocument.addSearchableDefinition(longXMLDef.build());
    // adding float searchable attribute
    WorkflowAttributeDefinition.Builder floatXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdFloatRangeInclusive");
    floatXMLDef.addPropertyDefinition(TestXMLSearchableAttributeFloat.SEARCH_STORAGE_KEY, TestXMLSearchableAttributeFloat.SEARCH_STORAGE_VALUE.toString());
    workflowDocument.addSearchableDefinition(floatXMLDef.build());
    // adding string searchable attribute
    WorkflowAttributeDefinition.Builder dateXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdDateTimeRangeInclusive");
    dateXMLDef.addPropertyDefinition(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_KEY, DocumentSearchInternalUtils
            .getDisplayValueWithDateOnly(TestXMLSearchableAttributeDateTime.SEARCH_STORAGE_VALUE));
    workflowDocument.addSearchableDefinition(dateXMLDef.build());

    workflowDocument.setTitle("Routing style");
    workflowDocument.route("routing this document.");

    return WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(userNetworkId), workflowDocument.getDocumentId());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:37,代码来源:StandardGenericXMLSearchableAttributeRangesTest.java

示例11: testEmptyRoutePath

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * this test will verify that a document type with an empty route path will go directly
 * to "final" status
 *
 * @throws Exception
 */
@Test public void testEmptyRoutePath() throws Exception {

    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "EmptyRoutePathDocumentType");
    document.setTitle("");
    document.route("");
    assertTrue("Document should be in final state", document.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:DocumentTypeTest.java

示例12: testXMLStandardSearchableAttributeWithInvalidValue

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testXMLStandardSearchableAttributeWithInvalidValue() throws Exception {
    String documentTypeName = "SearchDocTypeStandardSearchDataType";
    String userNetworkId = "rkirkend";
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName(userNetworkId), documentTypeName);

    /*
     *   Below we are using the keys and values from the custom searchable attribute classes' static constants but
     *   this is only for convenience as those should always be valid values to test for.
     */
    // adding string value in what should be a long searchable attribute
    WorkflowAttributeDefinition.Builder longXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttributeStdLong");
    longXMLDef.addPropertyDefinition(TestXMLSearchableAttributeLong.SEARCH_STORAGE_KEY, "123x23");
    workflowDocument.addSearchableDefinition(longXMLDef.build());

    workflowDocument.setTitle("Routing style");
    try {
        workflowDocument.route("routing this document.");
        fail("Document should be unroutable with invalid searchable attribute value");
    } catch (Exception e) {
        e.printStackTrace();
    }
    /*
     * The call to TestUtilities below is needed because when exception routing spawns a new thread (see
     * TestExceptionRoutingServiceImpl class) the next test will begin before the exception thread is complete and
     * cause errors. This was originally discovered because the test method
     * testXMLStandardSearchableAttributesWithDataType() would run and get errors loading xml data for workgroups
     * perhaps because the exception thread was keeping the cache around and now allowing it to be cleared?
     */
    TestUtilities.waitForExceptionRouting();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:31,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例13: doRouteLevelChange

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
	levelChanges++;
	WorkflowDocument document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), levelChangeEvent.getDocumentId());
	document.setTitle("Current level change: " + levelChanges);
	document.saveDocumentData();
	return new ProcessDocReport(true);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:8,代码来源:PostProcessorTest.java

示例14: testSearchableAttributeWithQuickfinder

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests the resolution to issues EN-95, KULWF-757, KULOWF-52 whereby the use of a quickfinder is causing
 * NullPointers when searching for documents.
 */
@Test public void testSearchableAttributeWithQuickfinder() throws Exception {
    String documentTypeName = "AttributeWithQuickfinderDocType";
    String key = "chart";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
     WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), documentTypeName);

     // define the chart for the searchable attribute
     WorkflowAttributeDefinition.Builder chartDef = WorkflowAttributeDefinition.Builder.create("SearchableAttributeWithQuickfinder");
     chartDef.addPropertyDefinition(key, "BL");
     document.addSearchableDefinition(chartDef.build());

     // save the document
     document.setTitle("Routin' with style");
     document.saveDocument("Savin' this document.");

     // prepare to search
     DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);
     Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("rkirkend");

     // execute the search by our chart, we should see one result
     DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
     criteria.setDocumentTypeName(documentTypeName);
     addSearchableAttribute(criteria, key, "BL");
     DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(),
             criteria.build());
     assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
     DocumentSearchResult result = results.getSearchResults().get(0);
     String documentId = result.getDocument().getDocumentId();
     assertEquals("Wrong document in search results.", document.getDocumentId(), documentId);

     // search with no searchable attribute criteria, should return our document as well
     criteria = DocumentSearchCriteria.Builder.create();
     criteria.setDocumentTypeName(documentTypeName);
     results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
     assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
     result = results.getSearchResults().get(0);
     assertEquals("Wrong document in search results.", document.getDocumentId(), result.getDocument().getDocumentId());

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

示例15: createNotificationWorkflowDocument

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Creates a notification {@link WorkflowDocument}.
 *
 * @param request the servlet request
 * @param initiatorId the user sending the notification
 * @param model the Spring MVC model
 *
 * @return a {@link WorkflowDocument} for the notification
 * @throws java.lang.IllegalArgumentException
 * @throws org.kuali.rice.ken.exception.ErrorList
 */
protected WorkflowDocument createNotificationWorkflowDocument(HttpServletRequest request, String initiatorId,
        Map<String, Object> model) throws IllegalArgumentException, ErrorList {
    WorkflowDocument document = NotificationWorkflowDocument.createNotificationDocument(initiatorId,
            NotificationConstants.KEW_CONSTANTS.SEND_NOTIFICATION_REQ_DOC_TYPE);

    //parse out the application content into a Notification BO
    NotificationBo notification = populateNotificationInstance(request, model);

    // now get that content in an understandable XML format and pass into document
    String notificationAsXml = notificationMessageContentService.generateNotificationMessage(notification);

    Map<String, String> attrFields = new HashMap<String,String>();
    List<NotificationChannelReviewerBo> reviewers = notification.getChannel().getReviewers();
    int ui = 0;
    int gi = 0;
    for (NotificationChannelReviewerBo reviewer: reviewers) {
        String prefix;
        int index;
        if (KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode().equals(reviewer.getReviewerType())) {
            prefix = "user";
            index = ui;
            ui++;
        } else if (KimConstants.KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode().equals(reviewer.getReviewerType())) {
            prefix = "group";
            index = gi;
            gi++;
        } else {
            LOG.error("Invalid type for reviewer " + reviewer.getReviewerId() + ": " + reviewer.getReviewerType());
            continue;
        }
        attrFields.put(prefix + index, reviewer.getReviewerId());
    }
    GenericAttributeContent gac = new GenericAttributeContent("channelReviewers");
    document.setApplicationContent(notificationAsXml);
    document.setAttributeContent("<attributeContent>" + gac.generateContent(attrFields) + "</attributeContent>");

    document.setTitle(notification.getTitle());

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


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