|
||||||||||
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 List<Content> |
collectAllChildren(Content node)
Get all children recursively (content and contentnode). |
static List<Content> |
collectAllChildren(Content node,
Content.ContentFilter filter)
Get all children using a filter. |
static List<Content> |
collectAllChildren(Content node,
ItemType type)
Get all children of a particular type. |
static List<Content> |
collectAllChildren(Content node,
ItemType[] types)
Get all children of a particular type. |
static void |
copyInSession(Content src,
String dest)
Session based copy operation. |
static Content |
createPath(Content parent,
String path,
ItemType type)
|
static Content |
createPath(Content parent,
String path,
ItemType type,
boolean save)
|
static Content |
createPath(HierarchyManager hm,
String path)
|
static Content |
createPath(HierarchyManager hm,
String path,
boolean save)
|
static Content |
createPath(HierarchyManager hm,
String path,
ItemType type)
|
static Content |
createPath(HierarchyManager hm,
String path,
ItemType type,
boolean save)
|
static void |
deleteAndRemoveEmptyParents(Content node)
|
static void |
deleteAndRemoveEmptyParents(Content node,
int level)
|
static Collection<Content> |
getAllChildren(Content node)
Returns all children (not recursively) independent of there type. |
static Collection<Content> |
getAllChildren(Content node,
Comparator<Content> comp)
Returns all children (not recursively) independent of there type. |
static Content |
getAncestorOfType(Content firstNode,
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,
String name)
Get a subnode case insensitive. |
static Content |
getContent(Content node,
String name)
Get the node or null if not exists. |
static Content |
getContent(String repository,
String path)
Returns a Content object of the named repository or null if not existing. |
static Content |
getContentByUUID(String repository,
String uuid)
|
static Content |
getOrCreateContent(Content node,
String name,
ItemType contentType)
If the node doesn't exist just create it. |
static Content |
getOrCreateContent(Content node,
String name,
ItemType contentType,
boolean save)
If the node doesn't exist just create it. |
static void |
moveInSession(Content src,
String dest)
Magnolia uses by default workspace move operation to move nodes. |
static void |
orderAfter(Content nodeToMove,
String targetNodeName)
Convenient method for ordering a node after a specific target node. |
static void |
orderBefore(Content nodeToMove,
String targetNodeName)
Convenient method to order a node before a target node. |
static void |
orderNodes(Content node,
Comparator<Content> comparator)
Uses the passed comparator to create the jcr ordering of the children. |
static void |
orderNodes(Content node,
String[] nodes)
|
static String |
path2uuid(String repository,
String path)
|
static void |
rename(Content node,
String newName)
|
static String |
uuid2path(String repository,
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(String repository, String path)
public static Content getContentByUUID(String repository, String uuid)
public static Content getContent(Content node, String name)
node
- name
-
public static Content getOrCreateContent(Content node, String name, ItemType contentType) throws AccessDeniedException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.RepositoryException
public static Content getOrCreateContent(Content node, String name, ItemType contentType, boolean save) throws AccessDeniedException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.RepositoryException
public static Content getCaseInsensitive(Content node, String name)
node
- name
-
public static List<Content> collectAllChildren(Content node)
public static List<Content> collectAllChildren(Content node, Content.ContentFilter filter)
node
- filter
-
public static List<Content> collectAllChildren(Content node, ItemType type)
public static Collection<Content> getAllChildren(Content node)
public static Collection<Content> getAllChildren(Content node, Comparator<Content> comp)
public static List<Content> collectAllChildren(Content node, ItemType[] types)
public static Content getAncestorOfType(Content firstNode, String nodeType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderBefore(Content nodeToMove, String targetNodeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderAfter(Content nodeToMove, String targetNodeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderNodes(Content node, String[] nodes) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderNodes(Content node, Comparator<Content> comparator) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void visit(Content node, ContentUtil.Visitor visitor) throws Exception
Exception
public static void visit(Content node, ContentUtil.Visitor visitor, Content.ContentFilter filter) throws Exception
Exception
public static Content createPath(HierarchyManager hm, String path) throws AccessDeniedException, javax.jcr.PathNotFoundException, javax.jcr.RepositoryException
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
public static Content createPath(HierarchyManager hm, 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, 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, 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, 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, String path, ItemType type, boolean save) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException
public static String uuid2path(String repository, String uuid)
public static String path2uuid(String repository, 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, String dest) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void moveInSession(Content src, String dest) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void rename(Content node, 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 |