Package org.apache.jackrabbit.vault.util
Class DocViewProperty
- java.lang.Object
-
- org.apache.jackrabbit.vault.util.DocViewProperty
-
public class DocViewProperty extends 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 } ] "]" )
-
-
Constructor Summary
Constructors Constructor Description DocViewProperty(String name, String[] values, boolean multi, int type)
Creates a new property.DocViewProperty(String name, 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 nodeboolean
equals(Object obj)
static String
format(Property prop)
Formats the given jcr property to the enhanced docview syntax.static 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(String name, String value)
Parses a enhanced docview property string and returns the property.String
toString()
-
-
-
Field Detail
-
name
public final String name
name of the property
-
values
public final 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(String name, 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:
IllegalArgumentException
- if single value property and not exactly 1 value is given.
-
DocViewProperty
public DocViewProperty(String name, 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
-true
to indicated that this is a binary reference property- Throws:
IllegalArgumentException
- if single value property and not exactly 1 value is given.
-
-
Method Detail
-
parse
public static DocViewProperty parse(String name, 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 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 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
- iftrue
multivalue properties are sorteduseBinaryReferences
-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
-
-