public abstract class VersionManagerImplBase extends Object
This class provides basic routines for all operations and the methods related to checkin and checkout.
Modifier and Type | Class and Description |
---|---|
class |
VersionManagerImplBase.WriteOperation
Helper for managing write operations.
|
Modifier and Type | Field and Description |
---|---|
protected SessionContext |
context
Component context of the current session
|
protected NodeId |
currentActivity
the node id of the current activity
|
protected HierarchyManager |
hierMgr
hierarchy manager that operates on the locale state manager
|
protected NodeTypeRegistry |
ntReg
node type registry
|
protected SessionImpl |
session
workspace session
|
protected UpdatableItemStateManager |
stateMgr
item state manager for all workspace operations
|
protected InternalVersionManager |
vMgr
the session version manager.
|
Modifier | Constructor and Description |
---|---|
protected |
VersionManagerImplBase(SessionContext context,
UpdatableItemStateManager stateMgr,
HierarchyManager hierMgr)
Creates a new version manager base for the given session
|
Modifier and Type | Method and Description |
---|---|
protected VersioningLock.ReadLock |
acquireReadLock()
acquires the read lock on this version manager.
|
protected VersioningLock.WriteLock |
acquireWriteLock()
Acquires the write lock on this version manager.
|
protected void |
checkModify(NodeImpl node,
int options,
int permissions)
Checks modify and permissions
|
protected void |
checkModify(NodeStateEx state,
int options,
int permissions)
Checks modify and permissions
|
protected NodeId |
checkoutCheckin(NodeStateEx state,
boolean checkin,
boolean checkout,
Calendar created)
Performs a checkin or checkout operation.
|
protected boolean |
checkVersionable(NodeStateEx state)
Checks if the underlying node is versionable, i.e.
|
protected InternalVersion |
getBaseVersion(NodeStateEx state)
Returns the internal base version for the underlying node.
|
protected NodeId |
getBaseVersionId(NodeStateEx state)
Returns the node id of the base version, retrieved from the node state
|
protected NodeStateEx |
getNodeStateEx(NodeId nodeId)
returns the node state for the given node id
|
protected InternalVersion |
getVersion(Version v)
helper class that returns the internal version for a JCR one.
|
protected InternalVersionHistory |
getVersionHistory(NodeStateEx state)
Returns the internal version history for the underlying node.
|
protected boolean |
isCheckedOut(NodeStateEx state)
Determines the checked-out status of the given node state.
|
protected String |
safeGetJCRPath(NodeStateEx state)
Returns the JCR path for the given node state without throwing an exception.
|
VersionManagerImplBase.WriteOperation |
startWriteOperation()
Starts a write operation by acquiring the write lock and setting the
item state manager to the "edit" state.
|
protected final SessionContext context
protected final SessionImpl session
protected final UpdatableItemStateManager stateMgr
protected final HierarchyManager hierMgr
protected final NodeTypeRegistry ntReg
protected final InternalVersionManager vMgr
protected NodeId currentActivity
protected VersionManagerImplBase(SessionContext context, UpdatableItemStateManager stateMgr, HierarchyManager hierMgr)
context
- component context of the current sessionstateMgr
- the underlying state managerhierMgr
- local hierarchy managerprotected NodeId checkoutCheckin(NodeStateEx state, boolean checkin, boolean checkout, Calendar created) throws RepositoryException
checkin
is
true
the node is checked in. if checkout
is
true
the node is checked out. if both flags are true
the checkin is performed prior to the checkout and the operation is
equivalent to a checkpoint operation.state
- node statecheckin
- if true
the node is checked in.checkout
- if true
the node is checked out.created
- create time of the new version (if any),
or null
for the current timenull
for a pure
checkout.RepositoryException
- if an error occursprotected boolean checkVersionable(NodeStateEx state) throws UnsupportedRepositoryOperationException, RepositoryException
state
- node statetrue
if this node is full versionable, i.e. is
of nodetype mix:versionableUnsupportedRepositoryOperationException
- if this node is not versionable at allRepositoryException
protected String safeGetJCRPath(NodeStateEx state)
state
- node stateprotected boolean isCheckedOut(NodeStateEx state) throws RepositoryException
A node is considered checked-out if it is versionable and checked-out, or is non-versionable but its nearest versionable ancestor is checked-out, or is non-versionable and there are no versionable ancestors.
state
- node stateRepositoryException
- if an error occursVersionManager.isCheckedOut(String)
,
Node.isCheckedOut()
protected NodeId getBaseVersionId(NodeStateEx state)
state
- node statenull
if not definedprotected InternalVersionHistory getVersionHistory(NodeStateEx state) throws RepositoryException
state
- node stateRepositoryException
- if an error occursprotected InternalVersion getVersion(Version v) throws RepositoryException
v
- the jcr versionRepositoryException
- if an error occursprotected InternalVersion getBaseVersion(NodeStateEx state) throws RepositoryException
state
- node stateRepositoryException
- if an error occursprotected NodeStateEx getNodeStateEx(NodeId nodeId) throws RepositoryException
nodeId
- the node idRepositoryException
- if an error occursprotected void checkModify(NodeStateEx state, int options, int permissions) throws RepositoryException
state
- state to checkoptions
- options to checkpermissions
- permissions to checkRepositoryException
- if an error occursprotected void checkModify(NodeImpl node, int options, int permissions) throws RepositoryException
node
- node to checkoptions
- options to checkpermissions
- permissions to checkRepositoryException
- if an error occursprotected VersioningLock.WriteLock acquireWriteLock()
protected VersioningLock.ReadLock acquireReadLock()
public VersionManagerImplBase.WriteOperation startWriteOperation() throws RepositoryException
The pattern for using this method and the returned helper instance is:
WriteOperation operation = startWriteOperation(); try { ... operation.save(); // if everything is OK ... } catch (...) { ... } finally { operation.close(); }
RepositoryException
- if the write operation could not be startedCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.