Package org.alfresco.repo.domain.node
Class NodePropertyValue
java.lang.Object
org.alfresco.repo.domain.node.NodePropertyValue
- All Implemented Interfaces:
Serializable,Cloneable
Immutable property value storage class.
- Since:
- 3.4
- Author:
- Derek Hulley
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Serializableused to provide empty collection values in and outImmutable classes in addition toValueProtectingMap.DEFAULT_IMMUTABLE_CLASSESContentData ContentDataId NodeRef ChildAssociationRef AssociationRef QName VersionNumber Period -
Constructor Summary
ConstructorsConstructorDescriptiondefault constructorNodePropertyValue(QName typeQName, Serializable value) Construct a new property value. -
Method Summary
Modifier and TypeMethodDescriptionclone()static intconvertToPersistedTypeOrdinal(QName typeQName, Serializable value) Given an actual type qualified name, returns the int ordinal number that represents its persisted in the database.static intconvertToTypeOrdinal(QName typeQName) Given an actual type qualified name, returns the int ordinal number that represents it in the database.booleanbooleangetCollection(QName typeQName) Gets the value or values as a guaranteed collection.doublefloatlongFetches the value as a desired type.inthashCode()static booleanisDataTypeSupported(QName typeQName) If property value of the typeQNameis supportedvoidsetActualType(Integer actualType) voidsetBooleanValue(boolean value) voidsetDoubleValue(double value) voidsetFloatValue(float value) voidsetLongValue(long value) voidsetPersistedType(Integer persistedType) voidsetPersistedValue(org.alfresco.repo.domain.node.NodePropertyValue.ValueType persistedType, Serializable value) Stores the value in the correct slot based on the type of persistence requested.voidsetSerializableValue(Serializable value) voidsetStringValue(String value) toString()
-
Field Details
-
EMPTY_COLLECTION_VALUE
used to provide empty collection values in and out -
IMMUTABLE_CLASSES
Immutable classes in addition toValueProtectingMap.DEFAULT_IMMUTABLE_CLASSES- ContentData
- ContentDataId
- NodeRef
- ChildAssociationRef
- AssociationRef
- QName
- VersionNumber
- Period
-
-
Constructor Details
-
NodePropertyValue
public NodePropertyValue()default constructor -
NodePropertyValue
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:
UnsupportedOperationException- if the value cannot be converted to the type given
-
-
Method Details
-
convertToTypeOrdinal
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.
-
convertToPersistedTypeOrdinal
Given an actual type qualified name, returns the int ordinal number that represents its persisted in the database.- Parameters:
typeQName- the type qualified namevalue- the value going to be persisted (optional, null for the default)- Returns:
- Returns the int representation of the type, e.g. CONTENT.getOrdinalNumber() for type d:content.
-
isDataTypeSupported
If property value of the typeQNameis supported- Parameters:
typeQName- the type qualified name
-
equals
-
hashCode
public int hashCode() -
clone
- Overrides:
clonein classObject- Throws:
CloneNotSupportedException
-
toString
-
getActualType
-
getActualTypeString
- Returns:
- Returns the actual type's String representation
-
setActualType
-
getPersistedType
-
setPersistedType
-
setPersistedValue
public void setPersistedValue(org.alfresco.repo.domain.node.NodePropertyValue.ValueType persistedType, 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
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 recognizedTypeConversionException- if the conversion to the required type fails- See Also:
-
getCollection
Gets the value or values as a guaranteed collection.- See Also:
-
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
-
setStringValue
-
getSerializableValue
-
setSerializableValue
-