Class PropertyEntryImpl
- java.lang.Object
-
- org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntryImpl
-
- All Implemented Interfaces:
HierarchyEntry
,PropertyEntry
public class PropertyEntryImpl extends Object implements PropertyEntry
PropertyEntryImpl
implements a reference to a property state.
-
-
Field Summary
Fields Modifier and Type Field Description protected EntryFactory
factory
The item state factory to create the item state.protected Name
name
The name of the target item state.protected NodeEntryImpl
parent
Hard reference to the parentNodeEntry
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calculateStatus()
Calculates the status of the underlyingItemState
: any pending changes to the underlyingItemState
are applied.void
complete(Operation operation)
Clean up this entry uponOperation.undo()
orOperation.persisted()
.boolean
denotesNode()
Returns false.long
getGeneration()
The required generation of thisHierarchyEntry
.PropertyId
getId()
protected IdFactory
getIdFactory()
Shortcut forEntryFactory.getIdFactory()
protected EntryFactory.InvalidationStrategy
getInvalidationStrategy()
ItemState
getItemState()
If thisHierarchyEntry
has already been resolved before (seeHierarchyEntry.isAvailable()
), thatItemState
is returned.protected TransientItemStateFactory
getItemStateFactory()
Shortcut forEntryFactory.getItemStateFactory()
Name
getName()
NodeEntry
getParent()
Returns theNodeEntry
being parent to thisHierarchyEntry
.Path
getPath()
protected PathFactory
getPathFactory()
Shortcut forEntryFactory.getPathFactory()
PropertyState
getPropertyState()
int
getStatus()
If thisHierarchyEntry
provides an underlyingItemState
this method returns the status of that state, otherwise it returnsStatus._UNDEFINED_
.PropertyId
getWorkspaceId()
Returns the ID that must be used for resolving this entry OR loading its children entries from the persistent layer.Path
getWorkspacePath()
void
invalidate(boolean recursive)
Invalidates the underlyingItemState
if available and if it is not transiently modified.protected void
invalidateInternal(boolean recursive)
Invalidates the underlyingItemState
.boolean
isAvailable()
Returnstrue
if the referencedItemState
is available.void
reload(boolean recursive)
Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved.void
remove()
Removes thisHierarchyEntry
from its parent and sets the status of the underlying ItemState toStatus.REMOVED
or toStatus.STALE_DESTROYED
, respectively.void
revert()
Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states.void
setItemState(ItemState state)
Set the ItemState this hierarchyEntry will be resolved to.void
transientRemove()
Traverses the hierarchy and marks all available item states as transiently removed.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry
calculateStatus, getGeneration, getItemState, getName, getParent, getPath, getStatus, getWorkspacePath, invalidate, isAvailable, reload, remove, revert, setItemState, transientRemove
-
-
-
-
Field Detail
-
name
protected Name name
The name of the target item state.
-
parent
protected NodeEntryImpl parent
Hard reference to the parentNodeEntry
.
-
factory
protected final EntryFactory factory
The item state factory to create the item state.
-
-
Method Detail
-
getId
public PropertyId getId() throws InvalidItemStateException, RepositoryException
- Specified by:
getId
in interfacePropertyEntry
- Returns:
- the
NodeId
of this child node entry. - Throws:
InvalidItemStateException
RepositoryException
- See Also:
PropertyEntry.getId()
-
getWorkspaceId
public PropertyId getWorkspaceId() throws InvalidItemStateException, RepositoryException
Description copied from interface:PropertyEntry
Returns the ID that must be used for resolving this entry OR loading its children entries from the persistent layer. This is the same asgetId()
unless any of its ancestors has been transiently moved.- Specified by:
getWorkspaceId
in interfacePropertyEntry
- Returns:
- Throws:
InvalidItemStateException
RepositoryException
- See Also:
PropertyEntry.getWorkspaceId()
-
getPropertyState
public PropertyState getPropertyState() throws ItemNotFoundException, RepositoryException
- Specified by:
getPropertyState
in interfacePropertyEntry
- Returns:
- the referenced
PropertyState
. - Throws:
ItemNotFoundException
- if thePropertyState
does not exist anymore.RepositoryException
- if an error occurs while retrieving thePropertyState
.- See Also:
PropertyEntry.getPropertyState()
-
denotesNode
public boolean denotesNode()
Returns false.- Specified by:
denotesNode
in interfaceHierarchyEntry
- Returns:
- See Also:
HierarchyEntry.denotesNode()
-
complete
public void complete(Operation operation) throws RepositoryException
Description copied from interface:HierarchyEntry
Clean up this entry uponOperation.undo()
orOperation.persisted()
.- Specified by:
complete
in interfaceHierarchyEntry
- Throws:
RepositoryException
- See Also:
HierarchyEntry.complete(Operation)
-
getItemStateFactory
protected TransientItemStateFactory getItemStateFactory()
Shortcut forEntryFactory.getItemStateFactory()
- Returns:
-
getPathFactory
protected PathFactory getPathFactory()
Shortcut forEntryFactory.getPathFactory()
- Returns:
-
getIdFactory
protected IdFactory getIdFactory()
Shortcut forEntryFactory.getIdFactory()
- Returns:
-
getInvalidationStrategy
protected EntryFactory.InvalidationStrategy getInvalidationStrategy()
-
invalidateInternal
protected void invalidateInternal(boolean recursive)
Invalidates the underlyingItemState
. Ifrecursive
is true also invalidates the underlying item states of all child entries.- Parameters:
recursive
-
-
getName
public Name getName()
- Specified by:
getName
in interfaceHierarchyEntry
- Returns:
- the name of this hierarchy entry.
- See Also:
HierarchyEntry.getName()
-
getPath
public Path getPath() throws RepositoryException
- Specified by:
getPath
in interfaceHierarchyEntry
- Returns:
- the path of this hierarchy entry.
- Throws:
RepositoryException
- See Also:
HierarchyEntry.getPath()
-
getWorkspacePath
public Path getWorkspacePath() throws RepositoryException
- Specified by:
getWorkspacePath
in interfaceHierarchyEntry
- Returns:
- If this entry has not been modified this method returns the same
as
HierarchyEntry.getPath()
. In case of moved items this method return the original path as it is present on the persistent layer. - Throws:
RepositoryException
- See Also:
HierarchyEntry.getWorkspacePath()
-
getParent
public NodeEntry getParent()
Description copied from interface:HierarchyEntry
Returns theNodeEntry
being parent to thisHierarchyEntry
.- Specified by:
getParent
in interfaceHierarchyEntry
- Returns:
- the parent
HierarchyEntry
- See Also:
HierarchyEntry.getParent()
-
getStatus
public int getStatus()
Description copied from interface:HierarchyEntry
If thisHierarchyEntry
provides an underlyingItemState
this method returns the status of that state, otherwise it returnsStatus._UNDEFINED_
.- Specified by:
getStatus
in interfaceHierarchyEntry
- Returns:
- Status of the ItemState or
Status._UNDEFINED_
if this entry has not been resolved yet. - See Also:
HierarchyEntry.getStatus()
-
isAvailable
public boolean isAvailable()
Description copied from interface:HierarchyEntry
Returnstrue
if the referencedItemState
is available. That is, the referencedItemState
has already been resolved.
Note, that the validity of the ItemState is not checked.- Specified by:
isAvailable
in interfaceHierarchyEntry
- Returns:
true
if theItemState
is available; otherwisefalse
.- See Also:
HierarchyEntry.isAvailable()
-
getItemState
public ItemState getItemState() throws ItemNotFoundException, RepositoryException
If thisHierarchyEntry
has already been resolved before (seeHierarchyEntry.isAvailable()
), thatItemState
is returned. Note however, that the validity of the State is not asserted.
If the entry has not been resolved yet an attempt is made to resolve this entry, which may fail if there exists no accessibleItemState
or if the corresponding state has been removed in the mean time.- Specified by:
getItemState
in interfaceHierarchyEntry
- Returns:
- the referenced
ItemState
. - Throws:
ItemNotFoundException
- if theItemState
does not exist anymore.RepositoryException
- If an error occurs while retrieving theItemState
.- See Also:
HierarchyEntry.getItemState()
-
setItemState
public void setItemState(ItemState state)
Set the ItemState this hierarchyEntry will be resolved to.- Specified by:
setItemState
in interfaceHierarchyEntry
- See Also:
HierarchyEntry.setItemState(ItemState)
-
invalidate
public void invalidate(boolean recursive)
Invalidates the underlyingItemState
if available and if it is not transiently modified. If therecursive
flag is true, also invalidates the child entries recursively.
Note, that in contrast toHierarchyEntry.reload(boolean)
this method only sets the status of this item state toStatus.INVALIDATED
and does not actually update it with the persistent state in the repository.- Specified by:
invalidate
in interfaceHierarchyEntry
- See Also:
HierarchyEntry.invalidate(boolean)
-
calculateStatus
public void calculateStatus()
Description copied from interface:HierarchyEntry
Calculates the status of the underlyingItemState
: any pending changes to the underlyingItemState
are applied.- Specified by:
calculateStatus
in interfaceHierarchyEntry
-
revert
public void revert() throws RepositoryException
Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states. 'Existing' item states are reverted to their initial state and their status is reset toStatus.EXISTING
.- Specified by:
revert
in interfaceHierarchyEntry
- Throws:
RepositoryException
- if an error occurs.- See Also:
HierarchyEntry.revert()
-
reload
public void reload(boolean recursive)
Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved. If 'recursive
' the complete hierarchy below this entry is reloaded as well.- Specified by:
reload
in interfaceHierarchyEntry
- See Also:
HierarchyEntry.reload(boolean)
-
transientRemove
public void transientRemove() throws InvalidItemStateException, RepositoryException
Traverses the hierarchy and marks all available item states as transiently removed. They will change their status to eitherStatus.EXISTING_REMOVED
if the item is existing in the persistent storage orStatus.REMOVED
if the item has been transiently added before. In the latter case, the corresponding HierarchyEntries can be removed as well from their parent.- Specified by:
transientRemove
in interfaceHierarchyEntry
- Throws:
InvalidItemStateException
- if this entry has been removed in the mean time.RepositoryException
- if an error occurs while removing any of the item states e.g. an item state is not valid anymore.- See Also:
HierarchyEntry.transientRemove()
-
remove
public void remove()
Description copied from interface:HierarchyEntry
Removes thisHierarchyEntry
from its parent and sets the status of the underlying ItemState toStatus.REMOVED
or toStatus.STALE_DESTROYED
, respectively. If this entry is a NodeEntry all descending ItemStates must get their status changed as well.- Specified by:
remove
in interfaceHierarchyEntry
- See Also:
HierarchyEntry.remove()
-
getGeneration
public long getGeneration()
Description copied from interface:HierarchyEntry
The required generation of thisHierarchyEntry
. This is used by theItemInfoCache
to determine whether an item info in the cache is up to date or not. That is whether the generation of the item info in the cache is the same or more recent as the required generation of this entry.- Specified by:
getGeneration
in interfaceHierarchyEntry
-
-