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 Tdlgstatic StringITEM_SAVE_DOES_SESSION_SAVEstatic intMV_PROPERTY_WARN_THRESHOLDstatic booleanSAVE_SESSIONThe value of this flag determines the behaviour ofItem.save().protected SessionContextsessionContextprotected SessionDelegatesessionDelegate-
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 voidaddVersionLabel(String versionName, String label, boolean moveLabel)protected @NotNull PropertyStatecreateMultiState(String oakName, List<Value> values, Type<?> type)protected @NotNull PropertyStatecreateSingleState(String oakName, Value value, Type<?> type)NodeIteratorgetAllFrozenNodes()NodeIteratorgetAllLinearFrozenNodes()VersionIteratorgetAllLinearVersions()VersionIteratorgetAllVersions()ItemgetAncestor(int depth)intgetDepth()@NotNull StringgetName()@NotNull StringgetPath()VersiongetRootVersion()@NotNull SessiongetSession()VersiongetVersion(String versionName)StringgetVersionableIdentifier()StringgetVersionableUUID()VersiongetVersionByLabel(String label)String[]getVersionLabels()String[]getVersionLabels(Version version)booleanhasVersionLabel(String label)booleanhasVersionLabel(Version version, String label)booleanisSame(Item otherItem)protected <U> Uperform(@NotNull SessionOperation<U> op)Perform the passedSessionOperation.voidrefresh(boolean keepChanges)voidremoveVersion(String versionName)voidremoveVersionLabel(String label)voidsave()StringtoString()-
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, getParentOrNull, 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 aUnsupportedRepositoryOperationExceptionif 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:
getVersionableUUIDin interfaceVersionHistory- Throws:
RepositoryException
-
getVersionableIdentifier
public String getVersionableIdentifier() throws RepositoryException
- Specified by:
getVersionableIdentifierin interfaceVersionHistory- Throws:
RepositoryException
-
getRootVersion
public Version getRootVersion() throws RepositoryException
- Specified by:
getRootVersionin interfaceVersionHistory- Throws:
RepositoryException
-
getAllLinearVersions
public VersionIterator getAllLinearVersions() throws RepositoryException
- Specified by:
getAllLinearVersionsin interfaceVersionHistory- Throws:
RepositoryException
-
getAllVersions
public VersionIterator getAllVersions() throws RepositoryException
- Specified by:
getAllVersionsin interfaceVersionHistory- Throws:
RepositoryException
-
getAllLinearFrozenNodes
public NodeIterator getAllLinearFrozenNodes() throws RepositoryException
- Specified by:
getAllLinearFrozenNodesin interfaceVersionHistory- Throws:
RepositoryException
-
getAllFrozenNodes
public NodeIterator getAllFrozenNodes() throws RepositoryException
- Specified by:
getAllFrozenNodesin interfaceVersionHistory- Throws:
RepositoryException
-
getVersion
public Version getVersion(String versionName) throws VersionException, RepositoryException
- Specified by:
getVersionin interfaceVersionHistory- Throws:
VersionExceptionRepositoryException
-
getVersionByLabel
public Version getVersionByLabel(String label) throws VersionException, RepositoryException
- Specified by:
getVersionByLabelin interfaceVersionHistory- Throws:
VersionExceptionRepositoryException
-
addVersionLabel
public void addVersionLabel(String versionName, String label, boolean moveLabel) throws LabelExistsVersionException, VersionException, RepositoryException
- Specified by:
addVersionLabelin interfaceVersionHistory- Throws:
LabelExistsVersionExceptionVersionExceptionRepositoryException
-
removeVersionLabel
public void removeVersionLabel(String label) throws VersionException, RepositoryException
- Specified by:
removeVersionLabelin interfaceVersionHistory- Throws:
VersionExceptionRepositoryException
-
hasVersionLabel
public boolean hasVersionLabel(String label) throws RepositoryException
- Specified by:
hasVersionLabelin interfaceVersionHistory- Throws:
RepositoryException
-
hasVersionLabel
public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException
- Specified by:
hasVersionLabelin interfaceVersionHistory- Throws:
VersionExceptionRepositoryException
-
getVersionLabels
public String[] getVersionLabels() throws RepositoryException
- Specified by:
getVersionLabelsin interfaceVersionHistory- Throws:
RepositoryException
-
getVersionLabels
public String[] getVersionLabels(Version version) throws VersionException, RepositoryException
- Specified by:
getVersionLabelsin interfaceVersionHistory- Throws:
VersionExceptionRepositoryException
-
removeVersion
public void removeVersion(String versionName) throws ReferentialIntegrityException, AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException
- Specified by:
removeVersionin interfaceVersionHistory- Throws:
ReferentialIntegrityExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionVersionExceptionRepositoryException
-
perform
@NotNull protected final <U> U perform(@NotNull @NotNull SessionOperation<U> op) throws RepositoryExceptionPerform 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:
getNamein interfaceItem- Throws:
RepositoryException- See Also:
Item.getName()
-
getPath
@NotNull public @NotNull String getPath() throws RepositoryException
- Specified by:
getPathin interfaceItem- Throws:
RepositoryException- See Also:
Item.getPath()
-
getSession
@NotNull public @NotNull Session getSession()
- Specified by:
getSessionin interfaceItem
-
getAncestor
public Item getAncestor(int depth) throws RepositoryException
- Specified by:
getAncestorin interfaceItem- Throws:
RepositoryException
-
getDepth
public int getDepth() throws RepositoryException- Specified by:
getDepthin interfaceItem- Throws:
RepositoryException
-
isSame
public boolean isSame(Item otherItem) throws RepositoryException
- Specified by:
isSamein interfaceItem- Throws:
RepositoryException- See Also:
Item.isSame(javax.jcr.Item)
-
save
public void save() throws RepositoryExceptionThis implementation delegates toSession.save()ifSAVE_SESSIONistrue. 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:
savein interfaceItem- Throws:
RepositoryException- See Also:
Item.save()
-
refresh
public void refresh(boolean keepChanges) throws RepositoryException- Specified by:
refreshin 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
-
-