org.apache.cayenne.map
Class AshwoodEntitySorter

java.lang.Object
  extended by org.apache.cayenne.map.AshwoodEntitySorter
All Implemented Interfaces:
EntitySorter

public class AshwoodEntitySorter
extends java.lang.Object
implements EntitySorter

Implements dependency sorting algorithms for ObjEntities, DbEntities and DataObjects. Presently it works for acyclic database schemas with possible multi-reflexive tables. The class uses topological sorting from the Ashwood library.

Since:
1.1
Author:
Andriy Shapochka, Andrus Adamchik

Field Summary
protected  java.util.Map components
           
protected  org.objectstyle.ashwood.graph.Digraph contractedReferentialDigraph
           
protected  java.util.Collection dataMaps
           
protected  org.apache.cayenne.map.AshwoodEntitySorter.DbEntityComparator dbEntityComparator
           
protected  java.util.Map dbEntityToTableMap
           
protected  boolean dirty
           
protected  org.apache.cayenne.map.AshwoodEntitySorter.ObjEntityComparator objEntityComparator
           
protected  org.objectstyle.ashwood.graph.Digraph referentialDigraph
           
protected  java.util.Map reflexiveDbEntities
           
protected  org.apache.cayenne.map.AshwoodEntitySorter.TableComparator tableComparator
           
 
Constructor Summary
AshwoodEntitySorter(java.util.Collection dataMaps)
           
 
Method Summary
protected  void _indexSorter()
          Reindexes internal sorter.
protected  void fillInMetadata(org.objectstyle.ashwood.dbutil.Table table, DbEntity entity)
           
protected  DataObject findReflexiveMaster(DataObject object, ObjRelationship toOneRel, java.lang.String targetEntityName)
           
protected  java.util.Comparator getDbEntityComparator(boolean dependantFirst)
           
protected  java.util.Comparator getObjEntityComparator(boolean dependantFirst)
           
protected  org.objectstyle.ashwood.dbutil.Table getTable(DbEntity dbEntity)
           
protected  org.objectstyle.ashwood.dbutil.Table getTable(ObjEntity objEntity)
           
 void indexSorter(QueryEngine queryEngine)
          Deprecated. since 1.2 - unused.
protected  boolean isReflexive(DbEntity metadata)
           
 void setDataMaps(java.util.Collection dataMaps)
          Initializes a list of DataMaps used by the sorter.
 void sortDbEntities(java.util.List dbEntities, boolean deleteOrder)
          Sorts a list of DbEntities.
 void sortObjectsForEntity(ObjEntity objEntity, java.util.List objects, boolean deleteOrder)
          Sorts a list of objects belonging to the ObjEntity.
 void sortObjEntities(java.util.List objEntities, boolean deleteOrder)
          Sorts a list of ObjEntities.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataMaps

protected java.util.Collection dataMaps

dbEntityToTableMap

protected java.util.Map dbEntityToTableMap

referentialDigraph

protected org.objectstyle.ashwood.graph.Digraph referentialDigraph

contractedReferentialDigraph

protected org.objectstyle.ashwood.graph.Digraph contractedReferentialDigraph

components

protected java.util.Map components

reflexiveDbEntities

protected java.util.Map reflexiveDbEntities

tableComparator

protected org.apache.cayenne.map.AshwoodEntitySorter.TableComparator tableComparator

dbEntityComparator

protected org.apache.cayenne.map.AshwoodEntitySorter.DbEntityComparator dbEntityComparator

objEntityComparator

protected org.apache.cayenne.map.AshwoodEntitySorter.ObjEntityComparator objEntityComparator

dirty

protected boolean dirty
Constructor Detail

AshwoodEntitySorter

public AshwoodEntitySorter(java.util.Collection dataMaps)
Method Detail

_indexSorter

protected void _indexSorter()
Reindexes internal sorter.


setDataMaps

public void setDataMaps(java.util.Collection dataMaps)
Description copied from interface: EntitySorter
Initializes a list of DataMaps used by the sorter.

Specified by:
setDataMaps in interface EntitySorter
Since:
1.1

indexSorter

public void indexSorter(QueryEngine queryEngine)
Deprecated. since 1.2 - unused.

Marks this instance as "dirty", so that it will be indexed lazily on the next invocation.


sortDbEntities

public void sortDbEntities(java.util.List dbEntities,
                           boolean deleteOrder)
Description copied from interface: EntitySorter
Sorts a list of DbEntities.

Specified by:
sortDbEntities in interface EntitySorter

sortObjEntities

public void sortObjEntities(java.util.List objEntities,
                            boolean deleteOrder)
Description copied from interface: EntitySorter
Sorts a list of ObjEntities.

Specified by:
sortObjEntities in interface EntitySorter

sortObjectsForEntity

public void sortObjectsForEntity(ObjEntity objEntity,
                                 java.util.List objects,
                                 boolean deleteOrder)
Description copied from interface: EntitySorter
Sorts a list of objects belonging to the ObjEntity.

Specified by:
sortObjectsForEntity in interface EntitySorter

fillInMetadata

protected void fillInMetadata(org.objectstyle.ashwood.dbutil.Table table,
                              DbEntity entity)

findReflexiveMaster

protected DataObject findReflexiveMaster(DataObject object,
                                         ObjRelationship toOneRel,
                                         java.lang.String targetEntityName)

getDbEntityComparator

protected java.util.Comparator getDbEntityComparator(boolean dependantFirst)

getObjEntityComparator

protected java.util.Comparator getObjEntityComparator(boolean dependantFirst)

getTable

protected org.objectstyle.ashwood.dbutil.Table getTable(DbEntity dbEntity)

getTable

protected org.objectstyle.ashwood.dbutil.Table getTable(ObjEntity objEntity)

isReflexive

protected boolean isReflexive(DbEntity metadata)


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