All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.jcr.Property Maven / Gradle / Ivy

There is a newer version: 2024.11.18598.20241113T125352Z-241000
Show newest version
/*
 * Copyright 2009 Day Management AG, Switzerland. All rights reserved.
 */
package javax.jcr;

import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.PropertyDefinition;
import javax.jcr.version.VersionException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.Calendar;

/**
 * A Property object represents the smallest granularity of content
 * storage. It has a single parent node and no children. A property consists of
 * a name and a value, or in the case of multi-value properties, a set of values
 * all of the same type. See {@link Value}.
 */
public interface Property extends Item {

    /**
     * A constant for the property name jcr:primaryType (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_BASE
     * nt:base}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PRIMARY_TYPE = "{http://www.jcp.org/jcr/1.0}primaryType";

    /**
     * A constant for the property name jcr:mixinTypes (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_BASE
     * nt:base}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_MIXIN_TYPES = "{http://www.jcp.org/jcr/1.0}mixinTypes";

    /**
     * A constant for the property name jcr:content (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_LINKED_FILE
     * nt:linkedFile}. Note, jcr:content is also the name of a
     * child node declared in {@link javax.jcr.nodetype.NodeType#NT_FILE
     * nt:file}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_CONTENT = "{http://www.jcp.org/jcr/1.0}content";

    /**
     * A constant for the property name jcr:data (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_RESOURCE
     * nt:resource}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_DATA = "{http://www.jcp.org/jcr/1.0}data";

    /**
     * A constant for the property name jcr:protocol (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PROTOCOL = "{http://www.jcp.org/jcr/1.0}protocol";

    /**
     * A constant for the property name jcr:host (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_HOST = "{http://www.jcp.org/jcr/1.0}host";

    /**
     * A constant for the property name jcr:port (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PORT = "{http://www.jcp.org/jcr/1.0}port";

    /**
     * A constant for the property name jcr:repository (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_REPOSITORY = "{http://www.jcp.org/jcr/1.0}repository";

    /**
     * A constant for the property name jcr:workspace (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_WORKSPACE = "{http://www.jcp.org/jcr/1.0}workspace";

    /**
     * A constant for the property name jcr:path (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PATH = "{http://www.jcp.org/jcr/1.0}path";

    /**
     * A constant for the property name jcr:id (in expanded form),
     * declared in node type {@link javax.jcr.nodetype.NodeType#NT_ADDRESS
     * nt:address}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_ID = "{http://www.jcp.org/jcr/1.0}id";

    /**
     * A constant for the property name jcr:uuid (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_REFERENCEABLE
     * mix:referenceable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_UUID = "{http://www.jcp.org/jcr/1.0}uuid";

    /**
     * A constant for the property name jcr:title (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#MIX_TITLE
     * mix:title} and {@link javax.jcr.nodetype.NodeType#NT_ACTIVITY
     * nt:activity}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_TITLE = "{http://www.jcp.org/jcr/1.0}title";

    /**
     * A constant for the property name jcr:description (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_TITLE
     * mix:title}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_DESCRIPTION = "{http://www.jcp.org/jcr/1.0}description";

    /**
     * A constant for the property name jcr:created (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#MIX_CREATED
     * mix:created} and {@link javax.jcr.nodetype.NodeType#NT_VERSION
     * nt:version}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_CREATED = "{http://www.jcp.org/jcr/1.0}created";

    /**
     * A constant for the property name jcr:createdBy (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_CREATED
     * mix:created}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_CREATED_BY = "{http://www.jcp.org/jcr/1.0}createdBy";

    /**
     * A constant for the property name jcr:lastModified (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_LAST_MODIFIED
     * mix:lastModified}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_LAST_MODIFIED = "{http://www.jcp.org/jcr/1.0}lastModified";

    /**
     * A constant for the property name jcr:lastModifiedBy (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_LAST_MODIFIED
     * mix:lastModified}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_LAST_MODIFIED_BY = "{http://www.jcp.org/jcr/1.0}lastModifiedBy";

    /**
     * A constant for the property name jcr:language (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#MIX_LANGUAGE
     * mix:language} and {@link javax.jcr.nodetype.NodeType#NT_QUERY nt:query}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_LANGUAGE = "{http://www.jcp.org/jcr/1.0}language";

    /**
     * A constant for the property name jcr:mimeType (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_MIMETYPE
     * mix:mimeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_MIMETYPE = "{http://www.jcp.org/jcr/1.0}mimeType";

    /**
     * A constant for the property name jcr:encoding (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_MIMETYPE
     * mix:mimeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_ENCODING = "{http://www.jcp.org/jcr/1.0}encoding";

    /**
     * A constant for the property name jcr:nodeTypeName (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE
     * nt:nodeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_NODE_TYPE_NAME = "{http://www.jcp.org/jcr/1.0}nodeTypeName";

    /**
     * A constant for the property name jcr:supertypes (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE
     * nt:nodeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_SUPERTYPES = "{http://www.jcp.org/jcr/1.0}supertypes";

    /**
     * A constant for the property name jcr:isAbstract (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE
     * nt:nodeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_IS_ABSTRACT = "{http://www.jcp.org/jcr/1.0}isAbstract";

    /**
     * A constant for the property name jcr:isMixin (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE
     * nt:nodeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_IS_MIXIN = "{http://www.jcp.org/jcr/1.0}isMixin";

    /**
     * A constant for the property name jcr:hasOrderableChildNodes
     * (in expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE
     * nt:nodeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_HAS_ORDERABLE_CHILD_NODES = "{http://www.jcp.org/jcr/1.0}hasOrderableChildNodes";

    /**
     * A constant for the property name jcr:primaryItemName (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_NODE_TYPE
     * nt:nodeType}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PRIMARY_ITEM_NAME = "{http://www.jcp.org/jcr/1.0}primaryItemName";

    /**
     * A constant for the property name jcr:name (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition} and {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_NAME = "{http://www.jcp.org/jcr/1.0}name";

    /**
     * A constant for the property name jcr:autoCreated (in
     * expanded form), declared in node types {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition} and {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_AUTOCREATED = "{http://www.jcp.org/jcr/1.0}autoCreated";

    /**
     * A constant for the property name jcr:mandatory (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition} and {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_MANDATORY = "{http://www.jcp.org/jcr/1.0}mandatory";

    /**
     * A constant for the property name jcr:protected (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition} and {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PROTECTED = "{http://www.jcp.org/jcr/1.0}protected";

    /**
     * A constant for the property name jcr:onParentVersion (in
     * expanded form), declared in node types {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition} and {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_ON_PARENT_VERSION = "{http://www.jcp.org/jcr/1.0}onParentVersion";

    /**
     * A constant for the property name jcr:requiredType (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_REQUIRED_TYPE = "{http://www.jcp.org/jcr/1.0}requiredType";

    /**
     * A constant for the property name jcr:valueConstraints (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_VALUE_CONSTRAINTS = "{http://www.jcp.org/jcr/1.0}valueConstraints";

    /**
     * A constant for the property name jcr:defaultValues (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_DEFAULT_VALUES = "{http://www.jcp.org/jcr/1.0}defaultValues";

    /**
     * A constant for the property name jcr:multiple (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_PROPERTY_DEFINITION
     * nt:propertyDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_MULTIPLE = "{http://www.jcp.org/jcr/1.0}multiple";

    /**
     * A constant for the property name jcr:requiredPrimaryTypes
     * (in expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_REQUIRED_PRIMARY_TYPES = "{http://www.jcp.org/jcr/1.0}requiredPrimaryTypes";

    /**
     * A constant for the property name jcr:defaultPrimaryType (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_DEFAULT_PRIMARY_TYPE = "{http://www.jcp.org/jcr/1.0}defaultPrimaryType";

    /**
     * A constant for the property name jcr:sameNameSiblings (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_CHILD_NODE_DEFINITION
     * nt:childNodeDefinition}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_SAME_NAME_SIBLINGS = "{http://www.jcp.org/jcr/1.0}sameNameSiblings";

    /**
     * A constant for the property name jcr:lockOwner (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_LOCKABLE
     * mix:lockable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_LOCK_OWNER = "{http://www.jcp.org/jcr/1.0}lockOwner";

    /**
     * A constant for the property name jcr:lockIsDeep (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_LOCKABLE
     * mix:lockable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_LOCK_IS_DEEP = "{http://www.jcp.org/jcr/1.0}lockIsDeep";

    /**
     * A constant for the property name jcr:lifecyclePolicy (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_LIFECYCLE
     * mix:lifecycle}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_LIFECYCLE_POLICY = "{http://www.jcp.org/jcr/1.0}lifecyclePolicy";

    /**
     * A constant for the property name jcr:currentLifecycleState
     * (in expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_LIFECYCLE
     * mix:lifecycle}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_CURRENT_LIFECYCLE_STATE = "{http://www.jcp.org/jcr/1.0}currentLifecycleState";

    /**
     * A constant for the property name jcr:isCheckedOut (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_SIMPLE_VERSIONABLE
     * mix:simpleVersionable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_IS_CHECKED_OUT = "{http://www.jcp.org/jcr/1.0}isCheckedOut";

    /**
     * A constant for the property name jcr:frozenPrimaryType (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_FROZEN_NODE
     * nt:frozenNode}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_FROZEN_PRIMARY_TYPE = "{http://www.jcp.org/jcr/1.0}frozenPrimaryType";

    /**
     * A constant for the property name jcr:frozenMixinTypes (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_FROZEN_NODE
     * nt:frozenNode}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_FROZEN_MIXIN_TYPES = "{http://www.jcp.org/jcr/1.0}frozenMixinTypes";

    /**
     * A constant for the property name jcr:frozenUuid (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_FROZEN_NODE
     * nt:frozenNode}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_FROZEN_UUID = "{http://www.jcp.org/jcr/1.0}frozenUuid";

    /**
     * A constant for the property name jcr:versionHistory (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE
     * mix:versionable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_VERSION_HISTORY = "{http://www.jcp.org/jcr/1.0}versionHistory";

    /**
     * A constant for the property name jcr:baseVersion (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE
     * mix:versionable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_BASE_VERSION = "{http://www.jcp.org/jcr/1.0}baseVersion";

    /**
     * A constant for the property name jcr:predecessors (in
     * expanded form), declared in node types {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE
     * mix:versionable} and {@link javax.jcr.nodetype.NodeType#NT_VERSION
     * nt:version}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_PREDECESSORS = "{http://www.jcp.org/jcr/1.0}predecessors";

    /**
     * A constant for the property name jcr:mergeFailed (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE
     * mix:versionable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_MERGE_FAILED = "{http://www.jcp.org/jcr/1.0}mergeFailed";

    /**
     * A constant for the property name jcr:activity (in expanded
     * form), declared in node types {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE
     * mix:versionable} and {@link javax.jcr.nodetype.NodeType#NT_VERSION
     * nt:version}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_ACTIVITY = "{http://www.jcp.org/jcr/1.0}activity";

    /**
     * A constant for the property name jcr:configuration (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#MIX_VERSIONABLE
     * mix:versionable}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_CONFIGURATION = "{http://www.jcp.org/jcr/1.0}configuration";

    /**
     * A constant for the property name jcr:versionableUuid (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_VERSION
     * nt:version}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_VERSIONABLE_UUID = "{http://www.jcp.org/jcr/1.0}versionableUuid";

    /**
     * A constant for the property name jcr:copiedFrom (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_VERSION
     * nt:version}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_COPIED_FROM = "{http://www.jcp.org/jcr/1.0}copiedFrom";

    /**
     * A constant for the property name jcr:successors (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_VERSION
     * nt:versione}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_SUCCESSORS = "{http://www.jcp.org/jcr/1.0}successors";

    /**
     * A constant for the property name jcr:childVersionHistory (in
     * expanded form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_VERSIONED_CHILD
     * nt:versionedChild}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_CHILD_VERSION_HISTORY = "{http://www.jcp.org/jcr/1.0}childVersionHistory";

    /**
     * A constant for the property name jcr:root (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_CONFIGURATION
     * nt:configuration}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_ROOT = "{http://www.jcp.org/jcr/1.0}root";

    /**
     * A constant for the property name jcr:statement (in expanded
     * form), declared in node type {@link javax.jcr.nodetype.NodeType#NT_QUERY
     * nt:query}.
     *
     * @since JCR 2.0
     */
    public static final String JCR_STATEMENT = "{http://www.jcp.org/jcr/1.0}statement";

    /**
     * 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.
     * 

* This method is a session-write and therefore requires a save * to dispatch the change. *

* A ConstraintViolationException will be thrown either * immediately, on dispatch, or on persist, if the change would violate a * node type or implementation-specific constraint. Implementations may * differ on when this validation is performed. *

* A VersionException will be thrown either immediately, on * dispatch, or on persist, if this property belongs to a node that is * versionable and checked-in or is non-versionable but whose nearest * versionable ancestor is checked-in. Implementations may differ on when * this validation is performed. *

* A LockException will be thrown either immediately, on * dispatch, or on persist, if a lock prevents the setting of the value. * Implementations may differ on when this validation is performed. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to the values array. If this * property's property type is not constrained by the node type of its * parent node, then the property type may be changed. If the property type * is constrained, then a best-effort conversion is attempted, according to * an implemention-dependent definition of "best effort". The change will be * persisted (if valid) on save. *

* A ConstraintViolationException will be thrown either * immediately, on dispatch, or on persist, if the change would violate a * node type or implementation-specific constraint. Implementations may * differ on when this validation is performed. *

* A VersionException will be thrown either immediately, on * dispatch, or on persist, if this property belongs to a node that is * read-only due to a checked-in node. Implementations may differ on when * this validation is performed. *

* A LockException will be thrown either immediately, on * dispatch, or on persist, if a lock prevents the setting of the value. * Implementations may differ on when this validation is performed. * * @param values The new values to set the property to. * @throws ValueFormatException if the type or format of the specified * values is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(Value[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a String. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified * values is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(String value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to the values array. Same as * {@link #setValue(Value[] values)} except that the values are * specified as a String[]. * * @param values The new values to set the property to. * @throws ValueFormatException if the type or format of one or more of the * specified values is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as an InputStream. *

* The passed stream is closed before this method returns either normally or * because of an exception. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. * @deprecated As of JCR 2.0, {@link #setValue(Binary)} should be used * instead. */ public void setValue(InputStream value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a Binary. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. * @since JCR 2.0 */ public void setValue(Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a long. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(long value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a double. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(double value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a BigDecimal. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. * @since JCR 2.0 */ public void setValue(BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a Calendar. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(Calendar value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets the value of this property to value. Same as * {@link #setValue(Value value)} except that the value is * specified as a boolean. * * @param value The new value to set the property to. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(boolean value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Sets this REFERENCE or WEAKREFERNCE property to * refer to the specified node. * * @param value The node to which this property will refer. * @throws ValueFormatException if the type or format of the specified value * is incompatible with the type of this property the specified node is not * referenceable. * @throws VersionException if this property belongs to a node that is * read-only due to a checked-in node and this implementation performs this * validation immediately. * @throws LockException if a lock prevents the setting of the value and * this implementation performs this validation immediately. * @throws ConstraintViolationException if the change would violate a * node-type or other constraint and this implementation performs this * validation immediately. * @throws RepositoryException if another error occurs. */ public void setValue(Node value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException; /** * Returns the value of this property as a Value object. *

* The object returned is a copy of the stored value and is immutable. * * @return the Value. * @throws ValueFormatException if the property is multi-valued. * @throws RepositoryException if another error occurs. */ public Value getValue() throws ValueFormatException, RepositoryException; /** * Returns an array of all the values of this property. Used to access * multi-value properties. The array returned is a copy of the stored * values, so changes to it are not reflected in internal storage. * * @return a Value array. * @throws ValueFormatException if the property is single-valued. * @throws RepositoryException if another error occurs. */ public Value[] getValues() throws ValueFormatException, RepositoryException; /** * Returns a String representation of the value of this * property. A shortcut for Property.getValue().getString(). * * @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. * @see Value */ public String getString() throws ValueFormatException, RepositoryException; /** * Returns an InputStream representation of the value of this * property. A shortcut for Property.getValue().getStream(). *

* It is the responsibility of the caller to close the returned * InputStream. * * @return A stream representation of the value of this property. * @throws ValueFormatException if the property is multi-valued. * @throws RepositoryException if another error occurs * @see Value * @deprecated As of JCR 2.0, {@link #getBinary()} should be used instead. */ public InputStream getStream() throws ValueFormatException, RepositoryException; /** * Returns a Binary representation of the value of this * property. A shortcut for Property.getValue().getBinary(). * * @return A Binary representation of the value of this * property. * @throws ValueFormatException if the property is multi-valued. * @throws RepositoryException if another error occurs. * @see Value * @see Binary * @since JCR 2.0 */ public Binary getBinary() throws ValueFormatException, RepositoryException; /** * Returns a long representation of the value of this property. * A shortcut for Property.getValue().getLong(). * * @return A long representation of the value of this * property. * @throws ValueFormatException if conversion to a long is not * possible or if the property is multi-valued. * @throws RepositoryException if another error occurs. * @see Value */ public long getLong() throws ValueFormatException, RepositoryException; /** * Returns a double representation of the value of this * property. A shortcut for Property.getValue().getDouble(). * * @return A double representation of the value of this * property. * @throws ValueFormatException if conversion to a double is * not possible or if the property is multi-valued. * @throws RepositoryException if another error occurs. * @see Value */ public double getDouble() throws ValueFormatException, RepositoryException; /** * Returns a BigDecimal representation of the value of this * property. A shortcut for Property.getValue().getDecimal(). * * @return A BigDecimal representation of the value of this * property. * @throws ValueFormatException if conversion to a BigDecimal * is not possible or if the property is multi-valued. * @throws RepositoryException if another error occurs * @see Value * @since JCR 2.0 */ public BigDecimal getDecimal() throws ValueFormatException, RepositoryException; /** * Returns a Calendar representation of the value of this * property. A shortcut for Property.getValue().getDate(). * * @return A Calendar 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. * @see Value */ public Calendar getDate() throws ValueFormatException, RepositoryException; /** * Returns a boolean representation of the value of this * property. A shortcut for Property.getValue().getBoolean(). * * @return A boolean representation of the value of this * property. * @throws ValueFormatException if conversion to a boolean is * not possible or if the property is multi-valued. * @throws RepositoryException if another error occurs. * @see Value */ public boolean getBoolean() throws ValueFormatException, RepositoryException; /** * If this property is of type REFERENCE, * WEAKREFERENCE or PATH (or convertible to one of * these types) this method returns the Node to which this * property refers. *

* If this property is of type PATH and it contains a relative * path, it is interpreted relative to the parent node of this property. For * example "." refers to the parent node itself, * ".." to the parent of the parent node and "foo" * to a sibling node of this property. * * @return the referenced Node * @throws ValueFormatException if this property cannot be converted to a * referring type (REFERENCE, WEAKREFERENCE or * PATH), if the property is multi-valued or if this property * is a referring type but is currently part of the frozen state of a * version in version storage. * @throws ItemNotFoundException If this property is of type * PATH or WEAKREFERENCE and no target node * accessible by the current Session exists in this workspace. * Note that this applies even if the property is a PATHS and a * property exists at the specified location. To dereference to a * target property (as opposed to a target node), the method * Property.getProperty is used. * @throws RepositoryException if another error occurs. */ public Node getNode() throws ItemNotFoundException, ValueFormatException, RepositoryException; /** * If this property is of type PATH (or convertible to this * type) this method returns the Property to which this * property refers. *

* If this property contains a relative path, it is interpreted relative to * the parent node of this property. Therefore, when resolving such a * relative path, the segment "." refers to * the parent node itself, ".." to the parent of the parent * node and "foo" to a sibling property of this property or * this property itself. *

* For example, if this property is located at * /a/b/c and it has a value of "../d" then this * method will return the property at /a/d if such exists. *

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

* If this property cannot be converted to a PATH then a * ValueFormatException is thrown. *

* If this property is currently part of the frozen state of a version in * version storage, this method will throw a ValueFormatException. * * @return the referenced property * @throws ValueFormatException if this property cannot be converted to a * PATH, if the property is multi-valued or if this property is * a referring type but is currently part of the frozen state of a version * in version storage. * @throws ItemNotFoundException If no property accessible by the current * Session exists in this workspace at the specified path. Note * that this applies even if a node exists at the specified location. * To dereference to a target node, the method Property.getNode * is used. * @throws RepositoryException if another error occurs. * @since JCR 2.0 */ public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException; /** * Returns the length of the value of this property. *

* For a BINARY property, getLength returns the * number of bytes. For other property types, getLength returns * the same value that would be returned by calling {@link * java.lang.String#length()} on the value when it has been converted to a * STRING according to standard JCR property type conversion. *

* Returns -1 if the implementation cannot determine the length. * * @return an long. * @throws ValueFormatException if this property is multi-valued. * @throws RepositoryException if another error occurs. */ public long getLength() throws ValueFormatException, RepositoryException; /** * Returns an array holding the lengths of the values of this (multi-value) * property in bytes where each is individually calculated as described in * {@link #getLength()}. *

* Returns a -1 in the appropriate position if the * implementation cannot determine the length of a value. * * @return an array of lengths * @throws ValueFormatException if this property is single-valued. * @throws RepositoryException if another error occurs. */ public long[] getLengths() throws ValueFormatException, RepositoryException; /** * 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 or change of this * property, a single particular definition is chosen by the implementation. * It is that definition that this method returns. How this governing * definition is selected upon property creation or change from among others * which may have been applicable is an implementation issue and is not * covered by this specification. * * @return a PropertyDefinition object. * @throws RepositoryException if an error occurs. * @see javax.jcr.nodetype.NodeType#getPropertyDefinitions */ public PropertyDefinition getDefinition() throws RepositoryException; /** * Returns the type of this Property. One of:

    *
  • PropertyType.STRING
  • PropertyType.BINARY
  • *
  • PropertyType.DATE
  • PropertyType.DOUBLE
  • *
  • PropertyType.LONG
  • PropertyType.BOOLEAN
  • *
  • PropertyType.NAME
  • PropertyType.PATH
  • *
  • PropertyType.REFERENCE
  • PropertyType.WEAKREFERENCE
  • *
  • PropertyType.URI
The type returned is that * which was set at property creation. Note that for some property * p, the type returned by p.getType() will 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 int getType() throws RepositoryException; /** * Returns true if this property is multi-valued and * false if this property is single-valued. * * @return true if this property is multi-valued; * false otherwise. * @throws RepositoryException if an error occurs. */ public boolean isMultiple() throws RepositoryException; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy