|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object info.magnolia.module.delta.AbstractTask info.magnolia.module.delta.AbstractRepositoryTask info.magnolia.module.delta.NodeVisitorTask
public abstract class NodeVisitorTask
The NodeVisitorTask
helps traversing a repository, match nodes and execute changes on them.
This is intended to replace QueryTask
for most cases, since query results may not account for pending changes in the session (e.g. coming from earlier deltas).
Field Summary |
---|
Fields inherited from class info.magnolia.module.delta.AbstractTask |
---|
DO_NOTHING, log |
Constructor Summary | |
---|---|
NodeVisitorTask(String name,
String description,
String workspace,
String absPath)
|
Method Summary | |
---|---|
protected void |
doExecute(InstallContext installContext)
|
protected org.apache.jackrabbit.commons.predicate.Predicate |
getFilteringPredicate()
Override this method to specify a Predicate where we should stop visiting the hierarchy, e.g. |
protected abstract boolean |
nodeMatches(javax.jcr.Node node)
Implement this method to define which nodes should subsequently be operated upon. |
protected abstract void |
operateOnNode(InstallContext installContext,
javax.jcr.Node node)
Implement this method to apply changes to each of the nodes that are matched by nodeMatches(Node) . |
Methods inherited from class info.magnolia.module.delta.AbstractRepositoryTask |
---|
execute |
Methods inherited from class info.magnolia.module.delta.AbstractTask |
---|
getDescription, getName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NodeVisitorTask(String name, String description, String workspace, String absPath)
Method Detail |
---|
protected void doExecute(InstallContext installContext) throws javax.jcr.RepositoryException, TaskExecutionException
doExecute
in class AbstractRepositoryTask
javax.jcr.RepositoryException
TaskExecutionException
protected abstract boolean nodeMatches(javax.jcr.Node node)
This will be called for every visited node in that task, and serves a similar purpose as a JCR query statement.
node
- the JCR node that is currently being visited
true
if the node should be operated upon, false
otherwiseoperateOnNode(InstallContext, Node)
protected abstract void operateOnNode(InstallContext installContext, javax.jcr.Node node)
nodeMatches(Node)
.
This is typically where the update logic goes, in a similar fashion as the QueryTask
.
installContext
- the current install contextnode
- the JCR node that should be operated uponQueryTask#operateOnNode(InstallContext, Node)}
protected org.apache.jackrabbit.commons.predicate.Predicate getFilteringPredicate()
Predicate
where we should stop visiting the hierarchy, e.g. to restrict node-types.
Mind that whatever the predicate, the starting node is always visited by NodeUtil
, even if it doesn't match the predicate.
true
for all objects.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |