org.apache.cayenne.ashwood

## Class AshwoodEntitySorter

- java.lang.Object
- - org.apache.cayenne.ashwood.AshwoodEntitySorter

- All Implemented Interfaces:
    EntitySorter
  Direct Known Subclasses:
    AshwoodEntitySorter

      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.
  Since:
    3.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<DbEntity,org.apache.cayenne.ashwood.AshwoodEntitySorter.ComponentRecord>` | `components`
    `protected Comparator<DbEntity>` | `dbEntityComparator`
    `protected EntityResolver` | `entityResolver`
    `protected Comparator<ObjEntity>` | `objEntityComparator`
    `protected Map<DbEntity,List<DbRelationship>>` | `reflexiveDbEntities`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AshwoodEntitySorter()`
    `AshwoodEntitySorter(Collection<DataMap> dataMaps)` Deprecated. since 3.1. Use `AshwoodEntitySorter()` constructor together with `setDataMaps(Collection)` instead.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `doIndexSorter()` Reindexes internal sorter without synchronization.
    `protected Object` | `findReflexiveMaster(Persistent object, ObjRelationship toOneRel, String targetEntityName)`
    `protected Comparator<DbEntity>` | `getDbEntityComparator(boolean dependantFirst)`
    `protected Comparator<ObjEntity>` | `getObjEntityComparator(boolean dependantFirst)`
    `protected void` | `indexSorter()` Reindexes internal sorter in a thread-safe manner.
    `protected boolean` | `isReflexive(DbEntity metadata)`
    `void` | `setDataMaps(Collection<DataMap> dataMaps)` Deprecated. since 3.1, `setEntityResolver(EntityResolver)` is used instead.
    `void` | `setEntityResolver(EntityResolver entityResolver)` Sets EntityResolver for this 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

    - #### entityResolver

          protected EntityResolver entityResolver

    - #### components

          protected Map<DbEntity,org.apache.cayenne.ashwood.AshwoodEntitySorter.ComponentRecord> components

    - #### reflexiveDbEntities

          protected Map<DbEntity,List<DbRelationship>> reflexiveDbEntities

    - #### dbEntityComparator

          protected Comparator<DbEntity> dbEntityComparator

    - #### objEntityComparator

          protected Comparator<ObjEntity> objEntityComparator

  - ### Constructor Detail

    - #### AshwoodEntitySorter

          public AshwoodEntitySorter()

    - #### AshwoodEntitySorter

          @Deprecated
          public AshwoodEntitySorter(Collection<DataMap> dataMaps)

      Deprecated. since 3.1. Use `AshwoodEntitySorter()` constructor together with `setDataMaps(Collection)` instead.

  - ### Method Detail

    - #### indexSorter

          protected void indexSorter()

      Reindexes internal sorter in a thread-safe manner.

    - #### doIndexSorter

          protected void doIndexSorter()

      Reindexes internal sorter without synchronization.

    - #### setDataMaps

          @Deprecated
          public void setDataMaps(Collection<DataMap> dataMaps)

      Deprecated. since 3.1, `setEntityResolver(EntityResolver)` is used instead.
      Description copied from interface: `EntitySorter`
      Initializes a list of DataMaps used by the sorter.
      Specified by:
        `setDataMaps` in interface `EntitySorter`
      Since:
        1.1

    - #### setEntityResolver

          public void setEntityResolver(EntityResolver entityResolver)

      Description copied from interface: `EntitySorter`
      Sets EntityResolver for this sorter. All entities present in the resolver will be used to determine sort ordering.
      Specified by:
        `setEntityResolver` in interface `EntitySorter`
      Since:
        3.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`

    - #### findReflexiveMaster

          protected Object findReflexiveMaster(Persistent object,
                                               ObjRelationship toOneRel,
                                               String targetEntityName)

    - #### getDbEntityComparator

          protected Comparator<DbEntity> getDbEntityComparator(boolean dependantFirst)

    - #### getObjEntityComparator

          protected Comparator<ObjEntity> getObjEntityComparator(boolean dependantFirst)

    - #### isReflexive

          protected boolean isReflexive(DbEntity metadata)

Copyright © 2001–2018 Apache Cayenne. All rights reserved.