info.magnolia.cms.core
Interface Content

All Superinterfaces:
Cloneable
All Known Implementing Classes:
AbstractContent, ContentVersion, ContentWrapper, DefaultContent, ExtendingContentWrapper, HTMLEncodingContentWrapper, I18nContentWrapper, InheritanceContentWrapper, LazyContentWrapper, NodeMapWrapper, SetNode.NodeMapWrapper, SystemContentWrapper

public interface Content
extends Cloneable

Represents a piece of content (node) which has nodedatas (properties) containing the values and which can have sub contents. This is is very similar to the JCR Node interface.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Nested Class Summary
static interface Content.ContentFilter
          Implement this interface to be used as node filter by getChildren().
 
Method Summary
 void addMixin(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(String name)
          Creates a Content node under the current node with the specified name.
 Content createContent(String name, ItemType contentType)
          Creates a Content node under the current node with the specified name.
 Content createContent(String name, String contentType)
          Creates a Content node under the current node with the specified name.
 NodeData createNodeData(String name)
          Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Object) instead.
 NodeData createNodeData(String name, int type)
          Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Object) instead.
 NodeData createNodeData(String name, Object obj)
          Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Object) instead.
 NodeData createNodeData(String name, javax.jcr.Value value)
          Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Value) instead.
 NodeData createNodeData(String name, javax.jcr.Value[] value)
          Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Value[]) instead.
 void delete()
          Remove this path.
 void delete(String path)
          Remove specified path.
 void deleteNodeData(String name)
          Delete NodeData with the specified name.
 AccessManager getAccessManager()
          Deprecated. since 4.0 - use getHierarchyManager instead
 javax.jcr.version.VersionIterator getAllVersions()
           
 Content getAncestor(int level)
          get absolute parent object starting from the root node.
 Collection<Content> getAncestors()
          Convenience method for taglib.
 ContentVersion getBaseVersion()
          get the current base version of this node.
 Content getChildByName(String namePattern)
          Deprecated. since 4.3, either use getContent(String) or getChildren(String)
 Collection<Content> getChildren()
          Gets a Collection containing all child nodes of the same NodeType as "this" object.
 Collection<Content> getChildren(Content.ContentFilter filter)
          Get a collection containing child nodes which satisfies the given filter.
 Collection<Content> getChildren(Content.ContentFilter filter, Comparator<Content> orderCriteria)
          Get a collection containing child nodes which satisfies the given filter.
 Collection<Content> getChildren(ItemType contentType)
          Get collection of specified content type.
 Collection<Content> getChildren(String contentType)
          Get collection of specified content type and its subtypes.
 Collection<Content> getChildren(String contentType, String namePattern)
          Get collection of specified content type.
 Content getContent(String name)
          Gets the Content node of the current node with the specified name.
 String getHandle()
          get a handle representing path relative to the content repository.
 HierarchyManager getHierarchyManager()
           
 int getIndex()
          This method returns the index of this node within the ordered set of its same-name sibling nodes.
 ItemType getItemType()
          Get the magnolia ItemType.
 javax.jcr.Node getJCRNode()
          utility method to get Node object used to create current content object.
 int getLevel()
          get node level from the ROOT node.
 javax.jcr.lock.Lock getLock()
          Returns the Lock object that applies to this node.
 MetaData getMetaData()
          Returns the meta data of the current node.
 javax.jcr.nodetype.NodeType[] getMixinNodeTypes()
          Returns an array of NodeType objects representing the mixin node types assigned to this node.
 String getName()
          get node name.
 NodeData getNodeData(String name)
          Returns a NodeData object.
 Collection<NodeData> getNodeDataCollection()
          Gets all properties bind in NodeData object excluding JCR system properties.
 Collection<NodeData> getNodeDataCollection(String namePattern)
          Gets all node datas matching the given pattern.
 javax.jcr.nodetype.NodeType getNodeType()
          returns primary node type definition of the associated Node of this object.
 String getNodeTypeName()
          returns primary node type name of the associated Node of this object.
 Content getParent()
          get parent content object.
 String getTemplate()
          Returns the template name which is assigned to this content.
 String getTitle()
           
 String getUUID()
          UUID of the node referenced by this object.
 ContentVersion getVersionedContent(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()
           
 javax.jcr.Workspace getWorkspace()
          get workspace to which this node attached to.
 boolean hasChildren()
           
 boolean hasChildren(String contentType)
           
 boolean hasContent(String name)
           
 boolean hasMetaData()
          checks if this node has a sub node with name MetaData.
 boolean hasMixin(String mixinName)
          Checks whether or not given mixin is assigned to a type.
 boolean hasNodeData(String name)
           
 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.
 boolean isNodeData(String path)
          checks if the requested resource is an NodeData (Property).
 boolean isNodeType(String type)
          evaluate primary node type of the associated Node of this object.
 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(String srcName, String beforeName)
          move current node to the specified location above the named beforename.
 void refresh(boolean keepChanges)
          If keepChanges is false, this method discards all pending changes recorded in this session.
 void removeMixin(String type)
          Removes the specified mixin node type from this node.
 void removeVersionHistory()
          removes all versions of this node and associated version graph.
 void restore(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, String relPath, boolean removeExisting)
          Restores the specified version to relPath, relative to this node.
 void restoreByLabel(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 succeeds.
 NodeData setNodeData(String name, boolean value)
          Sets the node data.
 NodeData setNodeData(String name, Calendar value)
          Sets the node data.
 NodeData setNodeData(String name, Content value)
          Sets the node data.
 NodeData setNodeData(String name, double value)
          Sets the node data.
 NodeData setNodeData(String name, InputStream value)
          Sets the node data.
 NodeData setNodeData(String name, long value)
          Sets the node data.
 NodeData setNodeData(String name, Object value)
          Sets the node data.
 NodeData setNodeData(String name, String value)
          Sets the node data.
 NodeData setNodeData(String name, javax.jcr.Value value)
          Sets the node data.
 NodeData setNodeData(String name, javax.jcr.Value[] value)
          Sets the node data.
 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.
 

Method Detail

getContent

Content getContent(String name)
                   throws javax.jcr.PathNotFoundException,
                          javax.jcr.RepositoryException,
                          AccessDeniedException
Gets the Content node of the current node with the specified name.

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

Content createContent(String name)
                      throws javax.jcr.PathNotFoundException,
                             javax.jcr.RepositoryException,
                             AccessDeniedException
Creates a Content node under the current node with the specified name. The default node type ItemType.CONTENT will be use as the contents primary type.

Parameters:
name - of the node to be created as Content
Returns:
newly created 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

Content createContent(String name,
                      String contentType)
                      throws javax.jcr.PathNotFoundException,
                             javax.jcr.RepositoryException,
                             AccessDeniedException
Creates a Content node under the current node with the specified name.

Parameters:
name - of the node to be created as Content
contentType - JCR node type as configured
Returns:
newly created 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

Content createContent(String name,
                      ItemType contentType)
                      throws javax.jcr.PathNotFoundException,
                             javax.jcr.RepositoryException,
                             AccessDeniedException
Creates a Content node under the current node with the specified name.

Parameters:
name - of the node to be created as Content
contentType - ItemType
Returns:
newly created 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

getTemplate

String getTemplate()
Returns the template name which is assigned to this content.


getTitle

String getTitle()
Returns:
String, title

getMetaData

MetaData getMetaData()
Returns the meta data of the current node.

Returns:
MetaData meta information of the content Node

getNodeData

NodeData getNodeData(String name)
Returns a NodeData object. If the node data does not exist (respectively if it has no value) an empty representation is returned whose NodeData.isExist() will return false.

Returns:
NodeData requested NodeData object

getName

String getName()
get node name.

Returns:
String name of the current Node

createNodeData

NodeData createNodeData(String name)
                        throws javax.jcr.PathNotFoundException,
                               javax.jcr.RepositoryException,
                               AccessDeniedException
Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Object) instead.

Creates a node data of type STRING with an empty String as default value.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

createNodeData

NodeData createNodeData(String name,
                        int type)
                        throws javax.jcr.PathNotFoundException,
                               javax.jcr.RepositoryException,
                               AccessDeniedException
Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Object) instead.

Creates a node data of type with an default value set. If the no default value can be set (for BINARY, REFERENCE type) the returned node data will be empty and per definition not yet exist.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

createNodeData

NodeData createNodeData(String name,
                        javax.jcr.Value value)
                        throws javax.jcr.PathNotFoundException,
                               javax.jcr.RepositoryException,
                               AccessDeniedException
Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Value) instead.

Creates a node data setting the value.

Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

createNodeData

NodeData createNodeData(String name,
                        javax.jcr.Value[] value)
                        throws javax.jcr.PathNotFoundException,
                               javax.jcr.RepositoryException,
                               AccessDeniedException
Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Value[]) instead.

Create a multi value node data.

Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

createNodeData

NodeData createNodeData(String name,
                        Object obj)
                        throws javax.jcr.RepositoryException
Deprecated. since 4.3, as JCR only supports set or remove operations for properties we recommend to use setNodeData(String, Object) instead.

Creates a property and set its value immediately, according to the type of the passed instance, hiding the complexity of using JCR's ValueFactory and providing a sensible default behavior.

Throws:
javax.jcr.RepositoryException

setNodeData

NodeData setNodeData(String name,
                     javax.jcr.Value value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null is not allowed

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     javax.jcr.Value[] value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null is not allowed.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     String value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null is not allowed.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     long value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null is not allowed.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     InputStream value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null is not allowed.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     double value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null will remove the node data.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     boolean value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null will remove the node data.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     Calendar value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null will remove the node data.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     Content value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null will remove the node data.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

setNodeData

NodeData setNodeData(String name,
                     Object value)
                     throws javax.jcr.PathNotFoundException,
                            javax.jcr.RepositoryException,
                            AccessDeniedException
Sets the node data. If the node data does not yet exist the node data is created. Setting null will remove the node data.
The type of the node data will be determined by the type of the passed value

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

deleteNodeData

void deleteNodeData(String name)
                    throws javax.jcr.PathNotFoundException,
                           javax.jcr.RepositoryException
Delete NodeData with the specified name.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException - if an error occurs

updateMetaData

void updateMetaData()
                    throws javax.jcr.RepositoryException,
                           AccessDeniedException
You could call this method anytime to update working page properties - Modification date & Author ID.

Throws:
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation
javax.jcr.RepositoryException - if an error occurs

getChildren

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

Returns:
Collection of content objects

getChildren

Collection<Content> getChildren(Content.ContentFilter filter)
Get a collection containing child nodes which satisfies the given filter.

Parameters:
filter -
Returns:
Collection of content objects or empty collection when no children are found.

getChildren

Collection<Content> getChildren(Content.ContentFilter filter,
                                Comparator<Content> orderCriteria)
Get a collection containing child nodes which satisfies the given filter. The returned collection is ordered according to the passed in criteria.

Parameters:
filter - filter for the child nodes
orderCriteria - ordering for the selected child nodes; if null than no particular order of the child nodes
Returns:
Collection of content objects or empty collection when no children are found.

getChildren

Collection<Content> getChildren(String contentType)
Get collection of specified content type and its subtypes.

Parameters:
contentType - JCR node type as configured
Returns:
Collection of content nodes

getChildren

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

Parameters:
contentType - ItemType
Returns:
Collection of content nodes

getChildren

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

Parameters:
contentType - JCR node type as configured
namePattern -
Returns:
Collection of content nodes

getChildByName

Content getChildByName(String namePattern)
Deprecated. since 4.3, either use getContent(String) or getChildren(String)

Returns the first child with the given name, any node type.

Parameters:
namePattern - child node name
Returns:
first found node with the given name or null if not found

getNodeDataCollection

Collection<NodeData> getNodeDataCollection()
Gets all properties bind in NodeData object excluding JCR system properties.


getNodeDataCollection

Collection<NodeData> getNodeDataCollection(String namePattern)
Gets all node datas matching the given pattern. If no pattern is given (null), gets all node datas.


hasChildren

boolean hasChildren()
Returns:
Boolean, if sub node(s) exists

hasChildren

boolean hasChildren(String contentType)
Parameters:
contentType - JCR node type as configured
Returns:
Boolean, if sub collectionType exists

hasContent

boolean hasContent(String name)
                   throws javax.jcr.RepositoryException
Parameters:
name -
Throws:
javax.jcr.RepositoryException - if an error occurs

hasNodeData

boolean hasNodeData(String name)
                    throws javax.jcr.RepositoryException
Parameters:
name -
Throws:
javax.jcr.RepositoryException - if an error occurs

getHandle

String getHandle()
get a handle representing path relative to the content repository.

Returns:
String representing path (handle) of the content

getParent

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

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

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

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

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

Returns:
Content representing node on level 0
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.PathNotFoundException

getLevel

int getLevel()
             throws javax.jcr.PathNotFoundException,
                    javax.jcr.RepositoryException
get node level from the ROOT node.

Returns:
level at which current node exist, relative to the ROOT node
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException - if an error occurs

orderBefore

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

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

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.

Returns:
The index of this node within the ordered set of its same-name sibling nodes.
Throws:
javax.jcr.RepositoryException - if an error occurs

getJCRNode

javax.jcr.Node getJCRNode()
utility method to get Node object used to create current content object.

Returns:
Node

isNodeType

boolean isNodeType(String type)
evaluate primary node type of the associated Node of this object.

Parameters:
type -

getNodeType

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

Throws:
javax.jcr.RepositoryException - if an error occurs

getNodeTypeName

String getNodeTypeName()
                       throws javax.jcr.RepositoryException
returns primary node type name of the associated Node of this object.

Throws:
javax.jcr.RepositoryException - if an error occurs

getItemType

ItemType getItemType()
                     throws javax.jcr.RepositoryException
Get the magnolia ItemType.

Returns:
the type
Throws:
javax.jcr.RepositoryException

restore

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

Parameters:
versionName -
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.UnsupportedRepositoryOperationException

restore

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

Parameters:
version -
removeExisting -
Throws:
javax.jcr.version.VersionException - if the specified version is not part of this node's version history
javax.jcr.RepositoryException - if an error occurs
javax.jcr.UnsupportedRepositoryOperationException

restore

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

Parameters:
version -
relPath -
removeExisting -
Throws:
javax.jcr.version.VersionException - if the specified version is not part of this node's version history
javax.jcr.RepositoryException - if an error occurs
javax.jcr.UnsupportedRepositoryOperationException

restoreByLabel

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

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

addVersion

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

Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException - if an error occurs

addVersion

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

Parameters:
rule - to be used to collect content
Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException - if an error occurs
See Also:
Rule

isModified

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.

Returns:
true if this item is modified; false otherwise.

getVersionHistory

javax.jcr.version.VersionHistory getVersionHistory()
                                                   throws javax.jcr.UnsupportedRepositoryOperationException,
                                                          javax.jcr.RepositoryException
Returns:
version history
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.UnsupportedRepositoryOperationException

getAllVersions

javax.jcr.version.VersionIterator getAllVersions()
                                                 throws javax.jcr.UnsupportedRepositoryOperationException,
                                                        javax.jcr.RepositoryException
Returns:
Version iterator retreived from version history
Throws:
javax.jcr.RepositoryException - if an error occurs
javax.jcr.UnsupportedRepositoryOperationException

getBaseVersion

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

Returns:
base ContentVersion
Throws:
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException

getVersionedContent

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

Parameters:
version -
Returns:
version object wrapped in ContentVersion
Throws:
javax.jcr.RepositoryException
See Also:
ContentVersion

getVersionedContent

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

Parameters:
versionName -
Returns:
version object wrapped in ContentVersion
Throws:
javax.jcr.RepositoryException
See Also:
ContentVersion

removeVersionHistory

void removeVersionHistory()
                          throws AccessDeniedException,
                                 javax.jcr.RepositoryException
removes all versions of this node and associated version graph.

Throws:
AccessDeniedException - If not allowed to do write operations on this node
javax.jcr.RepositoryException - if unable to remove versions from version store

save

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

Throws:
javax.jcr.RepositoryException - if an error occurs

isGranted

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

Parameters:
permissions - as defined in javax.jcr.Permission
Returns:
true is the current user has specified access on this node.

delete

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

Throws:
javax.jcr.RepositoryException - if an error occurs

delete

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

Throws:
javax.jcr.RepositoryException - if an error occurs

isNodeData

boolean isNodeData(String path)
                   throws AccessDeniedException,
                          javax.jcr.RepositoryException
checks if the requested resource is an NodeData (Property).

Parameters:
path - of the requested NodeData
Returns:
boolean true is the requested content is an NodeData
Throws:
AccessDeniedException
AccessDeniedException - if the current session does not have sufficient access rights to complete the operation
javax.jcr.RepositoryException - if an error occurs

refresh

void refresh(boolean keepChanges)
             throws javax.jcr.RepositoryException
If keepChanges is false, this method discards all pending changes recorded in this session.

Throws:
javax.jcr.RepositoryException - if an error occurs
See Also:
Item.refresh(boolean)

getUUID

String getUUID()
UUID of the node referenced by this object.

Returns:
uuid

addMixin

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

Parameters:
type - mixin type to be added
Throws:
javax.jcr.RepositoryException - if an error occurs

removeMixin

void removeMixin(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.

Parameters:
type - , mixin type to be removed
Throws:
javax.jcr.RepositoryException - if an error occurs

getMixinNodeTypes

javax.jcr.nodetype.NodeType[] getMixinNodeTypes()
                                                throws javax.jcr.RepositoryException
Returns an array of NodeType objects representing the mixin node types assigned to this node. This includes only those mixin types explicitly assigned to this node, and therefore listed in the property jcr:mixinTypes. It does not include mixin types inherited through the addition of supertypes to the primary type hierarchy.

Returns:
an array of mixin NodeType objects.
Throws:
javax.jcr.RepositoryException - if an error occurs

lock

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

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

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.

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

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.

Throws:
javax.jcr.lock.LockException - If no lock applies to this node, a LockException is thrown.
javax.jcr.RepositoryException - if an error occurs

unlock

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.

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

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.

Returns:
a boolean
Throws:
javax.jcr.RepositoryException - if an error occurs

isLocked

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.

Returns:
a boolean
Throws:
javax.jcr.RepositoryException - if an error occurs

getWorkspace

javax.jcr.Workspace getWorkspace()
                                 throws javax.jcr.RepositoryException
get workspace to which this node attached to.

Throws:
javax.jcr.RepositoryException - if unable to get this node session

getAccessManager

AccessManager getAccessManager()
Deprecated. since 4.0 - use getHierarchyManager instead

Returns:
the underlying AccessManager

getHierarchyManager

HierarchyManager getHierarchyManager()

hasMetaData

boolean hasMetaData()
checks if this node has a sub node with name MetaData.

Returns:
true if MetaData exists

hasMixin

boolean hasMixin(String mixinName)
                 throws javax.jcr.RepositoryException
Checks whether or not given mixin is assigned to a type.

Throws:
javax.jcr.RepositoryException


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