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


Java WorkflowDocument.setApplicationContent方法代码示例

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


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

示例1: 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

示例2: doRouteStatusChange

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
	if (KewApiConstants.ROUTE_HEADER_PROCESSED_CD.equals(statusChangeEvent.getNewRouteStatus())) {
		WorkflowDocument document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), statusChangeEvent.getDocumentId());
		document.setApplicationContent(APPLICATION_CONTENT);
		document.setTitle(DOC_TITLE);
		document.saveDocumentData();
		// now route another document from the post processor, sending it an adhoc request
		WorkflowDocument ppDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("user1"), "testModifyDocumentInPostProcessor");
		routedDocumentId = ppDocument.getDocumentId();
		// principal id 1 = ewestfal
		ppDocument.adHocToPrincipal(ActionRequestType.APPROVE, "AdHoc", "", "2001", "", true);
		ppDocument.route("");
		processedChange = true;
	}
	return new ProcessDocReport(true);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:PostProcessorTest.java

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

示例4: 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

示例5: testDirtyContent

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testDirtyContent() {
    WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"), "UnitTestDocument");
    document.setApplicationContent("application content");
    document.setAttributeContent("attribute content");
    document.setSearchableContent("searchable content");
    assertEquals("application content", document.getApplicationContent());
    assertEquals("application content", document.getDocumentContent().getApplicationContent());
    assertEquals("attribute content", document.getAttributeContent());
    assertEquals("attribute content", document.getDocumentContent().getAttributeContent());
    assertEquals("searchable content", document.getDocumentContent().getSearchableContent());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:12,代码来源:WorkflowDocumentTest.java

示例6: testDocumentContentConsistency

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests that document content is reloaded from the database after every call (such as Approve, etc.)
 * so as to verify that the document content stored on the WorkflowDocument will not go stale in between
 * calls.
 */
@Test public void testDocumentContentConsistency() throws Exception {
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "TestDocumentType");
	String appContent = "<app>content</app>";
	document.setApplicationContent(appContent);
	document.saveDocumentData();
    XMLAssert.assertXMLEqual(appContent, document.getApplicationContent());
	
	// load the document and modify the content
	WorkflowDocument document2 = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
	XMLAssert.assertXMLEqual(appContent, document2.getApplicationContent());
	String appContent2 = "<app>content2</app>";
	document2.setApplicationContent(appContent2);
	XMLAssert.assertXMLEqual(appContent2, document2.getApplicationContent());
	document2.saveDocumentData();
	
	// the original document should not notice these changes yet
	XMLAssert.assertXMLEqual(appContent, document.getApplicationContent());
	// but if we saveRoutingData, we should see the new value
	document.saveDocumentData();
	XMLAssert.assertXMLEqual(appContent2, document.getApplicationContent());
	
	// also verify that just setting the content, but not saving it, doesn't get persisted
	document2.setApplicationContent("<bad>content</bad>");
	document2 = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document2.getDocumentId());
	XMLAssert.assertXMLEqual(appContent2, document.getApplicationContent());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:DocumentContentTest.java

示例7: 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

示例8: 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

示例9: testRouteDocumentWithSearchableAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testRouteDocumentWithSearchableAttribute() 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);
    WorkflowAttributeDefinition.Builder givennameXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttribute");

    workflowDocument.setApplicationContent("<test></test>");

    givennameXMLDef.addPropertyDefinition(key, "jack");
    workflowDocument.addSearchableDefinition(givennameXMLDef.build());

    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 have one document.", 1, results.getSearchResults().size());

    criteria = null;
    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 = null;
    criteria = DocumentSearchCriteria.Builder.create();
    criteria.setDocumentTypeName(documentTypeName);
    addSearchableAttribute(criteria, "fakeproperty", "doesntexist");
    try {
        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,代码行数:45,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例10: testDocumentSearchAttributeWildcarding

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test public void testDocumentSearchAttributeWildcarding() throws Exception {
    DocumentSearchService docSearchService = (DocumentSearchService) KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_SEARCH_SERVICE);

    String documentTypeName = "SearchDocType";
    String key = "givenname";
    DocumentType docType = ((DocumentTypeService)KEWServiceLocator.getService(KEWServiceLocator.DOCUMENT_TYPE_SERVICE)).findByName(
            documentTypeName);
    WorkflowDocument workflowDocument = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("rkirkend"),
            documentTypeName);
    WorkflowAttributeDefinition.Builder givennameXMLDef = WorkflowAttributeDefinition.Builder.create("XMLSearchableAttribute");

    workflowDocument.setApplicationContent("<test></test>");

    givennameXMLDef.addPropertyDefinition(key, "jack");
    workflowDocument.addSearchableDefinition(givennameXMLDef.build());

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

    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 have one document.", 1, results.getSearchResults().size());

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

    assertEquals("Search results should have one document.", 1, results.getSearchResults().size());

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

    assertEquals("Search results should have one document.", 0, results.getSearchResults().size());

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

    assertEquals("Search results should have one document.", 1, results.getSearchResults().size());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:49,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例11: testRouteDocumentWithInvalidSearchableAttributeContent

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests searching with client-generated documentContent which will not match what the SearchableAttributeOld
 * is configured to look for.  This should pass with zero search results, but should not throw an exception.
 * @throws Exception
 */
@Test public void testRouteDocumentWithInvalidSearchableAttributeContent() 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><garbage>" +
                                           "<blah>not going to match anything</blah>" +
                                           "</garbage></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.", 0, 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,代码行数:47,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例12: testRouteDocumentWithMoreInvalidSearchableAttributeContent

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests searching with client-generated documentContent which will not match what the SearchableAttributeOld
 * is configured to look for.  This should pass with zero search results, but should not throw an exception.
 * @throws Exception
 */
@Test public void testRouteDocumentWithMoreInvalidSearchableAttributeContent() 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><NOTsearchableContent><garbage>" +
                                           "<blah>not going to match anything</blah>" +
                                           "</garbage></NOTsearchableContent></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.", 0, 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,代码行数:47,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例13: testRouteDocumentWithXStreamSearchableAttribute

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
/**
 * Tests the XStreamSafeEvaluator against searchable attributes to resolve EN-63 and KULWF-723.
 *
 * This test is pretty much just a copy of testRouteDocumentWithSearchableAttribute using a
 * different document type which defines the same xpath expression, only with embedded
 * XStream "reference" attributes in the XML.
 */
@Test public void testRouteDocumentWithXStreamSearchableAttribute() 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"), "SearchDocTypeXStream");
    WorkflowAttributeDefinition.Builder givennameXMLDef = WorkflowAttributeDefinition.Builder.create("XMLXStreamSearchableAttribute");

    workflowDocument.setApplicationContent("<test></test>");

    givennameXMLDef.addPropertyDefinition("givenname", "jack");
    workflowDocument.addSearchableDefinition(givennameXMLDef.build());

    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.", 0, 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,代码行数:51,代码来源:StandardGenericXMLSearchableAttributeTest.java

示例14: testHierarchyRoutingNodeUnevenApprovalExtraStops

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testHierarchyRoutingNodeUnevenApprovalExtraStops() throws WorkflowException {
    loadXmlFile("HierarchyRoutingNodeConfig.xml");
    
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "HierarchyDocType");
    
    doc.setApplicationContent(HIERARCHY);
    doc.route("initial route");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user2", "user1", "temay", "jhopf" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
    doc.approve("approving as user2");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "temay", "jhopf" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user2", "user3", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), doc.getDocumentId());
    doc.approve("approving as jhopf");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "temay" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "jhopf", "user2", "user3", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
    doc.setApplicationContent(HIERARCHY_UPDATED);
    doc.approve("approving as user1");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "temay", "delyea", "pzhang", "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "jhopf", "user2", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
    doc.approve("approving as user3");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "temay", "delyea", "pzhang", "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "user1", "jhopf", "user2", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("temay"), doc.getDocumentId());
    doc.approve("approving as temay");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "delyea", "pzhang", "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "temay", "user1", "jhopf", "user2", "dewey", "quickstart" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("delyea"), doc.getDocumentId());
    doc.approve("approving as delyea");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "pzhang", "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "delyea", "temay", "user1", "jhopf", "user2", "quickstart", "dewey" }, false);

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
    doc.approve("approving as user3");

    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "pzhang", "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "delyea", "temay", "user1", "jhopf", "user2", "quickstart", "dewey" }, false);

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("pzhang"), doc.getDocumentId());
    doc.approve("approving as pzhang");

    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "quickstart", "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "pzhang", "delyea", "temay", "user1", "jhopf", "user2", "dewey" }, false);

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("quickstart"), doc.getDocumentId());
    doc.approve("approving as quickstart");

    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "shenl" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "pzhang", "delyea", "temay", "user1", "jhopf", "user2", "quickstart", "dewey" }, false);

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("shenl"), doc.getDocumentId());
    doc.approve("approving as shenl");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "dewey" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "pzhang", "delyea", "temay", "user1", "jhopf", "user2", "quickstart", "shenl" }, false);

    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("dewey"), doc.getDocumentId());
    doc.approve("approving as dewey");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "shenl", "dewey", "pzhang", "delyea", "user3", "temay", "user1", "jhopf", "user2", "quickstart" }, false);
    
    assertTrue(doc.isFinal());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:81,代码来源:HierarchyRoutingNodeTest.java

示例15: testHierarchyRoutingNodeUnevenApprovalDisapprove

import org.kuali.rice.kew.api.WorkflowDocument; //导入方法依赖的package包/类
@Test
public void testHierarchyRoutingNodeUnevenApprovalDisapprove() throws WorkflowException {
    loadXmlFile("HierarchyRoutingNodeConfig.xml");
    
    WorkflowDocument doc = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("arh14"), "HierarchyDocType");
    
    doc.setApplicationContent(HIERARCHY);
    doc.route("initial route");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user2", "user1", "temay", "jhopf" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
    doc.approve("approving as user2");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "temay", "jhopf" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user2", "user3", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), doc.getDocumentId());
    doc.approve("approving as jhopf");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "temay" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "jhopf", "user2", "user3", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
    doc.approve("approving as user1");
    
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "temay" }, true);
    TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user1", "jhopf", "user2", "quickstart", "dewey" }, false);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user3"), doc.getDocumentId());
    doc.disapprove("disapproving as user3");
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), doc.getDocumentId());

    //TestUtilities.assertApprovals(doc.getDocumentId(), new String[] { "user3", "temay", "user1", "jhopf", "user2", "quickstart", "dewey" }, false);

    assertTrue(doc.isDisapproved());
 
    TestUtilities.logActionRequests(doc.getDocumentId());

    // these are ok, these are the ACKs for the previous approvers
    int numActionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(doc.getDocumentId()).size();
    assertEquals("Incorrect number of action requests", 4, numActionRequests);
    int numActionItems = KEWServiceLocator.getActionListService().findByDocumentId(doc.getDocumentId()).size();
    assertEquals("Incorrect number of action items.", 4, numActionItems);
    
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user2"), doc.getDocumentId());
    doc.acknowledge("acknowledging disapproval as user2");
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("jhopf"), doc.getDocumentId());
    doc.acknowledge("acknowledging disapproval as jhopf");
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("user1"), doc.getDocumentId());
    doc.acknowledge("acknowledging disapproval as user1");
    doc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("arh14"), doc.getDocumentId());
    doc.acknowledge("acknowledging disapproval as arh14");
    
    assertTrue(doc.isDisapproved());

    numActionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(doc.getDocumentId()).size();
    assertEquals("Incorrect number of action requests", 0, numActionRequests);
    numActionItems = KEWServiceLocator.getActionListService().findByDocumentId(doc.getDocumentId()).size();
    assertEquals("Incorrect number of action items.", 0, numActionItems);
    
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:65,代码来源:HierarchyRoutingNodeTest.java


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