org.apache.cayenne.project
Class ProjectTraversal

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

public class ProjectTraversal
extends 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.


Field Summary
protected static Comparator dataDomainComparator
           
protected static Comparator dataMapComparator
           
protected static Comparator dataNodeComparator
           
protected static Comparator embaddableComparator
           
protected  ProjectTraversalHandler handler
           
protected static Comparator mapObjectComparator
           
protected static 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(Object rootNode)
          Performs traversal starting from the root node.
 void traverse(Object rootNode, ProjectPath path)
           
 void traverseAttributes(Iterator attributes, ProjectPath path)
           
 void traverseDomains(Iterator domains, ProjectPath path)
          Performs traversal starting from a list of domains.
 void traverseEmbeddable(Iterator embeddadles, ProjectPath path)
           
 void traverseEmbeddableAttributes(Iterator emAttributes, ProjectPath path)
           
 void traverseEntities(Iterator entities, ProjectPath path)
           
 void traverseMaps(Iterator maps, ProjectPath path)
           
 void traverseNodes(Iterator nodes, ProjectPath path)
           
 void traverseProcedureParameters(Iterator<? extends ProcedureParameter> parameters, ProjectPath path)
           
 void traverseProcedures(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(Iterator queries, ProjectPath path)
          Performs recursive traversal of an Iterator of Cayenne Query objects.
 void traverseRelationships(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 Comparator mapObjectComparator

dataMapComparator

protected static final Comparator dataMapComparator

dataDomainComparator

protected static final Comparator dataDomainComparator

dataNodeComparator

protected static final Comparator dataNodeComparator

queryComparator

protected static final Comparator queryComparator

embaddableComparator

protected static final Comparator embaddableComparator

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(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(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(Iterator domains,
                            ProjectPath path)
Performs traversal starting from a list of domains.


traverseNodes

public void traverseNodes(Iterator nodes,
                          ProjectPath path)

traverseMaps

public void traverseMaps(Iterator maps,
                         ProjectPath path)

traverseEmbeddable

public void traverseEmbeddable(Iterator embeddadles,
                               ProjectPath path)

traverseQueries

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


traverseProcedures

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


traverseEntities

public void traverseEntities(Iterator entities,
                             ProjectPath path)

traverseAttributes

public void traverseAttributes(Iterator attributes,
                               ProjectPath path)

traverseEmbeddableAttributes

public void traverseEmbeddableAttributes(Iterator emAttributes,
                                         ProjectPath path)

traverseRelationships

public void traverseRelationships(Iterator relationships,
                                  ProjectPath path)

traverseProcedureParameters

public void traverseProcedureParameters(Iterator<? extends ProcedureParameter> parameters,
                                        ProjectPath path)


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.