public abstract class AbstractNode extends AbstractItem implements javax.jcr.Node
Node
interface.
Item
methods without a default implementation:
Item.accept(javax.jcr.ItemVisitor)
Item.getName()
Item.getParent()
Item.getSession()
Item.isModified()
Item.isNew()
Item.isSame(Item)
Item.refresh(boolean)
Item.remove()
Item.save()
Node
methods without a default implementation:
Node.addMixin(String)
Node.addNode(String)
Node.addNode(String, String)
Node.canAddMixin(String)
Node.cancelMerge(Version)
Node.checkin()
Node.checkout()
Node.doneMerge(Version)
Node.getBaseVersion()
Node.getCorrespondingNodePath(String)
Node.getDefinition()
Node.getIndex()
Node.getLock()
Node.getNode(String)
Node.getNodes()
Node.getNodes(String)
Node.getPrimaryItem()
Node.getProperties()
Node.getProperties(String)
Node.getReferences()
Node.lock(boolean, boolean)
Node.merge(String, boolean)
Node.orderBefore(String, String)
Node.removeMixin(String)
Node.restore(Version, String, boolean)
Node.setProperty(String, Value)
Node.setProperty(String, Value[])
Node.unlock()
Node.update(String)
Constructor and Description |
---|
AbstractNode() |
Modifier and Type | Method and Description |
---|---|
void |
accept(javax.jcr.ItemVisitor visitor)
Accepts the given item visitor.
|
javax.jcr.nodetype.NodeType[] |
getMixinNodeTypes()
Returns the declared mixin node types of this node.
|
String |
getPath()
Returns the path of this node.
|
javax.jcr.nodetype.NodeType |
getPrimaryNodeType()
Returns the primary node type of this node.
|
javax.jcr.Property |
getProperty(String relPath)
Returns the property at the given relative path from this node.
|
String |
getUUID()
Returns the UUID of this node.
|
javax.jcr.version.VersionHistory |
getVersionHistory()
Returns the version history of this node.
|
boolean |
hasNode(String relPath)
Checks whether a node at the given relative path exists.
|
boolean |
hasNodes()
Checks if this node has one or more properties.
|
boolean |
hasProperties()
Checks if this node has one or more properties.
|
boolean |
hasProperty(String relPath)
Checks whether a property at the given relative path exists.
|
boolean |
holdsLock()
Checks if this node holds a lock.
|
boolean |
isCheckedOut()
Checks whether this node is checked out.
|
boolean |
isLocked()
Checks if this node is locked.
|
boolean |
isNode()
Returns
true . |
boolean |
isNodeType(String name)
Checks whether this node is of the given type.
|
void |
restore(String versionName,
boolean removeExisting)
Restores this node to the version with the given name.
|
void |
restore(javax.jcr.version.Version version,
boolean removeExisting)
Restores this node to the given version.
|
void |
restoreByLabel(String versionLabel,
boolean removeExisting)
Restores this node to the version with the given label.
|
javax.jcr.Property |
setProperty(String name,
boolean value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
Calendar value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
double value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
InputStream value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
long value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
javax.jcr.Node value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
String value)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
String[] strings)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
String[] strings,
int type)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
String value,
int type)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
javax.jcr.Value[] values,
int type)
Sets the value of the named property.
|
javax.jcr.Property |
setProperty(String name,
javax.jcr.Value value,
int type)
Sets the value of the named property.
|
getAncestor, getDepth, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, doneMerge, followLifecycleTransition, getAllowedLifecycleTransistions, getBaseVersion, getCorrespondingNodePath, getDefinition, getIdentifier, getIndex, getLock, getNode, getNodes, getNodes, getNodes, getPrimaryItem, getProperties, getProperties, getProperties, getReferences, getReferences, getSharedSet, getWeakReferences, getWeakReferences, lock, merge, orderBefore, removeMixin, removeShare, removeSharedSet, restore, setPrimaryType, setProperty, setProperty, setProperty, setProperty, unlock, update
public void accept(javax.jcr.ItemVisitor visitor) throws javax.jcr.RepositoryException
The default implementation calls ItemVisitor.visit(Node)
on
the given visitor with this node as the argument.
accept
in interface javax.jcr.Item
visitor
- item visitorjavax.jcr.RepositoryException
- if an error occurspublic String getPath() throws javax.jcr.RepositoryException
The default implementation recursively calls this method on the parent node and appends the name and optionally the index of this node to construct the full path. Returns "/" if the parent node is not available (i.e. this is the root node).
getPath
in interface javax.jcr.Item
javax.jcr.RepositoryException
- if an error occurspublic boolean isNode()
true
.isNode
in interface javax.jcr.Item
true
public javax.jcr.nodetype.NodeType[] getMixinNodeTypes() throws javax.jcr.RepositoryException
The default implementation uses the values of the
jcr:mixinTypes
property to look up the mixin node types
from the NodeTypeManager
of the current workspace.
getMixinNodeTypes
in interface javax.jcr.Node
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.nodetype.NodeType getPrimaryNodeType() throws javax.jcr.RepositoryException
The default implementation uses the value of the
jcr:primaryType
property to look up the primary
node type from the NodeTypeManager
of the current workspace.
getPrimaryNodeType
in interface javax.jcr.Node
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property getProperty(String relPath) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
The default implementation looks up the parent node of the given relative path and iterates through the properties of that node to find and return the identified property.
getProperty
in interface javax.jcr.Node
relPath
- relative path of the propertyjavax.jcr.PathNotFoundException
- if the property is not foundjavax.jcr.RepositoryException
- if an error occurspublic String getUUID() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
The default implementation checks if this node is referenceable (i.e. of
type mix:referenceable
) and returns the contents of the
jcr:uuid
property if it is.
getUUID
in interface javax.jcr.Node
javax.jcr.UnsupportedRepositoryOperationException
- if this node is not referenceablejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.version.VersionHistory getVersionHistory() throws javax.jcr.RepositoryException
The default implementation returns the containing version history of the base version of this node.
getVersionHistory
in interface javax.jcr.Node
javax.jcr.RepositoryException
- if an error occurspublic boolean hasNode(String relPath) throws javax.jcr.RepositoryException
The default implementation looks up the node using
Node.getNode(String)
and returns true
if
a PathNotFoundException
is not thrown.
hasNode
in interface javax.jcr.Node
relPath
- relative pathtrue
if a node exists at the given path,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean hasNodes() throws javax.jcr.RepositoryException
The default implementation calls Node.getNodes()
and returns
true
iff returned iterator has at least one element.
hasNodes
in interface javax.jcr.Node
true
if this node has child nodes,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean hasProperties() throws javax.jcr.RepositoryException
The default implementation calls Node.getProperties()
and
returns true
iff returned iterator has at least one element.
Note that in normal circumstances (i.e. no weird access controls) this
method will always return true
since all nodes always have
at least the jcr:primaryType
property.
hasProperties
in interface javax.jcr.Node
true
if this node has properties,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean hasProperty(String relPath) throws javax.jcr.RepositoryException
The default implementation looks up the property using
Node.getProperty(String)
and returns true
if
a PathNotFoundException
is not thrown.
hasProperty
in interface javax.jcr.Node
relPath
- relative pathtrue
if a property exists at the given path,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean holdsLock() throws javax.jcr.RepositoryException
The default implementation calls Node.getLock()
and returns
true
iff the holding node of the lock is the same as this
node.
holdsLock
in interface javax.jcr.Node
true
if this node holds a lock,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean isCheckedOut() throws javax.jcr.RepositoryException
The default implementation checks the jcr:isCheckedOut
property if this node is versionable, and recursively calls this method
on the parent node if this node is not versionable. A non-versionable
root node always returns true
from this method.
isCheckedOut
in interface javax.jcr.Node
true
if this node is checked out,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean isLocked() throws javax.jcr.RepositoryException
The default implementation calls Node.getLock()
and returns
true
iff a LockException
is not thrown.
isLocked
in interface javax.jcr.Node
true
if this node is locked,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic boolean isNodeType(String name) throws javax.jcr.RepositoryException
The default implementation iterates through the primary and mixin
types and all the supertypes of this node, returning true
if a type with the given name is encountered. Returns false
if none of the types matches.
isNodeType
in interface javax.jcr.Node
name
- type nametrue
if this node is of the given type,
false
otherwisejavax.jcr.RepositoryException
- if an error occurspublic void restore(String versionName, boolean removeExisting) throws javax.jcr.RepositoryException
The default implement retrieves the named Version
from the
associated VersionHistory
and forwards the call to the
Node.restore(Version, boolean)
method.
restore
in interface javax.jcr.Node
versionName
- version nameremoveExisting
- passed throughjavax.jcr.RepositoryException
- if an error occurspublic void restore(javax.jcr.version.Version version, boolean removeExisting) throws javax.jcr.RepositoryException
The default implementation forwards the call to the
Node.restore(Version, String, boolean)
method using the
relative path ".".
restore
in interface javax.jcr.Node
version
- passed throughremoveExisting
- passed throughjavax.jcr.RepositoryException
- if an error occurspublic void restoreByLabel(String versionLabel, boolean removeExisting) throws javax.jcr.RepositoryException
The default implement retrieves the labeled Version
from the
associated VersionHistory
and forwards the call to the
Node.restore(Version, boolean)
method.
restoreByLabel
in interface javax.jcr.Node
versionLabel
- version labelremoveExisting
- passed throughjavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, String[] strings) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instances from
the given string values and forwards the call to the
Node.setProperty(String, Value[])
method.
setProperty
in interface javax.jcr.Node
name
- property namestrings
- string valuesjavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, String value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given string value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- string valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, InputStream value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given binary value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- binary valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, boolean value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given boolean value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- boolean valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, double value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given double value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- double valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, long value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given long value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- long valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, Calendar value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given date value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- date valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, javax.jcr.Node value) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance from
the given reference value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- reference valuejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, javax.jcr.Value value, int type) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to convert the given value to the given
type and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- property valuetype
- property typejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, javax.jcr.Value[] values, int type) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to convert the given values to the given
type and forwards the call to the
Node.setProperty(String, Value[])
method.
setProperty
in interface javax.jcr.Node
name
- property namevalues
- property valuestype
- property typejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, String[] strings, int type) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create Value
instances of the
given type from the given string values and forwards the call to the
Node.setProperty(String, Value[])
method.
setProperty
in interface javax.jcr.Node
name
- property namestrings
- string valuestype
- property typejavax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Property setProperty(String name, String value, int type) throws javax.jcr.RepositoryException
The default implementation uses the ValueFactory
of the
current Session
to create a Value
instance of the
given type from the given string value and forwards the call to the
Node.setProperty(String, Value)
method.
setProperty
in interface javax.jcr.Node
name
- property namevalue
- string valuetype
- property typejavax.jcr.RepositoryException
- if an error occursCopyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.