|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.core.ContentHandler info.magnolia.cms.core.AbstractContent info.magnolia.cms.core.DefaultContent
public class DefaultContent
Default, JCR-based, implementation of Content
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface info.magnolia.cms.core.Content |
---|
Content.ContentFilter |
Field Summary | |
---|---|
protected javax.jcr.Node |
node
Wrapped jcr node. |
Fields inherited from class info.magnolia.cms.core.ContentHandler |
---|
hierarchyManager |
Constructor Summary | |
---|---|
protected |
DefaultContent()
Empty constructor. |
|
DefaultContent(javax.jcr.Item elem,
HierarchyManager hierarchyManager)
Constructor to get existing node. |
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,
String contentType)
Creates a Content node under the current node with the specified name. |
void |
delete()
Remove this path. |
protected int |
determineNodeDataType(String name)
|
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. |
Collection<Content> |
getChildren(Content.ContentFilter filter,
String namePattern,
Comparator<Content> orderCriteria)
|
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. |
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. |
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. |
protected Collection<NodeData> |
getPrimitiveNodeDatas(String namePattern)
|
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()
|
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)
Delegates to NodeData.isExist() . |
boolean |
holdsLock()
Returns true if this node holds a lock; otherwise returns false. |
protected boolean |
isCheckedOut()
Returns true if this node is either versionable and currently checked-out, non-versionable and its nearest versionable ancestor is checked-out or non-versionable and it has no versionable ancestor. |
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. |
protected boolean |
isNodeType(javax.jcr.Node node,
String type)
private Helper method to evaluate primary node type of the given node. |
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. |
NodeData |
newNodeDataInstance(String name,
int type,
boolean createIfNotExisting)
As defined in Content.getNodeData(String) this method always returns a node data 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. |
protected void |
setNode(javax.jcr.Node node)
|
protected void |
setPath(String path)
|
protected void |
setRootNode(javax.jcr.Node node)
|
void |
unlock()
Removes the lock on this node. |
Methods inherited from class info.magnolia.cms.core.AbstractContent |
---|
createContent, createContent, createNodeData, createNodeData, createNodeData, createNodeData, createNodeData, delete, deleteNodeData, getBinaryNodeDatas, getChildByName, getChildren, getChildren, getChildren, getChildren, getChildren, getChildren, getNodeData, getNodeDataCollection, getTemplate, getTitle, getWorkspace, hasChildren, hasChildren, isGranted, isNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, setNodeData, toString, updateMetaData |
Methods inherited from class info.magnolia.cms.core.ContentHandler |
---|
clone, getAccessManager, getHierarchyManager, setAccessManager, setHierarchyManager |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface info.magnolia.cms.core.Content |
---|
getAccessManager, getHierarchyManager |
Field Detail |
---|
protected javax.jcr.Node node
Constructor Detail |
---|
protected DefaultContent()
public DefaultContent(javax.jcr.Item elem, HierarchyManager hierarchyManager) throws javax.jcr.RepositoryException, AccessDeniedException
elem
- initialized node objecthierarchyManager
- HierarchyManager instance
AccessDeniedException
- if the current session does not have sufficient access rights to complete the
operation
javax.jcr.RepositoryException
- if an error occursMethod Detail |
---|
protected void setNode(javax.jcr.Node node)
node
- protected void setRootNode(javax.jcr.Node node)
node
- protected void setPath(String path)
path
- public Content getContent(String name) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
Content
name
- of the node acting as Content
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
- if an error occurs
AccessDeniedException
- if the current session does not have sufficient access rights
to complete the operationpublic Content createContent(String name, String contentType) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
Content
name
- of the node to be created as Content
contentType
- JCR node type as configured
Content
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
- if an error occurs
AccessDeniedException
- if the current session does not have sufficient access rights
to complete the operationpublic boolean hasNodeData(String name) throws javax.jcr.RepositoryException
AbstractContent
NodeData.isExist()
.
hasNodeData
in interface Content
hasNodeData
in class AbstractContent
javax.jcr.RepositoryException
- if an error occurspublic NodeData newNodeDataInstance(String name, int type, boolean createIfNotExisting) throws AccessDeniedException, javax.jcr.RepositoryException
AbstractContent
Content.getNodeData(String)
this method always returns a node data object. If the type is PropertyType.UNDEFINED
the implementation should check if the node data exists and determine the type to use.
newNodeDataInstance
in class AbstractContent
createIfNotExisting
- if false an empty non-mutable node data will be returned if the node data doesn't exist otherwise a mutable nodedata object is returned (depending on the type)
AccessDeniedException
javax.jcr.RepositoryException
protected int determineNodeDataType(String name)
public MetaData getMetaData()
Content
Node
public String getName()
Content
Node
public Collection<Content> getChildren(Content.ContentFilter filter, String namePattern, Comparator<Content> orderCriteria)
getChildren
in class AbstractContent
namePattern
- ignored if null.public Collection<NodeData> getNodeDataCollection(String namePattern)
Content
protected Collection<NodeData> getPrimitiveNodeDatas(String namePattern) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean hasContent(String name) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic String getHandle()
Content
public Content getParent() throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
Content
javax.jcr.PathNotFoundException
AccessDeniedException
- if the current session does not have sufficient access rights
to complete the operation
javax.jcr.RepositoryException
- if an error occurspublic Content getAncestor(int level) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
Content
level
- level at which the requested node exist, relative to the ROOT node
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
public Collection<Content> getAncestors() throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurs
javax.jcr.PathNotFoundException
public int getLevel() throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
Content
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
- if an error occurspublic void orderBefore(String srcName, String beforeName) throws javax.jcr.RepositoryException
Content
beforename
.
srcName
- where current node has to be movedbeforeName
- name of the node before the current node has to be placed
javax.jcr.RepositoryException
- if an error occurspublic int getIndex() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.Node getJCRNode()
Content
public boolean isNodeType(String type)
Content
protected boolean isNodeType(javax.jcr.Node node, String type)
node
- type
- public javax.jcr.nodetype.NodeType getNodeType() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic String getNodeTypeName() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic ItemType getItemType() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
public void restore(String versionName, boolean removeExisting) throws javax.jcr.version.VersionException, javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
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
public void restore(javax.jcr.version.Version version, boolean removeExisting) throws javax.jcr.version.VersionException, javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
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
public void restore(javax.jcr.version.Version version, String relPath, boolean removeExisting) throws javax.jcr.version.VersionException, javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
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
public void restoreByLabel(String versionLabel, boolean removeExisting) throws javax.jcr.version.VersionException, javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
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
public javax.jcr.version.Version addVersion() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.version.Version addVersion(Rule rule) throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
rule
- to be used to collect content
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
- if an error occursRule
protected boolean isCheckedOut() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean isModified()
Content
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
.
true
if this item is modified; false
otherwise.public javax.jcr.version.VersionHistory getVersionHistory() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurs
javax.jcr.UnsupportedRepositoryOperationException
public javax.jcr.version.VersionIterator getAllVersions() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurs
javax.jcr.UnsupportedRepositoryOperationException
public ContentVersion getBaseVersion() throws javax.jcr.UnsupportedRepositoryOperationException, javax.jcr.RepositoryException
Content
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
public ContentVersion getVersionedContent(javax.jcr.version.Version version) throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
ContentVersion
public ContentVersion getVersionedContent(String versionName) throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
ContentVersion
public void removeVersionHistory() throws AccessDeniedException, javax.jcr.RepositoryException
Content
AccessDeniedException
- If not allowed to do write operations on this node
javax.jcr.RepositoryException
- if unable to remove versions from version storepublic void save() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic void delete() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic void refresh(boolean keepChanges) throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occursItem.refresh(boolean)
public String getUUID()
Content
public void addMixin(String type) throws javax.jcr.RepositoryException
Content
type
- mixin type to be added
javax.jcr.RepositoryException
- if an error occurspublic void removeMixin(String type) throws javax.jcr.RepositoryException
Content
type
- , mixin type to be removed
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.nodetype.NodeType[] getMixinNodeTypes() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic javax.jcr.lock.Lock lock(boolean isDeep, boolean isSessionScoped) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
Content
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.
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 occursNode.lock(boolean,boolean)
public javax.jcr.lock.Lock lock(boolean isDeep, boolean isSessionScoped, long yieldFor) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
Content
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
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 occursNode.lock(boolean,boolean)
public javax.jcr.lock.Lock getLock() throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
Content
javax.jcr.lock.LockException
- If no lock applies to this node, a LockException is thrown.
javax.jcr.RepositoryException
- if an error occurspublic void unlock() throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
Content
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 occurspublic boolean holdsLock() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic boolean isLocked() throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
- if an error occurspublic boolean hasMetaData()
Content
public boolean hasMixin(String mixinName) throws javax.jcr.RepositoryException
Content
javax.jcr.RepositoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |