org.apache.jackrabbit.webdav.jcr.property
Class ValuesProperty

java.lang.Object
  extended by org.apache.jackrabbit.webdav.property.AbstractDavProperty
      extended by org.apache.jackrabbit.webdav.jcr.property.ValuesProperty
All Implemented Interfaces:
DavConstants, ItemResourceConstants, DavProperty, XmlSerializable

public class ValuesProperty
extends AbstractDavProperty
implements ItemResourceConstants

ValuesProperty extends DavProperty providing utilities to handle the multiple values of the property item represented by this resource.


Field Summary
 
Fields inherited from interface org.apache.jackrabbit.webdav.jcr.ItemResourceConstants
ATTR_VALUE_TYPE, EXCLUSIVE_SESSION, IMPORT_UUID_BEHAVIOR, JCR_DEFINITION, JCR_DEPTH, JCR_INDEX, JCR_ISMODIFIED, JCR_ISNEW, JCR_LENGTH, JCR_LENGTHS, JCR_MIXINNODETYPES, JCR_NAME, JCR_NAMESPACES, JCR_PARENT, JCR_PATH, JCR_PRIMARYITEM, JCR_PRIMARYNODETYPE, JCR_REFERENCES, JCR_TYPE, JCR_UUID, JCR_VALUE, JCR_VALUES, JCR_VERSIONABLEUUID, JCR_WORKSPACE_NAME, METHODS, NAMESPACE, PRIVILEGE_JCR_ADD_NODE, PRIVILEGE_JCR_READ, PRIVILEGE_JCR_REMOVE, PRIVILEGE_JCR_SET_PROPERTY, ROOT_ITEM_PATH, ROOT_ITEM_RESOURCEPATH, VERSIONSTORAGE_PATH, XML_DESCRIPTOR, XML_DESCRIPTORKEY, XML_DESCRIPTORVALUE, XML_EXCLUSIVE_SESSION_SCOPED, XML_LENGTH, XML_NAMESPACE, XML_PREFIX, XML_PRIMARYNODETYPE, XML_RELPATH, XML_REMOVEEXISTING, XML_URI, XML_VALUE
 
Fields inherited from interface org.apache.jackrabbit.webdav.DavConstants
creationDateFormat, DEPTH_0, DEPTH_1, DEPTH_INFINITY, DEPTH_INFINITY_S, HEADER_AUTHORIZATION, HEADER_CONTENT_LANGUAGE, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_DAV, HEADER_DEPTH, HEADER_DESTINATION, HEADER_ETAG, HEADER_IF, HEADER_LAST_MODIFIED, HEADER_LOCK_TOKEN, HEADER_OVERWRITE, HEADER_TIMEOUT, INFINITE_TIMEOUT, modificationDateFormat, NAMESPACE, OPAQUE_LOCK_TOKEN_PREFIX, PROPERTY_CREATIONDATE, PROPERTY_DISPLAYNAME, PROPERTY_GETCONTENTLANGUAGE, PROPERTY_GETCONTENTLENGTH, PROPERTY_GETCONTENTTYPE, PROPERTY_GETETAG, PROPERTY_GETLASTMODIFIED, PROPERTY_LOCKDISCOVERY, PROPERTY_RESOURCETYPE, PROPERTY_SOURCE, PROPERTY_SUPPORTEDLOCK, PROPFIND_ALL_PROP, PROPFIND_ALL_PROP_INCLUDE, PROPFIND_BY_PROPERTY, PROPFIND_PROPERTY_NAMES, TIMEOUT_INFINITE, UNDEFINED_TIME, UNDEFINED_TIMEOUT, XML_ACTIVELOCK, XML_ALLPROP, XML_COLLECTION, XML_DEPTH, XML_DST, XML_EXCLUSIVE, XML_HREF, XML_INCLUDE, XML_KEEPALIVE, XML_LINK, XML_LOCKENTRY, XML_LOCKINFO, XML_LOCKROOT, XML_LOCKSCOPE, XML_LOCKTOKEN, XML_LOCKTYPE, XML_MULTISTATUS, XML_OMIT, XML_OWNER, XML_PROP, XML_PROPERTYBEHAVIOR, XML_PROPERTYUPDATE, XML_PROPFIND, XML_PROPNAME, XML_PROPSTAT, XML_REMOVE, XML_RESPONSE, XML_RESPONSEDESCRIPTION, XML_SET, XML_SHARED, XML_SOURCE, XML_STATUS, XML_TIMEOUT, XML_WRITE
 
Constructor Summary
ValuesProperty(DavProperty property, int defaultType, ValueFactory valueFactory)
          Wrap the specified DavProperty in a new ValuesProperty.
ValuesProperty(Value value)
          Create a new ValuesProperty from the given single Value.
ValuesProperty(Value[] values)
          Create a new ValuesProperty from the given Value array.
 
Method Summary
 Value getJcrValue()
           
 Value getJcrValue(int propertyType, ValueFactory valueFactory)
           
 Value[] getJcrValues()
          Returns the internal property value as jcr Value array
 Value[] getJcrValues(int propertyType, ValueFactory valueFactory)
          Converts the value of this property to a value array.
 Object getValue()
          Returns an array of Values representing the value of this property.
 int getValueType()
          Returns the type of the values present in this property or PropertyType.UNDEFINED if no values are available.
 Element toXml(Document document)
          Return a XML element representation of this property.
 
Methods inherited from class org.apache.jackrabbit.webdav.property.AbstractDavProperty
equals, getName, hashCode, isInvisibleInAllprop
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValuesProperty

public ValuesProperty(Value value)
Create a new ValuesProperty from the given single Value.

Parameters:
value - Array of Value objects as obtained from the JCR property.

ValuesProperty

public ValuesProperty(Value[] values)
Create a new ValuesProperty from the given Value array.

Parameters:
values - Array of Value objects as obtained from the JCR property.

ValuesProperty

public ValuesProperty(DavProperty property,
                      int defaultType,
                      ValueFactory valueFactory)
               throws RepositoryException,
                      DavException
Wrap the specified DavProperty in a new ValuesProperty.

Parameters:
property -
defaultType - default type of the values to be deserialized. If however the 'value' elements provide a 'type' attribute, the default value is ignored.
valueFactory - Factory used to retrieve JCR values from the value of the given DavProperty.
Throws:
RepositoryException
DavException
Method Detail

getJcrValues

public Value[] getJcrValues(int propertyType,
                            ValueFactory valueFactory)
                     throws ValueFormatException
Converts the value of this property to a value array.

Returns:
Array of Value objects
Throws:
ValueFormatException - if convertion of the internal jcr values to the specified value type fails.

getJcrValues

public Value[] getJcrValues()
                     throws ValueFormatException
Returns the internal property value as jcr Value array

Returns:
the internal property value as jcr Value array
Throws:
ValueFormatException

getJcrValue

public Value getJcrValue(int propertyType,
                         ValueFactory valueFactory)
                  throws ValueFormatException
Parameters:
propertyType -
Returns:
Throws:
ValueFormatException

getJcrValue

public Value getJcrValue()
                  throws ValueFormatException
Returns:
Throws:
ValueFormatException

getValueType

public int getValueType()
Returns the type of the values present in this property or PropertyType.UNDEFINED if no values are available.

Returns:
type of values or PropertyType.UNDEFINED

getValue

public Object getValue()
Returns an array of Values representing the value of this property.

Specified by:
getValue in interface DavProperty
Returns:
an array of Values
See Also:
getJcrValues(), getJcrValue()

toXml

public Element toXml(Document document)
Description copied from class: AbstractDavProperty
Return a XML element representation of this property. The value of the property will be added as text or as child element.
 new DavProperty("displayname", "WebDAV Directory").toXml
 gives a element like:
 <D:displayname>WebDAV Directory</D:displayname>

 new DavProperty("resourcetype", new Element("collection")).toXml
 gives a element like:
 <D:resourcetype><D:collection/></D:resourcetype>

 Element[] customVals = { new Element("bla", customNamespace), new Element("bli", customNamespace) };
 new DavProperty("custom-property", customVals, customNamespace).toXml
 gives an element like
 <Z:custom-property>
    <Z:bla/>
    <Z:bli/>
 </Z:custom-property>
 

Specified by:
toXml in interface XmlSerializable
Overrides:
toXml in class AbstractDavProperty
Parameters:
document -
Returns:
the xml element
See Also:
XmlSerializable.toXml(Document)


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.