Package org.apache.jackrabbit.vault.util
Class DocViewProperty
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.DocViewProperty
-
public class DocViewProperty extends java.lang.ObjectHelper 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 booleanisMultiindicates a MV propertybooleanisReferencePropertyindicates a binary ref propertyjava.lang.Stringnamename of the propertyinttypetype of this property (can be undefined)java.lang.String[]valuesvalue(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 booleanapply(Node node)Sets this property on the given nodebooleanequals(java.lang.Object obj)static java.lang.Stringformat(Property prop)Formats the given jcr property to the enhanced docview syntax.static java.lang.Stringformat(Property prop, boolean sort, boolean useBinaryReferences)Formats the given jcr property to the enhanced docview syntax.inthashCode()static booleanisAmbiguous(Property prop)Checks if the type of the given property is ambiguous in respect to it's property definition.static DocViewPropertyparse(java.lang.String name, java.lang.String value)Parses a enhanced docview property string and returns the property.java.lang.StringtoString()
-
-
-
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 propertyvalues- values.multi- multiple flagtype- 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 propertyvalues- values.multi- multiple flagtype- type of the propertyisRef-trueto 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 propertyvalue- (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 propertysort- iftruemultivalue properties are sorteduseBinaryReferences-trueto 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:
trueif the value was modified.- Throws:
RepositoryException- if a repository error occurs
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-