Class DocViewProperty


  • public class DocViewProperty
    extends java.lang.Object
    Helper class that represents a (jcr) property in the document view format. It contains formatting and parsing methods for writing/reading enhanced docview properties. prop:= [ "{" type "}" ] ( value | "[" [ value { "," value } ] "]" )
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean isMulti
      indicates a MV property
      boolean isReferenceProperty
      indicates a binary ref property
      java.lang.String name
      name of the property
      int type
      type of this property (can be undefined)
      java.lang.String[] values
      value(s) of the property.
    • Constructor Summary

      Constructors 
      Constructor Description
      DocViewProperty​(java.lang.String name, java.lang.String[] values, boolean multi, int type)
      Creates a new property.
      DocViewProperty​(java.lang.String name, java.lang.String[] values, boolean multi, int type, boolean isRef)
      Creates a new property.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean apply​(Node node)
      Sets this property on the given node
      boolean equals​(java.lang.Object obj)  
      static java.lang.String format​(Property prop)
      Formats the given jcr property to the enhanced docview syntax.
      static java.lang.String format​(Property prop, boolean sort, boolean useBinaryReferences)
      Formats the given jcr property to the enhanced docview syntax.
      int hashCode()  
      static boolean isAmbiguous​(Property prop)
      Checks if the type of the given property is ambiguous in respect to it's property definition.
      static DocViewProperty parse​(java.lang.String name, java.lang.String value)
      Parses a enhanced docview property string and returns the property.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        public final java.lang.String name
        name of the property
      • values

        public final java.lang.String[] values
        value(s) of the property. always contains at least one value if this is not a mv property.
      • isMulti

        public final boolean isMulti
        indicates a MV property
      • type

        public final int type
        type of this property (can be undefined)
      • isReferenceProperty

        public final boolean isReferenceProperty
        indicates a binary ref property
    • Constructor Detail

      • DocViewProperty

        public DocViewProperty​(java.lang.String name,
                               java.lang.String[] values,
                               boolean multi,
                               int type)
        Creates a new property.
        Parameters:
        name - name of the property
        values - values.
        multi - multiple flag
        type - type of the property
        Throws:
        java.lang.IllegalArgumentException - if single value property and not exactly 1 value is given.
      • DocViewProperty

        public DocViewProperty​(java.lang.String name,
                               java.lang.String[] values,
                               boolean multi,
                               int type,
                               boolean isRef)
        Creates a new property.
        Parameters:
        name - name of the property
        values - values.
        multi - multiple flag
        type - type of the property
        isRef - true to indicated that this is a binary reference property
        Throws:
        java.lang.IllegalArgumentException - if single value property and not exactly 1 value is given.
    • Method Detail

      • parse

        public static DocViewProperty parse​(java.lang.String name,
                                            java.lang.String value)
        Parses a enhanced docview property string and returns the property.
        Parameters:
        name - name of the property
        value - (attribute) value
        Returns:
        a property
      • format

        public static java.lang.String format​(Property prop)
                                       throws RepositoryException
        Formats the given jcr property to the enhanced docview syntax.
        Parameters:
        prop - the jcr property
        Returns:
        the formatted string
        Throws:
        RepositoryException - if a repository error occurs
      • format

        public static java.lang.String format​(Property prop,
                                              boolean sort,
                                              boolean useBinaryReferences)
                                       throws RepositoryException
        Formats the given jcr property to the enhanced docview syntax.
        Parameters:
        prop - the jcr property
        sort - if true multivalue properties are sorted
        useBinaryReferences - true to use binary references
        Returns:
        the formatted string
        Throws:
        RepositoryException - if a repository error occurs
      • isAmbiguous

        public static boolean isAmbiguous​(Property prop)
                                   throws RepositoryException
        Checks if the type of the given property is ambiguous in respect to it's property definition. the current implementation just checks some well known properties.
        Parameters:
        prop - the property
        Returns:
        type
        Throws:
        RepositoryException - if a repository error occurs
      • apply

        public boolean apply​(Node node)
                      throws RepositoryException
        Sets this property on the given node
        Parameters:
        node - the node
        Returns:
        true if the value was modified.
        Throws:
        RepositoryException - if a repository error occurs
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object