Package org.alfresco.repo.domain.node
Class NodePropertyValue
- java.lang.Object
-
- org.alfresco.repo.domain.node.NodePropertyValue
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class NodePropertyValue extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableImmutable property value storage class.- Since:
- 3.4
- Author:
- Derek Hulley
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.io.SerializableEMPTY_COLLECTION_VALUEused to provide empty collection values in and outstatic java.util.Set<java.lang.Class<?>>IMMUTABLE_CLASSESImmutable classes in addition toValueProtectingMap.DEFAULT_IMMUTABLE_CLASSESContentData ContentDataId NodeRef ChildAssociationRef AssociationRef QName VersionNumber Period
-
Constructor Summary
Constructors Constructor Description NodePropertyValue()default constructorNodePropertyValue(org.alfresco.service.namespace.QName typeQName, java.io.Serializable value)Construct a new property value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()static intconvertToTypeOrdinal(org.alfresco.service.namespace.QName typeQName)Given an actual type qualified name, returns the int ordinal number that represents it in the database.booleanequals(java.lang.Object obj)java.lang.IntegergetActualType()java.lang.StringgetActualTypeString()booleangetBooleanValue()java.util.Collection<java.io.Serializable>getCollection(org.alfresco.service.namespace.QName typeQName)Gets the value or values as a guaranteed collection.doublegetDoubleValue()floatgetFloatValue()longgetLongValue()java.lang.IntegergetPersistedType()java.io.SerializablegetSerializableValue()java.lang.StringgetStringValue()java.io.SerializablegetValue(org.alfresco.service.namespace.QName typeQName)Fetches the value as a desired type.inthashCode()static booleanisDataTypeSupported(org.alfresco.service.namespace.QName typeQName)If property value of the typeQNameis supportedvoidsetActualType(java.lang.Integer actualType)voidsetBooleanValue(boolean value)voidsetDoubleValue(double value)voidsetFloatValue(float value)voidsetLongValue(long value)voidsetPersistedType(java.lang.Integer persistedType)voidsetPersistedValue(org.alfresco.repo.domain.node.NodePropertyValue.ValueType persistedType, java.io.Serializable value)Stores the value in the correct slot based on the type of persistence requested.voidsetSerializableValue(java.io.Serializable value)voidsetStringValue(java.lang.String value)java.lang.StringtoString()
-
-
-
Field Detail
-
EMPTY_COLLECTION_VALUE
public static final java.io.Serializable EMPTY_COLLECTION_VALUE
used to provide empty collection values in and out
-
IMMUTABLE_CLASSES
public static final java.util.Set<java.lang.Class<?>> IMMUTABLE_CLASSES
Immutable classes in addition toValueProtectingMap.DEFAULT_IMMUTABLE_CLASSES- ContentData
- ContentDataId
- NodeRef
- ChildAssociationRef
- AssociationRef
- QName
- VersionNumber
- Period
-
-
Constructor Detail
-
NodePropertyValue
public NodePropertyValue()
default constructor
-
NodePropertyValue
public NodePropertyValue(org.alfresco.service.namespace.QName typeQName, java.io.Serializable value)Construct a new property value.- Parameters:
typeQName- the dictionary-defined property type to store the property asvalue- the value to store. This will be converted into a format compatible with the type given- Throws:
java.lang.UnsupportedOperationException- if the value cannot be converted to the type given
-
-
Method Detail
-
convertToTypeOrdinal
public static int convertToTypeOrdinal(org.alfresco.service.namespace.QName typeQName)
Given an actual type qualified name, returns the int ordinal number that represents it in the database.- Parameters:
typeQName- the type qualified name- Returns:
- Returns the int representation of the type, e.g. CONTENT.getOrdinalNumber() for type d:content.
-
isDataTypeSupported
public static boolean isDataTypeSupported(org.alfresco.service.namespace.QName typeQName)
If property value of the typeQNameis supported- Parameters:
typeQName- the type qualified name
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getActualType
public java.lang.Integer getActualType()
-
getActualTypeString
public java.lang.String getActualTypeString()
- Returns:
- Returns the actual type's String representation
-
setActualType
public void setActualType(java.lang.Integer actualType)
-
getPersistedType
public java.lang.Integer getPersistedType()
-
setPersistedType
public void setPersistedType(java.lang.Integer persistedType)
-
setPersistedValue
public void setPersistedValue(org.alfresco.repo.domain.node.NodePropertyValue.ValueType persistedType, java.io.Serializable value)Stores the value in the correct slot based on the type of persistence requested. No conversion is done.- Parameters:
persistedType- the value typevalue- the value - it may only be null if the persisted type isValueType#NULL
-
getValue
public java.io.Serializable getValue(org.alfresco.service.namespace.QName typeQName)
Fetches the value as a desired type. Collections (i.e. multi-valued properties) will be converted as a whole to ensure that all the values returned within the collection match the given type.- Parameters:
typeQName- the type required for the return value- Returns:
- Returns the value of this property as the desired type, or a
Collectionof values of the required type - Throws:
org.alfresco.error.AlfrescoRuntimeException- if the type given is not recognizedorg.alfresco.service.cmr.repository.datatype.TypeConversionException- if the conversion to the required type fails- See Also:
The static qualified names for the types
-
getCollection
public java.util.Collection<java.io.Serializable> getCollection(org.alfresco.service.namespace.QName typeQName)
Gets the value or values as a guaranteed collection.- See Also:
getValue(QName)
-
getBooleanValue
public boolean getBooleanValue()
-
setBooleanValue
public void setBooleanValue(boolean value)
-
getLongValue
public long getLongValue()
-
setLongValue
public void setLongValue(long value)
-
getFloatValue
public float getFloatValue()
-
setFloatValue
public void setFloatValue(float value)
-
getDoubleValue
public double getDoubleValue()
-
setDoubleValue
public void setDoubleValue(double value)
-
getStringValue
public java.lang.String getStringValue()
-
setStringValue
public void setStringValue(java.lang.String value)
-
getSerializableValue
public java.io.Serializable getSerializableValue()
-
setSerializableValue
public void setSerializableValue(java.io.Serializable value)
-
-