info.magnolia.cms.core.version
Class BaseVersionManager

java.lang.Object
  extended by info.magnolia.cms.core.version.BaseVersionManager
Direct Known Subclasses:
VersionManager

public abstract class BaseVersionManager
extends java.lang.Object

Author:
Sameer Charles $Id$

Field Summary
static java.lang.String PROPERTY_RULE
          property name for collection rule
protected static java.lang.String ROOT_VERSION
          jcr root version
protected static java.lang.String SYSTEM_NODE
          version system node, holds this node version specific data
static java.lang.String TMP_REFERENCED_NODES
          version workspace system path
static java.lang.String VERSION_WORKSPACE
          version data base
 
Constructor Summary
BaseVersionManager()
           
 
Method Summary
 javax.jcr.version.Version addVersion(Content node)
          add version of the specified node and all child nodes while ignoring the same node type
 javax.jcr.version.Version addVersion(Content node, Rule rule)
          add version of the specified node and all child nodes while ignoring the same node type
protected  void checkAndAddMixin(Content node)
          Veryfies 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(Content node, Rule rule)
          create version of the specified node and all child nodes based on the given Rule
protected  java.util.List getAccessManagerPermissions()
          get access manager permission list
 javax.jcr.version.VersionIterator getAllVersions(Content node)
          get all versions
 javax.jcr.version.Version getBaseVersion(Content node)
          Returns the current base version of given node
protected  HierarchyManager getHierarchyManager()
          get version store hierarchy manager
protected  Content getSystemNode(Content node)
          get magnolia system node created under the given node
protected  Rule getUsedFilter(Content versionedNode)
          get Rule used for this version
 javax.jcr.version.Version getVersion(Content node, java.lang.String name)
          get named version
 Content getVersionedNode(Content node)
          get node from version store
protected  Content getVersionedNode(java.lang.String uuid)
          get node from version store
 javax.jcr.version.VersionHistory getVersionHistory(Content node)
          get history of this node as recorded in the version store
protected  void impersonateAccessManager(java.util.List permissions)
          impersonate to be access manager with system rights
abstract  boolean isInvalidMaxVersions()
          check if version index is set to negative number
 void removeVersionHistory(java.lang.String uuid)
          Removes all versions of the node associated with given UUID
 void restore(Content node, javax.jcr.version.Version version, boolean removeExisting)
          restore specified version
protected  void revertAccessManager(java.util.List permissions)
          revert access manager permissions
abstract  void setMaxVersionHistory(Content node)
          set version history to max version possible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_WORKSPACE

public static final java.lang.String VERSION_WORKSPACE
version data base

See Also:
Constant Field Values

TMP_REFERENCED_NODES

public static final java.lang.String TMP_REFERENCED_NODES
version workspace system path

See Also:
Constant Field Values

SYSTEM_NODE

protected static final java.lang.String SYSTEM_NODE
version system node, holds this node version specific data

See Also:
Constant Field Values

PROPERTY_RULE

public static final java.lang.String PROPERTY_RULE
property name for collection rule

See Also:
Constant Field Values

ROOT_VERSION

protected static final java.lang.String ROOT_VERSION
jcr root version

See Also:
Constant Field Values
Constructor Detail

BaseVersionManager

public BaseVersionManager()
Method Detail

createInitialStructure

protected void createInitialStructure()
                               throws javax.jcr.RepositoryException
create structure needed for version store workspace

Throws:
javax.jcr.RepositoryException - if unable to create magnolia system structure

addVersion

public javax.jcr.version.Version addVersion(Content node)
                                     throws javax.jcr.UnsupportedRepositoryOperationException,
                                            javax.jcr.RepositoryException
add version of the specified node and all child nodes while ignoring the same node type

Parameters:
node - to be versioned
Returns:
newly created version node
Throws:
java.lang.UnsupportedOperationException - if repository implementation does not support Versions API
javax.jcr.RepositoryException - if any repository error occurs
javax.jcr.UnsupportedRepositoryOperationException

addVersion

public javax.jcr.version.Version addVersion(Content node,
                                            Rule rule)
                                     throws javax.jcr.UnsupportedRepositoryOperationException,
                                            javax.jcr.RepositoryException
add version of the specified node and all child nodes while ignoring the same node type

Parameters:
node - to be versioned
Returns:
newly created version node
Throws:
java.lang.UnsupportedOperationException - if repository implementation does not support Versions API
javax.jcr.RepositoryException - if any repository error occurs
javax.jcr.UnsupportedRepositoryOperationException

createVersion

protected javax.jcr.version.Version createVersion(Content node,
                                                  Rule rule)
                                           throws javax.jcr.UnsupportedRepositoryOperationException,
                                                  javax.jcr.RepositoryException
create version of the specified node and all child nodes based on the given Rule

Parameters:
node - to be versioned
rule -
Returns:
newly created version node
Throws:
java.lang.UnsupportedOperationException - if repository implementation does not support Versions API
javax.jcr.RepositoryException - if any repository error occurs
javax.jcr.UnsupportedRepositoryOperationException

isInvalidMaxVersions

public abstract boolean isInvalidMaxVersions()
check if version index is set to negative number


getVersionedNode

public Content getVersionedNode(Content node)
                         throws javax.jcr.RepositoryException
get node from version store

Parameters:
node -
Throws:
javax.jcr.RepositoryException

getVersionedNode

protected Content getVersionedNode(java.lang.String uuid)
                            throws javax.jcr.RepositoryException
get node from version store

Parameters:
uuid -
Throws:
javax.jcr.RepositoryException

setMaxVersionHistory

public abstract void setMaxVersionHistory(Content node)
                                   throws javax.jcr.RepositoryException
set version history to max version possible

Parameters:
node -
Throws:
javax.jcr.RepositoryException - if failed to get VersionHistory or fail to remove

getVersionHistory

public javax.jcr.version.VersionHistory getVersionHistory(Content node)
                                                   throws javax.jcr.UnsupportedRepositoryOperationException,
                                                          javax.jcr.RepositoryException
get history of this node as recorded in the version store

Parameters:
node -
Returns:
version history of the given node
Throws:
java.lang.UnsupportedOperationException - if repository implementation does not support Versions API
javax.jcr.RepositoryException - if any repository error occurs
javax.jcr.UnsupportedRepositoryOperationException

getVersion

public javax.jcr.version.Version getVersion(Content node,
                                            java.lang.String name)
                                     throws javax.jcr.UnsupportedRepositoryOperationException,
                                            javax.jcr.RepositoryException
get named version

Parameters:
node -
name -
Returns:
version node
Throws:
java.lang.UnsupportedOperationException - if repository implementation does not support Versions API
javax.jcr.RepositoryException - if any repository error occurs
javax.jcr.UnsupportedRepositoryOperationException

getBaseVersion

public javax.jcr.version.Version getBaseVersion(Content node)
                                         throws java.lang.UnsupportedOperationException,
                                                javax.jcr.RepositoryException
Returns the current base version of given node

Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
java.lang.UnsupportedOperationException

getAllVersions

public javax.jcr.version.VersionIterator getAllVersions(Content node)
                                                 throws javax.jcr.UnsupportedRepositoryOperationException,
                                                        javax.jcr.RepositoryException
get all versions

Parameters:
node -
Returns:
Version iterator retreived from version history
Throws:
java.lang.UnsupportedOperationException - if repository implementation does not support Versions API
javax.jcr.RepositoryException - if any repository error occurs
javax.jcr.UnsupportedRepositoryOperationException

restore

public void restore(Content node,
                    javax.jcr.version.Version version,
                    boolean removeExisting)
             throws javax.jcr.version.VersionException,
                    javax.jcr.UnsupportedRepositoryOperationException,
                    javax.jcr.RepositoryException
restore specified version

Parameters:
node - to be restored
version - to be used
removeExisting -
Throws:
javax.jcr.version.VersionException - if the specified versionName does not exist in this node's version history
javax.jcr.RepositoryException - if an error occurs
javax.jcr.version.VersionException
javax.jcr.UnsupportedRepositoryOperationException

removeVersionHistory

public void removeVersionHistory(java.lang.String uuid)
                          throws javax.jcr.RepositoryException
Removes all versions of the node associated with given UUID

Parameters:
uuid -
Throws:
javax.jcr.RepositoryException - if fails to remove versioned node from the version store

checkAndAddMixin

protected void checkAndAddMixin(Content node)
                         throws javax.jcr.RepositoryException
Veryfies the existence of the mix:versionable and adds it if not.

Throws:
javax.jcr.RepositoryException

getUsedFilter

protected Rule getUsedFilter(Content versionedNode)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException,
                             javax.jcr.RepositoryException
get Rule used for this version

Parameters:
versionedNode -
Throws:
java.io.IOException
java.lang.ClassNotFoundException
javax.jcr.RepositoryException

getSystemNode

protected Content getSystemNode(Content node)
                         throws javax.jcr.RepositoryException
get magnolia system node created under the given node

Parameters:
node -
Throws:
javax.jcr.RepositoryException - if failed to create system node

impersonateAccessManager

protected void impersonateAccessManager(java.util.List permissions)
impersonate to be access manager with system rights

Parameters:
permissions -

revertAccessManager

protected void revertAccessManager(java.util.List permissions)
revert access manager permissions

Parameters:
permissions -

getAccessManagerPermissions

protected java.util.List getAccessManagerPermissions()
get access manager permission list


getHierarchyManager

protected HierarchyManager getHierarchyManager()
get version store hierarchy manager



Copyright © 2003-2010 Magnolia International Ltd.. All Rights Reserved.