Class PropertyEntryImpl
- java.lang.Object
-
- org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntryImpl
-
- All Implemented Interfaces:
HierarchyEntry,PropertyEntry
public class PropertyEntryImpl extends Object implements PropertyEntry
PropertyEntryImplimplements a reference to a property state.
-
-
Field Summary
Fields Modifier and Type Field Description protected EntryFactoryfactoryThe item state factory to create the item state.protected NamenameThe name of the target item state.protected NodeEntryImplparentHard reference to the parentNodeEntry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalculateStatus()Calculates the status of the underlyingItemState: any pending changes to the underlyingItemStateare applied.voidcomplete(Operation operation)Clean up this entry uponOperation.undo()orOperation.persisted().booleandenotesNode()Returns false.longgetGeneration()The required generation of thisHierarchyEntry.PropertyIdgetId()protected IdFactorygetIdFactory()Shortcut forEntryFactory.getIdFactory()protected EntryFactory.InvalidationStrategygetInvalidationStrategy()ItemStategetItemState()If thisHierarchyEntryhas already been resolved before (seeHierarchyEntry.isAvailable()), thatItemStateis returned.protected TransientItemStateFactorygetItemStateFactory()Shortcut forEntryFactory.getItemStateFactory()NamegetName()NodeEntrygetParent()Returns theNodeEntrybeing parent to thisHierarchyEntry.PathgetPath()protected PathFactorygetPathFactory()Shortcut forEntryFactory.getPathFactory()PropertyStategetPropertyState()intgetStatus()If thisHierarchyEntryprovides an underlyingItemStatethis method returns the status of that state, otherwise it returnsStatus._UNDEFINED_.PropertyIdgetWorkspaceId()Returns the ID that must be used for resolving this entry OR loading its children entries from the persistent layer.PathgetWorkspacePath()voidinvalidate(boolean recursive)Invalidates the underlyingItemStateif available and if it is not transiently modified.protected voidinvalidateInternal(boolean recursive)Invalidates the underlyingItemState.booleanisAvailable()Returnstrueif the referencedItemStateis available.voidreload(boolean recursive)Reloads this hierarchy entry and the corresponding ItemState, if this entry has already been resolved.voidremove()Removes thisHierarchyEntryfrom its parent and sets the status of the underlying ItemState toStatus.REMOVEDor toStatus.STALE_DESTROYED, respectively.voidrevert()Traverses the hierarchy and reverts all transient modifications such as adding, modifying or removing item states.voidsetItemState(ItemState state)Set the ItemState this hierarchyEntry will be resolved to.voidtransientRemove()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:
getIdin interfacePropertyEntry- Returns:
- the
NodeIdof this child node entry. - Throws:
InvalidItemStateExceptionRepositoryException- See Also:
PropertyEntry.getId()
-
getWorkspaceId
public PropertyId getWorkspaceId() throws InvalidItemStateException, RepositoryException
Description copied from interface:PropertyEntryReturns 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:
getWorkspaceIdin interfacePropertyEntry- Returns:
- Throws:
InvalidItemStateExceptionRepositoryException- See Also:
PropertyEntry.getWorkspaceId()
-
getPropertyState
public PropertyState getPropertyState() throws ItemNotFoundException, RepositoryException
- Specified by:
getPropertyStatein interfacePropertyEntry- Returns:
- the referenced
PropertyState. - Throws:
ItemNotFoundException- if thePropertyStatedoes not exist anymore.RepositoryException- if an error occurs while retrieving thePropertyState.- See Also:
PropertyEntry.getPropertyState()
-
denotesNode
public boolean denotesNode()
Returns false.- Specified by:
denotesNodein interfaceHierarchyEntry- Returns:
- See Also:
HierarchyEntry.denotesNode()
-
complete
public void complete(Operation operation) throws RepositoryException
Description copied from interface:HierarchyEntryClean up this entry uponOperation.undo()orOperation.persisted().- Specified by:
completein 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. Ifrecursiveis true also invalidates the underlying item states of all child entries.- Parameters:
recursive-
-
getName
public Name getName()
- Specified by:
getNamein interfaceHierarchyEntry- Returns:
- the name of this hierarchy entry.
- See Also:
HierarchyEntry.getName()
-
getPath
public Path getPath() throws RepositoryException
- Specified by:
getPathin interfaceHierarchyEntry- Returns:
- the path of this hierarchy entry.
- Throws:
RepositoryException- See Also:
HierarchyEntry.getPath()
-
getWorkspacePath
public Path getWorkspacePath() throws RepositoryException
- Specified by:
getWorkspacePathin 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:HierarchyEntryReturns theNodeEntrybeing parent to thisHierarchyEntry.- Specified by:
getParentin interfaceHierarchyEntry- Returns:
- the parent
HierarchyEntry - See Also:
HierarchyEntry.getParent()
-
getStatus
public int getStatus()
Description copied from interface:HierarchyEntryIf thisHierarchyEntryprovides an underlyingItemStatethis method returns the status of that state, otherwise it returnsStatus._UNDEFINED_.- Specified by:
getStatusin 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:HierarchyEntryReturnstrueif the referencedItemStateis available. That is, the referencedItemStatehas already been resolved.
Note, that the validity of the ItemState is not checked.- Specified by:
isAvailablein interfaceHierarchyEntry- Returns:
trueif theItemStateis available; otherwisefalse.- See Also:
HierarchyEntry.isAvailable()
-
getItemState
public ItemState getItemState() throws ItemNotFoundException, RepositoryException
If thisHierarchyEntryhas already been resolved before (seeHierarchyEntry.isAvailable()), thatItemStateis 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 accessibleItemStateor if the corresponding state has been removed in the mean time.- Specified by:
getItemStatein interfaceHierarchyEntry- Returns:
- the referenced
ItemState. - Throws:
ItemNotFoundException- if theItemStatedoes 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:
setItemStatein interfaceHierarchyEntry- See Also:
HierarchyEntry.setItemState(ItemState)
-
invalidate
public void invalidate(boolean recursive)
Invalidates the underlyingItemStateif available and if it is not transiently modified. If therecursiveflag 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.INVALIDATEDand does not actually update it with the persistent state in the repository.- Specified by:
invalidatein interfaceHierarchyEntry- See Also:
HierarchyEntry.invalidate(boolean)
-
calculateStatus
public void calculateStatus()
Description copied from interface:HierarchyEntryCalculates the status of the underlyingItemState: any pending changes to the underlyingItemStateare applied.- Specified by:
calculateStatusin interfaceHierarchyEntry
-
revert
public void revert() throws RepositoryExceptionTraverses 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:
revertin 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:
reloadin interfaceHierarchyEntry- See Also:
HierarchyEntry.reload(boolean)
-
transientRemove
public void transientRemove() throws InvalidItemStateException, RepositoryExceptionTraverses the hierarchy and marks all available item states as transiently removed. They will change their status to eitherStatus.EXISTING_REMOVEDif the item is existing in the persistent storage orStatus.REMOVEDif the item has been transiently added before. In the latter case, the corresponding HierarchyEntries can be removed as well from their parent.- Specified by:
transientRemovein 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:HierarchyEntryRemoves thisHierarchyEntryfrom its parent and sets the status of the underlying ItemState toStatus.REMOVEDor toStatus.STALE_DESTROYED, respectively. If this entry is a NodeEntry all descending ItemStates must get their status changed as well.- Specified by:
removein interfaceHierarchyEntry- See Also:
HierarchyEntry.remove()
-
getGeneration
public long getGeneration()
Description copied from interface:HierarchyEntryThe required generation of thisHierarchyEntry. This is used by theItemInfoCacheto 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:
getGenerationin interfaceHierarchyEntry
-
-