info.magnolia.cms.core.version
Class ContentVersion

java.lang.Object
  extended by info.magnolia.cms.core.ContentHandler
      extended by info.magnolia.cms.core.AbstractContent
          extended by info.magnolia.cms.core.DefaultContent
              extended by info.magnolia.cms.core.version.ContentVersion
All Implemented Interfaces:
Content, java.lang.Cloneable

public class ContentVersion
extends DefaultContent

Author:
Sameer Charles $Id: ContentVersion.java 32886 2010-03-17 08:00:02Z had $

Nested Class Summary
 
Nested classes/interfaces inherited from interface info.magnolia.cms.core.Content
Content.ContentFilter
 
Field Summary
static java.lang.String NAME
          name of the base node
static java.lang.String VERSION_USER
          user who created this version
 
Fields inherited from class info.magnolia.cms.core.DefaultContent
node
 
Fields inherited from class info.magnolia.cms.core.ContentHandler
hierarchyManager
 
Constructor Summary
ContentVersion(javax.jcr.version.Version thisVersion, AbstractContent base)
          package private constructor
 
Method Summary
 void addMixin(java.lang.String type)
          add specified mixin type if allowed
 javax.jcr.version.Version addVersion()
          add version leaving the node checked out
 javax.jcr.version.Version addVersion(Rule rule)
          add version leaving the node checked out
 Content createContent(java.lang.String name)
          create Content node under the current node with the specified name
 Content createContent(java.lang.String name, ItemType contentType)
          Create Content node under the current node with the specified name.
 Content createContent(java.lang.String name, java.lang.String contentType)
          create Content node under the current node with the specified name
 NodeData createNodeData(java.lang.String name)
          create top level NodeData object
 NodeData createNodeData(java.lang.String name, int type)
          create top level NodeData object
 NodeData createNodeData(java.lang.String name, javax.jcr.Value value)
          Create NodeData with the given value and type.
 NodeData createNodeData(java.lang.String name, javax.jcr.Value value, int type)
          Create NodeData with the given value and type.
 void delete()
          Remove this path
 void delete(java.lang.String path)
          Remove specified path
 void deleteNodeData(java.lang.String name)
          delete NodeData with the specified name
 AccessManager getAccessManager()
          Deprecated. use getHierarchyManager instead
 javax.jcr.version.VersionIterator getAllVersions()
           
 Content getAncestor(int level)
          get absolute parent object starting from the root node
 java.util.Collection<Content> getAncestors()
          Convenience method for taglib
 ContentVersion getBaseVersion()
          get the current base version of this node
 java.util.Collection<Content> getChildren()
          gets a Collection containing all child nodes of the same NodeType as "this" object.
 java.util.Collection<Content> getChildren(ItemType contentType)
          Get collection of specified content type
 java.util.Collection<Content> getChildren(java.lang.String contentType)
          Get collection of specified content type
 java.util.Collection<Content> getChildren(java.lang.String contentType, java.lang.String namePattern)
          Get collection of specified content type.
 javax.jcr.version.VersionHistory getContainingHistory()
          Get containing version history
 Content getContent(java.lang.String name)
          Gets the Content node of the current node with the specified name.
 java.util.Calendar getCreated()
          Get creation date of this version
 java.lang.String getHandle()
          get original path of this versioned content
 HierarchyManager getHierarchyManager()
          Get hierarchy manager if previously set for this object
 int getIndex()
          This method returns the index of this node within the ordered set of its same-name sibling nodes.
 int getLevel()
          get node level from the ROOT node : FIXME implement getDepth in javax.jcr
 javax.jcr.lock.Lock getLock()
          Returns the Lock object that applies to this node.
 java.lang.String getName()
          The original name of the node.
 javax.jcr.nodetype.NodeType getNodeType()
          returns primary node type definition of the associated Node of this object
 Content getParent()
          get parent content object
 java.lang.String getUserName()
          The name of the user who created this version
 java.lang.String getUUID()
          UUID of the node refrenced by this object
 ContentVersion getVersionedContent(java.lang.String versionName)
          get content view over the jcr version object
 ContentVersion getVersionedContent(javax.jcr.version.Version version)
          get content view over the jcr version object
 javax.jcr.version.VersionHistory getVersionHistory()
           
 java.lang.String getVersionLabel()
          Return the name of the version represented by this object
 javax.jcr.Workspace getWorkspace()
          get workspace to which this node attached to.
 boolean hasChildren()
           
 boolean hasChildren(java.lang.String contentType)
           
 boolean holdsLock()
          Returns true if this node holds a lock; otherwise returns false.
 boolean isGranted(long permissions)
          checks for the allowed access rights
 boolean isLocked()
          Returns true if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returns false.
 boolean isModified()
          Returns true if this Item has been saved but has subsequently been modified through the current session and therefore the state of this item as recorded in the session differs from the state of this item as saved.
 javax.jcr.lock.Lock lock(boolean isDeep, boolean isSessionScoped)
          places a lock on this object
 javax.jcr.lock.Lock lock(boolean isDeep, boolean isSessionScoped, long yieldFor)
          places a lock on this object
 void orderBefore(java.lang.String srcName, java.lang.String beforeName)
          move current node to the specified location above the named beforename
 void removeMixin(java.lang.String type)
          Removes the specified mixin node type from this node.
 void restore(java.lang.String versionName, boolean removeExisting)
          Restores this node to the state defined by the version with the specified versionName.
 void restore(javax.jcr.version.Version version, boolean removeExisting)
          Restores this node to the state defined by the specified version.
 void restore(javax.jcr.version.Version version, java.lang.String relPath, boolean removeExisting)
          Restores the specified version to relPath, relative to this node.
 void restoreByLabel(java.lang.String versionLabel, boolean removeExisting)
          Restores this node to the state recorded in the version specified by versionLabel.
 void save()
          Persists all changes to the repository if validation succeds
 void unlock()
          Removes the lock on this node.
 void updateMetaData()
          you could call this method anytime to update working page properties - Modification date & Author ID
 
Methods inherited from class info.magnolia.cms.core.DefaultContent
determineNodeDataType, getChildren, getItemType, getJCRNode, getMetaData, getMixinNodeTypes, getNodeDataCollection, getNodeTypeName, getPrimitiveNodeDatas, hasContent, hasMetaData, hasNodeData, isCheckedOut, isNodeType, isNodeType, newNodeDataInstance, refresh, removeVersionHistory, setNode, setPath, setRootNode
 
Methods inherited from class info.magnolia.cms.core.AbstractContent
createNodeData, createNodeData, getBinaryNodeDatas, getChildByName, getChildren, getChildren, getNodeData, getNodeDataCollection, getTemplate, getTitle, isNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, toString
 
Methods inherited from class info.magnolia.cms.core.ContentHandler
clone, setAccessManager, setHierarchyManager
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION_USER

public static final java.lang.String VERSION_USER
user who created this version

See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
name of the base node

See Also:
Constant Field Values
Constructor Detail

ContentVersion

public ContentVersion(javax.jcr.version.Version thisVersion,
                      AbstractContent base)
               throws javax.jcr.RepositoryException
package private constructor

Parameters:
thisVersion -
base - content on which this version is based on
Throws:
javax.jcr.RepositoryException
Method Detail

getCreated

public java.util.Calendar getCreated()
                              throws javax.jcr.RepositoryException
Get creation date of this version

Returns:
creation date as calendar
Throws:
javax.jcr.RepositoryException

getVersionLabel

public java.lang.String getVersionLabel()
                                 throws javax.jcr.RepositoryException
Return the name of the version represented by this object

Returns:
the versions name
Throws:
javax.jcr.RepositoryException

getContainingHistory

public javax.jcr.version.VersionHistory getContainingHistory()
                                                      throws javax.jcr.RepositoryException
Get containing version history

Returns:
version history associated to this version
Throws:
javax.jcr.RepositoryException

getName

public java.lang.String getName()
The original name of the node.

Specified by:
getName in interface Content
Overrides:
getName in class DefaultContent
Returns:
String name of the current Node

getUserName

public java.lang.String getUserName()
The name of the user who created this version


getHandle

public java.lang.String getHandle()
get original path of this versioned content

Specified by:
getHandle in interface Content
Overrides:
getHandle in class DefaultContent
Returns:
String representing path (handle) of the content

getContent

public Content getContent(java.lang.String name)
                   throws javax.jcr.PathNotFoundException,
                          javax.jcr.RepositoryException,
                          AccessDeniedException
Description copied from interface: Content
Gets the Content node of the current node with the specified name.

Specified by:
getContent in interface Content
Overrides:
getContent in class DefaultContent
Parameters:
name - of the node acting as Content
Returns:
Content
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException - if an error occurs
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createContent

public Content createContent(java.lang.String name)
                      throws AccessDeniedException
create Content node under the current node with the specified name

Specified by:
createContent in interface Content
Overrides:
createContent in class AbstractContent
Parameters:
name - of the node to be created as Content
Returns:
newly created Content
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createContent

public Content createContent(java.lang.String name,
                             java.lang.String contentType)
                      throws AccessDeniedException
create Content node under the current node with the specified name

Specified by:
createContent in interface Content
Overrides:
createContent in class DefaultContent
Parameters:
name - of the node to be created as Content
contentType - JCR node type as configured
Returns:
newly created Content
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createContent

public Content createContent(java.lang.String name,
                             ItemType contentType)
                      throws AccessDeniedException
Create Content node under the current node with the specified name.

Specified by:
createContent in interface Content
Overrides:
createContent in class AbstractContent
Parameters:
name - of the node to be created as Content
contentType - ItemType
Returns:
newly created Content
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createNodeData

public NodeData createNodeData(java.lang.String name)
                        throws AccessDeniedException
create top level NodeData object

Specified by:
createNodeData in interface Content
Overrides:
createNodeData in class AbstractContent
Parameters:
name - to be created
Returns:
NodeData requested NodeData object
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createNodeData

public NodeData createNodeData(java.lang.String name,
                               javax.jcr.Value value,
                               int type)
                        throws AccessDeniedException
Create NodeData with the given value and type.

Parameters:
name - to be created
value - to be set initially
type - propertyType
Returns:
NodeData requested NodeData object
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createNodeData

public NodeData createNodeData(java.lang.String name,
                               javax.jcr.Value value)
                        throws AccessDeniedException
Create NodeData with the given value and type.

Specified by:
createNodeData in interface Content
Overrides:
createNodeData in class AbstractContent
Parameters:
name - to be created
value - to be set initially
Returns:
NodeData requested NodeData object
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

createNodeData

public NodeData createNodeData(java.lang.String name,
                               int type)
                        throws AccessDeniedException
create top level NodeData object

Specified by:
createNodeData in interface Content
Overrides:
createNodeData in class AbstractContent
Parameters:
name - to be created
type - propertyType
Returns:
NodeData requested NodeData object
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

deleteNodeData

public void deleteNodeData(java.lang.String name)
                    throws javax.jcr.RepositoryException
delete NodeData with the specified name

Specified by:
deleteNodeData in interface Content
Overrides:
deleteNodeData in class AbstractContent
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.PathNotFoundException

updateMetaData

public void updateMetaData()
                    throws AccessDeniedException
you could call this method anytime to update working page properties - Modification date & Author ID

Specified by:
updateMetaData in interface Content
Overrides:
updateMetaData in class AbstractContent
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation

getChildren

public java.util.Collection<Content> getChildren()
gets a Collection containing all child nodes of the same NodeType as "this" object.

Specified by:
getChildren in interface Content
Overrides:
getChildren in class AbstractContent
Returns:
Collection of content objects

getChildren

public java.util.Collection<Content> getChildren(java.lang.String contentType)
Get collection of specified content type

Specified by:
getChildren in interface Content
Overrides:
getChildren in class AbstractContent
Parameters:
contentType - JCR node type as configured
Returns:
Collection of content nodes

getChildren

public java.util.Collection<Content> getChildren(ItemType contentType)
Get collection of specified content type

Specified by:
getChildren in interface Content
Overrides:
getChildren in class AbstractContent
Parameters:
contentType - ItemType
Returns:
Collection of content nodes

getChildren

public java.util.Collection<Content> getChildren(java.lang.String contentType,
                                                 java.lang.String namePattern)
Get collection of specified content type.

Specified by:
getChildren in interface Content
Overrides:
getChildren in class AbstractContent
Parameters:
contentType - JCR node type as configured
namePattern -
Returns:
Collection of content nodes

hasChildren

public boolean hasChildren()
Specified by:
hasChildren in interface Content
Overrides:
hasChildren in class AbstractContent
Returns:
Boolean, if sub node(s) exists

hasChildren

public boolean hasChildren(java.lang.String contentType)
Specified by:
hasChildren in interface Content
Overrides:
hasChildren in class AbstractContent
Parameters:
contentType - JCR node type as configured
Returns:
Boolean, if sub collectionType exists

getParent

public Content getParent()
                  throws javax.jcr.PathNotFoundException,
                         javax.jcr.RepositoryException,
                         AccessDeniedException
get parent content object

Specified by:
getParent in interface Content
Overrides:
getParent in class DefaultContent
Returns:
Content representing parent node
Throws:
javax.jcr.PathNotFoundException
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation
javax.jcr.RepositoryException - if an error occurs

getAncestor

public Content getAncestor(int level)
                    throws javax.jcr.PathNotFoundException,
                           javax.jcr.RepositoryException,
                           AccessDeniedException
get absolute parent object starting from the root node

Specified by:
getAncestor in interface Content
Overrides:
getAncestor in class DefaultContent
Parameters:
level - level at which the requested node exist, relative to the ROOT node
Returns:
Content representing parent node
Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation
javax.jcr.RepositoryException - if an error occurs
javax.jcr.PathNotFoundException

getAncestors

public java.util.Collection<Content> getAncestors()
                                           throws javax.jcr.PathNotFoundException,
                                                  javax.jcr.RepositoryException
Convenience method for taglib

Specified by:
getAncestors in interface Content
Overrides:
getAncestors in class DefaultContent
Returns:
Content representing node on level 0
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.PathNotFoundException

getLevel

public int getLevel()
             throws javax.jcr.PathNotFoundException,
                    javax.jcr.RepositoryException
get node level from the ROOT node : FIXME implement getDepth in javax.jcr

Specified by:
getLevel in interface Content
Overrides:
getLevel in class DefaultContent
Returns:
level at which current node exist, relative to the ROOT node
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException - if an error occurs

orderBefore

public void orderBefore(java.lang.String srcName,
                        java.lang.String beforeName)
                 throws javax.jcr.RepositoryException
move current node to the specified location above the named beforename

Specified by:
orderBefore in interface Content
Overrides:
orderBefore in class DefaultContent
Parameters:
srcName - where current node has to be moved
beforeName - name of the node before the current node has to be placed
Throws:
javax.jcr.RepositoryException - if an error occurs

getIndex

public int getIndex()
             throws javax.jcr.RepositoryException
This method returns the index of this node within the ordered set of its same-name sibling nodes. This index is the one used to address same-name siblings using the square-bracket notation, e.g., /a[3]/b[4]. Note that the index always starts at 1 (not 0), for compatibility with XPath. As a result, for nodes that do not have same-name-siblings, this method will always return 1.

Specified by:
getIndex in interface Content
Overrides:
getIndex in class DefaultContent
Returns:
The index of this node within the ordered set of its same-name sibling nodes.
Throws:
javax.jcr.RepositoryException - if an error occurs

getNodeType

public javax.jcr.nodetype.NodeType getNodeType()
                                        throws javax.jcr.RepositoryException
returns primary node type definition of the associated Node of this object

Specified by:
getNodeType in interface Content
Overrides:
getNodeType in class DefaultContent
Throws:
javax.jcr.RepositoryException - if an error occurs

restore

public void restore(java.lang.String versionName,
                    boolean removeExisting)
             throws javax.jcr.RepositoryException
Restores this node to the state defined by the version with the specified versionName.

Specified by:
restore in interface Content
Overrides:
restore in class DefaultContent
Parameters:
versionName -
removeExisting -
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.version.VersionException - if the specified versionName does not exist in this node's version history

restore

public void restore(javax.jcr.version.Version version,
                    boolean removeExisting)
             throws javax.jcr.RepositoryException
Restores this node to the state defined by the specified version.

Specified by:
restore in interface Content
Overrides:
restore in class DefaultContent
Parameters:
version -
removeExisting -
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.version.VersionException - if the specified version is not part of this node's version history

restore

public void restore(javax.jcr.version.Version version,
                    java.lang.String relPath,
                    boolean removeExisting)
             throws javax.jcr.RepositoryException
Restores the specified version to relPath, relative to this node.

Specified by:
restore in interface Content
Overrides:
restore in class DefaultContent
Parameters:
version -
relPath -
removeExisting -
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.version.VersionException - if the specified version is not part of this node's version history

restoreByLabel

public void restoreByLabel(java.lang.String versionLabel,
                           boolean removeExisting)
                    throws javax.jcr.RepositoryException
Restores this node to the state recorded in the version specified by versionLabel.

Specified by:
restoreByLabel in interface Content
Overrides:
restoreByLabel in class DefaultContent
Parameters:
versionLabel -
removeExisting -
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.version.VersionException - if the specified versionLabel does not exist in this node's version history

addVersion

public javax.jcr.version.Version addVersion()
                                     throws javax.jcr.RepositoryException
add version leaving the node checked out

Specified by:
addVersion in interface Content
Overrides:
addVersion in class DefaultContent
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.UnsupportedRepositoryOperationException

addVersion

public javax.jcr.version.Version addVersion(Rule rule)
                                     throws javax.jcr.RepositoryException
add version leaving the node checked out

Specified by:
addVersion in interface Content
Overrides:
addVersion in class DefaultContent
Parameters:
rule - to be used to collect content
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.UnsupportedRepositoryOperationException
See Also:
Rule

isModified

public boolean isModified()
Returns true if this Item has been saved but has subsequently been modified through the current session and therefore the state of this item as recorded in the session differs from the state of this item as saved. Within a transaction, isModified on an Item may return false (because the Item has been saved since the modification) even if the modification in question is not in persistent storage (because the transaction has not yet been committed).

Note that in level 1 (that is, read-only) implementations, this method will always return false.

Specified by:
isModified in interface Content
Overrides:
isModified in class DefaultContent
Returns:
true if this item is modified; false otherwise.

getVersionHistory

public javax.jcr.version.VersionHistory getVersionHistory()
                                                   throws javax.jcr.RepositoryException
Specified by:
getVersionHistory in interface Content
Overrides:
getVersionHistory in class DefaultContent
Returns:
version history
Throws:
javax.jcr.RepositoryException - if an error occurs

getAllVersions

public javax.jcr.version.VersionIterator getAllVersions()
                                                 throws javax.jcr.RepositoryException
Specified by:
getAllVersions in interface Content
Overrides:
getAllVersions in class DefaultContent
Returns:
Version iterator retreived from version history
Throws:
javax.jcr.RepositoryException - if an error occurs

getBaseVersion

public ContentVersion getBaseVersion()
                              throws javax.jcr.RepositoryException
get the current base version of this node

Specified by:
getBaseVersion in interface Content
Overrides:
getBaseVersion in class DefaultContent
Returns:
base ContentVersion
Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException

getVersionedContent

public ContentVersion getVersionedContent(javax.jcr.version.Version version)
                                   throws javax.jcr.RepositoryException
get content view over the jcr version object

Specified by:
getVersionedContent in interface Content
Overrides:
getVersionedContent in class DefaultContent
Parameters:
version -
Returns:
version object wrapped in ContentVersion
Throws:
javax.jcr.RepositoryException
See Also:
ContentVersion

getVersionedContent

public ContentVersion getVersionedContent(java.lang.String versionName)
                                   throws javax.jcr.RepositoryException
get content view over the jcr version object

Specified by:
getVersionedContent in interface Content
Overrides:
getVersionedContent in class DefaultContent
Parameters:
versionName -
Returns:
version object wrapped in ContentVersion
Throws:
javax.jcr.RepositoryException
See Also:
ContentVersion

save

public void save()
          throws javax.jcr.RepositoryException
Persists all changes to the repository if validation succeds

Specified by:
save in interface Content
Overrides:
save in class DefaultContent
Throws:
javax.jcr.RepositoryException - if an error occurs

isGranted

public boolean isGranted(long permissions)
checks for the allowed access rights

Specified by:
isGranted in interface Content
Overrides:
isGranted in class AbstractContent
Parameters:
permissions - as defined in javax.jcr.Permission
Returns:
true is the current user has specified access on this node.

delete

public void delete()
            throws javax.jcr.RepositoryException
Remove this path

Specified by:
delete in interface Content
Overrides:
delete in class DefaultContent
Throws:
javax.jcr.RepositoryException - if an error occurs

delete

public void delete(java.lang.String path)
            throws javax.jcr.RepositoryException
Remove specified path

Specified by:
delete in interface Content
Overrides:
delete in class AbstractContent
Throws:
javax.jcr.RepositoryException - if an error occurs

getUUID

public java.lang.String getUUID()
UUID of the node refrenced by this object

Specified by:
getUUID in interface Content
Overrides:
getUUID in class DefaultContent
Returns:
uuid

addMixin

public void addMixin(java.lang.String type)
              throws javax.jcr.RepositoryException
add specified mixin type if allowed

Specified by:
addMixin in interface Content
Overrides:
addMixin in class DefaultContent
Parameters:
type - mixin type to be added
Throws:
javax.jcr.RepositoryException - if an error occurs

removeMixin

public void removeMixin(java.lang.String type)
                 throws javax.jcr.RepositoryException
Removes the specified mixin node type from this node. Also removes mixinName from this node's jcr:mixinTypes property. The mixin node type removal takes effect on save.

Specified by:
removeMixin in interface Content
Overrides:
removeMixin in class DefaultContent
Parameters:
type - , mixin type to be removed
Throws:
javax.jcr.RepositoryException - if an error occurs

lock

public javax.jcr.lock.Lock lock(boolean isDeep,
                                boolean isSessionScoped)
                         throws javax.jcr.lock.LockException,
                                javax.jcr.RepositoryException
places a lock on this object

Specified by:
lock in interface Content
Overrides:
lock in class DefaultContent
Parameters:
isDeep - if true this lock will apply to this node and all its descendants; if false, it applies only to this node.
isSessionScoped - if true, this lock expires with the current session; if false it expires when explicitly or automatically unlocked for some other reason.
Returns:
A Lock object containing a lock token.
Throws:
javax.jcr.lock.LockException - if this node is already locked or isDeep is true and a descendant node of this node already holds a lock.
javax.jcr.RepositoryException - if an error occurs
See Also:
Node.lock(boolean, boolean)

lock

public javax.jcr.lock.Lock lock(boolean isDeep,
                                boolean isSessionScoped,
                                long yieldFor)
                         throws javax.jcr.lock.LockException,
                                javax.jcr.RepositoryException
places a lock on this object

Specified by:
lock in interface Content
Overrides:
lock in class DefaultContent
Parameters:
isDeep - if true this lock will apply to this node and all its descendants; if false, it applies only to this node.
isSessionScoped - if true, this lock expires with the current session; if false it expires when explicitly or automatically unlocked for some other reason.
yieldFor - number of milliseconds for which this method will try to get a lock
Returns:
A Lock object containing a lock token.
Throws:
javax.jcr.lock.LockException - if this node is already locked or isDeep is true and a descendant node of this node already holds a lock.
javax.jcr.RepositoryException - if an error occurs
See Also:
Node.lock(boolean, boolean)

getLock

public javax.jcr.lock.Lock getLock()
                            throws javax.jcr.lock.LockException,
                                   javax.jcr.RepositoryException
Returns the Lock object that applies to this node. This may be either a lock on this node itself or a deep lock on a node above this node.

Specified by:
getLock in interface Content
Overrides:
getLock in class DefaultContent
Throws:
javax.jcr.lock.LockException - If no lock applies to this node, a LockException is thrown.
javax.jcr.RepositoryException - if an error occurs

unlock

public void unlock()
            throws javax.jcr.lock.LockException,
                   javax.jcr.RepositoryException
Removes the lock on this node. Also removes the properties jcr:lockOwner and jcr:lockIsDeep from this node. These changes are persisted automatically; there is no need to call save.

Specified by:
unlock in interface Content
Overrides:
unlock in class DefaultContent
Throws:
javax.jcr.lock.LockException - if either does not currently hold a lock, or holds a lock for which this Session does not have the correct lock token
javax.jcr.RepositoryException - if an error occurs

holdsLock

public boolean holdsLock()
                  throws javax.jcr.RepositoryException
Returns true if this node holds a lock; otherwise returns false. To hold a lock means that this node has actually had a lock placed on it specifically, as opposed to just having a lock apply to it due to a deep lock held by a node above.

Specified by:
holdsLock in interface Content
Overrides:
holdsLock in class DefaultContent
Returns:
a boolean
Throws:
javax.jcr.RepositoryException - if an error occurs

isLocked

public boolean isLocked()
                 throws javax.jcr.RepositoryException
Returns true if this node is locked either as a result of a lock held by this node or by a deep lock on a node above this node; otherwise returns false.

Specified by:
isLocked in interface Content
Overrides:
isLocked in class DefaultContent
Returns:
a boolean
Throws:
javax.jcr.RepositoryException - if an error occurs

getHierarchyManager

public HierarchyManager getHierarchyManager()
Get hierarchy manager if previously set for this object

Specified by:
getHierarchyManager in interface Content
Overrides:
getHierarchyManager in class ContentHandler
Returns:
HierarchyManager

getAccessManager

public AccessManager getAccessManager()
Deprecated. use getHierarchyManager instead

Get access manager if previously set for this object

Specified by:
getAccessManager in interface Content
Overrides:
getAccessManager in class ContentHandler
Returns:
AccessManager

getWorkspace

public javax.jcr.Workspace getWorkspace()
                                 throws javax.jcr.RepositoryException
Description copied from interface: Content
get workspace to which this node attached to.

Specified by:
getWorkspace in interface Content
Overrides:
getWorkspace in class AbstractContent
Throws:
javax.jcr.RepositoryException - if unable to get this node session


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