Class NodeImpl
- java.lang.Object
-
- org.apache.jackrabbit.core.ItemImpl
-
- org.apache.jackrabbit.core.NodeImpl
-
- All Implemented Interfaces:
Item,Node,JackrabbitNode
- Direct Known Subclasses:
VersionHistoryImpl,VersionImpl
public class NodeImpl extends ItemImpl implements Node, JackrabbitNode
NodeImplimplements theNodeinterface.
-
-
Field Summary
Fields Modifier and Type Field Description protected static shortCREATED-
Fields inherited from class org.apache.jackrabbit.core.ItemImpl
id, itemMgr, sessionContext, stateMgr, STATUS_DESTROYED, STATUS_INVALIDATED, STATUS_MODIFIED, STATUS_NORMAL
-
Fields inherited from interface javax.jcr.Node
JCR_CHILD_NODE_DEFINITION, JCR_CONTENT, JCR_FROZEN_NODE, JCR_PROPERTY_DEFINITION, JCR_ROOT_VERSION, JCR_VERSION_LABELS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNodeImpl(ItemManager itemMgr, SessionContext sessionContext, AbstractNodeData data)Protected constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(ItemVisitor visitor)voidaddMixin(String mixinName)Wrapper aroundaddMixin(Name).voidaddMixin(Name mixinName)NodeaddNode(String relPath)NodeaddNode(String relPath, String nodeTypeName)NodeImpladdNode(Name nodeName, Name nodeTypeName, NodeId id)Same asexcept that this method takesNode.addNode(String, String)Namearguments instead ofStrings and has an additionaluuidargument.NodeaddNodeWithUuid(String relPath, String uuid)Adds a node with the given UUID.NodeaddNodeWithUuid(String relPath, String nodeTypeName, String uuid)Adds a node with the given node type and UUID.voidassignLifecyclePolicy(Node policy, String state)Assigns the given lifecycle policy to this node and sets the current state to the one given.booleancanAddMixin(String mixinName)voidcancelMerge(Version version)Deprecated.Versioncheckin()Deprecated.Versioncheckin(Calendar created)Deprecated.protected voidcheckLock()Deprecated.voidcheckout()Deprecated.protected voidcheckSetProperty()Checks various pre-conditions that are common to allsetProperty()methods.NodeImplclone(NodeImpl src, Name name)Create a child node that is a clone of a shareable node.protected NodeImplcreateChildNode(Name name, NodeTypeImpl nodeType, NodeId id)protected PropertyImplcreateChildProperty(Name name, int type, PropertyDefinitionImpl def)Creates a new property with the given name andtypehint and property definition.voiddoneMerge(Version version)Deprecated.voidfollowLifecycleTransition(String transition)Transitions this node through its lifecycle to the given target state.String[]getAllowedLifecycleTransistions()Returns all allowed transitions from the current lifecycle state of this node.protected NodeDefinitionImplgetApplicableChildNodeDefinition(Name nodeName, Name nodeTypeName)Returns the applicable child node definition for a child node with the specified name and node type.protected PropertyDefinitionImplgetApplicablePropertyDefinition(Name propertyName, int type, boolean multiValued, boolean exactTypeMatch)Returns the applicable property definition for a property with the specified name and type.VersiongetBaseVersion()Deprecated.StringgetCorrespondingNodePath(String workspaceName)NodeDefinitiongetDefinition()EffectiveNodeTypegetEffectiveNodeType()Returns the effective (i.e.StringgetIdentifier()intgetIndex()LockgetLock()NodeType[]getMixinNodeTypes()Set<Name>getMixinTypeNames()Returns theNames of this node's mixin types.StringgetName()NodegetNode(String relPath)NodeImplgetNode(Name name)Returns the child node ofthisnode with the specifiedname.NodeImplgetNode(Name name, int index)Returns the child node ofthisnode with the specifiedname.NodeIdgetNodeId()Returns the identifier of thisNode.NodeIteratorgetNodes()NodeIteratorgetNodes(String namePattern)NodeIteratorgetNodes(String[] nameGlobs)protected PropertyImplgetOrCreateProperty(String name, int type, boolean multiValued, boolean exactTypeMatch, BitSet status)protected PropertyImplgetOrCreateProperty(Name name, int type, boolean multiValued, boolean exactTypeMatch, BitSet status)protected ItemStategetOrCreateTransientItemState()NodegetParent()NodeIdgetParentId()Helper method, returning the parent id this node is attached to.ItemgetPrimaryItem()NodeTypegetPrimaryNodeType()NamegetPrimaryNodeTypeName()Returns the name of the primary node type as exposed on the node state without retrieving the node type.PathgetPrimaryPath()Returns the primary path to thisItem.PropertyIteratorgetProperties()PropertyIteratorgetProperties(String namePattern)PropertyIteratorgetProperties(String[] nameGlobs)PropertygetProperty(String relPath)PropertyImplgetProperty(Name name)Returns the property ofthisnode with the specifiedname.NamegetQName()PropertyIteratorgetReferences()PropertyIteratorgetReferences(String name)NodeIteratorgetSharedSet()Returns an iterator over all nodes that are in the shared set of this node.StringgetUUID()VersionHistorygetVersionHistory()Deprecated.PropertyIteratorgetWeakReferences()PropertyIteratorgetWeakReferences(String name)booleanhasNode(String relPath)booleanhasNode(Name name)Indicates whether a child node with the specifiednameexists.booleanhasNode(Name name, int index)Indicates whether a child node with the specifiednameexists.booleanhasNodes()protected booleanhasPendingChanges()Determines if there are pending unsaved changes either on this node or on any node or property in the subtree below it.booleanhasProperties()booleanhasProperty(String relPath)booleanhasProperty(Name name)Indicates whether a property with the specifiednameexists.booleanholdsLock()protected PropertyinternalSetProperty(Name name, InternalValue value)Sets the internal value of a property without checking any constraints.protected PropertyinternalSetProperty(Name name, InternalValue[] values)Sets the internal value of a property without checking any constraints.protected PropertyinternalSetProperty(Name name, InternalValue[] values, int type)Sets the internal value of a property without checking any constraints.booleanisAccessControllable()Test if this node is access controlled.booleanisCheckedOut()booleanisLocked()booleanisNode()booleanisNodeType(String nodeTypeName)booleanisNodeType(Name ntName)Locklock(boolean isDeep, boolean isSessionScoped)protected voidmakePersistent()NodeIteratormerge(String srcWorkspace, boolean bestEffort)Deprecated.protected voidonRedefine(QNodeDefinition def)protected voidonRemove(NodeId parentId)voidorderBefore(String srcName, String destName)voidorderBefore(Path.Element srcName, Path.Element dstName)Same asexcept that this method takes aNode.orderBefore(String, String)Path.Elementarguments instead ofStrings.protected voidremoveChildNode(NodeId childId)protected voidremoveChildProperty(Name propName)voidremoveMixin(String mixinName)Wrapper aroundremoveMixin(Name).voidremoveMixin(Name mixinName)voidremoveShare()A special kind ofremove()that removes this node, but does not remove any other node in the shared set of this node.voidremoveSharedSet()A special kind ofremove()that removes this node and every other node in the shared set of this node.voidrename(String newName)protected voidrenameChildNode(NodeId id, Name newName, boolean replace)protected voidrenameChildNode(Name oldName, int index, NodeId id, Name newName)Deprecated.use #renameChildNode(NodeId, Name, boolean)NodeImplreplaceChildNode(NodeId id, Name nodeName, Name nodeTypeName, Name[] mixinNames)Replaces the child node with the specifiedidby a new child node with the same id and specifiednodeName,nodeTypeNameandmixinNames.protected NodeIdresolveRelativeNodePath(String relPath)Returns the id of the node atrelPathornullif no node exists atrelPath.protected PropertyIdresolveRelativePropertyPath(String relPath)Returns the id of the property atrelPathornullif no property exists atrelPath.voidrestore(String versionName, boolean removeExisting)Deprecated.voidrestore(Version version, boolean removeExisting)Deprecated.voidrestore(Version version, String relPath, boolean removeExisting)Deprecated.voidrestoreByLabel(String versionLabel, boolean removeExisting)Deprecated.protected voidrestoreTransient(NodeState transientState)voidsetMixins(String[] mixinNames)voidsetPrimaryType(String nodeTypeName)PropertysetProperty(String name, boolean value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, double value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, long value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, InputStream value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, String value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, String[] strings)Wrapper aroundsetProperty(Name, Value[], int, boolean)PropertysetProperty(String name, String[] values, int type)Wrapper aroundsetProperty(Name, Value[], int, boolean)PropertysetProperty(String name, String value, int type)Wrapper aroundsetProperty(String, Value, int)PropertysetProperty(String name, BigDecimal value)PropertysetProperty(String name, Calendar value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, Binary value)PropertysetProperty(String name, Node value)Wrapper aroundsetProperty(String, Value)PropertysetProperty(String name, Value value)Wrapper aroundNodeImpl.SetPropertyOperationPropertysetProperty(String name, Value[] values)Wrapper aroundsetProperty(Name, Value[], int, boolean)PropertysetProperty(String name, Value[] values, int type)Wrapper aroundsetProperty(Name, Value[], int, boolean)PropertysetProperty(String name, Value value, int type)Wrapper aroundNodeImpl.SetPropertyOperationPropertyImplsetProperty(Name name, Value value)Same asexcept that this method takes aNode.setProperty(String, Value)Namename argument instead of aString.PropertyImplsetProperty(Name name, Value[] values, int type)Same asexcept that this method takes aNode.setProperty(String, Value[], int)Namename argument instead of aString.protected PropertyImplsetProperty(Name name, Value[] values, int type, boolean enforceType)Implementation forsetProperty()using aValuearray.StringtoString()Return a string representation of this node for diagnostic purposes.voidunlock()voidupdate(String srcWorkspaceName)-
Methods inherited from class org.apache.jackrabbit.core.ItemImpl
getAncestor, getDepth, getId, getPath, getQName, getSession, getType, getValueFactory, getValues, isModified, isNew, isSame, isTransactionalNew, isTransient, itemSanityCheck, perform, refresh, remove, safeGetJCRPath, sanityCheck, save, setRemoved
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.jcr.Item
getAncestor, getDepth, getPath, getSession, isModified, isNew, isSame, refresh, remove, save
-
Methods inherited from interface org.apache.jackrabbit.api.JackrabbitNode
getNodeOrNull, getPropertyOrNull
-
-
-
-
Field Detail
-
CREATED
protected static final short CREATED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NodeImpl
protected NodeImpl(ItemManager itemMgr, SessionContext sessionContext, AbstractNodeData data)
Protected constructor.- Parameters:
itemMgr- theItemManagerthat created thisNodeinstancesessionContext- the component context of the associated sessiondata- the node data
-
-
Method Detail
-
resolveRelativePropertyPath
protected PropertyId resolveRelativePropertyPath(String relPath) throws RepositoryException
Returns the id of the property atrelPathornullif no property exists atrelPath.Note that access rights are not checked.
- Parameters:
relPath- relative path of a (possible) property- Returns:
- the id of the property at
relPathornullif no property exists atrelPath - Throws:
RepositoryException- ifrelPathis not a valid relative path
-
resolveRelativeNodePath
protected NodeId resolveRelativeNodePath(String relPath) throws RepositoryException
Returns the id of the node atrelPathornullif no node exists atrelPath.Note that access rights are not checked.
- Parameters:
relPath- relative path of a (possible) node- Returns:
- the id of the node at
relPathornullif no node exists atrelPath - Throws:
RepositoryException- ifrelPathis not a valid relative path
-
hasPendingChanges
protected boolean hasPendingChanges() throws RepositoryExceptionDetermines if there are pending unsaved changes either on this node or on any node or property in the subtree below it.- Returns:
trueif there are pending unsaved changes,falseotherwise.- Throws:
RepositoryException- if an error occurred
-
getOrCreateTransientItemState
protected ItemState getOrCreateTransientItemState() throws RepositoryException
- Specified by:
getOrCreateTransientItemStatein classItemImpl- Throws:
RepositoryException
-
getOrCreateProperty
protected PropertyImpl getOrCreateProperty(String name, int type, boolean multiValued, boolean exactTypeMatch, BitSet status) throws ConstraintViolationException, RepositoryException
- Parameters:
name-type-multiValued-exactTypeMatch-status-- Returns:
- Throws:
ConstraintViolationException- if no applicable property definition could be foundRepositoryException- if another error occurs
-
getOrCreateProperty
protected PropertyImpl getOrCreateProperty(Name name, int type, boolean multiValued, boolean exactTypeMatch, BitSet status) throws ConstraintViolationException, RepositoryException
- Parameters:
name-type-multiValued-exactTypeMatch-status-- Returns:
- Throws:
ConstraintViolationException- if no applicable property definition could be foundRepositoryException- if another error occurs
-
createChildProperty
protected PropertyImpl createChildProperty(Name name, int type, PropertyDefinitionImpl def) throws RepositoryException
Creates a new property with the given name andtypehint and property definition. If the given property definition is not of typeUNDEFINED, then it takes precedence over thetypehint.- Parameters:
name- the name of the property to create.type- the type hint.def- the associated property definition.- Returns:
- the property instance.
- Throws:
RepositoryException- if the property cannot be created.
-
createChildNode
protected NodeImpl createChildNode(Name name, NodeTypeImpl nodeType, NodeId id) throws RepositoryException
- Throws:
RepositoryException
-
renameChildNode
@Deprecated protected void renameChildNode(Name oldName, int index, NodeId id, Name newName) throws RepositoryException
Deprecated.use #renameChildNode(NodeId, Name, boolean)- Parameters:
oldName-index-id-newName-- Throws:
RepositoryException
-
renameChildNode
protected void renameChildNode(NodeId id, Name newName, boolean replace) throws RepositoryException
- Parameters:
id-newName-replace-- Throws:
RepositoryException
-
removeChildProperty
protected void removeChildProperty(Name propName) throws RepositoryException
- Throws:
RepositoryException
-
removeChildNode
protected void removeChildNode(NodeId childId) throws RepositoryException
- Throws:
RepositoryException
-
onRedefine
protected void onRedefine(QNodeDefinition def) throws RepositoryException
- Throws:
RepositoryException
-
onRemove
protected void onRemove(NodeId parentId) throws RepositoryException
- Throws:
RepositoryException
-
getMixinTypeNames
public Set<Name> getMixinTypeNames()
Returns theNames of this node's mixin types.- Returns:
- a set of the
Names of this node's mixin types.
-
getEffectiveNodeType
public EffectiveNodeType getEffectiveNodeType() throws RepositoryException
Returns the effective (i.e. merged and resolved) node type representation of this node's primary and mixin node types.- Returns:
- the effective node type
- Throws:
RepositoryException- if an error occurs
-
getApplicableChildNodeDefinition
protected NodeDefinitionImpl getApplicableChildNodeDefinition(Name nodeName, Name nodeTypeName) throws ConstraintViolationException, RepositoryException
Returns the applicable child node definition for a child node with the specified name and node type.- Parameters:
nodeName-nodeTypeName-- Returns:
- Throws:
ConstraintViolationException- if no applicable child node definition could be foundRepositoryException- if another error occurs
-
getApplicablePropertyDefinition
protected PropertyDefinitionImpl getApplicablePropertyDefinition(Name propertyName, int type, boolean multiValued, boolean exactTypeMatch) throws ConstraintViolationException, RepositoryException
Returns the applicable property definition for a property with the specified name and type.- Parameters:
propertyName-type-multiValued-exactTypeMatch-- Returns:
- Throws:
ConstraintViolationException- if no applicable property definition could be foundRepositoryException- if another error occurs
-
makePersistent
protected void makePersistent() throws RepositoryException- Specified by:
makePersistentin classItemImpl- Throws:
RepositoryException
-
restoreTransient
protected void restoreTransient(NodeState transientState) throws RepositoryException
- Throws:
RepositoryException
-
addMixin
public void addMixin(Name mixinName) throws RepositoryException
- Throws:
RepositoryException- See Also:
Node.addMixin(String)
-
removeMixin
public void removeMixin(Name mixinName) throws RepositoryException
- Throws:
RepositoryException- See Also:
Node.removeMixin(String)
-
isNodeType
public boolean isNodeType(Name ntName) throws RepositoryException
- Parameters:
ntName- name of node type- Returns:
trueif this node is of the specified node type; otherwisefalse- Throws:
RepositoryException
-
checkSetProperty
protected void checkSetProperty() throws VersionException, LockException, RepositoryExceptionChecks various pre-conditions that are common to allsetProperty()methods. The checks performed are:- this node must be checked-out
- this node must not be locked by somebody else
Property.setValue()methods.- Throws:
VersionException- if this node is not checked-outLockException- if this node is locked by somebody elseRepositoryException- if another error occurs- See Also:
Node.setProperty(java.lang.String, javax.jcr.Value)
-
internalSetProperty
protected Property internalSetProperty(Name name, InternalValue value) throws ValueFormatException, RepositoryException
Sets the internal value of a property without checking any constraints.Note that no type conversion is being performed, i.e. it's the caller's responsibility to make sure that the type of the given value is compatible with the specified property's definition.
- Parameters:
name-value-- Returns:
- Throws:
ValueFormatExceptionRepositoryException
-
internalSetProperty
protected Property internalSetProperty(Name name, InternalValue[] values) throws ValueFormatException, RepositoryException
Sets the internal value of a property without checking any constraints.Note that no type conversion is being performed, i.e. it's the caller's responsibility to make sure that the type of the given values is compatible with the specified property's definition.
- Parameters:
name-values-- Returns:
- Throws:
ValueFormatExceptionRepositoryException
-
internalSetProperty
protected Property internalSetProperty(Name name, InternalValue[] values, int type) throws ValueFormatException, RepositoryException
Sets the internal value of a property without checking any constraints.Note that no type conversion is being performed, i.e. it's the caller's responsibility to make sure that the type of the given values is compatible with the specified property's definition.
- Parameters:
name-values-type-- Returns:
- Throws:
ValueFormatExceptionRepositoryException
-
getNode
public NodeImpl getNode(Name name) throws ItemNotFoundException, RepositoryException
Returns the child node ofthisnode with the specifiedname.- Parameters:
name- The name of the child node to retrieve.- Returns:
- The child node with the specified
name. - Throws:
ItemNotFoundException- If no child node exists with the specified name.RepositoryException- If another error occurs.
-
getNode
public NodeImpl getNode(Name name, int index) throws ItemNotFoundException, RepositoryException
Returns the child node ofthisnode with the specifiedname.- Parameters:
name- The name of the child node to retrieve.index- The index of the child node to retrieve (in the case of same-name siblings).- Returns:
- The child node with the specified
name. - Throws:
ItemNotFoundException- If no child node exists with the specified name.RepositoryException- If another error occurs.
-
hasNode
public boolean hasNode(Name name) throws RepositoryException
Indicates whether a child node with the specifiednameexists. Returnstrueif the child node exists andfalseotherwise.- Parameters:
name- The name of the child node.- Returns:
trueif the child node exists;falseotherwise.- Throws:
RepositoryException- If an unspecified error occurs.
-
hasNode
public boolean hasNode(Name name, int index) throws RepositoryException
Indicates whether a child node with the specifiednameexists. Returnstrueif the child node exists andfalseotherwise.- Parameters:
name- The name of the child node.index- The index of the child node (in the case of same-name siblings).- Returns:
trueif the child node exists;falseotherwise.- Throws:
RepositoryException- If an unspecified error occurs.
-
getProperty
public PropertyImpl getProperty(Name name) throws ItemNotFoundException, RepositoryException
Returns the property ofthisnode with the specifiedname.- Parameters:
name- The name of the property to retrieve.- Returns:
- The property with the specified
name. - Throws:
ItemNotFoundException- If no property exists with the specified name.RepositoryException- If another error occurs.
-
hasProperty
public boolean hasProperty(Name name) throws RepositoryException
Indicates whether a property with the specifiednameexists. Returnstrueif the property exists andfalseotherwise.- Parameters:
name- The name of the property.- Returns:
trueif the property exists;falseotherwise.- Throws:
RepositoryException- If an unspecified error occurs.
-
addNode
public NodeImpl addNode(Name nodeName, Name nodeTypeName, NodeId id) throws RepositoryException
Same asexcept that this method takesNode.addNode(String, String)Namearguments instead ofStrings and has an additionaluuidargument.Important Notice: This method is for internal use only! Passing already assigned uuid's might lead to unexpected results and data corruption in the worst case.
- Parameters:
nodeName- name of the new nodenodeTypeName- name of the new node's node type ornullif it should be determined automaticallyid- id of the new node ornullif a new id should be assigned- Returns:
- the newly added node
- Throws:
RepositoryException- if the node can not added
-
setProperty
public PropertyImpl setProperty(Name name, Value[] values, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException
Same asexcept that this method takes aNode.setProperty(String, Value[], int)Namename argument instead of aString.- Parameters:
name-values-type-- Returns:
- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionRepositoryException
-
setProperty
public PropertyImpl setProperty(Name name, Value value) throws RepositoryException
Same asexcept that this method takes aNode.setProperty(String, Value)Namename argument instead of aString.- Throws:
RepositoryException
-
getQName
public Name getQName() throws RepositoryException
Description copied from class:ItemImpl- Specified by:
getQNamein classItemImpl- Returns:
- the name of this item as
Name - Throws:
RepositoryException- if an error occurs.- See Also:
ItemImpl.getQName()
-
getNodeId
public NodeId getNodeId()
Returns the identifier of thisNode.- Returns:
- the id of this
Node
-
getPrimaryNodeTypeName
public Name getPrimaryNodeTypeName()
Returns the name of the primary node type as exposed on the node state without retrieving the node type.- Returns:
- the name of the primary node type.
-
isAccessControllable
public boolean isAccessControllable() throws RepositoryExceptionTest if this node is access controlled. The node is access controlled if it is of node type"rep:AccessControllable"and if it has a child node namedAccessControlConstants.N_POLICY.- Returns:
trueif this node is access controlled and has a rep:policy child;falseotherwise.- Throws:
RepositoryException- if an error occurs
-
orderBefore
public void orderBefore(Path.Element srcName, Path.Element dstName) throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException, ItemNotFoundException, LockException, RepositoryException
Same asexcept that this method takes aNode.orderBefore(String, String)Path.Elementarguments instead ofStrings.- Parameters:
srcName-dstName-- Throws:
UnsupportedRepositoryOperationExceptionVersionExceptionConstraintViolationExceptionItemNotFoundExceptionLockExceptionRepositoryException
-
replaceChildNode
public NodeImpl replaceChildNode(NodeId id, Name nodeName, Name nodeTypeName, Name[] mixinNames) throws ItemNotFoundException, NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException
Replaces the child node with the specifiedidby a new child node with the same id and specifiednodeName,nodeTypeNameandmixinNames.- Parameters:
id- id of the child node to be replacednodeName- name of the new nodenodeTypeName- name of the new node's node typemixinNames- name of the new node's mixin types- Returns:
- the new child node replacing the existing child
- Throws:
ItemNotFoundExceptionNoSuchNodeTypeExceptionVersionExceptionConstraintViolationExceptionLockExceptionRepositoryException
-
clone
public NodeImpl clone(NodeImpl src, Name name) throws ItemExistsException, VersionException, ConstraintViolationException, LockException, RepositoryException
Create a child node that is a clone of a shareable node.- Parameters:
src- shareable source nodename- name of new node- Returns:
- child node
- Throws:
ItemExistsException- if there already is a child node with the name given and the definition does not allow creating another oneVersionException- if this node is not checked outConstraintViolationException- if no definition is found in this node that would allow creating the child nodeLockException- if this node is lockedRepositoryException- if some other error occurs
-
isNode
public boolean isNode()
-
getName
public String getName() throws RepositoryException
- Specified by:
getNamein interfaceItem- Specified by:
getNamein classItemImpl- Throws:
RepositoryException
-
accept
public void accept(ItemVisitor visitor) throws RepositoryException
- Specified by:
acceptin interfaceItem- Specified by:
acceptin classItemImpl- Throws:
RepositoryException
-
getParent
public Node getParent() throws RepositoryException
- Specified by:
getParentin interfaceItem- Specified by:
getParentin classItemImpl- Throws:
RepositoryException
-
addNode
public Node addNode(String relPath) throws RepositoryException
- Specified by:
addNodein interfaceNode- Throws:
RepositoryException
-
addNode
public Node addNode(String relPath, String nodeTypeName) throws RepositoryException
- Specified by:
addNodein interfaceNode- Throws:
RepositoryException
-
addNodeWithUuid
public Node addNodeWithUuid(String relPath, String uuid) throws RepositoryException
Adds a node with the given UUID. You can only add a node with a UUID that is not already assigned to another node in this workspace.- Parameters:
relPath- path of the new nodeuuid- UUID of the new node, ornullfor a random new UUID- Returns:
- the newly added node
- Throws:
RepositoryException- if the node can not be added- Since:
- Apache Jackrabbit 1.6
- See Also:
- JCR-1972,
Node.addNode(String)
-
addNodeWithUuid
public Node addNodeWithUuid(String relPath, String nodeTypeName, String uuid) throws RepositoryException
Adds a node with the given node type and UUID. You can only add a node with a UUID that is not already assigned to another node in this workspace.- Parameters:
relPath- path of the new nodenodeTypeName- name of the new node's node type, ornullfor automatic type assignmentuuid- UUID of the new node, ornullfor a random new UUID- Returns:
- the newly added node
- Throws:
RepositoryException- if the node can not be added- Since:
- Apache Jackrabbit 1.6
- See Also:
- JCR-1972,
Node.addNode(String, String)
-
orderBefore
public void orderBefore(String srcName, String destName) throws UnsupportedRepositoryOperationException, VersionException, ConstraintViolationException, ItemNotFoundException, LockException, RepositoryException
- Specified by:
orderBeforein interfaceNode- Throws:
UnsupportedRepositoryOperationExceptionVersionExceptionConstraintViolationExceptionItemNotFoundExceptionLockExceptionRepositoryException
-
setProperty
public Property setProperty(String name, Value[] values) throws RepositoryException
Wrapper aroundsetProperty(Name, Value[], int, boolean)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, Value[] values, int type) throws RepositoryException
Wrapper aroundsetProperty(Name, Value[], int, boolean)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, String[] strings) throws RepositoryException
Wrapper aroundsetProperty(Name, Value[], int, boolean)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, String[] values, int type) throws RepositoryException
Wrapper aroundsetProperty(Name, Value[], int, boolean)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, String value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, String value, int type) throws RepositoryException
Wrapper aroundsetProperty(String, Value, int)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, Value value, int type) throws RepositoryException
Wrapper aroundNodeImpl.SetPropertyOperation- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, Value value) throws RepositoryException
Wrapper aroundNodeImpl.SetPropertyOperation- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, InputStream value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, boolean value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, double value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, long value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, Calendar value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
public Property setProperty(String name, Node value) throws RepositoryException
Wrapper aroundsetProperty(String, Value)- Specified by:
setPropertyin interfaceNode- Throws:
RepositoryException
-
setProperty
protected PropertyImpl setProperty(Name name, Value[] values, int type, boolean enforceType) throws RepositoryException
Implementation forsetProperty()using aValuearray. The type of the returned property is enforced based on theenforceTypeflag. If set totrue, the returned property is of the passed type if it didn't exist before. If set tofalse, then the returned property may be of some other type, but still must be based on an existing property definition for the given name and multi-valued flag. The resulting type is taken from that definition and the implementation tries to convert the passed values to that type. If that fails, then aValueFormatExceptionis thrown.- Parameters:
name- the name of the property to set.values- the values to set. Ifnullthe property is removed.type- the target type of the values to set.enforceType- if the target type is enforced.- Returns:
- the
Propertyobject set, ornullif this method was used to remove a property (by setting its value tonull). - 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.
-
getNode
public Node getNode(String relPath) throws RepositoryException
- Specified by:
getNodein interfaceNode- Throws:
RepositoryException
-
getNodes
public NodeIterator getNodes() throws RepositoryException
- Specified by:
getNodesin interfaceNode- Throws:
RepositoryException
-
getProperties
public PropertyIterator getProperties() throws RepositoryException
- Specified by:
getPropertiesin interfaceNode- Throws:
RepositoryException
-
getProperty
public Property getProperty(String relPath) throws PathNotFoundException, RepositoryException
- Specified by:
getPropertyin interfaceNode- Throws:
PathNotFoundExceptionRepositoryException
-
hasNode
public boolean hasNode(String relPath) throws RepositoryException
- Specified by:
hasNodein interfaceNode- Throws:
RepositoryException
-
hasNodes
public boolean hasNodes() throws RepositoryException- Specified by:
hasNodesin interfaceNode- Throws:
RepositoryException
-
hasProperties
public boolean hasProperties() throws RepositoryException- Specified by:
hasPropertiesin interfaceNode- Throws:
RepositoryException
-
isNodeType
public boolean isNodeType(String nodeTypeName) throws RepositoryException
- Specified by:
isNodeTypein interfaceNode- Throws:
RepositoryException
-
getPrimaryNodeType
public NodeType getPrimaryNodeType() throws RepositoryException
- Specified by:
getPrimaryNodeTypein interfaceNode- Throws:
RepositoryException
-
getMixinNodeTypes
public NodeType[] getMixinNodeTypes() throws RepositoryException
- Specified by:
getMixinNodeTypesin interfaceNode- Throws:
RepositoryException
-
addMixin
public void addMixin(String mixinName) throws RepositoryException
Wrapper aroundaddMixin(Name).- Specified by:
addMixinin interfaceNode- Throws:
RepositoryException
-
removeMixin
public void removeMixin(String mixinName) throws RepositoryException
Wrapper aroundremoveMixin(Name).- Specified by:
removeMixinin interfaceNode- Throws:
RepositoryException
-
canAddMixin
public boolean canAddMixin(String mixinName) throws NoSuchNodeTypeException, RepositoryException
- Specified by:
canAddMixinin interfaceNode- Throws:
NoSuchNodeTypeExceptionRepositoryException
-
hasProperty
public boolean hasProperty(String relPath) throws RepositoryException
- Specified by:
hasPropertyin interfaceNode- Throws:
RepositoryException
-
getReferences
public PropertyIterator getReferences() throws RepositoryException
- Specified by:
getReferencesin interfaceNode- Throws:
RepositoryException
-
getDefinition
public NodeDefinition getDefinition() throws RepositoryException
- Specified by:
getDefinitionin interfaceNode- Throws:
RepositoryException
-
getNodes
public NodeIterator getNodes(String namePattern) throws RepositoryException
- Specified by:
getNodesin interfaceNode- Throws:
RepositoryException
-
getProperties
public PropertyIterator getProperties(String namePattern) throws RepositoryException
- Specified by:
getPropertiesin interfaceNode- Throws:
RepositoryException
-
getPrimaryItem
public Item getPrimaryItem() throws ItemNotFoundException, RepositoryException
- Specified by:
getPrimaryItemin interfaceNode- Throws:
ItemNotFoundExceptionRepositoryException
-
getUUID
public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException
- Specified by:
getUUIDin interfaceNode- Throws:
UnsupportedRepositoryOperationExceptionRepositoryException
-
getCorrespondingNodePath
public String getCorrespondingNodePath(String workspaceName) throws ItemNotFoundException, NoSuchWorkspaceException, AccessDeniedException, RepositoryException
- Specified by:
getCorrespondingNodePathin interfaceNode- Throws:
ItemNotFoundExceptionNoSuchWorkspaceExceptionAccessDeniedExceptionRepositoryException
-
getIndex
public int getIndex() throws RepositoryException- Specified by:
getIndexin interfaceNode- Throws:
RepositoryException
-
getSharedSet
public NodeIterator getSharedSet() throws RepositoryException
Returns an iterator over all nodes that are in the shared set of this node. If this node is not shared then the returned iterator contains only this node.- Specified by:
getSharedSetin interfaceNode- Returns:
- a
NodeIterator - Throws:
RepositoryException- if an error occurs.- Since:
- JCR 2.0
-
removeSharedSet
public void removeSharedSet() throws VersionException, LockException, ConstraintViolationException, RepositoryExceptionA special kind ofremove()that removes this node and every other node in the shared set of this node.This removal must be done atomically, i.e., if one of the nodes cannot be removed, the function throws the exception
remove()would have thrown in that case, and none of the nodes are removed.If this node is not shared this method removes only this node.
- Specified by:
removeSharedSetin interfaceNode- Throws:
VersionExceptionLockExceptionConstraintViolationExceptionRepositoryException- Since:
- JCR 2.0
- See Also:
removeShare(),Item.remove()
-
removeShare
public void removeShare() throws VersionException, LockException, ConstraintViolationException, RepositoryExceptionA special kind ofremove()that removes this node, but does not remove any other node in the shared set of this node.All of the exceptions defined for
remove()apply to this function. In addition, aRepositoryExceptionis thrown if this node cannot be removed without removing another node in the shared set of this node.If this node is not shared this method removes only this node.
- Specified by:
removeSharein interfaceNode- Throws:
VersionExceptionLockExceptionConstraintViolationExceptionRepositoryException- Since:
- JCR 2.0
- See Also:
removeSharedSet(),Item.remove()
-
getParentId
public NodeId getParentId()
Helper method, returning the parent id this node is attached to. If this node is shareable, it returns the primary parent id (which remains fixed since shareable nodes are not moveable). Otherwise returns the underlying state's parent id.- Returns:
- parent id
-
getPrimaryPath
public Path getPrimaryPath() throws RepositoryException
Returns the primary path to thisItem. Overridden to return a different path for shareable nodes. TODO SN: copies functionality in that is already available in HierarchyManagerImpl, namely composing a path by concatenating the parent path + this node's name and index: rather use hierarchy manager to do this- Overrides:
getPrimaryPathin classItemImpl- Returns:
- the primary path to this
Item - Throws:
RepositoryException
-
isCheckedOut
public boolean isCheckedOut() throws RepositoryException- Specified by:
isCheckedOutin interfaceNode- Throws:
RepositoryException
-
update
public void update(String srcWorkspaceName) throws RepositoryException
- Specified by:
updatein interfaceNode- Throws:
RepositoryException
-
checkin
@Deprecated public Version checkin() throws RepositoryException
Deprecated.UseVersionManager.checkin(String)instead- Specified by:
checkinin interfaceNode- Throws:
RepositoryException
-
checkin
@Deprecated public Version checkin(Calendar created) throws RepositoryException
Deprecated.UseVersionManagerImpl.checkin(String, Calendar)instead- Throws:
RepositoryException- Since:
- Apache Jackrabbit 1.6
- See Also:
- JCR-1972
-
checkout
@Deprecated public void checkout() throws RepositoryException
Deprecated.UseVersionManager.checkout(String)instead- Specified by:
checkoutin interfaceNode- Throws:
RepositoryException
-
merge
@Deprecated public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws RepositoryException
Deprecated.UseVersionManager.merge(String, String, boolean)instead- Specified by:
mergein interfaceNode- Throws:
RepositoryException
-
cancelMerge
@Deprecated public void cancelMerge(Version version) throws RepositoryException
Deprecated.UseVersionManager.cancelMerge(String, Version)instead- Specified by:
cancelMergein interfaceNode- Throws:
RepositoryException
-
doneMerge
@Deprecated public void doneMerge(Version version) throws RepositoryException
Deprecated.UseVersionManager.doneMerge(String, Version)instead- Specified by:
doneMergein interfaceNode- Throws:
RepositoryException
-
restore
@Deprecated public void restore(String versionName, boolean removeExisting) throws RepositoryException
Deprecated.UseVersionManager.restore(String, String, boolean)instead- Specified by:
restorein interfaceNode- Throws:
RepositoryException
-
restore
@Deprecated public void restore(Version version, boolean removeExisting) throws RepositoryException
Deprecated.UseVersionManager.restore(String, Version, boolean)instead- Specified by:
restorein interfaceNode- Throws:
RepositoryException
-
restore
@Deprecated public void restore(Version version, String relPath, boolean removeExisting) throws RepositoryException
Deprecated.UseVersionManager.restore(String, Version, boolean)instead- Specified by:
restorein interfaceNode- Throws:
RepositoryException
-
restoreByLabel
@Deprecated public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException
Deprecated.- Specified by:
restoreByLabelin interfaceNode- Throws:
RepositoryException
-
getVersionHistory
@Deprecated public VersionHistory getVersionHistory() throws RepositoryException
Deprecated.UseVersionManager.getVersionHistory(String)instead- Specified by:
getVersionHistoryin interfaceNode- Throws:
RepositoryException
-
getBaseVersion
@Deprecated public Version getBaseVersion() throws RepositoryException
Deprecated.UseVersionManager.getBaseVersion(String)instead- Specified by:
getBaseVersionin interfaceNode- Throws:
RepositoryException
-
lock
public Lock lock(boolean isDeep, boolean isSessionScoped) throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException
- Specified by:
lockin interfaceNode- Throws:
UnsupportedRepositoryOperationExceptionLockExceptionAccessDeniedExceptionInvalidItemStateExceptionRepositoryException
-
getLock
public Lock getLock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, RepositoryException
- Specified by:
getLockin interfaceNode- Throws:
UnsupportedRepositoryOperationExceptionLockExceptionAccessDeniedExceptionRepositoryException
-
unlock
public void unlock() throws UnsupportedRepositoryOperationException, LockException, AccessDeniedException, InvalidItemStateException, RepositoryException- Specified by:
unlockin interfaceNode- Throws:
UnsupportedRepositoryOperationExceptionLockExceptionAccessDeniedExceptionInvalidItemStateExceptionRepositoryException
-
holdsLock
public boolean holdsLock() throws RepositoryException- Specified by:
holdsLockin interfaceNode- Throws:
RepositoryException
-
isLocked
public boolean isLocked() throws RepositoryException- Specified by:
isLockedin interfaceNode- Throws:
RepositoryException
-
checkLock
@Deprecated protected void checkLock() throws LockException, RepositoryException
Deprecated.Check whether this node is locked by somebody else.- Throws:
LockException- if this node is locked by somebody elseRepositoryException- if some other error occurs
-
getIdentifier
public String getIdentifier() throws RepositoryException
- Specified by:
getIdentifierin interfaceNode- Throws:
RepositoryException
-
getReferences
public PropertyIterator getReferences(String name) throws RepositoryException
- Specified by:
getReferencesin interfaceNode- Throws:
RepositoryException
-
getWeakReferences
public PropertyIterator getWeakReferences() throws RepositoryException
- Specified by:
getWeakReferencesin interfaceNode- Throws:
RepositoryException
-
getWeakReferences
public PropertyIterator getWeakReferences(String name) throws RepositoryException
- Specified by:
getWeakReferencesin interfaceNode- Throws:
RepositoryException
-
getNodes
public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException
- Specified by:
getNodesin interfaceNode- Throws:
RepositoryException
-
getProperties
public PropertyIterator getProperties(String[] nameGlobs) throws RepositoryException
- Specified by:
getPropertiesin interfaceNode- Throws:
RepositoryException
-
setPrimaryType
public void setPrimaryType(String nodeTypeName) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException
- Specified by:
setPrimaryTypein interfaceNode- Throws:
NoSuchNodeTypeExceptionVersionExceptionConstraintViolationExceptionLockExceptionRepositoryException
-
setProperty
public Property setProperty(String name, BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException
- Specified by:
setPropertyin interfaceNode- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionRepositoryException
-
setProperty
public Property setProperty(String name, Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException
- Specified by:
setPropertyin interfaceNode- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionRepositoryException
-
getAllowedLifecycleTransistions
public String[] getAllowedLifecycleTransistions() throws UnsupportedRepositoryOperationException, RepositoryException
Returns all allowed transitions from the current lifecycle state of this node.The lifecycle policy node referenced by the "jcr:lifecyclePolicy" property is expected to contain a "transitions" node with a list of child nodes, one for each transition. These transition nodes must have single-valued string "from" and "to" properties that identify the allowed source and target states of each transition.
Note that future versions of Apache Jackrabbit may well use different lifecycle policy implementations.
- Specified by:
getAllowedLifecycleTransistionsin interfaceNode- Returns:
- allowed transitions for the current lifecycle state of this node
- Throws:
UnsupportedRepositoryOperationException- if this node does not have the mix:lifecycle mixin node typeRepositoryException- if a repository error occurs- Since:
- Apache Jackrabbit 2.0
-
followLifecycleTransition
public void followLifecycleTransition(String transition) throws UnsupportedRepositoryOperationException, InvalidLifecycleTransitionException, RepositoryException
Transitions this node through its lifecycle to the given target state.- Specified by:
followLifecycleTransitionin interfaceNode- Parameters:
transition- target lifecycle state- Throws:
UnsupportedRepositoryOperationException- if this node does not have the mix:lifecycle mixin node typeInvalidLifecycleTransitionException- if the given target state is not among the allowed transitions from the current lifecycle state of this nodeRepositoryException- if a repository error occurs- Since:
- Apache Jackrabbit 2.0
- See Also:
getAllowedLifecycleTransistions()
-
assignLifecyclePolicy
public void assignLifecyclePolicy(Node policy, String state) throws RepositoryException
Assigns the given lifecycle policy to this node and sets the current state to the one given.Note that currently no special checks are made against the given arguments, and that you will need to explicitly persist these changes by calling save().
Note that future versions of Apache Jackrabbit may well use different lifecycle policy implementations.
- Parameters:
policy- lifecycle policy nodestate- current lifecycle state- Throws:
RepositoryException- if a repository error occurs
-
rename
public void rename(String newName) throws RepositoryException
- Specified by:
renamein interfaceJackrabbitNode- Throws:
RepositoryException
-
setMixins
public void setMixins(String[] mixinNames) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException
- Specified by:
setMixinsin interfaceJackrabbitNode- Throws:
NoSuchNodeTypeExceptionVersionExceptionConstraintViolationExceptionLockExceptionRepositoryException
-
-