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


Java DataTypeUtil类代码示例

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


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

示例1: getCleanSearchableValues

import org.kuali.rice.krad.util.DataTypeUtil; //导入依赖的package包/类
@Override
public List<String> getCleanSearchableValues(String attributeKey) throws AttributeValidationException {
    Class<?> attributeType = getType(attributeKey);
    Object rawValue = getValue(attributeKey);
    String attributeInValue = "";

    if (rawValue != null) {
        //if a date force the format
        if (rawValue instanceof Date && !(rawValue instanceof Timestamp)) {
            attributeInValue = new SimpleDateFormat("MM-dd-yyyy").format(rawValue);
        } else {
            attributeInValue = rawValue.toString();
        }
    }

    String attributeDataType = DataTypeUtil.determineDataType(attributeType);
    return SQLUtils.getCleanedSearchableValues(attributeInValue, attributeDataType);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:BaseAttributeValueReader.java

示例2: buildSearchableAttribute

import org.kuali.rice.krad.util.DataTypeUtil; //导入依赖的package包/类
/**
 * Using the type of the sent in value, determines what kind of SearchableAttributeValue implementation should be passed back 
 * @param attributeKey
 * @param value
 * @return
 */
public DocumentAttribute buildSearchableAttribute(Class<? extends BusinessObject> businessObjectClass, String attributeKey, Object value) {
    if (value == null) return null;
    final String fieldDataType = determineFieldDataType(businessObjectClass, attributeKey);
    if (fieldDataType.equals(KewApiConstants.SearchableAttributeConstants.DATA_TYPE_STRING)) return buildSearchableStringAttribute(attributeKey, value); // our most common case should go first
    if (fieldDataType.equals(KewApiConstants.SearchableAttributeConstants.DATA_TYPE_FLOAT) && DataTypeUtil.isDecimaltastic(value.getClass())) return buildSearchableRealAttribute(attributeKey, value);
    if (fieldDataType.equals(KewApiConstants.SearchableAttributeConstants.DATA_TYPE_DATE) && DataTypeUtil.isDateLike(value.getClass())) return buildSearchableDateTimeAttribute(attributeKey, value);
    if (fieldDataType.equals(KewApiConstants.SearchableAttributeConstants.DATA_TYPE_LONG) && DataTypeUtil.isIntsy(value.getClass())) return buildSearchableFixnumAttribute(attributeKey, value);
    if (fieldDataType.equals(DataDictionarySearchableAttribute.DATA_TYPE_BOOLEAN) && DataTypeUtil.isBooleanable(value.getClass())) return buildSearchableYesNoAttribute(attributeKey, value);
    return buildSearchableStringAttribute(attributeKey, value);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:17,代码来源:WorkflowAttributePropertyResolutionServiceImpl.java

示例3: getCleanSearchableValues

import org.kuali.rice.krad.util.DataTypeUtil; //导入依赖的package包/类
@Override
public List<String> getCleanSearchableValues(String attributeKey) throws AttributeValidationException {
    Class<?> attributeType = getType(attributeKey);
    Object rawValue = getValue(attributeKey);

    String attributeInValue = rawValue != null ? rawValue.toString() : "";
    String attributeDataType = DataTypeUtil.determineDataType(attributeType);
    return SQLUtils.getCleanedSearchableValues(attributeInValue, attributeDataType);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:10,代码来源:BaseAttributeValueReader.java

示例4: buildRemotableFieldFromAttributeDefinition

import org.kuali.rice.krad.util.DataTypeUtil; //导入依赖的package包/类
@Override
public RemotableAttributeField buildRemotableFieldFromAttributeDefinition(String componentClassName,
        String attributeName) {
    AttributeDefinition baseDefinition;
    Class<?> componentClass;
    // try to resolve the component name - if not possible - try to pull the definition from the app mediation service
    try {
        componentClass = Class.forName(componentClassName);
        baseDefinition = getDataDictionaryService().getDataDictionary().getDictionaryObjectEntry(componentClassName)
                .getAttributeDefinition(attributeName);
    } catch (ClassNotFoundException ex) {
        throw new RiceRuntimeException("Unable to find attribute definition for attribute : " + attributeName);
    }

    RemotableAttributeField.Builder definition = RemotableAttributeField.Builder.create(baseDefinition.getName());

    definition.setLongLabel(baseDefinition.getLabel());
    definition.setShortLabel(baseDefinition.getShortLabel());
    definition.setMaxLength(baseDefinition.getMaxLength());

    if (baseDefinition.isRequired() != null) {
        definition.setRequired(baseDefinition.isRequired().booleanValue());
    }

    definition.setForceUpperCase(baseDefinition.getForceUppercase().booleanValue());

    //set the datatype - needed for successful custom doc searches
    String dataType = DataTypeUtil.determineFieldDataType((Class<? extends BusinessObject>) componentClass,
            attributeName);
    definition.setDataType(DataType.valueOf(dataType.toUpperCase()));

    RemotableAbstractControl.Builder control = createControl(baseDefinition);
    if (control != null) {
        definition.setControl(control);
    }

    RemotableQuickFinder.Builder qf = createQuickFinder(componentClass, attributeName);
    if (qf != null) {
        definition.setWidgets(Collections.<RemotableAbstractWidget.Builder>singletonList(qf));
    }

    return definition.build();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:44,代码来源:DataDictionaryRemoteFieldServiceImpl.java

示例5: determineFieldDataType

import org.kuali.rice.krad.util.DataTypeUtil; //导入依赖的package包/类
public String determineFieldDataType(Class<? extends BusinessObject> businessObjectClass, String attributeName) {
    return DataTypeUtil.determineFieldDataType(businessObjectClass, attributeName);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:4,代码来源:WorkflowAttributePropertyResolutionServiceImpl.java

示例6: buildRemotableFieldFromAttributeDefinition

import org.kuali.rice.krad.util.DataTypeUtil; //导入依赖的package包/类
/**
 * @see org.kuali.rice.krad.service.DataDictionaryRemoteFieldService#buildRemotableFieldFromAttributeDefinition(java.lang.String,
 *      java.lang.String)
 */
public RemotableAttributeField buildRemotableFieldFromAttributeDefinition(String componentClassName,
        String attributeName) {
    AttributeDefinition baseDefinition;
    Class<?> componentClass;
    // try to resolve the component name - if not possible - try to pull the definition from the app mediation service
    try {
        componentClass = (Class<? extends BusinessObject>) Class.forName(componentClassName);
        baseDefinition = getDataDictionaryService().getDataDictionary().getDictionaryObjectEntry(componentClassName)
                .getAttributeDefinition(attributeName);
    } catch (ClassNotFoundException ex) {
        throw new RiceRuntimeException("Unable to find attribute definition for attribute : " + attributeName);
    }

    RemotableAttributeField.Builder definition = RemotableAttributeField.Builder.create(baseDefinition.getName());

    definition.setLongLabel(baseDefinition.getLabel());
    definition.setShortLabel(baseDefinition.getShortLabel());
    definition.setMaxLength(baseDefinition.getMaxLength());

    if (baseDefinition.isRequired() != null) {
        definition.setRequired(baseDefinition.isRequired());
    }

    definition.setForceUpperCase(baseDefinition.getForceUppercase());

    //set the datatype - needed for successful custom doc searches
    String dataType = DataTypeUtil.determineFieldDataType((Class<? extends BusinessObject>) componentClass,
            attributeName);
    definition.setDataType(DataType.valueOf(dataType.toUpperCase()));

    RemotableAbstractControl.Builder control = createControl(baseDefinition);
    if (control != null) {
        definition.setControl(control);
    }

    RemotableQuickFinder.Builder qf = createQuickFinder(componentClass, attributeName);
    if (qf != null) {
        definition.setWidgets(Collections.<RemotableAbstractWidget.Builder>singletonList(qf));
    }

    return definition.build();
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:47,代码来源:DataDictionaryRemoteFieldServiceImpl.java


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