info.magnolia.cms.util
Class ContentUtil

java.lang.Object
  extended by info.magnolia.cms.util.ContentUtil

Deprecated. since 4.5 - use NodeUtil instead.

@Deprecated
public class ContentUtil
extends Object

Some easy to use methods to handle with Content objects.

Version:
$Id$

Nested Class Summary
static interface ContentUtil.PostVisitor
          Deprecated. Used in ContentUtil.Visitor.visit(Content) if the visitor wants to use post order.
static interface ContentUtil.Visitor
          Deprecated. Used in ContentUtil.Visitor.visit(Content) to visit the hierarchy.
 
Field Summary
static Content.ContentFilter ALL_NODES_CONTENT_FILTER
          Deprecated. Content filter accepting everything.
static Content.ContentFilter ALL_NODES_EXCEPT_JCR_CONTENT_FILTER
          Deprecated. Content filter accepting everything exept nodes with namespace jcr (version and system store).
static Content.ContentFilter EXCLUDE_META_DATA_CONTENT_FILTER
          Deprecated. Content filter accepting everything except meta data and jcr types.
static Content.ContentFilter MAGNOLIA_FILTER
          Deprecated. Content filter accepting all nodes with a nodetype of namespace mgnl.
 
Constructor Summary
ContentUtil()
          Deprecated.  
 
Method Summary
static Content asContent(javax.jcr.Node content)
          Deprecated.  
static void changeNodeType(Content node, ItemType newType, boolean replaceAll)
          Deprecated. Utility method to change the jcr:primaryType value of a node.
static List<Content> collectAllChildren(Content node)
          Deprecated. Get all children recursively (content and contentnode).
static List<Content> collectAllChildren(Content node, Content.ContentFilter filter)
          Deprecated. Get all children using a filter.
static List<Content> collectAllChildren(Content node, ItemType type)
          Deprecated. Get all children of a particular type.
static List<Content> collectAllChildren(Content node, ItemType[] types)
          Deprecated. Get all children of a particular type.
static void copyInSession(Content src, String dest)
          Deprecated. Session based copy operation.
static Content createPath(Content parent, String path, ItemType type)
          Deprecated.  
static Content createPath(Content parent, String path, ItemType type, boolean save)
          Deprecated.  
static Content createPath(HierarchyManager hm, String path)
          Deprecated.  
static Content createPath(HierarchyManager hm, String path, boolean save)
          Deprecated.  
static Content createPath(HierarchyManager hm, String path, ItemType type)
          Deprecated.  
static Content createPath(HierarchyManager hm, String path, ItemType type, boolean save)
          Deprecated.  
static void deleteAndRemoveEmptyParents(Content node)
          Deprecated.  
static void deleteAndRemoveEmptyParents(Content node, int level)
          Deprecated.  
static Collection<Content> getAllChildren(Content node)
          Deprecated. Returns all children (not recursively) independent of there type.
static Collection<Content> getAllChildren(Content node, Comparator<Content> comp)
          Deprecated. Returns all children (not recursively) independent of there type.
static Content getAncestorOfType(Content firstNode, String nodeType)
          Deprecated. 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)
          Deprecated. Get a subnode case insensitive.
static Content getContent(Content node, String name)
          Deprecated. Get the node or null if not exists.
static Content getContent(String repository, String path)
          Deprecated. Returns a Content object of the named repository or null if not existing.
static Content getContentByUUID(String repository, String uuid)
          Deprecated.  
static Content getOrCreateContent(Content node, String name, ItemType contentType)
          Deprecated. If the node doesn't exist just create it.
static Content getOrCreateContent(Content node, String name, ItemType contentType, boolean save)
          Deprecated. If the node doesn't exist just create it.
static void moveInSession(Content src, String dest)
          Deprecated. Magnolia uses by default workspace move operation to move nodes.
static void orderAfter(Content nodeToMove, String targetNodeName)
          Deprecated. Convenient method for ordering a node after a specific target node.
static void orderBefore(Content nodeToMove, String targetNodeName)
          Deprecated. Convenient method to order a node before a target node.
static void orderNodes(Content node, Comparator<Content> comparator)
          Deprecated. Uses the passed comparator to create the jcr ordering of the children.
static void orderNodes(Content node, String[] nodes)
          Deprecated.  
static String path2uuid(String repository, String path)
          Deprecated.  
static void rename(Content node, String newName)
          Deprecated.  
static String uuid2path(String repository, String uuid)
          Deprecated.  
static void visit(Content node, ContentUtil.Visitor visitor)
          Deprecated.  
static void visit(Content node, ContentUtil.Visitor visitor, Content.ContentFilter filter)
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_NODES_CONTENT_FILTER

public static Content.ContentFilter ALL_NODES_CONTENT_FILTER
Deprecated. 
Content filter accepting everything.


ALL_NODES_EXCEPT_JCR_CONTENT_FILTER

public static Content.ContentFilter ALL_NODES_EXCEPT_JCR_CONTENT_FILTER
Deprecated. 
Content filter accepting everything exept nodes with namespace jcr (version and system store).


EXCLUDE_META_DATA_CONTENT_FILTER

public static Content.ContentFilter EXCLUDE_META_DATA_CONTENT_FILTER
Deprecated. 
Content filter accepting everything except meta data and jcr types.


MAGNOLIA_FILTER

public static Content.ContentFilter MAGNOLIA_FILTER
Deprecated. 
Content filter accepting all nodes with a nodetype of namespace mgnl.

Constructor Detail

ContentUtil

public ContentUtil()
Deprecated. 
Method Detail

getContent

public static Content getContent(String repository,
                                 String path)
Deprecated. 
Returns a Content object of the named repository or null if not existing.

Returns:
null if not found

getContentByUUID

public static Content getContentByUUID(String repository,
                                       String uuid)
Deprecated. 
Returns:
null if not found

getContent

public static Content getContent(Content node,
                                 String name)
Deprecated. 
Get the node or null if not exists.

Parameters:
node -
name -
Returns:
the sub node

getOrCreateContent

public static Content getOrCreateContent(Content node,
                                         String name,
                                         ItemType contentType)
                                  throws AccessDeniedException,
                                         javax.jcr.RepositoryException
Deprecated. 
If the node doesn't exist just create it. Attention the method does not save the newly created node.

Throws:
AccessDeniedException
javax.jcr.RepositoryException

getOrCreateContent

public static Content getOrCreateContent(Content node,
                                         String name,
                                         ItemType contentType,
                                         boolean save)
                                  throws AccessDeniedException,
                                         javax.jcr.RepositoryException
Deprecated. 
If the node doesn't exist just create it. If the parameter save is true the parent node is saved.

Throws:
AccessDeniedException
javax.jcr.RepositoryException

getCaseInsensitive

public static Content getCaseInsensitive(Content node,
                                         String name)
Deprecated. 
Get a subnode case insensitive.

Parameters:
node -
name -

collectAllChildren

public static List<Content> collectAllChildren(Content node)
Deprecated. 
Get all children recursively (content and contentnode).


collectAllChildren

public static List<Content> collectAllChildren(Content node,
                                               Content.ContentFilter filter)
Deprecated. 
Get all children using a filter.

Parameters:
node -
filter -
Returns:
list of all found nodes

collectAllChildren

public static List<Content> collectAllChildren(Content node,
                                               ItemType type)
Deprecated. 
Get all children of a particular type.


getAllChildren

public static Collection<Content> getAllChildren(Content node)
Deprecated. 
Returns all children (not recursively) independent of there type.


getAllChildren

public static Collection<Content> getAllChildren(Content node,
                                                 Comparator<Content> comp)
Deprecated. 
Returns all children (not recursively) independent of there type.


collectAllChildren

public static List<Content> collectAllChildren(Content node,
                                               ItemType[] types)
Deprecated. 
Get all children of a particular type.


getAncestorOfType

public static Content getAncestorOfType(Content firstNode,
                                        String nodeType)
                                 throws javax.jcr.RepositoryException
Deprecated. 
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.

Throws:
javax.jcr.RepositoryException

orderBefore

public static void orderBefore(Content nodeToMove,
                               String targetNodeName)
                        throws javax.jcr.RepositoryException
Deprecated. 
Convenient method to order a node before a target node.

Throws:
javax.jcr.RepositoryException

orderAfter

public static void orderAfter(Content nodeToMove,
                              String targetNodeName)
                       throws javax.jcr.RepositoryException
Deprecated. 
Convenient method for ordering a node after a specific target node. This is not that simple as jcr only supports ordering before a node.

Throws:
javax.jcr.RepositoryException

orderNodes

public static void orderNodes(Content node,
                              String[] nodes)
                       throws javax.jcr.RepositoryException
Deprecated. 
Throws:
javax.jcr.RepositoryException

orderNodes

public static void orderNodes(Content node,
                              Comparator<Content> comparator)
                       throws javax.jcr.RepositoryException
Deprecated. 
Uses the passed comparator to create the jcr ordering of the children.

Throws:
javax.jcr.RepositoryException

visit

public static void visit(Content node,
                         ContentUtil.Visitor visitor)
                  throws Exception
Deprecated. 
Throws:
Exception

visit

public static void visit(Content node,
                         ContentUtil.Visitor visitor,
                         Content.ContentFilter filter)
                  throws Exception
Deprecated. 
Throws:
Exception

createPath

public static Content createPath(HierarchyManager hm,
                                 String path)
                          throws AccessDeniedException,
                                 javax.jcr.PathNotFoundException,
                                 javax.jcr.RepositoryException
Deprecated. 
Throws:
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

createPath

public static Content createPath(HierarchyManager hm,
                                 String path,
                                 boolean save)
                          throws AccessDeniedException,
                                 javax.jcr.PathNotFoundException,
                                 javax.jcr.RepositoryException
Deprecated. 
Throws:
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

createPath

public static Content createPath(HierarchyManager hm,
                                 String path,
                                 ItemType type)
                          throws AccessDeniedException,
                                 javax.jcr.PathNotFoundException,
                                 javax.jcr.RepositoryException
Deprecated. 
Throws:
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

createPath

public static Content createPath(HierarchyManager hm,
                                 String path,
                                 ItemType type,
                                 boolean save)
                          throws AccessDeniedException,
                                 javax.jcr.PathNotFoundException,
                                 javax.jcr.RepositoryException
Deprecated. 
Throws:
AccessDeniedException
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

createPath

public static Content createPath(Content parent,
                                 String path,
                                 ItemType type)
                          throws javax.jcr.RepositoryException,
                                 javax.jcr.PathNotFoundException,
                                 AccessDeniedException
Deprecated. 
Throws:
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException

createPath

public static Content createPath(Content parent,
                                 String path,
                                 ItemType type,
                                 boolean save)
                          throws javax.jcr.RepositoryException,
                                 javax.jcr.PathNotFoundException,
                                 AccessDeniedException
Deprecated. 
Throws:
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException

uuid2path

public static String uuid2path(String repository,
                               String uuid)
Deprecated. 

path2uuid

public static String path2uuid(String repository,
                               String path)
Deprecated. 

deleteAndRemoveEmptyParents

public static void deleteAndRemoveEmptyParents(Content node)
                                        throws javax.jcr.PathNotFoundException,
                                               javax.jcr.RepositoryException,
                                               AccessDeniedException
Deprecated. 
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

deleteAndRemoveEmptyParents

public static void deleteAndRemoveEmptyParents(Content node,
                                               int level)
                                        throws javax.jcr.PathNotFoundException,
                                               javax.jcr.RepositoryException,
                                               AccessDeniedException
Deprecated. 
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException
AccessDeniedException

copyInSession

public static void copyInSession(Content src,
                                 String dest)
                          throws javax.jcr.RepositoryException
Deprecated. 
Session based copy operation. As JCR only supports workspace based copies this operation is performed by using export import operations.

Throws:
javax.jcr.RepositoryException

moveInSession

public static void moveInSession(Content src,
                                 String dest)
                          throws javax.jcr.RepositoryException
Deprecated. 
Magnolia uses by default workspace move operation to move nodes. This is a util method to move a node inside a session.

Throws:
javax.jcr.RepositoryException

rename

public static void rename(Content node,
                          String newName)
                   throws javax.jcr.RepositoryException
Deprecated. 
Throws:
javax.jcr.RepositoryException

changeNodeType

public static void changeNodeType(Content node,
                                  ItemType newType,
                                  boolean replaceAll)
                           throws javax.jcr.RepositoryException
Deprecated. 
Utility method to change the jcr:primaryType value of a node.

Parameters:
node - - Content the node whose type has to be changed
newType - - ItemType the new node type to be assigned
replaceAll - - boolean when true replaces all occurrences of the old node type. When false replaces only the first occurrence.
Throws:
javax.jcr.RepositoryException

asContent

public static Content asContent(javax.jcr.Node content)
Deprecated. 


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