Class VersionImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.jcr.session.NodeImpl<VersionDelegate>
-
- org.apache.jackrabbit.oak.jcr.version.VersionImpl
-
- All Implemented Interfaces:
Item
,Node
,Version
,JackrabbitNode
public class VersionImpl extends NodeImpl<VersionDelegate> implements Version
-
-
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 VersionImpl(VersionDelegate dlg, SessionContext sessionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected @NotNull PropertyState
createMultiState(String oakName, List<Value> values, Type<?> type)
protected @NotNull PropertyState
createSingleState(String oakName, Value value, Type<?> type)
Item
getAncestor(int depth)
VersionHistory
getContainingHistory()
Calendar
getCreated()
int
getDepth()
Node
getFrozenNode()
Version
getLinearPredecessor()
Version
getLinearSuccessor()
@NotNull String
getName()
@NotNull String
getPath()
Version[]
getPredecessors()
@NotNull Session
getSession()
Version[]
getSuccessors()
boolean
isSame(Item otherItem)
protected <U> U
perform(@NotNull SessionOperation<U> op)
Perform the passedSessionOperation
.void
refresh(boolean keepChanges)
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
-
VersionImpl
public VersionImpl(VersionDelegate dlg, SessionContext sessionContext)
-
-
Method Detail
-
getContainingHistory
public VersionHistory getContainingHistory() throws RepositoryException
- Specified by:
getContainingHistory
in interfaceVersion
- Throws:
RepositoryException
-
getCreated
public Calendar getCreated() throws RepositoryException
- Specified by:
getCreated
in interfaceVersion
- Throws:
RepositoryException
-
getLinearPredecessor
public Version getLinearPredecessor() throws RepositoryException
- Specified by:
getLinearPredecessor
in interfaceVersion
- Throws:
RepositoryException
-
getLinearSuccessor
public Version getLinearSuccessor() throws RepositoryException
- Specified by:
getLinearSuccessor
in interfaceVersion
- Throws:
RepositoryException
-
getPredecessors
public Version[] getPredecessors() throws RepositoryException
- Specified by:
getPredecessors
in interfaceVersion
- Throws:
RepositoryException
-
getSuccessors
public Version[] getSuccessors() throws RepositoryException
- Specified by:
getSuccessors
in interfaceVersion
- Throws:
RepositoryException
-
getFrozenNode
public Node getFrozenNode() throws RepositoryException
- Specified by:
getFrozenNode
in interfaceVersion
- Throws:
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
-
-