|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.cms.util.ContentUtil
public class ContentUtil
Some easy to use methods to handle with Content objects.
Nested Class Summary | |
---|---|
static interface |
ContentUtil.PostVisitor
Used in ContentUtil.Visitor.visit(Content) if the visitor wants to use post order. |
static interface |
ContentUtil.Visitor
Used in ContentUtil.Visitor.visit(Content) to visit the hierarchy. |
Field Summary | |
---|---|
static Content.ContentFilter |
ALL_NODES_CONTENT_FILTER
Content filter accepting everything. |
static Content.ContentFilter |
ALL_NODES_EXCEPT_JCR_CONTENT_FILTER
Content filter accepting everything exept nodes with namespace jcr (version and system store). |
static Content.ContentFilter |
EXCLUDE_META_DATA_CONTENT_FILTER
Content filter accepting everything except meta data and jcr types. |
static Content.ContentFilter |
MAGNOLIA_FILTER
Content filter accepting all nodes with a nodetype of namespace mgnl. |
Constructor Summary | |
---|---|
ContentUtil()
|
Method Summary | |
---|---|
static void |
changeNodeType(Content node,
ItemType newType,
boolean replaceAll)
Utility method to change the jcr:primaryType value of a node. |
static java.util.List<Content> |
collectAllChildren(Content node)
Get all children recursively (content and contentnode). |
static java.util.List<Content> |
collectAllChildren(Content node,
Content.ContentFilter filter)
Get all children using a filter. |
static java.util.List<Content> |
collectAllChildren(Content node,
ItemType type)
Get all children of a particular type. |
static java.util.List<Content> |
collectAllChildren(Content node,
ItemType[] types)
Get all children of a particular type. |
static void |
copyInSession(Content src,
java.lang.String dest)
Session based copy operation. |
static Content |
createPath(Content parent,
java.lang.String path,
ItemType type)
|
static Content |
createPath(Content parent,
java.lang.String path,
ItemType type,
boolean save)
|
static Content |
createPath(HierarchyManager hm,
java.lang.String path)
|
static Content |
createPath(HierarchyManager hm,
java.lang.String path,
boolean save)
|
static Content |
createPath(HierarchyManager hm,
java.lang.String path,
ItemType type)
|
static Content |
createPath(HierarchyManager hm,
java.lang.String path,
ItemType type,
boolean save)
|
static void |
deleteAndRemoveEmptyParents(Content node)
|
static void |
deleteAndRemoveEmptyParents(Content node,
int level)
|
static java.util.Collection<Content> |
getAllChildren(Content node)
Returns all children (not recursively) independent of there type. |
static java.util.Collection<Content> |
getAllChildren(Content node,
java.util.Comparator<Content> comp)
Returns all children (not recursively) independent of there type. |
static Content |
getAncestorOfType(Content firstNode,
java.lang.String nodeType)
Returns the first found ancestor of the given node which is of the given type, or the given node itself, it is of the given type. |
static Content |
getCaseInsensitive(Content node,
java.lang.String name)
Get a subnode case insensitive. |
static Content |
getContent(Content node,
java.lang.String name)
Get the node or null if not exists. |
static Content |
getContent(java.lang.String repository,
java.lang.String path)
Returns a Content object of the named repository or null if not existing. |
static Content |
getContentByUUID(java.lang.String repository,
java.lang.String uuid)
|
static Content |
getOrCreateContent(Content node,
java.lang.String name,
ItemType contentType)
If the node doesn't exist just create it. |
static Content |
getOrCreateContent(Content node,
java.lang.String name,
ItemType contentType,
boolean save)
If the node doesn't exist just create it. |
static void |
moveInSession(Content src,
java.lang.String dest)
Magnolia uses by default workspace move operation to move nodes. |
static void |
orderAfter(Content nodeToMove,
java.lang.String targetNodeName)
Convenient method for ordering a node after a specific target node. |
static void |
orderBefore(Content nodeToMove,
java.lang.String targetNodeName)
Convenient method to order a node before a target node. |
static void |
orderNodes(Content node,
java.util.Comparator<Content> comparator)
Uses the passed comparator to create the jcr ordering of the children. |
static void |
orderNodes(Content node,
java.lang.String[] nodes)
|
static java.lang.String |
path2uuid(java.lang.String repository,
java.lang.String path)
|
static void |
rename(Content node,
java.lang.String newName)
|
static java.lang.String |
uuid2path(java.lang.String repository,
java.lang.String uuid)
|
static void |
visit(Content node,
ContentUtil.Visitor visitor)
|
static void |
visit(Content node,
ContentUtil.Visitor visitor,
Content.ContentFilter filter)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static Content.ContentFilter ALL_NODES_CONTENT_FILTER
public static Content.ContentFilter ALL_NODES_EXCEPT_JCR_CONTENT_FILTER
public static Content.ContentFilter EXCLUDE_META_DATA_CONTENT_FILTER
public static Content.ContentFilter MAGNOLIA_FILTER
Constructor Detail |
---|
public ContentUtil()
Method Detail |
---|
public static Content getContent(java.lang.String repository, java.lang.String path)
public static Content getContentByUUID(java.lang.String repository, java.lang.String uuid)
public static Content getContent(Content node, java.lang.String name)
node
- name
-
public static Content getOrCreateContent(Content node, java.lang.String name, ItemType contentType) throws AccessDeniedException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.RepositoryException
public static Content getOrCreateContent(Content node, java.lang.String name, ItemType contentType, boolean save) throws AccessDeniedException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.RepositoryException
public static Content getCaseInsensitive(Content node, java.lang.String name)
node
- name
-
public static java.util.List<Content> collectAllChildren(Content node)
public static java.util.List<Content> collectAllChildren(Content node, Content.ContentFilter filter)
node
- filter
-
public static java.util.List<Content> collectAllChildren(Content node, ItemType type)
public static java.util.Collection<Content> getAllChildren(Content node)
public static java.util.Collection<Content> getAllChildren(Content node, java.util.Comparator<Content> comp)
public static java.util.List<Content> collectAllChildren(Content node, ItemType[] types)
public static Content getAncestorOfType(Content firstNode, java.lang.String nodeType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderBefore(Content nodeToMove, java.lang.String targetNodeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderAfter(Content nodeToMove, java.lang.String targetNodeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderNodes(Content node, java.lang.String[] nodes) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderNodes(Content node, java.util.Comparator<Content> comparator) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void visit(Content node, ContentUtil.Visitor visitor) throws java.lang.Exception
java.lang.Exception
public static void visit(Content node, ContentUtil.Visitor visitor, Content.ContentFilter filter) throws java.lang.Exception
java.lang.Exception
public static Content createPath(HierarchyManager hm, java.lang.String path) throws AccessDeniedException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
public static Content createPath(HierarchyManager hm, java.lang.String path, boolean save) throws AccessDeniedException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
public static Content createPath(HierarchyManager hm, java.lang.String path, ItemType type) throws AccessDeniedException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
public static Content createPath(HierarchyManager hm, java.lang.String path, ItemType type, boolean save) throws AccessDeniedException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
public static Content createPath(Content parent, java.lang.String path, ItemType type) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException
public static Content createPath(Content parent, java.lang.String path, ItemType type, boolean save) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException
public static java.lang.String uuid2path(java.lang.String repository, java.lang.String uuid)
public static java.lang.String path2uuid(java.lang.String repository, java.lang.String path)
public static void deleteAndRemoveEmptyParents(Content node) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException
public static void deleteAndRemoveEmptyParents(Content node, int level) throws javax.jcr.PathNotFoundException, javax.jcr.RepositoryException, AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException
public static void copyInSession(Content src, java.lang.String dest) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void moveInSession(Content src, java.lang.String dest) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void rename(Content node, java.lang.String newName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void changeNodeType(Content node, ItemType newType, boolean replaceAll) throws javax.jcr.RepositoryException
jcr:primaryType
value of a node.
node
- - Content
the node whose type has to be changednewType
- - ItemType
the new node type to be assignedreplaceAll
- - boolean when true
replaces all occurrences
of the old node type. When false
replaces only the first occurrence.
javax.jcr.RepositoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |