Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.access.util
Class SortHandler  view SortHandler download SortHandler.java

java.lang.Object
  extended byorg.objectstyle.cayenne.access.util.SortHandler

public class SortHandler
extends java.lang.Object

Defines a set of sorting methods based on object dependencies. The actual dependency tracking algorithm is pluggable via a sporter class.


Field Summary
protected static java.lang.Class defaultSorterClass
           
protected  DependencySorter sorter
           
 
Constructor Summary
SortHandler(java.lang.Class sorterClass, org.objectstyle.cayenne.access.QueryEngine queryEngine, org.objectstyle.cayenne.map.DataMap[] dataMaps)
          Creates SortHandler with a specified sorter class.
SortHandler(org.objectstyle.cayenne.access.QueryEngine queryEngine, org.objectstyle.cayenne.map.DataMap[] dataMaps)
          Constructor for SortHandler.
 
Method Summary
static java.lang.Class getDefaultSorterClass()
           
static void setDefaultSorterClass(java.lang.Class defaultSorterClass)
          Sets the class of the sorter that should be used as a source of dependency sorting algorithms.
 java.util.List sortedDbEntitiesInDeleteOrder(java.util.List dbEntities)
          Returns a new list containing all the DbEntities in entities, in the correct order for deleting objects from or removing the tables of, those entities.
 java.util.List sortedDbEntitiesInInsertOrder(java.util.List dbEntities)
          Returns a new list containing all the DbEntities in entities, in the correct order for inserting objects int,o or creating the tables of, those entities.
 java.util.List sortedQueries(java.util.List unsortedQueries)
          Creates and returns an array of queries in the right sorting order from an unsorted array.
 void sortObjectsInDeleteOrder(java.util.List objects)
          Sorts an unsorted array of DataObjects in the right delete order for database constraints not to be violated, and so that master pk's for dependent relationships are in place prior to being needed for the dependent object and reflexive relationships are correctly handled
 void sortObjectsInInsertOrder(java.util.List objects)
          Sorts an unsorted array of DataObjects in the right insert order for database constraints not to be violated, and so that master pk's for dependent relationships are in place prior to being needed for the dependent object, and reflexive relationships are correctly handled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSorterClass

protected static java.lang.Class defaultSorterClass

sorter

protected DependencySorter sorter
Constructor Detail

SortHandler

public SortHandler(org.objectstyle.cayenne.access.QueryEngine queryEngine,
                   org.objectstyle.cayenne.map.DataMap[] dataMaps)
Constructor for SortHandler.


SortHandler

public SortHandler(java.lang.Class sorterClass,
                   org.objectstyle.cayenne.access.QueryEngine queryEngine,
                   org.objectstyle.cayenne.map.DataMap[] dataMaps)
Creates SortHandler with a specified sorter class.

Method Detail

getDefaultSorterClass

public static java.lang.Class getDefaultSorterClass()

setDefaultSorterClass

public static void setDefaultSorterClass(java.lang.Class defaultSorterClass)
Sets the class of the sorter that should be used as a source of dependency sorting algorithms. Class must be an instance of DependencySorter and must have a default no-argument constructor.


sortedQueries

public java.util.List sortedQueries(java.util.List unsortedQueries)
Creates and returns an array of queries in the right sorting order from an unsorted array.


sortedDbEntitiesInInsertOrder

public java.util.List sortedDbEntitiesInInsertOrder(java.util.List dbEntities)
Returns a new list containing all the DbEntities in entities, in the correct order for inserting objects int,o or creating the tables of, those entities.


sortedDbEntitiesInDeleteOrder

public java.util.List sortedDbEntitiesInDeleteOrder(java.util.List dbEntities)
Returns a new list containing all the DbEntities in entities, in the correct order for deleting objects from or removing the tables of, those entities.


sortObjectsInInsertOrder

public void sortObjectsInInsertOrder(java.util.List objects)
Sorts an unsorted array of DataObjects in the right insert order for database constraints not to be violated, and so that master pk's for dependent relationships are in place prior to being needed for the dependent object, and reflexive relationships are correctly handled


sortObjectsInDeleteOrder

public void sortObjectsInDeleteOrder(java.util.List objects)
Sorts an unsorted array of DataObjects in the right delete order for database constraints not to be violated, and so that master pk's for dependent relationships are in place prior to being needed for the dependent object and reflexive relationships are correctly handled