|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.jcr.util.NodeUtil
public class NodeUtil
Various utility methods to collect data from JCR repository.
Field Summary | |
---|---|
static org.apache.jackrabbit.commons.predicate.Predicate |
ALL_NODES_EXCEPT_JCR_FILTER
Node filter accepting everything except nodes with namespace jcr (version and system store). |
static AbstractPredicate<javax.jcr.Node> |
EXCLUDE_META_DATA_FILTER
Node filter accepting everything except meta data and jcr types. |
static AbstractPredicate<javax.jcr.Node> |
MAGNOLIA_FILTER
Node filter accepting all nodes of a type with namespace mgnl. |
Constructor Summary | |
---|---|
NodeUtil()
|
Method Summary | |
---|---|
static Iterable<javax.jcr.Node> |
asIterable(javax.jcr.NodeIterator iterator)
|
static List<javax.jcr.Node> |
asList(Iterable<javax.jcr.Node> nodes)
|
static Iterable<javax.jcr.Node> |
collectAllChildren(List<javax.jcr.Node> nodes,
javax.jcr.Node parent,
org.apache.jackrabbit.commons.predicate.Predicate predicate)
Get all children (by recursion) using a Predicate. |
static Iterable<javax.jcr.Node> |
collectAllChildren(javax.jcr.Node node)
Get all children (by recursion) using MAGNOLIA_FILTER (filter accepting all nodes of a type with namespace mgnl). |
static Iterable<javax.jcr.Node> |
collectAllChildren(javax.jcr.Node node,
org.apache.jackrabbit.commons.predicate.Predicate predicate)
Get all children (by recursion) using a Predicate. |
static String |
combinePathAndName(String path,
String name)
|
static javax.jcr.Node |
createPath(javax.jcr.Node parent,
String relPath,
String primaryNodeTypeName)
Creates a node under the specified parent and relative path, then returns it. |
static javax.jcr.Node |
createPath(javax.jcr.Node parent,
String relPath,
String primaryNodeTypeName,
boolean save)
Creates a node under the specified parent and relative path, then returns it. |
static javax.jcr.Node |
deepUnwrap(javax.jcr.Node node,
Class<? extends DelegateNodeWrapper> wrapper)
Removes a wrapper by type. |
static javax.jcr.Node |
deepUnwrapAll(javax.jcr.Node node,
Class<? extends DelegateNodeWrapper> wrapperClass)
Removes all wrappers of a given type. |
static javax.jcr.NodeIterator |
filterDuplicates(javax.jcr.NodeIterator iterator)
|
static javax.jcr.NodeIterator |
filterNodeType(javax.jcr.NodeIterator iterator,
String nodeType)
|
static javax.jcr.NodeIterator |
filterParentNodeType(javax.jcr.NodeIterator iterator,
String nodeType)
|
static Collection<javax.jcr.Node> |
getAncestors(javax.jcr.Node node)
Get all Ancestors until level 1. |
static Collection<javax.jcr.Node> |
getCollectionFromNodeIterator(javax.jcr.NodeIterator iterator)
|
static String |
getName(javax.jcr.Node content)
This method return the node's name on success, otherwise it handles the RepositoryException by throwing a
RuntimeRepositoryException . |
static javax.jcr.Node |
getNodeByIdentifier(String workspace,
String identifier)
Get a Node by identifier. |
static String |
getNodeIdentifierIfPossible(javax.jcr.Node content)
Used for building exception messages where we want to avoid handling another exception inside a throws clause. |
static String |
getNodePathIfPossible(javax.jcr.Node node)
|
static Iterable<javax.jcr.Node> |
getNodes(javax.jcr.Node parent)
|
static Iterable<javax.jcr.Node> |
getNodes(javax.jcr.Node parent,
org.apache.jackrabbit.commons.predicate.Predicate predicate)
|
static Iterable<javax.jcr.Node> |
getNodes(javax.jcr.Node parent,
String nodeTypeName)
|
static String |
getPathIfPossible(javax.jcr.Node node)
Return the Path of the node. |
static javax.jcr.Node |
getSiblingAfter(javax.jcr.Node node)
|
static javax.jcr.Node |
getSiblingBefore(javax.jcr.Node node)
|
static Iterable<javax.jcr.Node> |
getSiblings(javax.jcr.Node node)
Gets the siblings of this node. |
static Iterable<javax.jcr.Node> |
getSiblings(javax.jcr.Node node,
org.apache.jackrabbit.commons.predicate.Predicate predicate)
Gets the siblings of this node according to predicate. |
static Iterable<javax.jcr.Node> |
getSiblings(javax.jcr.Node node,
String nodeTypeName)
Gets the siblings of this node with certain type. |
static Iterable<javax.jcr.Node> |
getSiblingsAfter(javax.jcr.Node node)
Gets the siblings after this node. |
static Iterable<javax.jcr.Node> |
getSiblingsAfter(javax.jcr.Node node,
String nodeTypeName)
Gets the siblings after this node with certain type. |
static Iterable<javax.jcr.Node> |
getSiblingsBefore(javax.jcr.Node node)
Gets the siblings before this node. |
static Iterable<javax.jcr.Node> |
getSiblingsBefore(javax.jcr.Node node,
String nodeTypeName)
Gets the siblings before this node with certain type. |
static boolean |
hasMixin(javax.jcr.Node node,
String mixinName)
from default content. |
static boolean |
isFirstSibling(javax.jcr.Node node)
|
static boolean |
isGranted(javax.jcr.Node node,
long permissions)
|
static boolean |
isLastSibling(javax.jcr.Node node)
|
static boolean |
isNodeType(javax.jcr.Node node,
String type)
TODO dlipp: better name? Clear javadoc! Move to MetaDataUtil, do not assign method-param! TODO cringele : shouldn't @param nodeType be aligned to JCR API? There it is nodeTypeName, nodeType is used for NodeType object |
static boolean |
isSame(javax.jcr.Node lhs,
javax.jcr.Node rhs)
Returns true if both arguments represents the same node. |
static boolean |
isSameNameSiblings(javax.jcr.Node node1,
javax.jcr.Node node2)
Check if node1 and node2 are siblings. |
static boolean |
isWrappedWith(javax.jcr.Node node,
Class<? extends DelegateNodeWrapper> wrapper)
|
static void |
moveNode(javax.jcr.Node nodeToMove,
javax.jcr.Node newParent)
|
static void |
moveNodeAfter(javax.jcr.Node nodeToMove,
javax.jcr.Node target)
|
static void |
moveNodeBefore(javax.jcr.Node nodeToMove,
javax.jcr.Node target)
|
static void |
orderAfter(javax.jcr.Node node,
String siblingName)
Orders the node directly after a given sibling. |
static void |
orderBefore(javax.jcr.Node node,
String siblingName)
Convenience - delegate to Node.orderBefore(String, String) . |
static void |
orderFirst(javax.jcr.Node node)
Orders the node first among its siblings. |
static void |
orderLast(javax.jcr.Node node)
Orders the node last among its siblings. |
static void |
orderNodeDown(javax.jcr.Node node)
Orders the node down one step among its siblings. |
static void |
orderNodeUp(javax.jcr.Node node)
Orders the node up one step among its siblings. |
static void |
renameNode(javax.jcr.Node node,
String newName)
|
static javax.jcr.Node |
unwrap(javax.jcr.Node node)
|
static void |
visit(javax.jcr.Node node,
NodeVisitor visitor)
Visits the given node and then all of nodes beneath it except for metadata nodes and nodes of jcr type. |
static void |
visit(javax.jcr.Node node,
NodeVisitor visitor,
org.apache.jackrabbit.commons.predicate.Predicate predicate)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static org.apache.jackrabbit.commons.predicate.Predicate ALL_NODES_EXCEPT_JCR_FILTER
public static AbstractPredicate<javax.jcr.Node> EXCLUDE_META_DATA_FILTER
public static AbstractPredicate<javax.jcr.Node> MAGNOLIA_FILTER
Constructor Detail |
---|
public NodeUtil()
Method Detail |
---|
public static javax.jcr.Node getNodeByIdentifier(String workspace, String identifier) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean hasMixin(javax.jcr.Node node, String mixinName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean isNodeType(javax.jcr.Node node, String type) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static javax.jcr.Node unwrap(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static javax.jcr.Node deepUnwrap(javax.jcr.Node node, Class<? extends DelegateNodeWrapper> wrapper)
public static javax.jcr.Node deepUnwrapAll(javax.jcr.Node node, Class<? extends DelegateNodeWrapper> wrapperClass)
public static boolean isWrappedWith(javax.jcr.Node node, Class<? extends DelegateNodeWrapper> wrapper)
public static void orderBefore(javax.jcr.Node node, String siblingName) throws javax.jcr.RepositoryException
Node.orderBefore(String, String)
.
javax.jcr.RepositoryException
public static void orderAfter(javax.jcr.Node node, String siblingName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderFirst(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderLast(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderNodeUp(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void orderNodeDown(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static javax.jcr.Node getSiblingBefore(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static javax.jcr.Node getSiblingAfter(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblings(javax.jcr.Node node) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrievednodeTypeName
- requested type of siblings nodes
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblings(javax.jcr.Node node, String nodeTypeName) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrievednodeTypeName
- requested type of siblings nodes
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblings(javax.jcr.Node node, org.apache.jackrabbit.commons.predicate.Predicate predicate) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrievedpredicate
- predicate
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblingsBefore(javax.jcr.Node node) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrieved
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblingsAfter(javax.jcr.Node node) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrieved
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblingsBefore(javax.jcr.Node node, String nodeTypeName) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrievednodeTypeName
- requested type of siblings nodes
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getSiblingsAfter(javax.jcr.Node node, String nodeTypeName) throws javax.jcr.RepositoryException
node
- node from which will be siblings retrievednodeTypeName
- requested type of siblings nodes
javax.jcr.RepositoryException
public static void moveNode(javax.jcr.Node nodeToMove, javax.jcr.Node newParent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void moveNodeBefore(javax.jcr.Node nodeToMove, javax.jcr.Node target) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void moveNodeAfter(javax.jcr.Node nodeToMove, javax.jcr.Node target) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean isFirstSibling(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean isSameNameSiblings(javax.jcr.Node node1, javax.jcr.Node node2) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean isLastSibling(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void renameNode(javax.jcr.Node node, String newName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean isGranted(javax.jcr.Node node, long permissions)
RuntimeException
- in case of RepositoryException.public static boolean isSame(javax.jcr.Node lhs, javax.jcr.Node rhs) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static String combinePathAndName(String path, String name)
public static javax.jcr.Node createPath(javax.jcr.Node parent, String relPath, String primaryNodeTypeName) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException
public static javax.jcr.Node createPath(javax.jcr.Node parent, String relPath, String primaryNodeTypeName, boolean save) throws javax.jcr.RepositoryException, javax.jcr.PathNotFoundException, AccessDeniedException
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
AccessDeniedException
public static void visit(javax.jcr.Node node, NodeVisitor visitor) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void visit(javax.jcr.Node node, NodeVisitor visitor, org.apache.jackrabbit.commons.predicate.Predicate predicate) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getNodes(javax.jcr.Node parent, org.apache.jackrabbit.commons.predicate.Predicate predicate) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getNodes(javax.jcr.Node parent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> getNodes(javax.jcr.Node parent, String nodeTypeName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> asIterable(javax.jcr.NodeIterator iterator)
public static List<javax.jcr.Node> asList(Iterable<javax.jcr.Node> nodes)
public static String getName(javax.jcr.Node content)
RepositoryException
by throwing a
RuntimeRepositoryException
.
public static Iterable<javax.jcr.Node> collectAllChildren(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> collectAllChildren(javax.jcr.Node node, org.apache.jackrabbit.commons.predicate.Predicate predicate) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Iterable<javax.jcr.Node> collectAllChildren(List<javax.jcr.Node> nodes, javax.jcr.Node parent, org.apache.jackrabbit.commons.predicate.Predicate predicate) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Collection<javax.jcr.Node> getAncestors(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static String getNodeIdentifierIfPossible(javax.jcr.Node content)
public static String getNodePathIfPossible(javax.jcr.Node node)
public static String getPathIfPossible(javax.jcr.Node node)
public static javax.jcr.NodeIterator filterNodeType(javax.jcr.NodeIterator iterator, String nodeType)
public static javax.jcr.NodeIterator filterDuplicates(javax.jcr.NodeIterator iterator)
public static javax.jcr.NodeIterator filterParentNodeType(javax.jcr.NodeIterator iterator, String nodeType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static Collection<javax.jcr.Node> getCollectionFromNodeIterator(javax.jcr.NodeIterator iterator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |