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


Java DocumentSearchCriteriaTranslatorImpl类代码示例

本文整理汇总了Java中org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaTranslatorImpl的典型用法代码示例。如果您正苦于以下问题:Java DocumentSearchCriteriaTranslatorImpl类的具体用法?Java DocumentSearchCriteriaTranslatorImpl怎么用?Java DocumentSearchCriteriaTranslatorImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DocumentSearchCriteriaTranslatorImpl类属于org.kuali.rice.kew.impl.document.search包,在下文中一共展示了DocumentSearchCriteriaTranslatorImpl类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAttributeRangeFieldGeneration

import org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaTranslatorImpl; //导入依赖的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


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