org.apache.cayenne.project
Class ProjectTraversal

java.lang.Object
  extended by org.apache.cayenne.project.ProjectTraversal

public class ProjectTraversal
extends java.lang.Object

ProjectTraversal allows to traverse Cayenne project tree in a "depth-first" order starting from an arbitrary level to its children.

Current implementation is not very efficient and would actually first read the whole tree, before returning the first element from the iterator.

Author:
Andrei Adamchik

Field Summary
protected static java.util.Comparator dataDomainComparator
           
protected static java.util.Comparator dataMapComparator
           
protected static java.util.Comparator dataNodeComparator
           
protected  ProjectTraversalHandler handler
           
protected static java.util.Comparator mapObjectComparator
           
protected static java.util.Comparator queryComparator
           
protected  boolean sort
           
 
Constructor Summary
ProjectTraversal(ProjectTraversalHandler handler)
           
ProjectTraversal(ProjectTraversalHandler handler, boolean sort)
          Creates ProjectTraversal instance with a given handler and sort policy.
 
Method Summary
 void traverse(java.lang.Object rootNode)
          Performs traversal starting from the root node.
 void traverse(java.lang.Object rootNode, ProjectPath path)
           
 void traverseAttributes(java.util.Iterator attributes, ProjectPath path)
           
 void traverseDomains(java.util.Iterator domains, ProjectPath path)
          Performs traversal starting from a list of domains.
 void traverseEntities(java.util.Iterator entities, ProjectPath path)
           
 void traverseMaps(java.util.Iterator maps, ProjectPath path)
           
 void traverseNodes(java.util.Iterator nodes, ProjectPath path)
           
 void traverseProcedureParameters(java.util.Iterator parameters, ProjectPath path)
           
 void traverseProcedures(java.util.Iterator procedures, ProjectPath path)
          Performs recusrive traversal of an Iterator of Cayenne Procedure objects.
 void traverseProject(Project project, ProjectPath path)
          Performs traversal starting from the Project and down to its children.
 void traverseQueries(java.util.Iterator queries, ProjectPath path)
          Performs recursive traversal of an Iterator of Cayenne Query objects.
 void traverseRelationships(java.util.Iterator relationships, ProjectPath path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapObjectComparator

protected static final java.util.Comparator mapObjectComparator

dataMapComparator

protected static final java.util.Comparator dataMapComparator

dataDomainComparator

protected static final java.util.Comparator dataDomainComparator

dataNodeComparator

protected static final java.util.Comparator dataNodeComparator

queryComparator

protected static final java.util.Comparator queryComparator

handler

protected ProjectTraversalHandler handler

sort

protected boolean sort
Constructor Detail

ProjectTraversal

public ProjectTraversal(ProjectTraversalHandler handler)

ProjectTraversal

public ProjectTraversal(ProjectTraversalHandler handler,
                        boolean sort)
Creates ProjectTraversal instance with a given handler and sort policy. If sort is true, children of each node will be sorted using a predefined Comparator for a given type of child nodes.

Method Detail

traverse

public void traverse(java.lang.Object rootNode)
Performs traversal starting from the root node. Root node can be of any type supported in Cayenne projects (Configuration, DataMap, DataNode, etc...)


traverse

public void traverse(java.lang.Object rootNode,
                     ProjectPath path)

traverseProject

public void traverseProject(Project project,
                            ProjectPath path)
Performs traversal starting from the Project and down to its children.


traverseDomains

public void traverseDomains(java.util.Iterator domains,
                            ProjectPath path)
Performs traversal starting from a list of domains.


traverseNodes

public void traverseNodes(java.util.Iterator nodes,
                          ProjectPath path)

traverseMaps

public void traverseMaps(java.util.Iterator maps,
                         ProjectPath path)

traverseQueries

public void traverseQueries(java.util.Iterator queries,
                            ProjectPath path)
Performs recursive traversal of an Iterator of Cayenne Query objects.


traverseProcedures

public void traverseProcedures(java.util.Iterator procedures,
                               ProjectPath path)
Performs recusrive traversal of an Iterator of Cayenne Procedure objects.


traverseEntities

public void traverseEntities(java.util.Iterator entities,
                             ProjectPath path)

traverseAttributes

public void traverseAttributes(java.util.Iterator attributes,
                               ProjectPath path)

traverseRelationships

public void traverseRelationships(java.util.Iterator relationships,
                                  ProjectPath path)

traverseProcedureParameters

public void traverseProcedureParameters(java.util.Iterator parameters,
                                        ProjectPath path)


Copyright © 2001-2006 Apache.org All Rights Reserved.