Interface Node
- All Superinterfaces:
Item
- All Known Subinterfaces:
JackrabbitNode
,Version
,VersionHistory
- All Known Implementing Classes:
AbstractNode
Node
interface represents a node in a workspace.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
A constant for the node namejcr:childNodeDefinition
declared innt:nodeType
.static final String
A constant for the JCR namejcr:content
.static final String
A constant for the node namejcr:frozenNode
declared innt:version
.static final String
A constant for the node namejcr:propertyDefinition
declared innt:nodeType
.static final String
A constant for the node namejcr:rootVersion
declared innt:versionHistory
.static final String
A constant for the node namejcr:versionLabels
declared innt:versionHistory
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the mixin node type namedmixinName
to this node.Creates a new node atrelPath
.Creates a new node atrelPath
of the specified node type.boolean
canAddMixin
(String mixinName) Returnstrue
if callingaddMixin(java.lang.String)
on this node with the mixn node typemixinName
will not fail.void
cancelMerge
(Version version) Deprecated.checkin()
Deprecated.As of JCR 2.0,VersionManager.checkin(java.lang.String)
should be used instead.void
checkout()
Deprecated.As of JCR 2.0,VersionManager.checkout(java.lang.String)
should be used instead.void
Deprecated.As of JCR 2.0,VersionManager.doneMerge(java.lang.String, javax.jcr.version.Version)
should be used instead.void
followLifecycleTransition
(String transition) Causes the lifecycle state of this node to undergo the specifiedtransition
.String[]
Returns the list of valid state transitions for this node.Deprecated.As of JCR 2.0,VersionManager.getBaseVersion(java.lang.String)
should be used instead.getCorrespondingNodePath
(String workspaceName) Returns the absolute path of the node in the specified workspace that corresponds tothis
node.Returns the node definition that applies to this node.Returns the identifier of this node.int
getIndex()
This method returns the index of this node within the ordered set of its same-name sibling nodes.getLock()
Deprecated.As of JCR 2.0,LockManager.getLock(String)
should be used instead.NodeType[]
Returns an array ofNodeType
objects representing the mixin node types in effect for this node.Returns the node atrelPath
relative to this node.getNodes()
Returns all child nodes of this node accessible through the currentSession
.Gets all child nodes of this node accessible through the currentSession
that matchnamePattern
.Gets all child nodes of this node accessible through the currentSession
that match one or more of thenameGlob
strings in the passed array.Returns the primary child item of this node.Returns the primary node type in effect for this node.Returns all properties of this node accessible through the currentSession
.getProperties
(String namePattern) Gets all properties of this node accessible through the currentSession
that matchnamePattern
.getProperties
(String[] nameGlobs) Gets all properties of this node accessible through the currentSession
that match one or more of thenameGlob
strings in the passed array.getProperty
(String relPath) Returns the property atrelPath
relative tothis
node.This method returns allREFERENCE
properties that refer to this node and that are accessible through the currentSession
.getReferences
(String name) This method returns allREFERENCE
properties that refer to this node, have the specifiedname
and that are accessible through the currentSession
.Returns an iterator over all nodes that are in the shared set of this node.getUUID()
Deprecated.As of JCR 2.0,getIdentifier()
should be used instead.Deprecated.As of JCR 2.0,VersionManager.getVersionHistory(java.lang.String)
should be used instead.This method returns allWEAKREFERENCE
properties that refer to this node and that are accessible through the currentSession
.getWeakReferences
(String name) This method returns allWEAKREFERENCE
properties that refer to this node, have the specifiedname
and that are accessible through the currentSession
.boolean
Indicates whether a node exists atrelPath
Returnstrue
if a node accessible through the currentSession
exists atrelPath
andfalse
otherwise.boolean
hasNodes()
Indicates whether this node has child nodes.boolean
Indicates whether this node has properties.boolean
hasProperty
(String relPath) Indicates whether a property exists atrelPath
Returnstrue
if a property accessible through the currentSession
exists atrelPath
andfalse
otherwise.boolean
Deprecated.As of JCR 2.0,LockManager.holdsLock(String)
should be used instead.boolean
Returnsfalse
if this node is currently in the checked-in state (either due to its own status as a versionable node or due to the effect of a versionable node being checked in above it).boolean
isLocked()
Returnstrue
if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returnsfalse
.boolean
isNodeType
(String nodeTypeName) Returnstrue
if this node is of the specified primary node type or mixin type, or a subtype thereof.lock
(boolean isDeep, boolean isSessionScoped) Deprecated.As of JCR 2.0,LockManager.lock(String, boolean, boolean, long, String)
should be used instead.Deprecated.As of JCR 2.0,VersionManager.merge(java.lang.String, java.lang.String, boolean)
should be used instead.void
orderBefore
(String srcChildRelPath, String destChildRelPath) If this node supports child node ordering, this method inserts the child node atsrcChildRelPath
into the child node list at the position immediately the child node atdestChildRelPath
.void
removeMixin
(String mixinName) Removes the specified mixin node type from this node and removesmixinName
from this node'sjcr:mixinTypes
property.void
Removes this node, but does not remove any other node in the shared set of this node.void
Removes this node and every other node in the shared set of this node.void
Deprecated.As of JCR 2.0,VersionManager.restore(javax.jcr.version.Version[], boolean)
should be used instead.void
Deprecated.As of JCR 2.0,VersionManager.restore(javax.jcr.version.Version[], boolean)
should be used instead.void
Deprecated.As of JCR 2.0,VersionManager.restore(javax.jcr.version.Version[], boolean)
should be used instead.void
restoreByLabel
(String versionLabel, boolean removeExisting) Deprecated.As of JCR 2.0,VersionManager.restoreByLabel(java.lang.String, java.lang.String, boolean)
should be used instead.void
setPrimaryType
(String nodeTypeName) Changes the primary node type of this node tonodeTypeName
.setProperty
(String name, boolean value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aboolean
and, if possible, the type assigned to the property isBOOLEAN
, otherwise a best-effort conversion is attempted.setProperty
(String name, double value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as adouble
and, if possible, the type assigned to the property isDOUBLE
, otherwise a best-effort conversion is attempted.setProperty
(String name, long value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as along
and, if possible, the type assigned to the property isLONG
, otherwise a best-effort conversion is attempted.setProperty
(String name, InputStream value) Deprecated.As of JCR 2.0,setProperty(String, Binary)
should be used instead.setProperty
(String name, String value) Sets the specified single-value property to the specified value.setProperty
(String name, String[] values) Sets the specified property to the specified array of values.setProperty
(String name, String[] values, int type) Sets the specified property to the specified array of values and to the specified type.setProperty
(String name, String value, int type) Sets the specified single-value property to the specified value.setProperty
(String name, BigDecimal value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aBigDecimal
and, if possible, the type assigned to the property isDECIMAL
, otherwise a best-effort conversion is attempted.setProperty
(String name, Calendar value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aCalendar
and, if possible, the type assigned to the property isDATE
, otherwise a best-effort conversion is attempted.setProperty
(String name, Binary value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aBinary
and, if possible, the type assigned to the property isBINARY
, otherwise a best-effort conversion is attempted.setProperty
(String name, Node value) The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aNode
and, if possible, the type assigned to the property isREFERENCE
orWEAKREFERENCE
, otherwise a best-effort conversion is attempted.setProperty
(String name, Value value) Sets the single-value property of this node calledname
to the specifiedvalue
.setProperty
(String name, Value[] values) Sets the multi-value property of this node calledname
to the specified array of values.setProperty
(String name, Value[] values, int type) Sets the multi-value property of this node calledname
to the specified array of values.setProperty
(String name, Value value, int type) Sets the single-value property of this node calledname
to the specifiedvalue
and the specifiedtype
.void
unlock()
Deprecated.As of JCR 2.0,LockManager.unlock(String)
should be used instead.void
If this node does have a corresponding node in the workspacesrcWorkspace
, then this replaces this node and its subgraph with a clone of the corresponding node and its subgraph.Methods inherited from interface javax.jcr.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, isSame, refresh, remove, save
-
Field Details
-
JCR_CONTENT
A constant for the JCR namejcr:content
. This is the name of a child node declared innt:file
and a property declared innt:linkedFile
.- Since:
- JCR 2.0
- See Also:
-
JCR_PROPERTY_DEFINITION
A constant for the node namejcr:propertyDefinition
declared innt:nodeType
.- Since:
- JCR 2.0
- See Also:
-
JCR_CHILD_NODE_DEFINITION
A constant for the node namejcr:childNodeDefinition
declared innt:nodeType
.- Since:
- JCR 2.0
- See Also:
-
JCR_ROOT_VERSION
A constant for the node namejcr:rootVersion
declared innt:versionHistory
.- Since:
- JCR 2.0
- See Also:
-
JCR_VERSION_LABELS
A constant for the node namejcr:versionLabels
declared innt:versionHistory
.- Since:
- JCR 2.0
- See Also:
-
JCR_FROZEN_NODE
A constant for the node namejcr:frozenNode
declared innt:version
.- Since:
- JCR 2.0
- See Also:
-
-
Method Details
-
addNode
Node addNode(String relPath) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException Creates a new node atrelPath
.This is session-write method, meaning that the addition of the new node is dispatch upon
Session.save()
.The
relPath
provided must not have an index on its final element, otherwise a RepositoryIf ordering is supported by the node type of the parent node of the new node then the new node is appended to the end of the child node list.
The new node's primary node type will be determined by the child node definitions in the node types of its parent. This may occur either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), depending on the implementation.
An
ItemExistsException
will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if an item at the specified path already exists and same-name siblings are not allowed. Implementations may differ on when this validation is performed.A
PathNotFoundException
will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if the specified path implies intermediary nodes that do not exist. Implementations may differ on when this validation is performed.A
ConstraintViolationException
will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if adding the node would violate a node type or implementation-specific constraint or if an attempt is made to add a node as the child of a property. Implementations may differ on when this validation is performed.A
VersionException
will be thrown either immediately, on dispatch (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if the node to which the new child is being added 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 (save, whether within or without transactions) or on persist (save without transactions, commit within a transaction), if a lock prevents the addition of the node. Implementations may differ on when this validation is performed.- Parameters:
relPath
- The path of the new node to be created.- Returns:
- The node that was added.
- Throws:
ItemExistsException
- if an item at the specified path already exists, same-name siblings are not allowed and this implementation performs this validation immediately.PathNotFoundException
- if the specified path implies intermediaryNode
s that do not exist or the last element ofrelPath
has an index, and this implementation performs this validation immediately.ConstraintViolationException
- if a node type or implementation-specific constraint is violated or if an attempt is made to add a node as the child of a property and this implementation performs this validation immediately.VersionException
- if the node to which the new child is being added is read-only due to a checked-in node and this implementation performs this validation immediately.LockException
- if a lock prevents the addition of the node and this implementation performs this validation immediately.RepositoryException
- If the last element ofrelPath
has an index or if another error occurs.
-
addNode
Node addNode(String relPath, String primaryNodeTypeName) throws ItemExistsException, PathNotFoundException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException Creates a new node atrelPath
of the specified node type. The behavior of this method is identical toaddNode(String relPath)
except that the primary node type of the new node is explicitly specified.- Parameters:
relPath
- the path of the new node to be created.primaryNodeTypeName
- The name of the primary node type of the new node.- Returns:
- the node that was added.
- Throws:
ItemExistsException
- if an item at the specified path already exists, same-name siblings are not allowed and this implementation performs this validation immediately instead of waiting untilsave
.PathNotFoundException
- if the specified path implies intermediaryNode
s that do not exist or the last element ofrelPath
has an index, and this implementation performs this validation immediately instead of waiting untilsave
.NoSuchNodeTypeException
- if the specified node type is not recognized and this implementation performs this validation immediately instead of waiting untilsave
.ConstraintViolationException
- if a node type or implementation-specific constraint is violated or if an attempt is made to add a node as the child of a property and this implementation performs this validation immediately instead of waiting untilsave
.VersionException
- if the node to which the new child is being added is read-only due to a checked-in node and this implementation performs this validation immediately instead of waiting untilsave
.LockException
- if a lock prevents the addition of the node and this implementation performs this validation immediately instead of waiting untilsave
.RepositoryException
- if the last element ofrelPath
has an index or if another error occurs.
-
orderBefore
void orderBefore(String srcChildRelPath, String destChildRelPath) throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException, ItemNotFoundException, LockException, RepositoryException If this node supports child node ordering, this method inserts the child node atsrcChildRelPath
into the child node list at the position immediately the child node atdestChildRelPath
.To place the node
srcChildRelPath
at the end of the list, adestChildRelPath
ofnull
is used.Note that (apart from the case where
destChildRelPath
isnull
) both of these arguments must be relative paths of depth one, in other words they are the names of the child nodes, possibly suffixed with an index.If
srcChildRelPath
anddestChildRelPath
are the same, then no change is made.This is session-write method, meaning that a change made by this method is dispatched on
save
A
ConstraintViolationException
will be thrown either immediately, on dispatch (save whether within or without transactions) or on persist (save without transactions, commit within a transaction), if this operation 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 (save whether within or without transactions) or on persist (save without transactions, commit within a transaction), if this node is read-only due to it or a node above it being checked-in Implementations may differ on when this validation is performed.A
LockException
will be thrown either immediately (by this method), or onsave
, if a lock prevents the re-ordering. Implementations may differ on when this validation is performed.- Parameters:
srcChildRelPath
- the relative path to the child node (that is, name plus possible index) to be moved in the orderingdestChildRelPath
- the the relative path to the child node (that is, name plus possible index) before which the nodesrcChildRelPath
will be placed.- Throws:
UnsupportedRepositoryOperationException
- if ordering is not supported on this node.ConstraintViolationException
- if an implementation-specific ordering restriction is violated and this implementation performs this validation immediately.ItemNotFoundException
- if either parameter is not the relative path of a child node of this node.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 re-ordering and this implementation performs this validation immediately.RepositoryException
- if another error occurs.
-
setProperty
Property setProperty(String name, Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the single-value property of this node calledname
to the specifiedvalue
.If the property does not yet exist, it is created and its property type determined by the by the node type of this node. If, based on the
name
andvalue
passed, there is more than one property definition that applies, the repository chooses one definition according to some implementation-specific criteria. Once a property with nameP
has been created, the behavior of a subsequentsetProperty(P,V)
may differ across implementations. Some repositories may allowP
to be dynamically re-bound to a different property definition (based for example, on the new value being of a different type than the original value) while other repositories may not allow such dynamic re-binding.If the property type of the supplied
Value
object is different from that required, then a best-effort conversion is attempted.If the node type of this node does not indicate a specific property type, then the property type of the supplied
Value
object is used and if the property already exists it assumes both the new value and new property type.Passing a
null
as the second parameter removes the property. It is equivalent to callingremove
on theProperty
object itself.This is a session-write method, meaning that changes made through this method are dispatched on
Session.save()
.A
ConstraintViolationException
will be thrown either immediately, on dispatch (save whether within or without transactions) or on persist (save without transactions, commit within a transaction), 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 (save whether within or without transactions) or on persist (save without transactions, commit within a transaction), if this node 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 (save whether within or without transactions) or on persist (save without transactions, commit within a transaction), if a lock prevents the setting of the property. Implementations may differ on when this validation is performed.- Parameters:
name
- The name of a property of this nodevalue
- The value to be assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- if the specified property is aDATE
but thevalue
cannot be expressed in the ISO 8601-based format defined in the JCR 2.0 specification and the implementation does not support dates incompatible with that format or ifvalue
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.
-
setProperty
Property setProperty(String name, Value value, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the single-value property of this node calledname
to the specifiedvalue
and the specifiedtype
.The behavior of this method is identical to that of
setProperty(String name, Value value)
except that the intended property type is explicitly specified.If the property does not yet exist, it is created. If the property already exists it assumes both the new value and the new property type.
- Parameters:
name
- the name of the property to be set.value
- aValue
object.type
- the type of the property.- Returns:
- the
Property
object set, ornull
if this method was used to remove a property (by setting its value tonull
). - Throws:
ValueFormatException
- ifvalue
cannot be converted to the specified type 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.
-
setProperty
Property setProperty(String name, Value[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the multi-value property of this node calledname
to the specified array of values.If the property does not yet exist, it is created.
The behavior of this method is identical to that of
setProperty(String name, Value value)
except that an array ofValue
objects is assigned instead of a singleValue
.The property type of the property will be that specified by the node type of this node. If the property type of one or more of the supplied
Value
objects is different from that required, then a best-effort conversion is attempted, according to an implemention-dependent definition of "best effort". If the conversion fails, aValueFormatException
is thrown.If the property is not multi-valued then a
ValueFormatException
is also thrown. If another error occurs, aRepositoryException
is thrown.If the node type of this node does not indicate a specific property type, then the property type of the supplied
Value
objects is used and if the property already exists it assumes both the new values and the new property type.Passing a
null
as the second parameter removes the property. It is equivalent to callingremove
on theProperty
object itself. Note that this is different from passing an array that containsnull
elements. In such a case, the array is compacted by removing thenull
values. The resulting set of values never contains a null. However, the set may be empty:N.setProperty("P", new Value[]{null})
would set the property to the empty set of values.- Parameters:
name
- the name of the property to be set.values
- an array ofValue
objects.- Returns:
- the updated
Property
object. - Throws:
ValueFormatException
- ifvalue
cannot be converted to the type of the specified property or if the property already exists and is not 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.
-
setProperty
Property setProperty(String name, Value[] values, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the multi-value property of this node calledname
to the specified array of values.The behavior of this method is identical to that of
setProperty(String name, Value[] values)
except that the type of the property is explicitly specified.If the property does not yet exist, it is created. The type of the property is determined by the
type
parameter specified.If the property type of one or more of the supplied
Value
objects is different from that specified, then a best-effort conversion is attempted, according to an implemention-dependent definition of "best effort". If the conversion fails, aValueFormatException
is thrown.If the property already exists it assumes both the new values and the new property type.
- Parameters:
name
- the name of the property to be set.values
- an array ofValue
objects.type
- the type of the property.- Returns:
- the updated
Property
object. - Throws:
ValueFormatException
- if a value cannot be converted to the specified type or if the property already exists and is not 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.
-
setProperty
Property setProperty(String name, String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the specified property to the specified array of values. Same assetProperty(String name, Value[] values)
except that the values are specified asString
objects instead ofValue
objects.- Parameters:
name
- the name of the property to be set.values
- an array ofValue
objects.- Returns:
- the updated
Property
object. - Throws:
ValueFormatException
- if a value cannot be converted to the type of the specified property or if the property already exists and is not 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.
-
setProperty
Property setProperty(String name, String[] values, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the specified property to the specified array of values and to the specified type. Same assetProperty(String name, Value[] values, int type)
except that the values are specified asString
objects instead ofValue
objects.- Parameters:
name
- the name of the property to be set.values
- an array ofValue
objects.type
- the type of the property.- Returns:
- the updated
Property
object. - Throws:
ValueFormatException
- if a value cannot be converted to the specified type or if the property already exists and is not 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.
-
setProperty
Property setProperty(String name, String value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the specified single-value property to the specified value. The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aString
. and, if possible, the type assigned to the property isSTRING
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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.
-
setProperty
Property setProperty(String name, String value, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Sets the specified single-value property to the specified value. If the property does not yet exist, it is created.The behavior of this method is identical to that of
setProperty(String name, String value)
except that the intended type of the property is explicitly specified by thetype
parameter.- Parameters:
name
- the name of the property to be set.value
- aString
object.type
- the type of the property.- Returns:
- the
Property
object set, ornull
if this method was used to remove a property (by setting its value tonull
). - Throws:
ValueFormatException
- ifvalue
cannot be converted to the specified type 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.
-
setProperty
Property setProperty(String name, InputStream value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException Deprecated.As of JCR 2.0,setProperty(String, Binary)
should be used instead.The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aInputStream
and, if possible, the type assigned to the property isBINARY
, otherwise a best-effort conversion is attempted.The passed stream is closed before this method returns either normally or because of an exception.
- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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.
-
setProperty
Property setProperty(String name, Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aBinary
and, if possible, the type assigned to the property isBINARY
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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, boolean value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aboolean
and, if possible, the type assigned to the property isBOOLEAN
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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.
-
setProperty
Property setProperty(String name, double value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as adouble
and, if possible, the type assigned to the property isDOUBLE
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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.
-
setProperty
Property setProperty(String name, BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aBigDecimal
and, if possible, the type assigned to the property isDECIMAL
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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, long value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as along
and, if possible, the type assigned to the property isLONG
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- ifvalue
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.
-
setProperty
Property setProperty(String name, Calendar value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aCalendar
and, if possible, the type assigned to the property isDATE
, otherwise a best-effort conversion is attempted.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object - Throws:
ValueFormatException
- if the specified property is aDATE
but thevalue
cannot be expressed in the ISO 8601-based format defined in the JCR 2.0 specification (section 3.6.4.3) and the implementation does not support dates incompatible with that format or ifvalue
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.
-
setProperty
Property setProperty(String name, Node value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException The behavior of this method is identical to that ofsetProperty(String name, Value value)
except that the value is specified as aNode
and, if possible, the type assigned to the property isREFERENCE
orWEAKREFERENCE
, otherwise a best-effort conversion is attempted.The value to which the property is set is the identifier of the passed node.
If the named property does not yet exist and the repository cannot determine whether a
REFERENCE
orWEAKREFERENCE
property is intended, then aREFERENCE
property is created.- Parameters:
name
- The name of a property of this nodevalue
- The value to assigned- Returns:
- The updated
Property
object. - Throws:
ValueFormatException
- if this property is not of typeREFERENCE
orWEAKREFERENCE
or the specified node is not referenceable or if the specified 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.
-
getNode
Returns the node atrelPath
relative to this node.If
relPath
contains a path element that refers to a node with same-name sibling nodes without explicitly including an index using the array-style notation ([x]
), then the index [1] is assumed (indexing of same name siblings begins at 1, not 0, in order to preserve compatibility with XPath).Within the scope of a single
Session
object, if aNode
object has been acquired, any subsequent call ofgetNode
reacquiring the same node must return aNode
object reflecting the same state as the earlierNode
object. Whether this object is actually the sameNode
instance, or simply one wrapping the same state, is up to the implementation.- Parameters:
relPath
- The relative path of the node to retrieve.- Returns:
- The node at
relPath
. - Throws:
PathNotFoundException
- if no node exists at the specified path or the currentSession
does not read access to the node at the specified path.RepositoryException
- If another error occurs.
-
getNodes
Returns all child nodes of this node accessible through the currentSession
. Does not include properties of thisNode
. The same reacquisition semantics apply as withgetNode(String)
. If this node has no accessible child nodes, then an empty iterator is returned.- Returns:
- A
NodeIterator
over all childNode
s of thisNode
. - Throws:
RepositoryException
- if an error occurs.
-
getNodes
Gets all child nodes of this node accessible through the currentSession
that matchnamePattern
. The pattern may be a full name or a partial name with one or more wildcard characters ("*
"), or a disjunction (using the "|
" character to represent logicalOR
) of these. For example,N.getNodes("jcr:* | myapp:report | my doc")
would return a
NodeIterator
holding all accessible child nodes ofN
that are either called 'myapp:report
', begin with the prefix 'jcr:
' or are called 'my doc
'.The substrings within the pattern that are delimited by "
|
" characters and which may contain wildcard characters ("*
") are called globs.Note that leading and trailing whitespace around a glob is ignored, but whitespace within a disjunct forms part of the pattern to be matched.
The pattern is matched against the names (not the paths) of the immediate child nodes of this node.
If this node has no accessible matching child nodes, then an empty iterator is returned.
The same reacquisition semantics apply as with
.getNode(String)
- Parameters:
namePattern
- a name pattern.- Returns:
- a
NodeIterator
. - Throws:
RepositoryException
- if an unexpected error occurs.
-
getNodes
Gets all child nodes of this node accessible through the currentSession
that match one or more of thenameGlob
strings in the passed array.A glob may be a full name or a partial name with one or more wildcard characters ("
*
"). For example,N.getNodes(new String[] {"jcr:*", "myapp:report", "my doc"})
would return a
NodeIterator
holding all accessible child nodes ofN
that are either called 'myapp:report
', begin with the prefix 'jcr:
' or are called 'my doc
'.Note that unlike in the case of the
getNodes(String)
leading and trailing whitespace around a glob is not ignored.The globs are matched against the names (not the paths) of the immediate child nodes of this node.
If this node has no accessible matching child nodes, then an empty iterator is returned.
The same reacquisition semantics apply as with
.getNode(String)
- Parameters:
nameGlobs
- an array of globbing strings.- Returns:
- a
NodeIterator
. - Throws:
RepositoryException
- if an unexpected error occurs.- Since:
- JCR 2.0
-
getProperty
Returns the property atrelPath
relative tothis
node. The same reacquisition semantics apply as with
.getNode(String)
- Parameters:
relPath
- The relative path of the property to retrieve.- Returns:
- The property at
relPath
. - Throws:
PathNotFoundException
- if no property exists at the specified path or if the currentSession
does not have read access to the specified property.RepositoryException
- If another error occurs.
-
getProperties
Returns all properties of this node accessible through the currentSession
. Does not include child nodes of this node. The same reacquisition semantics apply as with
. If this node has no accessible properties, then an empty iterator is returned.getNode(String)
- Returns:
- A
PropertyIterator
. - Throws:
RepositoryException
- if an error occurs.
-
getProperties
Gets all properties of this node accessible through the currentSession
that matchnamePattern
. The pattern may be a full name or a partial name with one or more wildcard characters ("*
"), or a disjunction (using the "|
" character to represent logicalOR
) of these. For example,N.getProperties("jcr:* | myapp:name | my doc")
would return a
PropertyIterator
holding all accessible properties ofN
that are either called 'myapp:name
', begin with the prefix 'jcr:
' or are called 'my doc
'.The substrings within the pattern that are delimited by "
|
" characters and which may contain wildcard characters ("*
") are called globs.Note that leading and trailing whitespace around a glob is ignored, but whitespace within a disjunct forms part of the pattern to be matched.
The pattern is matched against the names (not the paths) of the immediate child properties of this node.
If this node has no accessible matching properties, then an empty iterator is returned.
The same reacquisition semantics apply as with
.getNode(String)
- Parameters:
namePattern
- a name pattern.- Returns:
- a
PropertyIterator
. - Throws:
RepositoryException
- if an unexpected error occurs.
-
getProperties
Gets all properties of this node accessible through the currentSession
that match one or more of thenameGlob
strings in the passed array.A glob may be a full name or a partial name with one or more wildcard characters ("
*
"). For example,N.getProperties(new String[] {"jcr:*", "myapp:report", "my doc"})
would return a
PropertyIterator
holding all accessible properties ofN
that are either called 'myapp:report
', begin with the prefix 'jcr:
' or are called 'my doc
'.Note that unlike in the case of the
getProperties(String)
leading and trailing whitespace around a glob is not ignored.The globs are matched against the names (not the paths) of the properties of this node.
If this node has no accessible matching properties, then an empty iterator is returned.
The same reacquisition semantics apply as with
.getProperty(String)
- Parameters:
nameGlobs
- an array of globbing strings.- Returns:
- a
PropertyIterator
. - Throws:
RepositoryException
- if an unexpected error occurs.- Since:
- JCR 2.0
-
getPrimaryItem
Returns the primary child item of this node. The primary node type of this node may specify one child item (child node or property) of this node as the primary child item. This method returns that item.In cases where the primary child item specifies the name of a set same-name sibling child nodes, the node returned will be the one among the same-name siblings with index [1].
The same reacquisition semantics apply as with
.getNode(String)
- Returns:
- the primary child item.
- Throws:
ItemNotFoundException
- if this node does not have a primary child item, either because none is declared in the node type or because a declared primary item is not present on this node instance, or because none is accessible through the currentSession
.RepositoryException
- if another error occurs.
-
getUUID
Deprecated.As of JCR 2.0,getIdentifier()
should be used instead.Returns the UUID of this node as recorded in this node'sjcr:uuid
property. This method only works on nodes of mixin node typemix:referenceable
.On nonreferenceable nodes, this method throws an
UnsupportedRepositoryOperationException
. To avoid throwing an exception to determine whether a node has a UUID, a call toisNodeType("mix:referenceable")
can be made.- Returns:
- the UUID of this node.
- Throws:
UnsupportedRepositoryOperationException
- if this node nonreferenceable.RepositoryException
- if another error occurs.
-
getIdentifier
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
-
getIndex
This method returns the index of this node within the ordered set of its same-name sibling nodes. This index is the one used to address same-name siblings using the square-bracket notation, e.g.,/a[3]/b[4]
. Note that the index always starts at 1 (not 0), for compatibility with XPath. As a result, for nodes that do not have same-name-siblings, this method will always return 1.- Returns:
- The index of this node within the ordered set of its same-name sibling nodes.
- Throws:
RepositoryException
- if an error occurs.
-
getReferences
This method returns allREFERENCE
properties that refer to this node and that are accessible through the currentSession
. Equivalent toNode.getReferences(null)
.If this node has no referring
REFERENCE
properties, an empty iterator is returned. This includes the case where this node is not referenceable.- Returns:
- A
PropertyIterator
. - Throws:
RepositoryException
- if an error occurs.
-
getReferences
This method returns allREFERENCE
properties that refer to this node, have the specifiedname
and that are accessible through the currentSession
.If the
name
parameter isnull
then all referringREFERENCES
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
REFERENCE
properties with the specified name, an empty iterator is returned. This includes the case where this node is not referenceable.- Parameters:
name
- name of referringREFERENCE
properties to be returned; ifnull
then all referringREFERENCE
s are returned.- Returns:
- A
PropertyIterator
. - Throws:
RepositoryException
- if an error occurs.- Since:
- JCR 2.0
-
getWeakReferences
This method returns allWEAKREFERENCE
properties that refer to this node and that are accessible through the currentSession
. Equivalent toNode.getWeakReferences(null)
.If this node has no referring
WEAKREFERENCE
properties, an empty iterator is returned. This includes the case where this node is not referenceable.- Returns:
- A
PropertyIterator
. - Throws:
RepositoryException
- if an error occurs.- Since:
- JCR 2.0
-
getWeakReferences
This method returns allWEAKREFERENCE
properties that refer to this node, have the specifiedname
and that are accessible through the currentSession
.If the
name
parameter isnull
then all referringWEAKREFERENCE
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
WEAKREFERENCE
properties with the specified name, an empty iterator is returned. This includes the case where this node is not referenceable.- Parameters:
name
- name of referringWEAKREFERENCE
properties to be returned; ifnull
then all referringWEAKREFERENCE
s are returned.- Returns:
- A
PropertyIterator
. - Throws:
RepositoryException
- if an error occurs.- Since:
- JCR 2.0
-
hasNode
Indicates whether a node exists atrelPath
Returnstrue
if a node accessible through the currentSession
exists atrelPath
andfalse
otherwise.- Parameters:
relPath
- The path of a (possible) node.- Returns:
true
if a node exists atrelPath
;false
otherwise.- Throws:
RepositoryException
- if an error occurs.
-
hasProperty
Indicates whether a property exists atrelPath
Returnstrue
if a property accessible through the currentSession
exists atrelPath
andfalse
otherwise.- Parameters:
relPath
- The path of a (possible) property.- Returns:
true
if a property exists atrelPath
;false
otherwise.- Throws:
RepositoryException
- if an error occurs.
-
hasNodes
Indicates whether this node has child nodes. Returnstrue
if this node has one or more child nodes accessible through the currentSession
;false
otherwise.- Returns:
true
if this node has one or more child nodes;false
otherwise.- Throws:
RepositoryException
- if an error occurs.
-
hasProperties
Indicates whether this node has properties. Returnstrue
if this node has one or more properties accessible through the currentSession
;false
otherwise.- Returns:
true
if this node has one or more properties;false
otherwise.- Throws:
RepositoryException
- if an error occurs.
-
getPrimaryNodeType
Returns the primary node type in effect for this node. WhichNodeType
is returned when this method is called on the root node of a workspace is up to the implementation.- Returns:
- a
NodeType
object. - Throws:
RepositoryException
- if an error occurs
-
getMixinNodeTypes
Returns an array ofNodeType
objects representing the mixin node types in effect for this node. This includes only those mixin types explicitly assigned to this node. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy or through the addition of supertypes to the type hierarchy of any of the declared mixin types.- Returns:
- an array of
NodeType
objects. - Throws:
RepositoryException
- if an error occurs
-
isNodeType
Returnstrue
if this node is of the specified primary node type or mixin type, or a subtype thereof. Returnsfalse
otherwise.This method respects the effective node type of the node.
- Parameters:
nodeTypeName
- the name of a node type.- Returns:
true
If this node is of the specified primary node type or mixin type, or a subtype thereof. Returnsfalse
otherwise.- Throws:
RepositoryException
- if an error occurs.
-
setPrimaryType
void setPrimaryType(String nodeTypeName) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException Changes the primary node type of this node tonodeTypeName
. Also immediately changes this node'sjcr:primaryType
property appropriately. Semantically, the new node type may take effect immediately or on dispatch but must take effect on persist. The behavior adopted must be the same as the behavior adopted foraddMixin(java.lang.String)
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 then a
ConstraintViolationException
is thrown either immediately, on dispatch or on persist.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, on dispatch or on persist.A
ConstraintViolationException
is also thrown either immediately, on dispatch or on persist if a conflict with an already assigned mixin occurs.A
ConstraintViolationException
may also be thrown either immediately , on dispatch or on persist 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, on dispatch or on persist.A
VersionException
is thrown either immediately , on dispatch or on persist if this node is read-only dues to a check-in.A
LockException
is thrown either immediately, on dispatch or on persist if a lock prevents the change of node type.- Parameters:
nodeTypeName
- the name of the new node type.- Throws:
ConstraintViolationException
- if the specified primary node type creates a type conflict and this implementation performs this validation immediately.NoSuchNodeTypeException
- If the specifiednodeTypeName
is not recognized and this implementation performs this validation immediately.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 change of the primary node type and this implementation performs this validation immediately.RepositoryException
- if another error occurs.- Since:
- JCR 2.0
-
addMixin
void addMixin(String mixinName) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException Adds the mixin node type namedmixinName
to this node. If this node is already of typemixinName
(either due to a previously added mixin or due to its primary type, through inheritance) then this method has no effect. OtherwisemixinName
is added to this node'sjcr:mixinTypes
property.Semantically, the new node type may take effect immediately, on dispatch or on persist. The behavior adopted must be the same as the behavior adopted for
setPrimaryType(java.lang.String)
and the behavior that occurs when a node is first created.A
ConstraintViolationException
is thrown either immediately, on dispatch or on persist, if a conflict with another assigned mixin or the primary node type or for an implementation-specific reason. Implementations may differ on when this validation is done.In some implementations it may only be possible to add mixin types before a a node is persisted for the first time. I such cases any later calls to
addMixin
will throw aConstraintViolationException
either immediately, on dispatch or on persist.A
NoSuchNodeTypeException
is thrown either immediately, on dispatch or on persist, if the specifiedmixinName
is not recognized. Implementations may differ on when this validation is done.A
VersionException
is thrown either immediately, on dispatch or on persist, if this node is read-only due to a checked-in node. Implementations may differ on when this validation is done.A
LockException
is thrown either immediately, on dispatch or on persist, if a lock prevents the addition of the mixin. Implementations may differ on when this validation is done.- Parameters:
mixinName
- the name of the mixin node type to be added- Throws:
NoSuchNodeTypeException
- If the specifiedmixinName
is not recognized and this implementation performs this validation immediately.ConstraintViolationException
- if the specified mixin node type creates a conflict and this implementation performs this validation immediately.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 addition of the mixin and this implementation performs this validation immediately.RepositoryException
- if another error occurs.
-
removeMixin
void removeMixin(String mixinName) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException Removes the specified mixin node type from this node and removesmixinName
from this node'sjcr:mixinTypes
property. Both the semantic change in effective node type and the persistence of the change to thejcr:mixinTypes
property occur on persist.If this node does not have the specified mixin, a
NoSuchNodeTypeException
is thrown either immediately, on dispatch or on persist. Implementations may differ on when this validation is done.A
ConstraintViolationException
will be thrown either immediately, on dispatch or on persist, if the removal of a mixin is not allowed. Implementations are free to enforce any policy with regard to mixin removal and may differ on when this validation is done.A
VersionException
is thrown either immediately, on dispatch or on persist, if this node is read-only due to a checked-in node. Implementations may differ on when this validation is done.A
LockException
is thrown either immediately or onsave
if a lock prevents the removal of the mixin. Implementations may differ on when this validation is done.- Parameters:
mixinName
- the name of the mixin node type to be removed.- Throws:
NoSuchNodeTypeException
- if the specifiedmixinName
is not currently assigned to this node and this implementation performs this validation immediately.ConstraintViolationException
- if the specified mixin node type is prevented from being removed and this implementation performs this validation immediately.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 removal of the mixin and this implementation performs this validation immediately.RepositoryException
- if another error occurs.
-
canAddMixin
Returnstrue
if callingaddMixin(java.lang.String)
on this node with the mixn node typemixinName
will not fail. Returnsfalse
otherwise.- Parameters:
mixinName
- The name of the mixin to be tested.- Returns:
true
if addMixin will not fail when called on this node with the specifiedmixinName
;false
otherwise.- Throws:
NoSuchNodeTypeException
- if the specified mixin node type name is not recognized.RepositoryException
- if another error occurs.
-
getDefinition
Returns the node definition that applies to this node. 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 node, a single particular definition was used and it is that definition that this method returns. How this governing definition is selected upon node creation from among others which may have been applicable is an implementation issue and is not covered by this specification. TheNodeDefinition
returned when this method is called on the root node of a workspace is also up to the implementation.- Returns:
- a
NodeDefinition
object. - Throws:
RepositoryException
- if an error occurs.- See Also:
-
checkin
Version checkin() throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryExceptionDeprecated.As of JCR 2.0,VersionManager.checkin(java.lang.String)
should be used instead.Creates a new version of this node and returns thatVersion
object. The new version becomes the base version of this node. The name of the new version is implementaion determined.This node becomes checked-in and its
jcr:checkedOut
property is set to false to reflect this. On a successful check-in the change to this property is made as a workspace-write, and therefore does not require asave
.The part of the subgraph of this node that is affected by check-in becomes read-only (see the specification for details).
If this node is already checked-in, this method has no effect but returns the current base version of this node.
- Returns:
- the created version.
- Throws:
VersionException
- if a child item of this node has anOnParentVersion
status ofABORT
. This includes the case (under full versioning) where an unresolved merge failure exists on this node, as indicated by the presence of ajcr:mergeFailed
property. Under full versioning this exception is also thrown if the invalid input: '<'jcr:predecessors property of the node has no values.UnsupportedRepositoryOperationException
- if this node is not versionable.InvalidItemStateException
- if unsaved changes exist on this node.LockException
- If a lock prevents the operation.RepositoryException
- If another error occurs.
-
checkout
void checkout() throws UnsupportedRepositoryOperationException, LockException, ActivityViolationException, RepositoryExceptionDeprecated.As of JCR 2.0,VersionManager.checkout(java.lang.String)
should be used instead.Sets this versionable node to checked-out status by setting itsjcr:isCheckedOut
property totrue
. Under full versioning it also sets thejcr:predecessors
property to be a reference to the current base version (the same value as held injcr:baseVersion
). These changes are made by worksapce-write and therefore do require asave
.The part of the subgraph of this node that is affected by the checked-out status of this node becomes no longer read-only.
If this node is already checked-out, this method has no effect.
- Throws:
UnsupportedRepositoryOperationException
- if this node is not versionable.LockException
- if a lock prevents the checkout.ActivityViolationException
- if the checkout conflicts with the activity present on the current session.RepositoryException
- if another error occurs.
-
doneMerge
void doneMerge(Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.doneMerge(java.lang.String, javax.jcr.version.Version)
should be used instead.Support for this method is only required under full versioning.Completes the merge process with respect to this node and the specified
version
.When the
merge(java.lang.String, boolean)
method is called on a node, every versionable node in that subgraph is compared with its corresponding node in the indicated other workspace and a "merge test result" is determined indicating one of the following:- This node will be updated to the state of its correspondee (if the base version of the correspondee is more recent in terms of version history).
- This node will be left alone (if this node's base version is more recent in terms of version history).
- This node will be marked as having failed the merge test (if this node's base version is on a different branch of the version history from the base version of its corresponding node in the other workspace, thus preventing an automatic determination of which is more recent).
merge(java.lang.String, boolean)
for more details)In the last case the merging of the subgraph of the versionable node in question must be done by the application (for example, by providing a merge tool for the user).
Additionally, once the subgraphs of the nodes has been merged, their version graph branches must also be merged. The JCR versioning system provides for this by keeping a record, for each versionable node that fails the merge test, of the base version of the corresponding node that caused the merge failure. This record is kept in the
jcr:mergeFailed
property of this node. After amerge
, this property will contain one or more (if multiple merges have been performed)REFERENCE
s that point to the "failed versions".To complete the merge process, the client calls
doneMerge(Version v)
passing the version object referred to be thejcr:mergeFailed
property that the client wishes to connect tothis
node in the version graph. This has the effect of moving the reference to the indicated version from thejcr:mergeFailed
property ofthis
node to thejcr:predecessors
.If the client chooses not to connect this node to a particular version referenced in the
jcr:mergeFailed
property, he callscancelMerge(Version version)
. This has the effect of removing the reference to the specifiedversion
fromjcr:mergeFailed
without adding it tojcr:predecessors
.Once the last reference in
jcr:mergeFailed
has been either moved tojcr:predecessors
(withdoneMerge
) or just removed fromjcr:mergeFailed
(withcancelMerge
) thejcr:mergeFailed
property is automatically removed, thus enablingthis
node to be checked-in, creating a new version (note that before thejcr:mergeFailed
is removed, itsOnParentVersion
setting ofABORT
prevents checkin). This new version will have a predecessor connection to each version for whichdoneMerge
was called, thus joining those branches of the version graph.If successful, these changes are persisted immediately, there is no need to call
save
.- Parameters:
version
- a version referred to by this node'sjcr:mergeFailed
property.- Throws:
VersionException
- if the version specifed is not among those referenced in this node'sjcr:mergeFailed
or if this node is currently checked-in.InvalidItemStateException
- if there are unsaved changes pending on this node.UnsupportedRepositoryOperationException
- if this node is not versionable.RepositoryException
- if another error occurs.
-
cancelMerge
void cancelMerge(Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.cancelMerge(java.lang.String, javax.jcr.version.Version)
should be used instead.Support for this method is only required under full versioning.Cancels the merge process with respect to this node and specified
version
.See
doneMerge(javax.jcr.version.Version)
for a full explanation. Also seemerge(java.lang.String, boolean)
for more details.If successful, these changes are persisted immediately, there is no need to call
save
.- Parameters:
version
- a version referred to by this node'sjcr:mergeFailed
property.- Throws:
VersionException
- if the version specified is not among those referenced in this node'sjcr:mergeFailed
or if this node is currently checked-in.InvalidItemStateException
- if there are unsaved changes pending on this node.UnsupportedRepositoryOperationException
- if this node is not versionable.RepositoryException
- if another error occurs.
-
update
void update(String srcWorkspace) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException If this node does have a corresponding node in the workspacesrcWorkspace
, then this replaces this node and its subgraph with a clone of the corresponding node and its subgraph.If this node does not have a corresponding node in the workspace
srcWorkspace
, then theupdate
method has no effect.If the
update
succeeds the changes made are persisted immediately, there is no need to callsave
.Note that
update
does not respect the checked-in status of nodes. Anupdate
may change a node even if it is currently checked-in (This fact is only relevant in an implementation that supports versioning).- Parameters:
srcWorkspace
- the name of the source workspace.- Throws:
NoSuchWorkspaceException
- IfsrcWorkspace
does not exist.InvalidItemStateException
- if thisSession
(not necessarily thisNode
) has pending unsaved changes.AccessDeniedException
- If the current session does not have sufficent access to perform the operation.LockException
- if a lock prevents the update.RepositoryException
- If another error occurs.
-
merge
NodeIterator merge(String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.merge(java.lang.String, java.lang.String, boolean)
should be used instead.Support for this method is only required under full versioning.This method can be thought of as a version-sensitive update.
It recursively tests each versionable node in the subgraph of this node against its corresponding node in
srcWorkspace
with respect to the relation between their respective base versions and either updates the node in question or not, depending on the outcome of the test.A
MergeException
is thrown ifbestEffort
isfalse
and a versionable node is encountered whose corresponding node's base version is on a divergent branch from this node's base version.If successful, the changes are persisted immediately, there is no need to call
save
.This method returns a
NodeIterator
over all versionable nodes in the subgraph that received a merge result of fail. IfbestEffort
isfalse
, this iterator will be empty (since ifmerge
returns successfully, instead of throwing an exception, it will be because no failures were encountered). IfbestEffort
istrue
, this iterator will contain all nodes that received a fail during the course of thismerge
operation.- Parameters:
srcWorkspace
- the name of the source workspace.bestEffort
- a boolean- Returns:
- iterator over all nodes that received a merge result of "fail" in the course of this operation.
- Throws:
MergeException
- ifbestEffort
isfalse
and a failed merge result is encountered.InvalidItemStateException
- if this session (not necessarily thisnode
) has pending unsaved changes.NoSuchWorkspaceException
- if the specifiedsrcWorkspace
does not exist.AccessDeniedException
- if the current session does not have sufficient rights to perform the operation.LockException
- if a lock prevents the merge.RepositoryException
- if another error occurs.
-
getCorrespondingNodePath
String getCorrespondingNodePath(String workspaceName) throws ItemNotFoundException, NoSuchWorkspaceException, AccessDeniedException, RepositoryException Returns the absolute path of the node in the specified workspace that corresponds tothis
node.- Parameters:
workspaceName
- the name of the workspace.- Returns:
- the absolute path to the corresponding node.
- Throws:
ItemNotFoundException
- if no corresponding node is found.NoSuchWorkspaceException
- if the workspace is unknown.AccessDeniedException
- if the currentsession
has insufficent access capabilities to perform this operation.RepositoryException
- if another error occurs.
-
isCheckedOut
Returnsfalse
if this node is currently in the checked-in state (either due to its own status as a versionable node or due to the effect of a versionable node being checked in above it). Otherwise this method returnstrue
. This includes the case where the repository does not support versioning (and therefore all nodes are always "checked-out", by default).- Returns:
- a boolean
- Throws:
RepositoryException
- if an error occurs.
-
restore
void restore(String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.restore(javax.jcr.version.Version[], boolean)
should be used instead.Restoresthis
node to the state defined by the version with the specifiedversionName
.This method will work regardless of whether this node is checked-in or not.
An identifier collision occurs when a node exists outside the subgraph rooted at this node with the same identifier as a node that would be introduced by the
restore
operation into the subgraph at this node. The result in such a case is governed by theremoveExisting
flag. IfremoveExisting
istrue
, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryException
is thrown). IfremoveExisting
isfalse
, then aItemExistsException
is thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersion
settings ofCOPY
orVERSION
are also governed by theremoveExisting
flag.- Parameters:
versionName
- aVersion
objectremoveExisting
- a boolean flag that governs what happens in case of an identifier collision.- Throws:
UnsupportedRepositoryOperationException
- if this node is not versionable.VersionException
- if the specifiedversion
is not part of this node's version history or if an attempt is made to restore the root version (jcr:rootVersion
).ItemExistsException
- ifremoveExisting
isfalse
and an identifier collision occurs.LockException
- if a lock prevents the restore.InvalidItemStateException
- if thisSession
(not necessarily thisNode
) has pending unsaved changes.RepositoryException
- If another error occurs.
-
restore
void restore(Version version, boolean removeExisting) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.restore(javax.jcr.version.Version[], boolean)
should be used instead.Restoresthis
node to the state defined by the specifiedversion
.If successful, the change is persisted immediately and there is no need to call
save
.This method will work regardless of whether this node is checked-in or not.
An identifier collision occurs when a node exists outside the subgraph rooted at this node with the same identifier as a node that would be introduced by the
restore
operation into the subgraph at this node. The result in such a case is governed by theremoveExisting
flag. IfremoveExisting
istrue
, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryException
is thrown). IfremoveExisting
isfalse
, then aItemExistsException
is thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersion
settings ofCOPY
orVERSION
are also governed by theremoveExisting
flag.- Parameters:
version
- aVersion
objectremoveExisting
- a boolean flag that governs what happens in case of an identifier collision.- Throws:
UnsupportedRepositoryOperationException
- if this node is not versionable.VersionException
- if the specifiedversion
is not part of this node's version history or if an attempt is made to restore the root version (jcr:rootVersion
).ItemExistsException
- ifremoveExisting
isfalse
and an identifier collision occurs.InvalidItemStateException
- if thisSession
(not necessarily thisNode
) has pending unsaved changes.LockException
- if a lock prevents the restore.RepositoryException
- if another error occurs.
-
restore
void restore(Version version, String relPath, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.restore(javax.jcr.version.Version[], boolean)
should be used instead.Restores the specified version torelPath
, relative to this node.If the
restore
succeeds, the changes made to this node are persisted immediately, there is no need to callsave
.A node need not exist at relPath, though the parent of
relPath
must exist.If a node does exist at relPath then it must correspond to the version being restored (the version must be a version of that node) and must not be a root version (
jcr:rootVersion
), otherwise aVersionException
is thrown.If no node exists at
relPath
then aVersionException
is thrown if the parent node ofrelPath
is read-only due to a check-in. However, If there is a node atrelPath
then the read-only status of that node itself and the read-only status of its parent are irrelevant. The restore will work even if one or both are read-only due to a checked-in node.An identifier collision occurs when a node exists outside the subgraph rooted at
relPath
with the same identifier as a node that would be introduced by therestore
operation into the subgraph atrelPath
(Note that in cases where there is no node atrelPath
, this amounts to saying that an identifier collision occurs if there exists a node anywhere in this workspace with the same identifier as a node that would be introduced by therestore
). The result in such a case is governed by theremoveExisting
flag. IfremoveExisting
istrue
, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryException
is thrown). IfremoveExisting
isfalse
, then aItemExistsException
is thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersion
settings ofCOPY
orVERSION
are also governed by theremoveExisting
flag.- Parameters:
version
- a version objectrelPath
- the path to which the version is to be restoredremoveExisting
- governs what happens on identifier collision.- Throws:
PathNotFoundException
- if the parent ofrelPath
does not exist.ItemExistsException
- if removeExisting is false and an identifier collision occursConstraintViolationException
- if the would-be parent of the locationrelPath
is actually a property, or if a node type restriction would be violatedVersionException
- if the parent node ofrelPath
is read-only due to a checked-in node or if a node exists at relPath that is not the node corresponding to the specifiedversion
or if an attempt is made to restore the root version (jcr:rootVersion
).UnsupportedRepositoryOperationException
- if versioning is not supported.LockException
- if a lock prevents the restore.InvalidItemStateException
- if thisSession
(not necessarily thisNode
) has pending unsaved changes.RepositoryException
- if another error occurs
-
restoreByLabel
void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException Deprecated.As of JCR 2.0,VersionManager.restoreByLabel(java.lang.String, java.lang.String, boolean)
should be used instead.Restores the version of this node with the specified version label.If successful, the change is persisted immediately and there is no need to call
save
.This method will work regardless of whether this node is checked-in or not.
An identifier collision occurs when a node exists outside the subgraph rooted at this node with the same identifier as a node that would be introduced by the
restoreByLabel
operation into the subgraph at this node. The result in such a case is governed by theremoveExisting
flag. IfremoveExisting
istrue
, then the incoming node takes precedence, and the existing node (and its subgraph) is removed (if possible; otherwise aRepositoryException
is thrown). IfremoveExisting
isfalse
, then aItemExistsException
is thrown and no changes are made. Note that this applies not only to cases where the restored node itself conflicts with an existing node but also to cases where a conflict occurs with any node that would be introduced into the workspace by the restore operation. In particular, conflicts involving subnodes of the restored node that haveOnParentVersion
settings ofCOPY
orVERSION
are also governed by theremoveExisting
flag.Note the special behavior in case of chained versions where a child node of this node has an on
OnParentVersion
settings ofVERSION
and is mix:versionable: If there is a version of the child node with the specified label, then that version is restored; otherwise the determination depends on the configuration of the workspace and is defined by the implementation.- Parameters:
versionLabel
- a StringremoveExisting
- a boolean flag that governs what happens in case of an identifier collision.- Throws:
UnsupportedRepositoryOperationException
- if this node is not versionable.VersionException
- if the specifiedversionLabel
does not exist in this node's version history.ItemExistsException
- ifremoveExisting
isfalse
and an identifier collision occurs.LockException
- if a lock prevents the restore.InvalidItemStateException
- if thisSession
(not necessarily thisNode
) has pending unsaved changes.RepositoryException
- If another error occurs.
-
getVersionHistory
VersionHistory getVersionHistory() throws UnsupportedRepositoryOperationException, RepositoryExceptionDeprecated.As of JCR 2.0,VersionManager.getVersionHistory(java.lang.String)
should be used instead.Returns theVersionHistory
object of this node. Under full versioning this object provides access to thent:versionHistory
node holding this node's versions.- Returns:
- a
VersionHistory
object - Throws:
UnsupportedRepositoryOperationException
- if this node is not versionable.RepositoryException
- if another error occurs.
-
getBaseVersion
Deprecated.As of JCR 2.0,VersionManager.getBaseVersion(java.lang.String)
should be used instead.Returns the current base version of this versionable node.- Returns:
- a
Version
object. - Throws:
UnsupportedRepositoryOperationException
- if this node is not versionable.RepositoryException
- if another error occurs.
-
lock
Lock lock(boolean isDeep, boolean isSessionScoped) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException Deprecated.As of JCR 2.0,LockManager.lock(String, boolean, boolean, long, String)
should be used instead.Places a lock on this node. If successful, this node is said to hold the lock.If
isDeep
istrue
then the lock applies to this node and all its descendant nodes; iffalse
, the lock applies only to this, the holding node.If
isSessionScoped
istrue
then this lock will expire upon the expiration of the current session (either through an automatic or explicitSession.logout
); iffalse
, this lock does not expire until explicitly unlocked or automatically unlocked due to a implementation-specific limitation, such as a timeout.Returns a
Lock
object reflecting the state of the new lock.If the lock is open-scoped the returned lock will include a lock token.
The lock token is also automatically added to the set of lock tokens held by the current
Session
.If successful, then the property
jcr:lockOwner
is created and set to the value ofSession.getUserID
for the current session and the propertyjcr:lockIsDeep
is set to the value passed in asisDeep
. These changes are persisted automatically; there is no need to callsave
.Note that it is possible to lock a node even if it is checked-in (the lock-related properties will be changed despite the checked-in status).
- Parameters:
isDeep
- iftrue
this lock will apply to this node and all its descendants; iffalse
, it applies only to this node.isSessionScoped
- iftrue
, this lock expires with the current session; iffalse
it expires when explicitly or automatically unlocked for some other reason.- Returns:
- A
Lock
object containing a lock token. - Throws:
UnsupportedRepositoryOperationException
- if this implementation does not support locking.LockException
- if this node is notmix:lockable
or this node is already locked orisDeep
istrue
and a descendant node of this node already holds a lock or if this node has not yet been persisted.AccessDeniedException
- if this session does not have sufficient access capabilities to lock this node.InvalidItemStateException
- if this node has pending unsaved changes.RepositoryException
- if another error occurs.
-
getLock
Lock getLock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, RepositoryExceptionDeprecated.As of JCR 2.0,LockManager.getLock(String)
should be used instead.Returns theLock
object that applies to this node. This may be either a lock on this node itself or a deep lock on a node above this node.- Returns:
- The applicable
Lock
object. - Throws:
UnsupportedRepositoryOperationException
- if this implementation does not support locking.LockException
- if no lock applies to this node.AccessDeniedException
- if the curent session does not have sufficent access to get the lock.RepositoryException
- if another error occurs.
-
unlock
void unlock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryExceptionDeprecated.As of JCR 2.0,LockManager.unlock(String)
should be used instead.Removes the lock on this node. Also removes the propertiesjcr:lockOwner
andjcr:lockIsDeep
from this node. These changes are persisted automatically; there is no need to callsave
. As well, the corresponding lock token is removed from the set of lock tokens held by the currentSession
.If this node does not currently hold a lock or holds a lock for which this
Session
is not the owner, then aLockException
is thrown. Note however that the system may give permission to a non-owning session to unlock a lock. Typically such "lock-superuser" capability is intended to facilitate administrational clean-up of orphaned open-scoped locks.Note that it is possible to unlock a node even if it is checked-in (the lock-related properties will be changed despite the checked-in status).
- Throws:
UnsupportedRepositoryOperationException
- if this implementation does not support locking.LockException
- if this node does not currently hold a lock or holds a lock for which this Session does not have the correct lock tokenAccessDeniedException
- if the current session does not have sufficent access to unlock this node.InvalidItemStateException
- if this node has pending unsaved changes.RepositoryException
- if another error occurs.
-
holdsLock
Deprecated.As of JCR 2.0,LockManager.holdsLock(String)
should be used instead.Returnstrue
if this node holds a lock; otherwise returnsfalse
. To hold a lock means that this node has actually had a lock placed on it specifically, as opposed to just having a lock apply to it due to a deep lock held by a node above.- Returns:
- a
boolean
. - Throws:
RepositoryException
- if an error occurs.
-
isLocked
Returnstrue
if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returnsfalse
. This includes the case where a repository does not support locking (in which case all nodes are "unlocked" by default).- Returns:
- a
boolean
. - Throws:
RepositoryException
- if an error occurs.
-
followLifecycleTransition
void followLifecycleTransition(String transition) throws UnsupportedRepositoryOperationException, InvalidLifecycleTransitionException, RepositoryException Causes the lifecycle state of this node to undergo the specifiedtransition
.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 passedtransition
parameter, though this is an implementation-specific issue. If thejcr:currentLifecycleState
property is changed the change is persisted immediately, there is no need to callsave
.- Parameters:
transition
- a state transition- Throws:
UnsupportedRepositoryOperationException
- if this implementation does not support lifecycle actions or if this node does not have themix:lifecycle
mixin.InvalidLifecycleTransitionException
- if the lifecycle transition is not successful.RepositoryException
- if another error occurs.- Since:
- JCR 2.0
-
getAllowedLifecycleTransistions
String[] getAllowedLifecycleTransistions() throws UnsupportedRepositoryOperationException, RepositoryExceptionReturns 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 themix:lifecycle
mixin.RepositoryException
- if another error occurs.- Since:
- JCR 2.0
-
VersionManager.cancelMerge(java.lang.String, javax.jcr.version.Version)
should be used instead.