T
- the delegate typepublic class NodeImpl<T extends NodeDelegate> extends Object implements Node, JackrabbitNode
Modifier and Type | Field and Description |
---|---|
protected T |
dlg |
static String |
ITEM_SAVE_DOES_SESSION_SAVE |
static int |
MV_PROPERTY_WARN_THRESHOLD |
static boolean |
SAVE_SESSION
The value of this flag determines the behaviour of
save() . |
protected SessionContext |
sessionContext |
protected SessionDelegate |
sessionDelegate |
JCR_CHILD_NODE_DEFINITION, JCR_CONTENT, JCR_FROZEN_NODE, JCR_PROPERTY_DEFINITION, JCR_ROOT_VERSION, JCR_VERSION_LABELS
Constructor and Description |
---|
NodeImpl(T dlg,
SessionContext sessionContext) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAncestor, getDepth, getName, getPath, getSession, isSame, refresh, save
public static final String ITEM_SAVE_DOES_SESSION_SAVE
public static final int MV_PROPERTY_WARN_THRESHOLD
public static final boolean SAVE_SESSION
save()
. If false
,
save will throw a UnsupportedRepositoryOperationException
if the
sub tree rooted at this item does not contain all transient changes. If
true
, save will delegate to Session.save()
.protected final SessionContext sessionContext
protected final T extends ItemDelegate dlg
protected final SessionDelegate sessionDelegate
public NodeImpl(T dlg, SessionContext sessionContext)
@CheckForNull public static NodeImpl<? extends NodeDelegate> createNodeOrNull(@CheckForNull NodeDelegate delegate, @Nonnull SessionContext context) throws RepositoryException
RepositoryException
@Nonnull public static NodeImpl<? extends NodeDelegate> createNode(@Nonnull NodeDelegate delegate, @Nonnull SessionContext context) throws RepositoryException
RepositoryException
public boolean isNode()
isNode
in interface Item
Item.isNode()
@Nonnull public Node getParent() throws RepositoryException
getParent
in interface Item
RepositoryException
Item.getParent()
public boolean isNew()
isNew
in interface Item
Item.isNew()
public boolean isModified()
isModified
in interface Item
Item.isModified()
public void remove() throws RepositoryException
remove
in interface Item
RepositoryException
Item.remove()
public void accept(ItemVisitor visitor) throws RepositoryException
accept
in interface Item
RepositoryException
@Nonnull public Node addNode(String relPath) throws RepositoryException
addNode
in interface Node
RepositoryException
Node.addNode(String)
@Nonnull public Node addNode(String relPath, String primaryNodeTypeName) throws RepositoryException
addNode
in interface Node
RepositoryException
public void orderBefore(String srcChildRelPath, String destChildRelPath) throws RepositoryException
orderBefore
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, Value value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, Value value, int type) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, Value[] values) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String jcrName, Value[] values, int type) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, String[] values) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, String[] values, int type) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, String value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, String value, int type) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, InputStream value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, Binary value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, boolean value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, double value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, BigDecimal value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, long value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, Calendar value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Property setProperty(String name, Node value) throws RepositoryException
setProperty
in interface Node
RepositoryException
@Nonnull public Node getNode(String relPath) throws RepositoryException
getNode
in interface Node
RepositoryException
@Nonnull public NodeIterator getNodes() throws RepositoryException
getNodes
in interface Node
RepositoryException
@Nonnull public NodeIterator getNodes(String namePattern) throws RepositoryException
getNodes
in interface Node
RepositoryException
@Nonnull public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException
getNodes
in interface Node
RepositoryException
@Nonnull public Property getProperty(String relPath) throws RepositoryException
getProperty
in interface Node
RepositoryException
@Nonnull public PropertyIterator getProperties() throws RepositoryException
getProperties
in interface Node
RepositoryException
@Nonnull public PropertyIterator getProperties(String namePattern) throws RepositoryException
getProperties
in interface Node
RepositoryException
@Nonnull public PropertyIterator getProperties(String[] nameGlobs) throws RepositoryException
getProperties
in interface Node
RepositoryException
@Nonnull public Item getPrimaryItem() throws RepositoryException
getPrimaryItem
in interface Node
RepositoryException
Node.getPrimaryItem()
@Nonnull public String getUUID() throws RepositoryException
getUUID
in interface Node
RepositoryException
Node.getUUID()
@Nonnull public String getIdentifier() throws RepositoryException
getIdentifier
in interface Node
RepositoryException
public int getIndex() throws RepositoryException
getIndex
in interface Node
RepositoryException
@Nonnull public PropertyIterator getReferences() throws RepositoryException
getReferences
in interface Node
RepositoryException
Node.getReferences()
@Nonnull public PropertyIterator getReferences(String name) throws RepositoryException
getReferences
in interface Node
RepositoryException
@Nonnull public PropertyIterator getWeakReferences() throws RepositoryException
getWeakReferences
in interface Node
RepositoryException
Node.getWeakReferences()
@Nonnull public PropertyIterator getWeakReferences(String name) throws RepositoryException
getWeakReferences
in interface Node
RepositoryException
public boolean hasNode(String relPath) throws RepositoryException
hasNode
in interface Node
RepositoryException
public boolean hasProperty(String relPath) throws RepositoryException
hasProperty
in interface Node
RepositoryException
public boolean hasNodes() throws RepositoryException
hasNodes
in interface Node
RepositoryException
public boolean hasProperties() throws RepositoryException
hasProperties
in interface Node
RepositoryException
@Nonnull public NodeType getPrimaryNodeType() throws RepositoryException
getPrimaryNodeType
in interface Node
RepositoryException
Node.getPrimaryNodeType()
@Nonnull public NodeType[] getMixinNodeTypes() throws RepositoryException
getMixinNodeTypes
in interface Node
RepositoryException
Node.getMixinNodeTypes()
public boolean isNodeType(String nodeTypeName) throws RepositoryException
isNodeType
in interface Node
RepositoryException
public void setPrimaryType(String nodeTypeName) throws RepositoryException
setPrimaryType
in interface Node
RepositoryException
public void addMixin(String mixinName) throws RepositoryException
addMixin
in interface Node
RepositoryException
public void removeMixin(String mixinName) throws RepositoryException
removeMixin
in interface Node
RepositoryException
public boolean canAddMixin(String mixinName) throws RepositoryException
canAddMixin
in interface Node
RepositoryException
@Nonnull public NodeDefinition getDefinition() throws RepositoryException
getDefinition
in interface Node
RepositoryException
@Nonnull public String getCorrespondingNodePath(String workspaceName) throws RepositoryException
getCorrespondingNodePath
in interface Node
RepositoryException
public void update(String srcWorkspace) throws RepositoryException
update
in interface Node
RepositoryException
@Nonnull public Version checkin() throws RepositoryException
checkin
in interface Node
RepositoryException
Node.checkin()
public void checkout() throws RepositoryException
checkout
in interface Node
RepositoryException
Node.checkout()
public void doneMerge(Version version) throws RepositoryException
doneMerge
in interface Node
RepositoryException
Node.doneMerge(javax.jcr.version.Version)
public void cancelMerge(Version version) throws RepositoryException
cancelMerge
in interface Node
RepositoryException
Node.cancelMerge(javax.jcr.version.Version)
@Nonnull public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws RepositoryException
merge
in interface Node
RepositoryException
Node.merge(String, boolean)
public boolean isCheckedOut() throws RepositoryException
isCheckedOut
in interface Node
RepositoryException
Node.isCheckedOut()
public void restore(String versionName, boolean removeExisting) throws RepositoryException
restore
in interface Node
RepositoryException
Node.restore(String, boolean)
public void restore(Version version, boolean removeExisting) throws RepositoryException
restore
in interface Node
RepositoryException
Node.restore(javax.jcr.version.Version, boolean)
public void restore(Version version, String relPath, boolean removeExisting) throws RepositoryException
restore
in interface Node
RepositoryException
Node.restore(Version, String, boolean)
public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException
restoreByLabel
in interface Node
RepositoryException
Node.restoreByLabel(String, boolean)
@Nonnull public VersionHistory getVersionHistory() throws RepositoryException
getVersionHistory
in interface Node
RepositoryException
Node.getVersionHistory()
@Nonnull public Version getBaseVersion() throws RepositoryException
getBaseVersion
in interface Node
RepositoryException
Node.getBaseVersion()
public boolean isLocked() throws RepositoryException
isLocked
in interface Node
RepositoryException
public boolean holdsLock() throws RepositoryException
holdsLock
in interface Node
RepositoryException
@Nonnull public Lock getLock() throws RepositoryException
getLock
in interface Node
RepositoryException
@Nonnull public Lock lock(boolean isDeep, boolean isSessionScoped) throws RepositoryException
lock
in interface Node
RepositoryException
public void unlock() throws RepositoryException
unlock
in interface Node
RepositoryException
@Nonnull public NodeIterator getSharedSet()
getSharedSet
in interface Node
public void removeSharedSet() throws RepositoryException
removeSharedSet
in interface Node
RepositoryException
public void removeShare() throws RepositoryException
removeShare
in interface Node
RepositoryException
public void followLifecycleTransition(String transition) throws RepositoryException
followLifecycleTransition
in interface Node
RepositoryException
Node.followLifecycleTransition(String)
@Nonnull public String[] getAllowedLifecycleTransistions() throws RepositoryException
getAllowedLifecycleTransistions
in interface Node
RepositoryException
Node.getAllowedLifecycleTransistions()
public void rename(String newName) throws RepositoryException
JackrabbitNode.rename(String)
. In
contrast to the implementation in Jackrabbit 2.x which was operating on
the NodeState level directly, this implementation does a move plus
subsequent reorder on the JCR API due to a missing support for renaming
on the OAK API.
Note, that this also has an impact on how permissions are enforced: In
Jackrabbit 2.x the rename just required permission to modify the child
collection on the parent, whereas a move did the full permission check.
With this simplified implementation that (somewhat inconsistent) difference
has been removed.rename
in interface JackrabbitNode
newName
- The new name of this node.RepositoryException
- If an error occurs.public void setMixins(String[] mixinNames) throws RepositoryException
JackrabbitNode.setMixins(String[])
method that adds all mixin types that are not yet present on this node
and removes all mixins that are no longer contained in the specified
array. Note, that this implementation will not work exactly like the
variant in Jackrabbit 2.x which first created the effective node type
and adjusted the set of child items accordingly.setMixins
in interface JackrabbitNode
mixinNames
- RepositoryException
@Nonnull protected final <U> U perform(@Nonnull SessionOperation<U> op) throws RepositoryException
SessionOperation
.U
- return type of the operationop
- operation to performop.perform()
RepositoryException
- as thrown by op.perform()
.@Nonnull public String getName() throws RepositoryException
getName
in interface Item
RepositoryException
Item.getName()
@Nonnull public String getPath() throws RepositoryException
getPath
in interface Item
RepositoryException
Item.getPath()
@Nonnull public Session getSession()
getSession
in interface Item
public Item getAncestor(int depth) throws RepositoryException
getAncestor
in interface Item
RepositoryException
public int getDepth() throws RepositoryException
getDepth
in interface Item
RepositoryException
public boolean isSame(Item otherItem) throws RepositoryException
isSame
in interface Item
RepositoryException
Item.isSame(javax.jcr.Item)
public void save() throws RepositoryException
Session.save()
if SAVE_SESSION
is
true
. Otherwise it only performs the save if the subtree rooted at this item contains
all transient changes. That is, if calling Session.save()
would have the same effect
as calling this method. In all other cases this method will throw an
UnsupportedRepositoryOperationException
save
in interface Item
RepositoryException
Item.save()
public void refresh(boolean keepChanges) throws RepositoryException
refresh
in interface Item
RepositoryException
Item.refresh(boolean)
@Nonnull protected org.apache.jackrabbit.oak.api.PropertyState createSingleState(String oakName, Value value, org.apache.jackrabbit.oak.api.Type<?> type) throws RepositoryException
RepositoryException
@Nonnull protected org.apache.jackrabbit.oak.api.PropertyState createMultiState(String oakName, List<Value> values, org.apache.jackrabbit.oak.api.Type<?> type) throws RepositoryException
RepositoryException
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.