本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例7: getInDataType
import org.alfresco.service.cmr.dictionary.PropertyDefinition; //导入方法依赖的package包/类
@Override
protected DataTypeDefinition getInDataType()
{
PropertyDefinition pd = dictionaryService.getProperty(alfrescoName);
return pd.getDataType();
}
示例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);
}
}
示例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();
}