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


Java PropertyDefinition.getDataType方法代码示例

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


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

示例1: convertPropertyValue

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
protected Object convertPropertyValue(PropertyDefinition propDef, Serializable value)
{
    Object newValue = value;
    // Convert property value using a default type converter
    if (value instanceof Collection<?>)
    {
        // Convert a collecion of values
        newValue =typeConverter.convert(propDef.getDataType(), (Collection<?>) value);
    }
    else
    {
        // Convert a single value
        newValue = typeConverter.convert(propDef.getDataType(), value);
    }

    // Convert NodeRefs to ActivitiScriptNodes
    DataTypeDefinition dataTypeDef = propDef.getDataType();
    if (dataTypeDef.getName().equals(DataTypeDefinition.NODE_REF))
    {
        newValue = nodeConverter.convertNodes(newValue, propDef.isMultiValued());
    }
    return newValue;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:AbstractWorkflowPropertyHandler.java

示例2: getDataTypeDefinition

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
public static DataTypeDefinition getDataTypeDefinition(DictionaryService dictionaryService, QName propertyQname)
{
    if(propertyQname == null)
    {
        return null;
    }
    PropertyDefinition propDef = dictionaryService.getProperty(propertyQname);
    if(propDef == null)
    {
        return null;
    }
    return propDef.getDataType();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:DBQuery.java

示例3: getPropertyDataType

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
public DataTypeDefinition getPropertyDataType(QName propertyName)
{
    // get property datatype
    DataTypeDefinition valueDataType = propertyDatatypes.get(propertyName);
    if (valueDataType == null)
    {
        PropertyDefinition propDef = getDictionaryService().getProperty(propertyName);
        if (propDef != null)
        {
            valueDataType = propDef.getDataType();
        }
    }
    return valueDataType;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:NodeContext.java

示例4: M2PropertyDefinition

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
M2PropertyDefinition(
        ClassDefinition classDef,
        PropertyDefinition propertyDef,
        M2PropertyOverride override,
        NamespacePrefixResolver prefixResolver,
        Map<QName, ConstraintDefinition> modelConstraints)
{
    this.classDef = classDef;
    this.name = propertyDef.getName();
    this.dataType = propertyDef.getDataType();
    this.propertyTypeName = this.dataType.getName();
    this.m2Property = createOverriddenProperty(propertyDef, override, prefixResolver, modelConstraints);
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:14,代码来源:M2PropertyDefinition.java

示例5: getFacetableProperties

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
@Override public List<PropertyDefinition> getFacetableProperties(QName contentClass)
{
    final List<PropertyDefinition> result = new ArrayList<>();
    
    final Map<QName, PropertyDefinition> propertyDefs = dictionaryService.getPropertyDefs(contentClass);
    
    if (propertyDefs != null)
    {
        for (final Map.Entry<QName, PropertyDefinition> prop : propertyDefs.entrySet())
        {
            final PropertyDefinition propDef = prop.getValue();
            if (propDef.isIndexed()) //SHA-1308
            {
                final Facetable propIsFacetable = propDef.getFacetable();

                switch (propIsFacetable)
                {
                    case TRUE:
                        result.add(propDef);
                        break;
                    case FALSE:
                        // The value is not facetable. Do nothing.
                        break;
                    case UNSET:
                        // These values may be facetable.
                        final DataTypeDefinition datatype = propDef.getDataType();
                        if (isNumeric(datatype) || isDateLike(datatype) || isFacetableText(datatype))
                        {
                            result.add(propDef);
                            break;
                        }
                        break;
                    default:
                        // This should never happen. If it does, it's a programming error.
                        throw new IllegalStateException("Failed to handle " + Facetable.class.getSimpleName() + " type: " + propIsFacetable);
                }
            }
        }
    }
    
    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:43,代码来源:SolrFacetServiceImpl.java

示例6: getPropertyValue

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
private PropertyValue getPropertyValue(PropertyDefinition propertyDef, Object value) throws JSONException
{
    PropertyValue ret = null;

    if(value == null || value == JSONObject.NULL)
    {
        ret = null;
    }
    else if(propertyDef == null)
    {
        // assume a string
        ret = new StringPropertyValue((String)value);
    }
    else
    {
        DataTypeDefinition dataType = propertyDef.getDataType();
        
        boolean isMulti = propertyDef.isMultiValued();
        if(isMulti)
        {
            if(!(value instanceof JSONArray))
            {
                throw new IllegalArgumentException("Expected json array, got " + value.getClass().getName());
            }

            MultiPropertyValue multi = new MultiPropertyValue();
            JSONArray array = (JSONArray)value;
            for(int j = 0; j < array.length(); j++)
            {
                multi.addValue(getSinglePropertyValue(dataType, array.get(j)));
            }

            ret = multi;
        }
        else
        {
            ret = getSinglePropertyValue(dataType, value);
        }
    }
    
    return ret;
}
 
开发者ID:Alfresco,项目名称:alfresco-solrclient,代码行数:43,代码来源:SOLRAPIClient.java

示例7: getInDataType

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
@Override
protected DataTypeDefinition getInDataType()
{
    PropertyDefinition pd = dictionaryService.getProperty(alfrescoName);
    return pd.getDataType();
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:7,代码来源:DirectLuceneBuilder.java

示例8: serialize

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public PropertyValue serialize(QName propName, Serializable value) throws IOException, JSONException
{
    if(value == null)
    {
        return new PropertyValue(false, "null");
    }

    PropertyDefinition propertyDef = dictionaryService.getProperty(propName);
    if (propertyDef == null)
    {
        // Treat it as text
        return new PropertyValue(true, serializeToJSONString(value));
    }
    DataTypeDefinition dataType = propertyDef.getDataType();
    QName dataTypeName = dataType.getName();
    if (propertyDef.isMultiValued())
    {
        if(!(value instanceof Collection))
        {
            throw new IllegalArgumentException("Multi value: expected a collection, got " + value.getClass().getName());
        }

        Collection<Serializable> c = (Collection<Serializable>)value;

        JSONArray body = new JSONArray();
        for(Serializable o : c)
        {
            if(dataTypeName.equals(DataTypeDefinition.MLTEXT))
            {
                MLText source = (MLText)o;
                JSONArray array = new JSONArray();
                for(Locale locale : source.getLocales())
                {
                    JSONObject json = new JSONObject();
                    json.put("locale", DefaultTypeConverter.INSTANCE.convert(String.class, locale));
                    json.put("value", source.getValue(locale));
                    array.put(json);
                }
                body.put(array);
            }
            else if(dataTypeName.equals(DataTypeDefinition.CONTENT))
            {
                throw new RuntimeException("Multi-valued content properties are not supported");
            }
            else
            {
                body.put(serializeToJSONString(o));
            }
            
        }
        
        return new PropertyValue(false, body.toString());
    }
    else
    {
        boolean encodeString = true;
        if(dataTypeName.equals(DataTypeDefinition.MLTEXT))
        {
            encodeString = false;
        }
        else if(dataTypeName.equals(DataTypeDefinition.CONTENT))
        {
            encodeString = false;
        }
        else
        {
            encodeString = true;
        }

        String sValue = null;
        if (value instanceof String && encodeString) {
        	sValue = (String)jsonUtils.encodeJSONString(value);
        } else {
        	sValue = serializeToJSONString(value);
        }

        return new PropertyValue(encodeString, sValue);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:81,代码来源:SOLRSerializer.java

示例9: QueryParameterDefImpl

import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
/**
 * QueryParameterDefImpl
 * 
 * @param qName QName
 * @param propertyDefinition PropertyDefinition
 * @param hasDefaultValue boolean
 * @param defaultValue String
 */
public QueryParameterDefImpl(QName qName, PropertyDefinition propertyDefinition, boolean hasDefaultValue, String defaultValue)
{
    this(qName, hasDefaultValue, defaultValue);
    this.propertyDefintion = propertyDefinition;
    this.dataTypeDefintion = propertyDefinition.getDataType();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:QueryParameterDefImpl.java


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