public class NodeDelegate extends ItemDelegate
NodeDelegate serve as internal representations of Nodes.
Most methods of this class throw an InvalidItemStateException
exception if the instance is stale. An instance is stale if the underlying
items does not exist anymore.sessionDelegate| Constructor and Description |
|---|
NodeDelegate(SessionDelegate sessionDelegate,
org.apache.jackrabbit.oak.api.Tree tree) |
| Modifier and Type | Method and Description |
|---|---|
@Nullable NodeDelegate |
addChild(java.lang.String name,
java.lang.String typeName)
Add a child node
|
void |
addMixin(java.lang.String typeName) |
boolean |
canAddMixin(java.lang.String typeName) |
boolean |
exists()
Determine whether the underlying item exists
|
@Nullable NodeDelegate |
getChild(java.lang.String relPath)
Get child node
|
long |
getChildCount(long max)
Get the number of child nodes
|
@NotNull java.util.Iterator<NodeDelegate> |
getChildren()
Returns an iterator for traversing all the children of this node.
|
@NotNull java.lang.String |
getIdentifier() |
@Nullable NodeDelegate |
getLock() |
java.lang.String |
getLockOwner() |
@NotNull java.lang.String |
getName()
Get the name of this item
|
@Nullable NodeDelegate |
getParent()
Get the parent of this item or
null. |
@NotNull java.lang.String |
getPath()
Get the path of this item
|
@NotNull java.util.Iterator<PropertyDelegate> |
getProperties()
Get the properties of the node
|
@NotNull PropertyDelegate |
getProperty(java.lang.String relPath)
Get a property.
|
long |
getPropertyCount()
Get the number of properties of the node
|
@Nullable PropertyDelegate |
getPropertyOrNull(java.lang.String relPath)
Get a property
|
@Nullable org.apache.jackrabbit.oak.api.Tree.Status |
getStatus()
Get the status of this item.
|
@NotNull org.apache.jackrabbit.oak.api.Tree |
getTree() |
boolean |
holdsLock(boolean deep)
Checks whether this node holds a lock.
|
boolean |
isLocked()
Checks whether this node is locked, either directly or through
a deep lock on an ancestor.
|
boolean |
isLockOwner(java.lang.String user) |
boolean |
isProtected() |
boolean |
isRoot()
Determine whether this is the root node
|
void |
lock(boolean isDeep) |
void |
orderBefore(java.lang.String source,
java.lang.String target) |
boolean |
remove()
Remove this node.
|
void |
removeMixin(java.lang.String typeName) |
void |
setMixins(java.util.Set<java.lang.String> mixinNames) |
void |
setOrderableChildren(boolean enable)
Enables or disabled orderable children on the underlying tree.
|
@NotNull PropertyDelegate |
setProperty(org.apache.jackrabbit.oak.api.PropertyState propertyState,
boolean exactTypeMatch,
boolean setProtected)
Set a property
|
java.lang.String |
toString() |
void |
unlock() |
void |
updateMixins(java.util.Set<java.lang.String> addMixinNames,
java.util.Set<java.lang.String> removedOakMixinNames) |
checkAlive, checkUpdate, save, updatepublic NodeDelegate(SessionDelegate sessionDelegate, org.apache.jackrabbit.oak.api.Tree tree)
@NotNull public @NotNull java.lang.String getName()
ItemDelegategetName in class ItemDelegate@NotNull public @NotNull java.lang.String getPath()
ItemDelegategetPath in class ItemDelegate@Nullable public @Nullable NodeDelegate getParent()
ItemDelegatenull.getParent in class ItemDelegatenull for root or if the parent
is not accessible.public boolean exists()
ItemDelegateexists in class ItemDelegatetrue the underlying tree exists, false otherwise.@Nullable public @Nullable org.apache.jackrabbit.oak.api.Tree.Status getStatus()
ItemDelegategetStatus in class ItemDelegateTree.Status of this item or null if not available.@NotNull
public @NotNull java.lang.String getIdentifier()
throws InvalidItemStateException
InvalidItemStateExceptionpublic boolean isProtected()
throws InvalidItemStateException
isProtected in class ItemDelegateInvalidItemStateExceptionpublic boolean isRoot()
throws InvalidItemStateException
true iff this is the root nodeInvalidItemStateExceptionpublic long getPropertyCount()
throws InvalidItemStateException
InvalidItemStateException@Nullable public @Nullable PropertyDelegate getPropertyOrNull(java.lang.String relPath) throws RepositoryException
relPath - oak pathrelPath or null if
no such property existsRepositoryException@NotNull public @NotNull PropertyDelegate getProperty(java.lang.String relPath) throws RepositoryException
getPropertyOrNull(String) this
method never returns null. In the case where no property exists
at the given path, the returned property delegate throws an
InvalidItemStateException on access. See See OAK-395.relPath - oak pathrelPath.RepositoryException@NotNull public @NotNull java.util.Iterator<PropertyDelegate> getProperties() throws InvalidItemStateException
InvalidItemStateExceptionpublic long getChildCount(long max)
throws InvalidItemStateException
If an implementation does know the exact value, it returns it (even if the value is higher than max). If the implementation does not know the exact value, and the child node count is higher than max, it may return Long.MAX_VALUE. The cost of the operation is at most O(max).
max - the maximum valueInvalidItemStateException@Nullable public @Nullable NodeDelegate getChild(java.lang.String relPath) throws RepositoryException
relPath - oak pathrelPath or null if
no such node existsRepositoryException@NotNull public @NotNull java.util.Iterator<NodeDelegate> getChildren() throws InvalidItemStateException
InvalidItemStateExceptionpublic void orderBefore(java.lang.String source,
java.lang.String target)
throws ItemNotFoundException,
InvalidItemStateException
public boolean canAddMixin(java.lang.String typeName)
throws RepositoryException
RepositoryExceptionpublic void addMixin(java.lang.String typeName)
throws RepositoryException
RepositoryExceptionpublic void removeMixin(java.lang.String typeName)
throws RepositoryException
RepositoryExceptionpublic void setMixins(java.util.Set<java.lang.String> mixinNames)
throws RepositoryException
RepositoryExceptionpublic void updateMixins(java.util.Set<java.lang.String> addMixinNames,
java.util.Set<java.lang.String> removedOakMixinNames)
throws RepositoryException
RepositoryException@NotNull public @NotNull PropertyDelegate setProperty(org.apache.jackrabbit.oak.api.PropertyState propertyState, boolean exactTypeMatch, boolean setProtected) throws RepositoryException
RepositoryException@Nullable public @Nullable NodeDelegate addChild(java.lang.String name, java.lang.String typeName) throws RepositoryException
name - Oak name of the new child nodetypeName - Oak name of the type of the new child node,
or null if a default type should be usednull if such a node already existsRepositoryExceptionpublic boolean remove()
throws InvalidItemStateException
remove in class ItemDelegatetrue if the node was removed; false otherwise.InvalidItemStateExceptionpublic void setOrderableChildren(boolean enable)
throws InvalidItemStateException
enable - whether to enable or disable orderable children.InvalidItemStateExceptionpublic boolean isLocked()
@Nullable public @Nullable NodeDelegate getLock()
public boolean holdsLock(boolean deep)
deep - if true, only check for deep lockspublic java.lang.String getLockOwner()
public boolean isLockOwner(java.lang.String user)
public void lock(boolean isDeep)
throws RepositoryException
RepositoryExceptionpublic void unlock()
throws RepositoryException
RepositoryExceptionpublic java.lang.String toString()
toString in class java.lang.Object@NotNull public @NotNull org.apache.jackrabbit.oak.api.Tree getTree() throws InvalidItemStateException
InvalidItemStateExceptionCopyright © 2012–2022 The Apache Software Foundation. All rights reserved.