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


Java WorkflowDocument.route方法代码示例

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


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

示例1: testKimExceptionRoutingWithRiceDocumentChild

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Checks to make sure that the KIM routing is working for a RiceDocument child.
 * Based upon the test method org.kuali.rice.kew.doctype.DocumentTypeTest.testFinalApproverRouting()
 */
@Test public void testKimExceptionRoutingWithRiceDocumentChild() throws Exception {
	loadXmlFile("RouteExceptionTestDoc.xml");
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("admin"), "DocumentTypeDocument_New");
       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

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

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

示例4: testRoutingToInactiveWorkgroup

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testRoutingToInactiveWorkgroup() throws Exception {
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "InactiveWorkgroupDocType");
    try {
        doc.route("");
        fail("document should have thrown routing exception");
    } catch (Exception e) {
        e.printStackTrace();
    }
    TestUtilities.getExceptionThreader().join();//wait for doc to go into exception routing
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), doc.getDocumentId());
    assertTrue("Document should be in exception routing because workgroup is inactive", doc.isException());

    try {
        doc.route("routing a document that is in exception routing");
        fail("Succeeded in routing document that is in exception routing");
    } catch (InvalidActionTakenException iate) {
        log.info("Expected exception occurred: " + iate);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:RoutingToInactiveWorkgroupTest.java

示例5: testSuperUserCancel

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
   public void testSuperUserCancel() throws Exception {
WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
document.route("");

document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
assertTrue("WorkflowDocument should indicate jhopf as SuperUser", document.isValidAction(ActionType.SU_CANCEL));
document.superUserCancel("");
assertTrue("Document should be final after Super User Cancel", document.isCanceled());
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:SuperUserCancelTest.java

示例6: testInitiatorDisapprove

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests whether the initiator who disapproved a doc gets an acknowledgement
 * 
 */
@Test public void testInitiatorDisapprove() throws WorkflowException {
    // test initiator disapproval, via normal request with forceAction=true
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
    document.route("");

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

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
    assertFalse("Initiator should not have an Ack request from disapproval because they were the disapprover user", document.isAcknowledgeRequested());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:DisapproveActionTest.java

示例7: testMoveDocumentInsideProcess

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * This tests that we can invoke the move document command inside of a sub process.
 */
@Test public void testMoveDocumentInsideProcess() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "MoveInProcessTest");
    document.route("");
    
    // approve as bmcgough and rkirkend to move into process
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("bmcgough should have approve", document.isApprovalRequested());
    document.approve("");
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("rkirkend should have approve", document.isApprovalRequested());
    document.approve("");

    WorkflowDocumentService workflowDocumentService = KewApiServiceLocator.getWorkflowDocumentService();
    List<RouteNodeInstance> activeNodeInstances = workflowDocumentService.getActiveRouteNodeInstances(document.getDocumentId());
    assertEquals("Should be 1 active node instance.", 1, activeNodeInstances.size());
    RouteNodeInstance node2 = activeNodeInstances.get(0);
    assertEquals("Should be at the WorkflowDocument2 node.", SeqSetup.WORKFLOW_DOCUMENT_2_NODE, node2.getName());
    assertTrue("Node should be in a process.", node2.getProcessId() != null);
    
    // now try to move the document forward one which will keep us inside the subprocess
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_2_NODE, 1), "");
    
    activeNodeInstances = workflowDocumentService.getActiveRouteNodeInstances(document.getDocumentId());
    RouteNodeInstance node3 = activeNodeInstances.get(0);
    assertEquals("Should be at the WorkflowDocument3 node.", SeqSetup.WORKFLOW_DOCUMENT_3_NODE, node3.getName());
    assertTrue("Node should be in a process.", node3.getProcessId() != null);
    assertEquals("Node 2 and 3 should be in the same process.", node2.getProcessId(), node3.getProcessId());
    
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_3_NODE, 0), "");
    
    document.move(MovePoint.create(SeqSetup.WORKFLOW_DOCUMENT_3_NODE, -1), "");
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:36,代码来源:MoveDocumentTest.java

示例8: testDynamicParallelRoute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testDynamicParallelRoute() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), SEQ_DOC_TYPE_NAME);
    document.saveDocumentData();
    assertTrue("Document should be initiated", document.isInitiated());
    assertEquals("Should be no action requests.", 0, document.getRootActionRequests().size());
    List<RouteNodeInstance> nodeInstances = KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document.getDocumentId());
    assertEquals("Wrong number of active nodes.", 1, nodeInstances.size());
    assertEquals("Wrong active node.", INIT, nodeInstances.iterator().next().getRouteNode().getRouteNodeName());
    document.route("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("bmcgough"), document.getDocumentId());
    assertTrue("Approve should be requested.", document.isApprovalRequested());
    document.approve("");

    nodeInstances = KEWServiceLocator.getRouteNodeService().getActiveNodeInstances(document.getDocumentId());
    assertEquals("Wrong number of active nodes.", 1, nodeInstances.size());
    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pmckown"), document.getDocumentId());
    assertTrue("Approve should be requested.", document.isApprovalRequested());
    document.approve("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), document.getDocumentId());
    assertTrue("Approve should be requested.", document.isApprovalRequested());
    document.approve("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), document.getDocumentId());
    assertTrue("Approve should be requested.", document.isApprovalRequested());
    document.approve("");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("rkirkend"), document.getDocumentId());
    assertTrue("Approve should be requested.", document.isApprovalRequested());
    document.approve("");

    //        document = WorkflowDocumentFactory.loadDocument(new NetworkIdVO("ewestfal"), document.getDocumentId());
    //        assertTrue("Document should be final.", document.isFinal());

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

示例9: testSuperUserApproveInvalidUser

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testSuperUserApproveInvalidUser() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
       document.route("");
       
       document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), document.getDocumentId());
       try {
       	assertFalse("WorkflowDocument should not indicate quickstart as SuperUser", document.isValidAction(ActionType.SU_BLANKET_APPROVE));
       	document.superUserBlanketApprove("");
       	fail("invalid user attempted to SuperUserApprove");
       } catch (Exception e) {
       }
       
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:SuperUserActionTest.java

示例10: testInitiatorRoleDisapprove

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests whether the initator who disapproved a doc gets an acknowledgement
 *
 */
@Test public void testInitiatorRoleDisapprove() throws WorkflowException {
    // test initiator disapproval of their own doc via InitiatorRoleAttribute
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "InitiatorRoleApprovalTest");
    document.route("routing document");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), document.getDocumentId());
    document.disapprove("disapproving the document");

    document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), document.getDocumentId());
    assertFalse("Initiator should not have an Ack request from disapproval because they were the disapprover user", document.isAcknowledgeRequested());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:DisapproveActionTest.java

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

示例12: testWorkgroupActionItemGenerationWhenMultipleWorkgroupRequests

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * addresses the following bug http://fms.dfa.cornell.edu:8080/browse/KULWF-428
 *
 * @throws Exception
 */
@Test public void testWorkgroupActionItemGenerationWhenMultipleWorkgroupRequests() throws Exception {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "ActionItemDocumentType");
    document.setTitle("");
    document.route("");

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

    Group testGroup = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
            KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "AIWG-Test");
    Group adminGroup = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(
            KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "AIWG-Admin");

    List<ActionRequest> ars = document.getRootActionRequests();
    boolean routedWorkflowAdmin = false;
    boolean routedTestWorkgroup = false;
    for (ActionRequest request : ars) {
        if (request.isGroupRequest() && testGroup.getId().equals(request.getGroupId())) {
            routedTestWorkgroup = true;
        } else if (request.isGroupRequest() && adminGroup.getId().equals(request.getGroupId())) {
            routedWorkflowAdmin = true;
        }
    }

    //verify that our test is sane
    assertTrue("Should have routed to 'AIWG-Test'", routedTestWorkgroup);
    assertTrue("Should have routed to 'AIWG-Admin'", routedWorkflowAdmin);
    assertTrue("Approve should be requested to member of 'AIWG-Test'", document.isApprovalRequested());

    document.approve("");

    Collection actionItems = KEWServiceLocator.getActionListService().findByDocumentId(document.getDocumentId());

    assertEquals("There should be 6 action items to the AIWG-Admin.", 6, actionItems.size());

    for (Iterator iter = actionItems.iterator(); iter.hasNext();) {
        ActionItem actionItem = (ActionItem)iter.next();
        //don't worry about which workgroup - they can get activated in any order
        assertNotNull("this should be a workgroup request", actionItem.getGroup());
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:46,代码来源:ActionItemServiceTest.java

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

示例14: testSearchAttributesAcrossDocumentTypeVersions

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests searching documents with searchable attributes
 * @throws org.kuali.rice.kew.api.exception.WorkflowException
 */
@Test public void testSearchAttributesAcrossDocumentTypeVersions() throws Exception {
    // first test searching for an initial version of the doc which does not have a searchable attribute
    loadXmlFile("testdoc0.xml");

    String documentTypeName = "SearchDoc";
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), documentTypeName);
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);
    doc.route("routing");

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

    DocumentSearchCriteria.Builder criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));

    Person user = KimApiServiceLocator.getPersonService().getPersonByPrincipalName("arh14");
    DocumentSearchResults results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
    assertEquals(1, results.getSearchResults().size());

    // now upload the new version with a searchable attribute
    loadXmlFile("testdoc1.xml");
    docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(documentTypeName);

    // route a new doc
    doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), documentTypeName);
    doc.route("routing");

    // with no attribute criteria, both docs should be found
    criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));

    results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
    assertEquals(2, results.getSearchResults().size());

    // search with specific SearchableAttributeOld value
    criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));
    addSearchableAttribute(criteria, "MockSearchableAttributeKey", "MockSearchableAttributeValue");

    results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());
    assertEquals(1, results.getSearchResults().size());

    // search with any SearchableAttributeOld value
    criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    criteria.setDateCreatedFrom(new DateTime(2004, 1, 1, 0, 0));

    results = docSearchService.lookupDocuments(user.getPrincipalId(), criteria.build());

    assertEquals(2, results.getSearchResults().size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:58,代码来源:SearchableAttributeTest.java

示例15: testCustomizeResults

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testCustomizeResults() throws Exception {

    // route an instance of the CustomizeCriteria document type to FINAL

    String ewestfal = getPrincipalIdForName("ewestfal");
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"),
            "DocumentSearchCustomizerTest");
    document.route("");
    assertTrue(document.isFinal());

    // check that the document attributes get indexed properly

    List<String> attributeValues = KewApiServiceLocator.getWorkflowDocumentService().getSearchableAttributeStringValuesByKey(document.getDocumentId(), "myAttribute");
    assertEquals(1, attributeValues.size());
    assertEquals("myValue", attributeValues.get(0));
    attributeValues = KewApiServiceLocator.getWorkflowDocumentService().getSearchableAttributeStringValuesByKey(document.getDocumentId(), "myMultiValuedAttribute");
    assertEquals(2, attributeValues.size());
    assertTrue(attributeValues.contains("value1"));
    assertTrue(attributeValues.contains("value2"));

    DocumentSearchCriteria.Builder builder = DocumentSearchCriteria.Builder.create();
    DocumentSearchResults results = KewApiServiceLocator.getWorkflowDocumentService().documentSearch(ewestfal, builder.build());
    assertEquals(1, results.getSearchResults().size());
    DocumentSearchResult result = results.getSearchResults().get(0);

    // TODO - the below assertions really should work, but they currently don't.  Currently, unless you pass the
    // specific document type as one of the criteria the document attributes are not returned with the search
    // There should at least be an option on the search api to enable the returning of document attributes from
    // the search API - see https://jira.kuali.org/browse/KULRICE-6764
    /*assertEquals(1, result.getDocumentAttributes().size());
    DocumentAttribute attribute = result.getDocumentAttributes().get(0);
    assertEquals("myAttribute", attribute.getName());
    assertEquals("myValue", attribute.getValue());
    assertEquals(DocumentAttributeDataType.STRING, attribute.getDataType());*/

    // now do a document search targeting the specific customizer document type, the result should be customized
    // and the "myAttribute" attribute should have a customized value of "myCustomizedValue", also the
    // "myMultiValuedAttribute" should now only have a single value of "value0"
    
    builder.setDocumentTypeName("DocumentSearchCustomizerTest");
    results = KewApiServiceLocator.getWorkflowDocumentService().documentSearch(ewestfal, builder.build());
    assertEquals(1, results.getSearchResults().size());
    result = results.getSearchResults().get(0);
    assertEquals(3, result.getDocumentAttributes().size());
    for (DocumentAttribute attribute : result.getDocumentAttributes()) {
        if (attribute.getName().equals("myAttribute")) {
            assertEquals("myAttribute", attribute.getName());
            assertEquals("myCustomizedValue", attribute.getValue());
            assertEquals(DocumentAttributeDataType.STRING, attribute.getDataType());
        } else if (attribute.getName().equals("myMultiValuedAttribute")) {
            assertEquals("myMultiValuedAttribute", attribute.getName());
            assertEquals("value0", attribute.getValue());
            assertEquals(DocumentAttributeDataType.STRING, attribute.getDataType());
        } else if (attribute.getName().equals("criteriaUserId")) {
            assertEquals("criteriaUserId", attribute.getName());
            assertEquals(ewestfal, attribute.getValue());
        }else {
            fail("Encountered an attribute name which i didn't understand: " + attribute.getName());
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:63,代码来源:DocumentSearchCustomizerTest.java


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