Class VersionHistoryImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.jcr.session.NodeImpl<VersionHistoryDelegate>
-
- org.apache.jackrabbit.oak.jcr.version.VersionHistoryImpl
-
- All Implemented Interfaces:
Item
,Node
,VersionHistory
,JackrabbitNode
public class VersionHistoryImpl extends NodeImpl<VersionHistoryDelegate> implements VersionHistory
VersionHistoryImpl
...
-
-
Field Summary
Fields Modifier and Type Field 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 ofItem.save()
.protected SessionContext
sessionContext
protected SessionDelegate
sessionDelegate
-
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 Constructor Description VersionHistoryImpl(VersionHistoryDelegate dlg, SessionContext sessionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addVersionLabel(String versionName, String label, boolean moveLabel)
protected @NotNull PropertyState
createMultiState(String oakName, List<Value> values, Type<?> type)
protected @NotNull PropertyState
createSingleState(String oakName, Value value, Type<?> type)
NodeIterator
getAllFrozenNodes()
NodeIterator
getAllLinearFrozenNodes()
VersionIterator
getAllLinearVersions()
VersionIterator
getAllVersions()
Item
getAncestor(int depth)
int
getDepth()
@NotNull String
getName()
@NotNull String
getPath()
Version
getRootVersion()
@NotNull Session
getSession()
Version
getVersion(String versionName)
String
getVersionableIdentifier()
String
getVersionableUUID()
Version
getVersionByLabel(String label)
String[]
getVersionLabels()
String[]
getVersionLabels(Version version)
boolean
hasVersionLabel(String label)
boolean
hasVersionLabel(Version version, String label)
boolean
isSame(Item otherItem)
protected <U> U
perform(@NotNull SessionOperation<U> op)
Perform the passedSessionOperation
.void
refresh(boolean keepChanges)
void
removeVersion(String versionName)
void
removeVersionLabel(String label)
void
save()
String
toString()
-
Methods inherited from class org.apache.jackrabbit.oak.jcr.session.NodeImpl
accept, addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, createNode, createNodeOrNull, doneMerge, followLifecycleTransition, getAllowedLifecycleTransistions, getBaseVersion, getCorrespondingNodePath, getDefinition, getIdentifier, getIndex, getLock, getMixinNodeTypes, getNode, getNodeOrNull, getNodes, getNodes, getNodes, getParent, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperties, getProperty, getPropertyOrNull, getReferences, getReferences, getSharedSet, getUUID, getVersionHistory, getWeakReferences, getWeakReferences, hasNode, hasNodes, hasProperties, hasProperty, holdsLock, internalIsCheckedOut, isCheckedOut, isLocked, isModified, isNew, isNode, isNodeType, lock, merge, orderBefore, remove, removeMixin, removeShare, removeSharedSet, rename, restore, restore, restore, restoreByLabel, setMixins, setPrimaryType, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.jcr.Item
accept, getAncestor, getDepth, getName, getParent, getPath, getSession, isModified, isNew, isNode, isSame, refresh, remove, save
-
Methods inherited from interface javax.jcr.Node
addMixin, addNode, addNode, canAddMixin, cancelMerge, checkin, checkout, doneMerge, followLifecycleTransition, getAllowedLifecycleTransistions, getBaseVersion, getCorrespondingNodePath, getDefinition, getIdentifier, getIndex, getLock, getMixinNodeTypes, getNode, getNodes, getNodes, getNodes, getPrimaryItem, getPrimaryNodeType, getProperties, getProperties, getProperties, getProperty, getReferences, getReferences, getSharedSet, getUUID, getVersionHistory, getWeakReferences, getWeakReferences, hasNode, hasNodes, hasProperties, hasProperty, holdsLock, isCheckedOut, isLocked, isNodeType, lock, merge, orderBefore, removeMixin, removeShare, removeSharedSet, restore, restore, restore, restoreByLabel, setPrimaryType, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, unlock, update
-
-
-
-
Field Detail
-
ITEM_SAVE_DOES_SESSION_SAVE
public static final String ITEM_SAVE_DOES_SESSION_SAVE
- See Also:
- Constant Field Values
-
MV_PROPERTY_WARN_THRESHOLD
public static final int MV_PROPERTY_WARN_THRESHOLD
- See Also:
- Constant Field Values
-
SAVE_SESSION
public static final boolean SAVE_SESSION
The value of this flag determines the behaviour ofItem.save()
. Iffalse
, save will throw aUnsupportedRepositoryOperationException
if the sub tree rooted at this item does not contain all transient changes. Iftrue
, save will delegate toSession.save()
.
-
sessionContext
protected final SessionContext sessionContext
-
dlg
protected final T extends ItemDelegate dlg
-
sessionDelegate
protected final SessionDelegate sessionDelegate
-
-
Constructor Detail
-
VersionHistoryImpl
public VersionHistoryImpl(VersionHistoryDelegate dlg, SessionContext sessionContext)
-
-
Method Detail
-
getVersionableUUID
public String getVersionableUUID() throws RepositoryException
- Specified by:
getVersionableUUID
in interfaceVersionHistory
- Throws:
RepositoryException
-
getVersionableIdentifier
public String getVersionableIdentifier() throws RepositoryException
- Specified by:
getVersionableIdentifier
in interfaceVersionHistory
- Throws:
RepositoryException
-
getRootVersion
public Version getRootVersion() throws RepositoryException
- Specified by:
getRootVersion
in interfaceVersionHistory
- Throws:
RepositoryException
-
getAllLinearVersions
public VersionIterator getAllLinearVersions() throws RepositoryException
- Specified by:
getAllLinearVersions
in interfaceVersionHistory
- Throws:
RepositoryException
-
getAllVersions
public VersionIterator getAllVersions() throws RepositoryException
- Specified by:
getAllVersions
in interfaceVersionHistory
- Throws:
RepositoryException
-
getAllLinearFrozenNodes
public NodeIterator getAllLinearFrozenNodes() throws RepositoryException
- Specified by:
getAllLinearFrozenNodes
in interfaceVersionHistory
- Throws:
RepositoryException
-
getAllFrozenNodes
public NodeIterator getAllFrozenNodes() throws RepositoryException
- Specified by:
getAllFrozenNodes
in interfaceVersionHistory
- Throws:
RepositoryException
-
getVersion
public Version getVersion(String versionName) throws VersionException, RepositoryException
- Specified by:
getVersion
in interfaceVersionHistory
- Throws:
VersionException
RepositoryException
-
getVersionByLabel
public Version getVersionByLabel(String label) throws VersionException, RepositoryException
- Specified by:
getVersionByLabel
in interfaceVersionHistory
- Throws:
VersionException
RepositoryException
-
addVersionLabel
public void addVersionLabel(String versionName, String label, boolean moveLabel) throws LabelExistsVersionException, VersionException, RepositoryException
- Specified by:
addVersionLabel
in interfaceVersionHistory
- Throws:
LabelExistsVersionException
VersionException
RepositoryException
-
removeVersionLabel
public void removeVersionLabel(String label) throws VersionException, RepositoryException
- Specified by:
removeVersionLabel
in interfaceVersionHistory
- Throws:
VersionException
RepositoryException
-
hasVersionLabel
public boolean hasVersionLabel(String label) throws RepositoryException
- Specified by:
hasVersionLabel
in interfaceVersionHistory
- Throws:
RepositoryException
-
hasVersionLabel
public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException
- Specified by:
hasVersionLabel
in interfaceVersionHistory
- Throws:
VersionException
RepositoryException
-
getVersionLabels
public String[] getVersionLabels() throws RepositoryException
- Specified by:
getVersionLabels
in interfaceVersionHistory
- Throws:
RepositoryException
-
getVersionLabels
public String[] getVersionLabels(Version version) throws VersionException, RepositoryException
- Specified by:
getVersionLabels
in interfaceVersionHistory
- Throws:
VersionException
RepositoryException
-
removeVersion
public void removeVersion(String versionName) throws ReferentialIntegrityException, AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException
- Specified by:
removeVersion
in interfaceVersionHistory
- Throws:
ReferentialIntegrityException
AccessDeniedException
UnsupportedRepositoryOperationException
VersionException
RepositoryException
-
perform
@NotNull protected final <U> U perform(@NotNull @NotNull SessionOperation<U> op) throws RepositoryException
Perform the passedSessionOperation
.- Type Parameters:
U
- return type of the operation- Parameters:
op
- operation to perform- Returns:
- the result of
op.perform()
- Throws:
RepositoryException
- as thrown byop.perform()
.
-
getName
@NotNull public @NotNull String getName() throws RepositoryException
- Specified by:
getName
in interfaceItem
- Throws:
RepositoryException
- See Also:
Item.getName()
-
getPath
@NotNull public @NotNull String getPath() throws RepositoryException
- Specified by:
getPath
in interfaceItem
- Throws:
RepositoryException
- See Also:
Item.getPath()
-
getSession
@NotNull public @NotNull Session getSession()
- Specified by:
getSession
in interfaceItem
-
getAncestor
public Item getAncestor(int depth) throws RepositoryException
- Specified by:
getAncestor
in interfaceItem
- Throws:
RepositoryException
-
getDepth
public int getDepth() throws RepositoryException
- Specified by:
getDepth
in interfaceItem
- Throws:
RepositoryException
-
isSame
public boolean isSame(Item otherItem) throws RepositoryException
- Specified by:
isSame
in interfaceItem
- Throws:
RepositoryException
- See Also:
Item.isSame(javax.jcr.Item)
-
save
public void save() throws RepositoryException
This implementation delegates toSession.save()
ifSAVE_SESSION
istrue
. Otherwise it only performs the save if the subtree rooted at this item contains all transient changes. That is, if callingSession.save()
would have the same effect as calling this method. In all other cases this method will throw anUnsupportedRepositoryOperationException
- Specified by:
save
in interfaceItem
- Throws:
RepositoryException
- See Also:
Item.save()
-
refresh
public void refresh(boolean keepChanges) throws RepositoryException
- Specified by:
refresh
in interfaceItem
- Throws:
RepositoryException
- See Also:
Item.refresh(boolean)
-
createSingleState
@NotNull protected @NotNull PropertyState createSingleState(String oakName, Value value, Type<?> type) throws RepositoryException
- Throws:
RepositoryException
-
createMultiState
@NotNull protected @NotNull PropertyState createMultiState(String oakName, List<Value> values, Type<?> type) throws RepositoryException
- Throws:
RepositoryException
-
-