org.apache.jackrabbit.api.jsr283
Interface Node

All Superinterfaces:
Item, Node

public interface Node
extends Node

This interface holds extensions made in JCR 2.0 while work is in progress implementing JCR 2.0.

Since:
JCR 2.0

Method Summary
 void followLifecycleTransition(String transition)
          Causes the lifecycle state of this node to undergo the specified transition.
 String[] getAllowedLifecycleTransistions()
          Returns the list of valid state transitions for this node.
 String getIdentifier()
          Returns the identifier of this node.
 PropertyIterator getReferences(String name)
          This method returns all REFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session.
 NodeIterator getSharedSet()
          Returns an iterator over all nodes that are in the shared set of this node.
 PropertyIterator getWeakReferences()
          This method returns all WEAKREFERENCE properties that refer to this node and that are accessible through the current Session.
 PropertyIterator getWeakReferences(String name)
          This method returns all WEAKREFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session.
 void removeShare()
          A special kind of remove() that removes this node, but does not remove any other node in the shared set of this node.
 void removeSharedSet()
          A special kind of remove() that removes this node and every other node in the shared set of this node.
 void setPrimaryType(String nodeTypeName)
          Changes the primary node type of this node to nodeTypeName.
 Property setProperty(String name, BigDecimal value)
          The behavior of this method is identical to that of Node.setProperty(String name, Value value) except that the value is specified as a BigDecimal and, if possible, the type assigned to the property is DECIMAL, otherwise a best-effort conversion is attempted.
 Property setProperty(String name, Binary value)
          The behavior of this method is identical to that of Node.setProperty(String name, Value value) except that the value is specified as a Binary and, if possible, the type assigned to the property is BINARY, otherwise a best-effort conversion is attempted.
 
Methods inherited from interface javax.jcr.Node
addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, doneMerge, getBaseVersion, getCorrespondingNodePath, getDefinition, getIndex, getLock, getMixinNodeTypes, getNode, getNodes, getNodes, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperty, getReferences, getUUID, getVersionHistory, hasNode, hasNodes, hasProperties, hasProperty, holdsLock, isCheckedOut, isLocked, isNodeType, lock, merge, orderBefore, removeMixin, restore, restore, restore, restoreByLabel, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock, update
 
Methods inherited from interface javax.jcr.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, isSame, refresh, remove, save
 

Method Detail

getIdentifier

String getIdentifier()
                     throws RepositoryException
Returns the identifier of this node. Applies to both referenceable and non-referenceable nodes.

A RepositoryException is thrown if an error occurs.

Returns:
the identifier of this node
Throws:
RepositoryException - If an error occurs.
Since:
JCR 2.0

getReferences

PropertyIterator getReferences(String name)
                               throws RepositoryException
This method returns all REFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session.

If the name parameter is null then all referring REFERENCES are returned regardless of name.

Some level 2 implementations may only return properties that have been saved (in a transactional setting this includes both those properties that have been saved but not yet committed, as well as properties that have been committed). Other level 2 implementations may additionally return properties that have been added within the current Session but are not yet saved.

In implementations that support versioning, this method does not return properties that are part of the frozen state of a version in version storage.

If this node has no referring properties with the specified name, an empty iterator is returned.

Parameters:
name - name of referring REFERENCE properties to be returned; if null then all referring REFERENCEs are returned
Returns:
A PropertyIterator.
Throws:
RepositoryException - if an error occurs
Since:
JCR 2.0

getWeakReferences

PropertyIterator getWeakReferences()
                                   throws RepositoryException
This method returns all WEAKREFERENCE properties that refer to this node and that are accessible through the current Session. Equivalent to Node.getWeakReferences(null).

Returns:
A PropertyIterator.
Throws:
RepositoryException - if an error occurs.
Since:
JCR 2.0
See Also:
getWeakReferences(String).

getWeakReferences

PropertyIterator getWeakReferences(String name)
                                   throws RepositoryException
This method returns all WEAKREFERENCE properties that refer to this node, have the specified name and that are accessible through the current Session.

If the name parameter is null then all referring WEAKREFERENCE are returned regardless of name.

Some implementations may only return properties that have been persisted. Some may return both properties that have been persisted and those that have been dispatched but not persisted (for example, those saved within a transaction but not yet committed) while others implementations may return these two categories of property as well as properties that are still pending and not yet dispatched.

In implementations that support versioning, this method does not return properties that are part of the frozen state of a version in version storage.

If this node has no referring properties with the specified name, an empty iterator is returned.

Parameters:
name - name of referring WEAKREFERENCE properties to be returned; if null then all referring WEAKREFERENCEs are returned.
Returns:
A PropertyIterator.
Throws:
RepositoryException - if an error occurs.
Since:
JCR 2.0

setPrimaryType

void setPrimaryType(String nodeTypeName)
                    throws NoSuchNodeTypeException,
                           VersionException,
                           ConstraintViolationException,
                           LockException,
                           RepositoryException
Changes the primary node type of this node to nodeTypeName. Also immediately changes this node's jcr:primaryType property appropriately. Semantically, the new node type may take effect immediately and must take effect on save. Whichever behavior is adopted it must be the same as the behavior adopted for addMixin() (see below) and the behavior that occurs when a node is first created.

If the presence of an existing property or child node would cause an incompatibility with the new node type a ConstraintViolationException is thrown either immediately or on save.

If the new node type would cause this node to be incompatible with the node type of its parent then a ConstraintViolationException is thrown either immediately or on save.

A ConstraintViolationException is also thrown either immediately or on save if a conflict with an already assigned mixin occurs.

A ConstraintViolationException may also be thrown either immediately or on save if the attempted change violates implementation-specific node type transition rules. A repository that disallows all primary node type changes would simple throw this exception in all cases.

If the specified node type is not recognized a NoSuchNodeTypeException is thrown either immediately or on save.

A VersionException is thrown either immediately or on save if this node is versionable and checked-in, or is non-versionable but its nearest versionable ancestor is checked-in.

A LockException is thrown either immediately or on save if a lock prevents the change of node type.

A RepositoryException will be thrown if another error occurs.

Parameters:
nodeTypeName - the name of the new node type.
Throws:
ConstraintViolationException - If the specified primary node type is prevented from being assigned.
NoSuchNodeTypeException - If the specified nodeTypeName is not recognized and this implementation performs this validation immediately instead of waiting until save.
VersionException - if this node is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save.
LockException - if a lock prevents the change of the primary node type and this implementation performs this validation immediately instead of waiting until save.
RepositoryException - if another error occurs.
Since:
JCR 2.0

setProperty

Property setProperty(String name,
                     BigDecimal value)
                     throws ValueFormatException,
                            VersionException,
                            LockException,
                            ConstraintViolationException,
                            RepositoryException
The behavior of this method is identical to that of Node.setProperty(String name, Value value) except that the value is specified as a BigDecimal and, if possible, the type assigned to the property is DECIMAL, otherwise a best-effort conversion is attempted.

Parameters:
name - The name of a property of this node
value - The value to assigned
Returns:
The updated Property object
Throws:
ValueFormatException - if value cannot be converted to the type of the specified property or if the property already exists and is multi-valued.
VersionException - if this node is read-only due to a checked-in node and this implementation performs this validation immediately.
LockException - if a lock prevents the setting of the property and this implementation performs this validation immediately.
ConstraintViolationException - if the change would violate a node-type or other constraint and this implementation performs this validation immediately.
RepositoryException - if another error occurs.
Since:
JCR 2.0

setProperty

Property setProperty(String name,
                     Binary value)
                     throws ValueFormatException,
                            VersionException,
                            LockException,
                            ConstraintViolationException,
                            RepositoryException
The behavior of this method is identical to that of Node.setProperty(String name, Value value) except that the value is specified as a Binary and, if possible, the type assigned to the property is BINARY, otherwise a best-effort conversion is attempted.

Parameters:
name - The name of a property of this node
value - The value to assigned
Returns:
The updated Property object
Throws:
ValueFormatException - if value cannot be converted to the type of the specified property or if the property already exists and is multi-valued.
VersionException - if this node is read-only due to a checked-in node and this implementation performs this validation immediately.
LockException - if a lock prevents the setting of the property and this implementation performs this validation immediately.
ConstraintViolationException - if the change would violate a node-type or other constraint and this implementation performs this validation immediately.
RepositoryException - if another error occurs.
Since:
JCR 2.0

getSharedSet

NodeIterator getSharedSet()
                          throws RepositoryException
Returns an iterator over all nodes that are in the shared set of this node. If this node is not shared then the returned iterator contains only this node.

Returns:
a NodeIterator
Throws:
RepositoryException - if an error occurs.
Since:
JCR 2.0

removeShare

void removeShare()
                 throws VersionException,
                        LockException,
                        ConstraintViolationException,
                        RepositoryException
A special kind of remove() that removes this node, but does not remove any other node in the shared set of this node.

All of the exceptions defined for remove() apply to this function. In addition, a RepositoryException is thrown if this node cannot be removed without removing another node in the shared set of this node.

If this node is not shared this method removes only this node.

Throws:
VersionException - if the parent node of this item is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save.
LockException - if a lock prevents the removal of this item and this implementation performs this validation immediately instead of waiting until save.
ConstraintViolationException - if removing the specified item would violate a node type or implementation-specific constraint and this implementation performs this validation immediately instead of waiting until save.
RepositoryException - if another error occurs.
Since:
JCR 2.0
See Also:
removeSharedSet(), Item.remove(), Session.removeItem(String)

removeSharedSet

void removeSharedSet()
                     throws VersionException,
                            LockException,
                            ConstraintViolationException,
                            RepositoryException
A special kind of remove() that removes this node and every other node in the shared set of this node.

This removal must be done atomically, i.e., if one of the nodes cannot be removed, the function throws the exception remove() would have thrown in that case, and none of the nodes are removed.

If this node is not shared this method removes only this node.

Throws:
VersionException - if the parent node of this item is versionable and checked-in or is non-versionable but its nearest versionable ancestor is checked-in and this implementation performs this validation immediately instead of waiting until save.
LockException - if a lock prevents the removal of this item and this implementation performs this validation immediately instead of waiting until save.
ConstraintViolationException - if removing the specified item would violate a node type or implementation-specific constraint and this implementation performs this validation immediately instead of waiting until save.
RepositoryException - if another error occurs.@throws VersionException if
Since:
JCR 2.0
See Also:
removeShare(), Item.remove(), Session.removeItem(String)

followLifecycleTransition

void followLifecycleTransition(String transition)
                               throws UnsupportedRepositoryOperationException,
                                      InvalidLifecycleTransitionException,
                                      RepositoryException
Causes the lifecycle state of this node to undergo the specified transition.

This method may change the value of the jcr:currentLifecycleState property, in most cases it is expected that the implementation will change the value to that of the passed transition parameter, though this is an implementation-specific issue. If the jcr:currentLifecycleState property is changed the change is persisted immediately, there is no need to call save.

Throws an UnsupportedRepositoryOperationException if this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin.

Throws InvalidLifecycleTransitionException if the lifecycle transition is not successful.

Parameters:
transition - a state transition
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin.
InvalidLifecycleTransitionException - if the lifecycle transition is not successful.
RepositoryException - if another error occurs.
Since:
JCR 2.0

getAllowedLifecycleTransistions

String[] getAllowedLifecycleTransistions()
                                         throws UnsupportedRepositoryOperationException,
                                                RepositoryException
Returns the list of valid state transitions for this node.

Returns:
a String array.
Throws:
UnsupportedRepositoryOperationException - if this implementation does not support lifecycle actions or if this node does not have the mix:lifecycle mixin.
RepositoryException - if another error occurs.
Since:
JCR 2.0


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