public abstract class FilteringItemVisitor extends Object implements ItemVisitor
Modifier and Type | Field and Description |
---|---|
protected boolean |
breadthFirst
indicates if traversal should be done in a breadth-first
manner rather than depth-first (which is the default)
|
protected int |
currentLevel
used to track hierarchy level of item currently being processed
|
protected LinkedList |
currentQueue
queues used to implement breadth-first traversal
|
protected Predicate |
includePredicate
Predicate that defines which items are included.
|
protected int |
maxLevel
the 0-based level up to which the hierarchy should be traversed
(if it's -1, the hierarchy will be traversed until there are no
more children of the current item)
|
protected LinkedList |
nextQueue |
protected Predicate |
traversalPredicate
Predicate that defines which items are traversed.
|
protected boolean |
walkProperties
Do we want to walk all properties of nodes?
The default is false.
|
Constructor and Description |
---|
FilteringItemVisitor() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
entering(Node node,
int level)
Implement this method to add behaviour performed before a
Node is visited. |
protected abstract void |
entering(Property property,
int level)
Implement this method to add behaviour performed before a
Property is visited. |
protected abstract void |
leaving(Node node,
int level)
Implement this method to add behaviour performed after a
Node is visited. |
protected abstract void |
leaving(Property property,
int level)
Implement this method to add behaviour performed after a
Property is visited. |
void |
setBreadthFirst(boolean flag) |
void |
setIncludePredicate(Predicate ip) |
void |
setMaxLevel(int ml) |
void |
setTraversalPredicate(Predicate tp) |
void |
setWalkProperties(boolean flag) |
void |
visit(Node node)
Called when the Visitor is passed to a
Node . |
void |
visit(Property property)
Called when the Visitor is passed to a
Property . |
protected Predicate includePredicate
protected Predicate traversalPredicate
protected boolean walkProperties
protected boolean breadthFirst
protected int maxLevel
protected LinkedList currentQueue
protected LinkedList nextQueue
protected int currentLevel
public void setMaxLevel(int ml)
public void setBreadthFirst(boolean flag)
public void setWalkProperties(boolean flag)
public void setIncludePredicate(Predicate ip)
public void setTraversalPredicate(Predicate tp)
protected abstract void entering(Property property, int level) throws RepositoryException
Property
is visited.property
- the Property
that is accepting this visitor.level
- hierarchy level of this property (the root node starts at level 0)RepositoryException
- if an error occurrsprotected abstract void entering(Node node, int level) throws RepositoryException
Node
is visited.node
- the Node
that is accepting this visitor.level
- hierarchy level of this node (the root node starts at level 0)RepositoryException
- if an error occurrsprotected abstract void leaving(Property property, int level) throws RepositoryException
Property
is visited.property
- the Property
that is accepting this visitor.level
- hierarchy level of this property (the root node starts at level 0)RepositoryException
- if an error occurrsprotected abstract void leaving(Node node, int level) throws RepositoryException
Node
is visited.node
- the Node
that is accepting this visitor.level
- hierarchy level of this node (the root node starts at level 0)RepositoryException
- if an error occurrspublic void visit(Property property) throws RepositoryException
Property
.
It calls TraversingItemVisitor.entering(Property, int)
followed by
TraversingItemVisitor.leaving(Property, int)
. Implement these abstract methods to
specify behaviour on 'arrival at' and 'after leaving' the Property
.
If this method throws, the visiting process is aborted.
visit
in interface ItemVisitor
property
- the Property
that is accepting this visitor.RepositoryException
- if an error occurrspublic void visit(Node node) throws RepositoryException
Node
.
It calls TraversingItemVisitor.entering(Node, int)
followed by
TraversingItemVisitor.leaving(Node, int)
. Implement these abstract methods to
specify behaviour on 'arrival at' and 'after leaving' the Node
.
If this method throws, the visiting process is aborted.
visit
in interface ItemVisitor
node
- the Node
that is accepting this visitor.RepositoryException
- if an error occurrsCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.