public abstract class BaseVersionManager extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_RULE
Property name for collection rule.
|
protected static String |
ROOT_VERSION
JCR version store root.
|
static String |
SOURCE_WORKSPACE
Workspace of the source node.
|
static String |
SYSTEM_NODE
Sub-node containing the data used for the version/restore process.
|
static String |
TMP_REFERENCED_NODES
Node which contains stubs for referenced nodes.
|
static String |
VERSION_WORKSPACE
Name of the workspace.
|
Constructor and Description |
---|
BaseVersionManager(SystemContext systemContext,
RepositoryManager repositoryManager,
CopyUtil copyUtil) |
Modifier and Type | Method and Description |
---|---|
javax.jcr.version.Version |
addVersion(javax.jcr.Node node)
Add version of the specified node and all child nodes while ignoring the same node type.
|
javax.jcr.version.Version |
addVersion(javax.jcr.Node node,
Rule rule)
Add version of the specified node and all child nodes based on the given
Rule . |
javax.jcr.version.Version |
addVersion(javax.jcr.Node node,
Rule rule,
String userName)
Add version of the specified node and all child nodes based on the given
Rule and userName . |
protected void |
checkAndAddMixin(javax.jcr.Node node)
Verifies the existence of the mix:versionable and adds it if not.
|
protected void |
createInitialStructure()
Create structure needed for version store workspace.
|
protected javax.jcr.version.Version |
createVersion(javax.jcr.Node node,
Rule rule,
String userName)
Create version of the specified node and all child nodes based on the given
Rule . |
javax.jcr.version.VersionIterator |
getAllVersions(javax.jcr.Node node)
Get all versions.
|
javax.jcr.version.Version |
getBaseVersion(javax.jcr.Node node)
Returns the current base version of given node.
|
protected javax.jcr.Node |
getSystemNode(javax.jcr.Node node)
Get the Magnolia system node created under the given node.
|
protected Rule |
getUsedFilter(javax.jcr.Node versionedNode)
Get Rule used for this version.
|
javax.jcr.version.Version |
getVersion(javax.jcr.Node node,
String name)
Get named version.
|
javax.jcr.Node |
getVersionedNode(javax.jcr.Node node)
Get node from version store.
|
protected javax.jcr.Node |
getVersionedNode(javax.jcr.Session session,
String uuid)
Get node from version store.
|
javax.jcr.version.VersionHistory |
getVersionHistory(javax.jcr.Node node)
Get history of this node as recorded in the version store.
|
boolean |
hasVersion(javax.jcr.Node node) |
abstract boolean |
isInvalidMaxVersions()
Check if max version index is lower then one.
|
void |
removeVersionHistory(javax.jcr.Node node)
Removes all versions of the node associated with given UUID.
|
void |
restore(Content node,
javax.jcr.version.Version version,
boolean removeExisting)
Deprecated.
since 4.5 use
restore(Node, Version, boolean) instead |
void |
restore(javax.jcr.Node node,
javax.jcr.version.Version version,
boolean removeExisting)
Restore specified version.
|
abstract void |
setMaxVersionHistory(javax.jcr.Node node)
Set version history to max version possible.
|
public static final String VERSION_WORKSPACE
public static final String TMP_REFERENCED_NODES
public static final String SYSTEM_NODE
public static final String PROPERTY_RULE
protected static final String ROOT_VERSION
public static final String SOURCE_WORKSPACE
@Inject public BaseVersionManager(SystemContext systemContext, RepositoryManager repositoryManager, CopyUtil copyUtil)
protected void createInitialStructure() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if unable to create magnolia system structurepublic javax.jcr.version.Version addVersion(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public javax.jcr.version.Version addVersion(javax.jcr.Node node, Rule rule) throws javax.jcr.RepositoryException
Rule
. Reads the userName
from the current context.javax.jcr.RepositoryException
public javax.jcr.version.Version addVersion(javax.jcr.Node node, Rule rule, String userName) throws javax.jcr.RepositoryException
Rule
and userName
.javax.jcr.RepositoryException
protected javax.jcr.version.Version createVersion(javax.jcr.Node node, Rule rule, String userName) throws javax.jcr.RepositoryException
Rule
.
This will return null if can't create new version in case when max version index is lower then one
or when content is marked for deletion.node
- to be versionedUnsupportedOperationException
- if repository implementation does not support Versions APIjavax.jcr.RepositoryException
- if any repository error occurspublic abstract boolean isInvalidMaxVersions()
public javax.jcr.Node getVersionedNode(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected javax.jcr.Node getVersionedNode(javax.jcr.Session session, String uuid) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public abstract void setMaxVersionHistory(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if failed to get VersionHistory or fail to removepublic javax.jcr.version.VersionHistory getVersionHistory(javax.jcr.Node node) throws javax.jcr.RepositoryException
UnsupportedOperationException
- if repository implementation does not support Versions APIjavax.jcr.RepositoryException
- if any repository error occurspublic javax.jcr.version.Version getVersion(javax.jcr.Node node, String name) throws javax.jcr.RepositoryException
UnsupportedOperationException
- if repository implementation does not support Versions APIjavax.jcr.RepositoryException
- if any repository error occurspublic javax.jcr.version.Version getBaseVersion(javax.jcr.Node node) throws UnsupportedOperationException, javax.jcr.RepositoryException
UnsupportedOperationException
javax.jcr.RepositoryException
public javax.jcr.version.VersionIterator getAllVersions(javax.jcr.Node node) throws javax.jcr.RepositoryException
UnsupportedOperationException
- if repository implementation does not support Versions APIjavax.jcr.RepositoryException
- if any repository error occurs@Deprecated public void restore(Content node, javax.jcr.version.Version version, boolean removeExisting) throws javax.jcr.RepositoryException
restore(Node, Version, boolean)
insteadnode
- to be restoredversion
- to be usedjavax.jcr.version.VersionException
- if the specified versionName
does not exist in this
node's version historyjavax.jcr.RepositoryException
- if an error occurspublic void restore(javax.jcr.Node node, javax.jcr.version.Version version, boolean removeExisting) throws javax.jcr.RepositoryException
node
- to be restoredversion
- to be usedjavax.jcr.version.VersionException
- if the specified versionName
does not exist in this
node's version historyjavax.jcr.RepositoryException
- if an error occurspublic void removeVersionHistory(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if fails to remove versioned node from the version storepublic boolean hasVersion(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void checkAndAddMixin(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected Rule getUsedFilter(javax.jcr.Node versionedNode) throws IOException, ClassNotFoundException, javax.jcr.RepositoryException
IOException
ClassNotFoundException
javax.jcr.RepositoryException
protected javax.jcr.Node getSystemNode(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if failed to create system nodeCopyright © 2003–2017 Magnolia International Ltd.. All rights reserved.