Class FilteringItemVisitor
- java.lang.Object
-
- org.apache.jackrabbit.commons.visitor.FilteringItemVisitor
-
- All Implemented Interfaces:
ItemVisitor
public abstract class FilteringItemVisitor extends Object implements ItemVisitor
-
-
Field Summary
Fields Modifier and Type Field 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 processedprotected LinkedList
currentQueue
queues used to implement breadth-first traversalprotected 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 Summary
Constructors Constructor Description FilteringItemVisitor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
entering(Node node, int level)
Implement this method to add behaviour performed before aNode
is visited.protected abstract void
entering(Property property, int level)
Implement this method to add behaviour performed before aProperty
is visited.protected abstract void
leaving(Node node, int level)
Implement this method to add behaviour performed after aNode
is visited.protected abstract void
leaving(Property property, int level)
Implement this method to add behaviour performed after aProperty
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 aNode
.void
visit(Property property)
Called when the Visitor is passed to aProperty
.
-
-
-
Field Detail
-
includePredicate
protected Predicate includePredicate
Predicate that defines which items are included.
-
traversalPredicate
protected Predicate traversalPredicate
Predicate that defines which items are traversed.
-
walkProperties
protected boolean walkProperties
Do we want to walk all properties of nodes? The default is false.
-
breadthFirst
protected boolean breadthFirst
indicates if traversal should be done in a breadth-first manner rather than depth-first (which is the default)
-
maxLevel
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)
-
currentQueue
protected LinkedList currentQueue
queues used to implement breadth-first traversal
-
nextQueue
protected LinkedList nextQueue
-
currentLevel
protected int currentLevel
used to track hierarchy level of item currently being processed
-
-
Method Detail
-
setMaxLevel
public void setMaxLevel(int ml)
-
setBreadthFirst
public void setBreadthFirst(boolean flag)
-
setWalkProperties
public void setWalkProperties(boolean flag)
-
setIncludePredicate
public void setIncludePredicate(Predicate ip)
-
setTraversalPredicate
public void setTraversalPredicate(Predicate tp)
-
entering
protected abstract void entering(Property property, int level) throws RepositoryException
Implement this method to add behaviour performed before aProperty
is visited.- Parameters:
property
- theProperty
that is accepting this visitor.level
- hierarchy level of this property (the root node starts at level 0)- Throws:
RepositoryException
- if an error occurrs
-
entering
protected abstract void entering(Node node, int level) throws RepositoryException
Implement this method to add behaviour performed before aNode
is visited.- Parameters:
node
- theNode
that is accepting this visitor.level
- hierarchy level of this node (the root node starts at level 0)- Throws:
RepositoryException
- if an error occurrs
-
leaving
protected abstract void leaving(Property property, int level) throws RepositoryException
Implement this method to add behaviour performed after aProperty
is visited.- Parameters:
property
- theProperty
that is accepting this visitor.level
- hierarchy level of this property (the root node starts at level 0)- Throws:
RepositoryException
- if an error occurrs
-
leaving
protected abstract void leaving(Node node, int level) throws RepositoryException
Implement this method to add behaviour performed after aNode
is visited.- Parameters:
node
- theNode
that is accepting this visitor.level
- hierarchy level of this node (the root node starts at level 0)- Throws:
RepositoryException
- if an error occurrs
-
visit
public void visit(Property property) throws RepositoryException
Called when the Visitor is passed to aProperty
.It calls
TraversingItemVisitor.entering(Property, int)
followed byTraversingItemVisitor.leaving(Property, int)
. Implement these abstract methods to specify behaviour on 'arrival at' and 'after leaving' theProperty
.If this method throws, the visiting process is aborted.
- Specified by:
visit
in interfaceItemVisitor
- Parameters:
property
- theProperty
that is accepting this visitor.- Throws:
RepositoryException
- if an error occurrs
-
visit
public void visit(Node node) throws RepositoryException
Called when the Visitor is passed to aNode
.It calls
TraversingItemVisitor.entering(Node, int)
followed byTraversingItemVisitor.leaving(Node, int)
. Implement these abstract methods to specify behaviour on 'arrival at' and 'after leaving' theNode
.If this method throws, the visiting process is aborted.
- Specified by:
visit
in interfaceItemVisitor
- Parameters:
node
- theNode
that is accepting this visitor.- Throws:
RepositoryException
- if an error occurrs
-
-