public abstract class NodeVisitorTask extends AbstractRepositoryTask
NodeVisitorTaskhelps 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).
|Constructor and Description|
|Modifier and Type||Method and Description|
Override this method to specify a
Implement this method to define which nodes should subsequently be operated upon.
Implement this method to apply changes to each of the nodes that are matched by
getDescription, getName, toString
protected void doExecute(InstallContext installContext) throws 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
trueif the node should be operated upon,
protected abstract void operateOnNode(InstallContext installContext, javax.jcr.Node node)
This is typically where the update logic goes, in a similar fashion as the
installContext- the current install context
node- the JCR node that should be operated upon
protected org.apache.jackrabbit.commons.predicate.Predicate getFilteringPredicate()
Predicatewhere 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.
truefor all objects.
Copyright © 2003–2020 Magnolia International Ltd.. All rights reserved.