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


Java KRADConstants.LOOKUP_RANGE_LOWER_BOUND_PROPERTY_PREFIX属性代码示例

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


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

示例1: testAttributeRangeFieldGeneration

@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,代码行数:28,代码来源:SearchableAttributeTest.java

示例2: constructFieldsForAttributeDefinition

private static List<Field> constructFieldsForAttributeDefinition(RemotableAttributeField remotableAttributeField) {
    List<Field> fields = new ArrayList<Field>();
    if (remotableAttributeField.getAttributeLookupSettings() != null
            && remotableAttributeField.getAttributeLookupSettings().isRanged()) {
        // create two fields, one for the "from" and one for the "to"
        AttributeLookupSettings lookupSettings = remotableAttributeField.getAttributeLookupSettings();
        // Create a pair of range input fields for a ranged attribute
        // the lower bound is prefixed to distinguish it from the upper bound, which retains the original field name
        String attrLabel;
        if (StringUtils.isBlank(remotableAttributeField.getLongLabel())) {
            attrLabel =  remotableAttributeField.getShortLabel();
        } else {
            attrLabel =  remotableAttributeField.getLongLabel();
        }
        String label = StringUtils.defaultString(lookupSettings.getLowerLabel(), attrLabel
            + " " + KewApiConstants.SearchableAttributeConstants.DEFAULT_RANGE_SEARCH_LOWER_BOUND_LABEL);
        Field lowerField = new Field(KRADConstants.LOOKUP_RANGE_LOWER_BOUND_PROPERTY_PREFIX + remotableAttributeField.getName(), label);
        lowerField.setMemberOfRange(true);
        lowerField.setAllowInlineRange(false);
        lowerField.setRangeFieldInclusive(lookupSettings.isLowerBoundInclusive());
        if (lookupSettings.isLowerDatePicker() != null) {
            lowerField.setDatePicker(lookupSettings.isLowerDatePicker());
        }
        if (!remotableAttributeField.getDataType().equals(DataType.CURRENCY)) {
            lowerField.setFieldDataType(remotableAttributeField.getDataType().name().toLowerCase());
        }
        fields.add(lowerField);

        label = StringUtils.defaultString(lookupSettings.getUpperLabel(), attrLabel
            + " " + KewApiConstants.SearchableAttributeConstants.DEFAULT_RANGE_SEARCH_UPPER_BOUND_LABEL);
        Field upperField = new Field(remotableAttributeField.getName(), label);
        upperField.setMemberOfRange(true);
        upperField.setAllowInlineRange(false);
        upperField.setRangeFieldInclusive(lookupSettings.isUpperBoundInclusive());
        if (lookupSettings.isUpperDatePicker() != null) {
            upperField.setDatePicker(lookupSettings.isUpperDatePicker());
        }
        if (!remotableAttributeField.getDataType().equals(DataType.CURRENCY)) {
            upperField.setFieldDataType(remotableAttributeField.getDataType().name().toLowerCase());
        }
        fields.add(upperField);
    } else {
        //this ain't right....
        Field tempField = new Field(remotableAttributeField.getName(), remotableAttributeField.getLongLabel());
        if (remotableAttributeField.getMaxLength() != null) {
            tempField.setMaxLength(remotableAttributeField.getMaxLength());
        }

        if (remotableAttributeField.getShortLabel() != null) {
            tempField.setFieldLabel(remotableAttributeField.getShortLabel());
        }

        if (!remotableAttributeField.getDataType().equals(DataType.CURRENCY)) {
            tempField.setFieldDataType(remotableAttributeField.getDataType().name().toLowerCase());
        } else {
            tempField.setFieldDataType(KewApiConstants.SearchableAttributeConstants.DATA_TYPE_FLOAT);
        }

        tempField.setMainFieldLabel(remotableAttributeField.getLongLabel());
        tempField.setFieldHelpSummary(remotableAttributeField.getHelpSummary());
        tempField.setUpperCase(remotableAttributeField.isForceUpperCase());
        if (remotableAttributeField.getMaxLength() != null) {
            if (remotableAttributeField.getMaxLength().intValue() > 0) {
                tempField.setMaxLength(remotableAttributeField.getMaxLength().intValue());
            } else {
                tempField.setMaxLength(100);
            }
        }
        tempField.setFieldRequired(remotableAttributeField.isRequired());

        fields.add(tempField);
    }
    return fields;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:74,代码来源:FieldUtils.java


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