Property object represents the smallest granularity of content * storage. *

* Level 1 and 2 *

* A property must have one and only one parent node. A property does * not have children. When we say that node A "has" property B it means that B * is a child of A. *

* A property consists of a name and a value. See Value. * * @author Markus Nix * @package phpcr */ interface Property extends Item { /** * Sets the value of this property to value. * If this property's property type is not constrained by the node type of * its parent node, then the property type is changed to that of the supplied * value. If the property type is constrained, then a * best-effort conversion is attempted. If conversion fails, a * ValueFormatException is thrown immediately (not on save). * The change will be persisted (if valid) on save *

* A ConstraintViolationException is thrown if a node-type * or other constraint violation is detected immediately. Otherwise, * if the violation is only detected later, at save, then a * ConstraintViolationException is thrown by that method. * Implementations may differ as to which constraints are enforced immediately, * and which on save. *

* A VersionException is thrown if the parent node of this property is * versionable and checked-in or is non-versionable but its nearest versionable * ancestor is checked-in. *

* A LockException is thrown if a lock prevents the setting of the value. * * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if the parent node of this property is * versionable and checked-in or is non-versionable but its nearest versionable * ancestor is checked-in. * @throws LockException if a lock prevents the setting of the value. * @throws ConstraintViolationException if a node-type or other constraint violation is detected immediately. * @throws RepositoryException if another error occurs. */ public function setValue( $value ); /** * Returns the value of this property as a generic * Value object. *

* If the property is multi-valued, this method throws a ValueFormatException. * * @throws ValueFormatException if the property is multi-valued. * @throws RepositoryException if another error occurs. * * @return the value */ public function getValue(); /** * Returns an array of all the values of this property. Used to access * multi-value properties. If the property is single-valued, this method throws a * ValueFormatException. The array returned is a copy of the stored * values, so changes to it are not reflected in internal storage. * * @throws ValueFormatException if the property is single-valued. * @throws RepositoryException if another error occurs. * * @return a Value array */ public function getValues(); /** * Returns a String representation of the value of this * property. A shortcut for * Property.getValue().getString(). See {@link Value}. * If this property is multi-valued, this method throws a ValueFormatException. *

* If the value of this property cannot be converted to a * string, a ValueFormatException is thrown. *

* A RepositoryException is thrown if another error occurs. * * @return A string representation of the value of this property. * @throws ValueFormatException if conversion to a string is not possible or if the * property is multi-valued. * @throws RepositoryException if another error occurs. */ public function getString(); /** * Returns an InputStream representation of the value of this * property. A shortcut for * Property.getValue().getStream(). See {@link Value}. * If this property is multi-valued, this method throws a ValueFormatException. *

* If the value of this property cannot be converted to a * stream, a ValueFormatException is thrown. *

* A RepositoryException is thrown if another error occurs. * * @return A stream representation of the value of this property. * @throws ValueFormatException if conversion to a string is not possible or if the * property is multi-valued. * @throws RepositoryException if another error occurs */ public function getStream(); /** * Returns a long representation of the value of this * property. A shortcut for * Property.getValue().getLong(). See {@link Value}. * If this property is multi-valued, this method throws a ValueFormatException. *

* If the value of this property cannot be converted to a * long, a ValueFormatException is thrown. *

* A RepositoryException is thrown if another error occurs. * * @return A long representation of the value of this property. * @throws ValueFormatException if conversion to a string is not possible or if the * property is multi-valued. * @throws RepositoryException if another error occurs */ public function getLong(); /** * Returns a double representation of the value of this * property. A shortcut for * Property.getValue().getDouble(). See {@link Value}. * If this property is multi-valued, this method throws a ValueFormatException. *

* If the value of this property cannot be converted to a * double, a ValueFormatException is thrown. *

* A RepositoryException is thrown if another error occurs. * * @return A double representation of the value of this property. * @throws ValueFormatException if conversion to a string is not possible or if the * property is multi-valued. * @throws RepositoryException if another error occurs */ public function getDouble(); /** * Returns date. A shortcut for * Property.getValue().getDate(). See {@link Value}. * If this property is multi-valued, this method throws a ValueFormatException. *

* If the value of this property cannot be converted to a * date, a ValueFormatException is thrown. *

* A RepositoryException is thrown if another error occurs. * * @return A date (Calendar object) representation of the value of this property. * @throws ValueFormatException if conversion to a string is not possible or if the * property is multi-valued. * @throws RepositoryException if another error occurs */ public function getDate(); /** * Returns a boolean representation of the value of this * property. A shortcut for * Property.getValue().getBoolean(). See {@link Value}. * If this property is multi-valued, this method throws a ValueFormatException. *

* If the value of this property cannot be converted to a * boolean, a ValueFormatException is thrown. *

* A RepositoryException is thrown if another error occurs. * * @return A boolean representation of the value of this property. * @throws ValueFormatException if conversion to a string is not possible or if the * property is multi-valued. * @throws RepositoryException if another error occurs */ public function getBoolean(); /** * If this property is of type REFERENCE * this method returns the node to which this property refers. *

* If this property is multi-valued, this method throws a ValueFormatException. *

* If this property cannot be coverted to a reference, then a ValueFormatException is thrown. *

* If this property is a REFERENCE property but is currently part of the frozen state of a version in version * storage, this method will throw a ValueFormatException. *

* A RepositoryException is thrown if another error occurs. * * @return the referenced Node * @throws ValueFormatException if this property cannot be converted to a reference, if the * property is multi-valued or if this property is a REFERENCE property but is currently part of the frozen * state of a version in version storage. * @throws RepositoryException if another error occurs */ public function getNode(); /** * Returns the length of the value of this property. *

* Returns the length in bytes if the value * is a PropertyType.BINARY, otherwise it returns the number * of characters needed to display the value (for strings this is the string * length, for numeric types it is the number of characters needed to * display the number). Returns �1 if the implementation cannot determine * the length. * * If this property is multi-valued, this method throws a ValueFormatException. * * @return an long. * @throws ValueFormatException if this property is multi-valued. * @throws RepositoryException if another error occurs. */ public function getLength(); /** * Returns an array holding the lengths of the values of this (multi-value) property in bytes * if the values are PropertyType.BINARY, otherwise it returns the number of * characters needed to display each value (for strings this is the string length, for * numeric types it is the number of characters needed to display the number). The order of the * length values corresponds to the order of the values in the property. *

* Returns a �1 in the appropriate position if the implementation cannot determine * the length of a value. *

* If this property is single-valued, this method throws a ValueFormatException. *

* A RepositoryException is thrown if another error occurs. * @return an array of lengths * @throws ValueFormatException if this property is single-valued. * @throws RepositoryException if another error occurs. */ public function getLengths(); /** * Returns the property definition that applies to this property. In some cases there may appear to * be more than one definition that could apply to this node. However, it is assumed that upon * creation of this property, a single particular definition was used and it is that * definition that this method returns. How this governing definition is selected upon property * creation from among others which may have been applicable is an implemention issue and is not * covered by this specification. * * @see NodeType#getPropertyDefinitions * @throws RepositoryException if an error occurs. * @return a PropertyDefinition object. */ public function getDefinition(); /** * Returns the type of this Property. One of: *

* The type returned is that which was set at property creation. Note that for some property p, * the type returned by p.getType() may differ from the type returned by * p.getDefinition.getRequiredType() only in the case where the latter returns UNDEFINED. * The type of a property instance is never UNDEFINED (it must always have some actual type). * * @return an int * @throws RepositoryException if an error occurs */ public function getType(); } ?>