Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.map
Class AshwoodEntitySorter

    java.lang.Object
      org.apache.cayenne.map.AshwoodEntitySorter

All Implemented Interfaces:
  EntitySorter

    public class AshwoodEntitySorter

extends 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 Map` | `components`
`protected org.objectstyle.ashwood.graph.Digraph` | `contractedReferentialDigraph`
`protected Collection<DataMap>` | `dataMaps`
`protected org.apache.cayenne.map.AshwoodEntitySorter.DbEntityComparator` | `dbEntityComparator`
`protected Map<DbEntity,org.objectstyle.ashwood.dbutil.Table>` | `dbEntityToTableMap`
`protected boolean` | `dirty`
`protected org.apache.cayenne.map.AshwoodEntitySorter.ObjEntityComparator` | `objEntityComparator`
`protected org.objectstyle.ashwood.graph.Digraph` | `referentialDigraph`
`protected Map<DbEntity,List<DbRelationship>>` | `reflexiveDbEntities`
`protected org.apache.cayenne.map.AshwoodEntitySorter.TableComparator` | `tableComparator`

Constructor Summary
`AshwoodEntitySorter(Collection<DataMap> dataMaps)`

Method Summary
`protected void` | `_indexSorter()` Reindexes internal sorter.
`protected void` | `fillInMetadata(org.objectstyle.ashwood.dbutil.Table table, DbEntity entity)`
`protected Object` | `findReflexiveMaster(Persistent object, ObjRelationship toOneRel, String targetEntityName)`
`protected Comparator` | `getDbEntityComparator(boolean dependantFirst)`
`protected Comparator<ObjEntity>` | `getObjEntityComparator(boolean dependantFirst)`
`protected org.objectstyle.ashwood.dbutil.Table` | `getTable(DbEntity dbEntity)`
`protected org.objectstyle.ashwood.dbutil.Table` | `getTable(ObjEntity objEntity)`
`protected boolean` | `isReflexive(DbEntity metadata)`
`void` | `setDataMaps(Collection<DataMap> dataMaps)` Initializes a list of DataMaps used by the sorter.
`void` | `sortDbEntities(List<DbEntity> dbEntities, boolean deleteOrder)` Sorts a list of DbEntities.
`void` | `sortObjectsForEntity(ObjEntity objEntity, List objects, boolean deleteOrder)` Sorts a list of objects belonging to the ObjEntity.
`void` | `sortObjEntities(List<ObjEntity> 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 Collection<DataMap> dataMaps

### dbEntityToTableMap

    protected Map<DbEntity,org.objectstyle.ashwood.dbutil.Table> dbEntityToTableMap

### referentialDigraph

    protected org.objectstyle.ashwood.graph.Digraph referentialDigraph

### contractedReferentialDigraph

    protected org.objectstyle.ashwood.graph.Digraph contractedReferentialDigraph

### components

    protected Map components

### reflexiveDbEntities

    protected Map<DbEntity,List<DbRelationship>> 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(Collection<DataMap> dataMaps)

Method Detail

### _indexSorter

    protected void _indexSorter()

  Reindexes internal sorter.

### setDataMaps

    public void setDataMaps(Collection<DataMap> dataMaps)

  Description copied from interface: `EntitySorter`
  Initializes a list of DataMaps used by the sorter.

  Specified by:
    `setDataMaps` in interface `EntitySorter`
  Since:
    1.1

### sortDbEntities

    public void sortDbEntities(List<DbEntity> dbEntities,
                               boolean deleteOrder)

  Description copied from interface: `EntitySorter`
  Sorts a list of DbEntities.

  Specified by:
    `sortDbEntities` in interface `EntitySorter`

### sortObjEntities

    public void sortObjEntities(List<ObjEntity> 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,
                                     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 Object findReflexiveMaster(Persistent object,
                                         ObjRelationship toOneRel,
                                         String targetEntityName)

### getDbEntityComparator

    protected Comparator getDbEntityComparator(boolean dependantFirst)

### getObjEntityComparator

    protected Comparator<ObjEntity> 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)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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