public interface MutableCachedNode extends CachedNode
Modifier and Type | Interface and Description |
---|---|
static interface |
MutableCachedNode.NodeChanges
Interface which exposes all the changes that have occurred on a
MutableCachedNode instance |
static interface |
MutableCachedNode.PermissionChanges
Interface which exposes the ACL-related changes for mutable cached nodes.
|
CachedNode.Properties, CachedNode.ReferenceType
Modifier and Type | Method and Description |
---|---|
void |
addFederatedSegment(String externalNodeKey,
String segmentName)
Adds a new federated segment with the given name and key to this node.
|
void |
addInternalProperty(String name,
Object value)
Adds an internal property to this cached node.
|
void |
addMixin(SessionCache cache,
Name mixinName)
Add the supplied mixin type if not already an explicitly referenced.
|
void |
addReferrer(SessionCache cache,
Property property,
NodeKey referrerKey,
CachedNode.ReferenceType type)
Adds to this node a reference with the given type from the node with the supplied key to this node.
|
MutableCachedNode |
createChild(SessionCache cache,
NodeKey key,
Name name,
Iterable<Property> properties)
Create a new node as a child of this node with the supplied name and properties.
|
MutableCachedNode |
createChild(SessionCache cache,
NodeKey key,
Name name,
Property firstProperty,
Property... additionalProperties)
Create a new node as a child of this node with the supplied name and properties.
|
void |
deepClone(SessionCache cache,
CachedNode sourceNode,
SessionCache sourceCache,
String systemWorkspaceKey,
Connectors connectors)
Clones into this node all the properties and children (deep clone) from the given source node.
|
Map<NodeKey,NodeKey> |
deepCopy(SessionCache cache,
CachedNode sourceNode,
SessionCache sourceCache,
String systemWorkspaceKey,
Connectors connectors)
Copies into this node all the properties and children (deep copy) from the given source node.
|
void |
excludeFromSearch()
Sets a flag indicating if this node and anything below it should be excluded from all searches and indexing operations.
|
Map<String,Object> |
getAddedInternalProperties()
Returns a map of all the internal properties added for this node.
|
Set<Name> |
getAddedMixins(SessionCache cache)
Get the set of mixin names that were added to this node but not yet saved.
|
Set<NodeKey> |
getChangedReferrerNodes()
Returns a set with all the referencing nodes (nodes which are referring this node) which have changed.
|
String |
getEtag(SessionCache cache)
Compute an ETag value for this node.
|
MutableCachedNode.NodeChanges |
getNodeChanges()
Returns an object encapsulating all the different changes that this session node contains.
|
Set<String> |
getRemovedInternalProperties()
Returns a set of all the internal properties which have been removed from this node.
|
boolean |
hasChangedPrimaryType()
Return whether the primary type for the node has changed.
|
boolean |
hasChanges()
Return whether this node has changes, including property-related changes and other changes not related to properties.
|
boolean |
hasNonPropertyChanges()
Return whether this node has changes unrelated to properties.
|
boolean |
hasOnlyChangesToAdditionalParents()
Return whether this node contains only changes to the additional parents.
|
boolean |
hasPropertyChanges()
Return whether this node has changes in the properties.
|
boolean |
isNew()
Return whether this node was created since last saved.
|
boolean |
isPropertyModified(SessionCache cache,
Name propertyName)
Return whether the property with the supplied name was modified since the session was last saved.
|
boolean |
isPropertyNew(SessionCache cache,
Name propertyName)
Return whether the property with the supplied name was created since the session was last saved.
|
boolean |
linkChild(SessionCache cache,
NodeKey childKey,
Name name)
Link the existing node with the supplied key to be appended as a child of this node.
|
void |
lock(boolean sessionScoped)
Lock this node.
|
void |
moveChild(SessionCache cache,
NodeKey key,
MutableCachedNode newParent,
Name newName)
Remove the node from being a child of this node and append it as a child of the supplied node.
|
MutableCachedNode.PermissionChanges |
removeACL(SessionCache cache)
Removes any potential existing ACL for this node.
|
void |
removeAllProperties(SessionCache cache)
Remove all of the properties from this node.
|
void |
removeChild(SessionCache cache,
NodeKey key)
Remove the node from being a child of this node.
|
void |
removeFederatedSegment(String externalNodeKey)
Removes the federated segment towards an external node.
|
boolean |
removeInternalProperty(String name)
Removes an internal property from this cached node.
|
void |
removeMixin(SessionCache cache,
Name mixinName)
Remove the supplied mixin type if already an explicitly referenced.
|
void |
removeProperty(SessionCache cache,
Name name)
Remove the property with the given name.
|
void |
removeReferrer(SessionCache cache,
Property property,
NodeKey referrerKey,
CachedNode.ReferenceType type)
Remove from this node a reference with the given type from the node with the supplied key to this node.
|
void |
renameChild(SessionCache cache,
NodeKey key,
Name newName)
Renames the child node.
|
void |
reorderChild(SessionCache cache,
NodeKey key,
NodeKey nextNode)
Remove the node from being a child of this node and append it as a child before the supplied node.
|
MutableCachedNode.PermissionChanges |
setPermissions(SessionCache cache,
Map<String,Set<String>> permissions)
Sets permissions for this node, creating in effect an ACL.
|
void |
setProperties(SessionCache cache,
Iterable<Property> properties)
Set the properties on this node.
|
void |
setProperties(SessionCache cache,
Iterator<Property> properties)
Set the properties on this node.
|
void |
setProperty(SessionCache cache,
Property property)
Set the property with the given name.
|
void |
setPropertyIfUnchanged(SessionCache cache,
Property property)
Set the given property only if it has not been set previously and therefore appear as changed.
|
void |
setReference(SessionCache cache,
Property property,
SessionCache systemCache)
Sets a property of type reference in the case when there's an active system cache and the property is a reference towards a
transient node from the system cache.
|
void |
unlock()
Unlock this node.
|
getAdditionalParentKeys, getChildReferences, getDepth, getKey, getMixinTypes, getName, getParentKey, getParentKeyInAnyWorkspace, getPath, getPath, getPermissions, getPrimaryType, getProperties, getProperties, getPropertiesByName, getProperty, getPropertyCount, getReferrerCounts, getReferrers, getSegment, hasACL, hasProperties, hasProperty, isAtOrBelow, isExcludedFromSearch, isExternal
boolean isNew()
boolean isPropertyNew(SessionCache cache, Name propertyName)
true
if isNew()
returns true
.cache
- the cache to which this node belongs; may not be nullpropertyName
- the name of the property; may not be nullisPropertyModified(org.modeshape.jcr.cache.SessionCache, org.modeshape.jcr.value.Name)
,
isNew()
boolean isPropertyModified(SessionCache cache, Name propertyName)
cache
- the cache to which this node belongs; may not be nullpropertyName
- the name of the property; may not be nullisPropertyNew(org.modeshape.jcr.cache.SessionCache, org.modeshape.jcr.value.Name)
boolean hasChanges()
hasNonPropertyChanges() || hasPropertyChanges()
.hasNonPropertyChanges()
,
hasPropertyChanges()
boolean hasNonPropertyChanges()
hasChanges()
,
hasPropertyChanges()
boolean hasPropertyChanges()
hasChanges()
,
hasNonPropertyChanges()
void lock(boolean sessionScoped)
sessionScoped
- true if the lock should be limited in scope to the lifetime of the session, or false otherwisevoid unlock()
void setProperty(SessionCache cache, Property property)
cache
- the cache to which this node belongs; may not be nullproperty
- the property; may not be nullNodeNotFoundException
- if this node no longer existsvoid setReference(SessionCache cache, Property property, SessionCache systemCache)
cache
- the cache to which this node belongs; may not be nullproperty
- the property; may not be nullsystemCache
- an existing system cache which contains transient nodes towards which the property points.NodeNotFoundException
- if this node no longer existsvoid setPropertyIfUnchanged(SessionCache cache, Property property)
cache
- the cache to which this node belongs; may not be nullproperty
- the property; may not be nullNodeNotFoundException
- if this node no longer existsvoid setProperties(SessionCache cache, Iterable<Property> properties)
cache
- the cache to which this node belongs; may not be nullproperties
- the properties to be set; may not be nullNodeNotFoundException
- if this node no longer existsvoid setProperties(SessionCache cache, Iterator<Property> properties)
cache
- the cache to which this node belongs; may not be nullproperties
- the iterator over the properties to be set; may not be nullNodeNotFoundException
- if this node no longer existsvoid removeAllProperties(SessionCache cache)
cache
- the cache to which this node belongs; may not be nullNodeNotFoundException
- if this node no longer existsvoid removeProperty(SessionCache cache, Name name)
cache
- the cache to which this node belongs; may not be nullname
- the name of the property to be removed; may not be nullNodeNotFoundException
- if this node no longer existsvoid addMixin(SessionCache cache, Name mixinName)
cache
- the cache to which this node belongs; may not be nullmixinName
- the name of the mixin to be removed; may not be nullvoid removeMixin(SessionCache cache, Name mixinName)
cache
- the cache to which this node belongs; may not be nullmixinName
- the name of the mixin to be removed; may not be nullSet<Name> getAddedMixins(SessionCache cache)
cache
- the cache to which this node belongs; may not be nullboolean hasChangedPrimaryType()
void addFederatedSegment(String externalNodeKey, String segmentName)
segmentName
- the name of the segment (i.e. the name of the alias under which an external child is linked); may not be
nullexternalNodeKey
- the key of the external node which should be linked under this name; may not be nullvoid removeFederatedSegment(String externalNodeKey)
externalNodeKey
- the key of the external node which should be linked under this name; may not be nullMutableCachedNode createChild(SessionCache cache, NodeKey key, Name name, Property firstProperty, Property... additionalProperties)
cache
- the cache to which this node belongs; may not be nullkey
- the key for the new node; may be nullname
- the name for the new node; may not be nullfirstProperty
- the first property; may not be nulladditionalProperties
- the properties that should be set on the node; may be null or empty, and any null property
references will be ignoredMutableCachedNode createChild(SessionCache cache, NodeKey key, Name name, Iterable<Property> properties)
cache
- the cache to which this node belongs; may not be nullkey
- the key for the new node; may be nullname
- the name for the new node; may not be nullproperties
- the properties that should be set on the node; may be null or empty, and any null property references
will be ignoredvoid removeChild(SessionCache cache, NodeKey key)
cache
- the cache to which this node belongs; may not be nullkey
- the key for the child that is to be removed; may not be nullNodeNotFoundException
- if the node does not exist as a child of this nodevoid moveChild(SessionCache cache, NodeKey key, MutableCachedNode newParent, Name newName)
cache
- the cache to which this node belongs; may not be nullkey
- the key for the child that is to be removed; may not be nullnewParent
- the new parent for the node; may not be null and may not be this nodenewName
- the new name for the node, or null if the existing name is to be usedNodeNotFoundException
- if the node does not exist as a child of this nodeboolean linkChild(SessionCache cache, NodeKey childKey, Name name)
The link can be removed by simply removing
the linked child from the parent,
and this works whether or not the parent is the original parent or an additional parent.
cache
- the cache to which this node belongs; may not be nullchildKey
- the key for the child that is to be removed; may not be nullname
- the name for the (linked) node, or null if the existing name is to be usedNodeNotFoundException
- if the node does not existvoid reorderChild(SessionCache cache, NodeKey key, NodeKey nextNode)
cache
- the cache to which this node belongs; may not be nullkey
- the key for the child that is to be removed; may not be nullnextNode
- the key for the node before which the node should be moved; may be null if the node should be moved to the
end of the parentsNodeNotFoundException
- if the node does not exist as a child of this nodevoid renameChild(SessionCache cache, NodeKey key, Name newName)
cache
- the cache to which this node belongs; may not be nullkey
- the key for the child that is to be removed; may not be nullnewName
- the new name for the node; may not be nullNodeNotFoundException
- if the node does not exist as a child of this nodevoid addReferrer(SessionCache cache, Property property, NodeKey referrerKey, CachedNode.ReferenceType type)
cache
- the cache to which this node belongs; may not be nullproperty
- the Property
of the referrer node; may not be nullreferrerKey
- the key for the node that has a new reference to this node; may not be nulltype
- the reference type; may not be nullvoid removeReferrer(SessionCache cache, Property property, NodeKey referrerKey, CachedNode.ReferenceType type)
cache
- the cache to which this node belongs; may not be nullproperty
- the Property
of the referrer node; may not be nullreferrerKey
- the key for the node that no longer has a reference to this node; may not be nulltype
- the reference type; may not be nullString getEtag(SessionCache cache)
cache
- the cache to which this node belongs; may not be nullMap<NodeKey,NodeKey> deepCopy(SessionCache cache, CachedNode sourceNode, SessionCache sourceCache, String systemWorkspaceKey, Connectors connectors)
cache
- the cache to which this node belongs; may not be nullsourceNode
- the node from which to copy the properties and children; may not be nullsourceCache
- the cache in which the source node belongs; may not be nullsystemWorkspaceKey
- the key of the system workspace; may not be nullconnectors
- a Connectors
instance which used for processing external nodes.void deepClone(SessionCache cache, CachedNode sourceNode, SessionCache sourceCache, String systemWorkspaceKey, Connectors connectors)
cache
- the cache to which this node belongs; may not be nullsourceNode
- the node from which to copy the properties and children; may not be nullsourceCache
- the cache in which the source node belongs; may not be nullsystemWorkspaceKey
- the key of the system workspace; may not be nullconnectors
- a Connectors
instance which used for processing external nodes.Set<NodeKey> getChangedReferrerNodes()
NodeKey
instances, never null.boolean hasOnlyChangesToAdditionalParents()
void excludeFromSearch()
MutableCachedNode.NodeChanges getNodeChanges()
non-null
MutableCachedNode.NodeChanges
object.MutableCachedNode.PermissionChanges setPermissions(SessionCache cache, Map<String,Set<String>> permissions)
cache
- the cache to which this node belongs; may not be nullpermissions
- a set of privileges enqueued by principal name; may not be nullMutableCachedNode.PermissionChanges
instance which reflects how the persistent
state has been affected by the change; never nullMutableCachedNode.PermissionChanges removeACL(SessionCache cache)
cache
- the cache to which this node belongs; may not be nullMutableCachedNode.PermissionChanges
instance which reflects which principal
have been removed; never nullvoid addInternalProperty(String name, Object value)
name
- a String
the name of the property; may not be null.value
- a String
the value of the property; may not be null.Map<String,Object> getAddedInternalProperties()
Map
of (propertyName, propertyValue) pairs. never null
but possibly empty.boolean removeInternalProperty(String name)
name
- a String
the name of the property; may not be null.true
if the property was removed, false
otherwise.Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.