Class NodePropertyValue

java.lang.Object
org.alfresco.repo.domain.node.NodePropertyValue
All Implemented Interfaces:
Serializable, Cloneable

public class NodePropertyValue extends Object implements Cloneable, Serializable
Immutable property value storage class.
Since:
3.4
Author:
Derek Hulley
See Also:
  • Field Details

    • EMPTY_COLLECTION_VALUE

      public static final Serializable EMPTY_COLLECTION_VALUE
      used to provide empty collection values in and out
    • IMMUTABLE_CLASSES

      public static final Set<Class<?>> IMMUTABLE_CLASSES
      Immutable classes in addition to ValueProtectingMap.DEFAULT_IMMUTABLE_CLASSES
    • ContentData
    • ContentDataId
    • NodeRef
    • ChildAssociationRef
    • AssociationRef
    • QName
    • VersionNumber
    • Period
  • Constructor Details

    • NodePropertyValue

      public NodePropertyValue()
      default constructor
    • NodePropertyValue

      public NodePropertyValue(QName typeQName, Serializable value)
      Construct a new property value.
      Parameters:
      typeQName - the dictionary-defined property type to store the property as
      value - 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

      public static int convertToTypeOrdinal(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.
    • convertToPersistedTypeOrdinal

      public static int convertToPersistedTypeOrdinal(QName typeQName, Serializable value)
      Given an actual type qualified name, returns the int ordinal number that represents its persisted in the database.
      Parameters:
      typeQName - the type qualified name
      value - 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

      public static boolean isDataTypeSupported(QName typeQName)
      If property value of the type QName is supported
      Parameters:
      typeQName - the type qualified name
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getActualType

      public Integer getActualType()
    • getActualTypeString

      public String getActualTypeString()
      Returns:
      Returns the actual type's String representation
    • setActualType

      public void setActualType(Integer actualType)
    • getPersistedType

      public Integer getPersistedType()
    • setPersistedType

      public void setPersistedType(Integer persistedType)
    • 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 type
      value - the value - it may only be null if the persisted type is ValueType#NULL
    • getValue

      public Serializable getValue(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 Collection of values of the required type
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if the type given is not recognized
      TypeConversionException - if the conversion to the required type fails
      See Also:
    • getCollection

      public Collection<Serializable> getCollection(QName typeQName)
      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

      public String getStringValue()
    • setStringValue

      public void setStringValue(String value)
    • getSerializableValue

      public Serializable getSerializableValue()
    • setSerializableValue

      public void setSerializableValue(Serializable value)