public abstract class ERXEntityOrder extends Object
This is implemented by creating a dictionary of entity name to group. Group 1 is entities with no dependencies. Group 2 is entities with
dependencies on entities in group 1. Group 3 is entities with dependencies on entities in groups 1 and 2. etc.
The dependencies between entities are determined by the abstract NSDictionary dependenciesByEntity()
.
Modifier and Type | Class and Description |
---|---|
static class |
ERXEntityOrder.EntityDeleteOrderComparator
NSComparator to sort on the ascending EOEntity group number from ordering.entityOrdering().
|
static class |
ERXEntityOrder.EntityInsertOrderComparator
NSComparator to sort on the descending EOEntity group number from ordering.entityOrdering().
|
Modifier and Type | Field and Description |
---|---|
protected NSArray<com.webobjects.eoaccess.EOEntity> |
allEntities |
protected NSMutableDictionary<String,Integer> |
groupedEntities |
Constructor and Description |
---|
ERXEntityOrder()
Convenience constructor for implementing classes.
|
ERXEntityOrder(com.webobjects.eoaccess.EOModelGroup modelGroup)
Designated constructor for implementing classes.
|
Modifier and Type | Method and Description |
---|---|
NSArray<com.webobjects.eoaccess.EOEntity> |
allEntities() |
void |
createListOfEntities(com.webobjects.eoaccess.EOModelGroup modelGroup)
Creates list of all entities (excluding prototype entities) in all models in
modelGroup . |
protected abstract NSDictionary<String,NSSet<String>> |
dependenciesByEntity()
Processes
allEntities() and returns a dictionary keyed on
dependencyKeyFor(EOEntity) . |
protected String |
dependencyKeyFor(com.webobjects.eoaccess.EOEntity entity)
This implementation returns
entity.name() . |
protected NSSet<String> |
dependentEntities(NSDictionary<String,NSSet<String>> dependencies,
com.webobjects.eoaccess.EOEntity entity) |
protected void |
generateOrdering()
Calls
dependenciesByEntity() to determine dependencies and processes entities
in allEntities() to generate the groupedEntities() dictionary. |
NSMutableDictionary<String,Integer> |
groupedEntities()
Returns dictionary of group numbers (
java.lang.Integer ) to entity names. |
protected boolean |
hasDependenciesForEntity(NSDictionary<String,NSSet<String>> dependencies,
com.webobjects.eoaccess.EOEntity entity) |
protected NSMutableDictionary<String,Integer> groupedEntities
protected NSArray<com.webobjects.eoaccess.EOEntity> allEntities
public ERXEntityOrder(com.webobjects.eoaccess.EOModelGroup modelGroup)
modelGroup
- EOModelGroup to get list of all entities frompublic ERXEntityOrder()
EOModelGroup.defaultGroup()
.public NSMutableDictionary<String,Integer> groupedEntities()
java.lang.Integer
) to entity names.
Group 1 is entities with no dependencies. Group 2 is entities with
dependencies on entities in group 1. Group 3 is entities with
dependencies on entities in groups 1 and 2. etcprotected abstract NSDictionary<String,NSSet<String>> dependenciesByEntity()
allEntities()
and returns a dictionary keyed on
dependencyKeyFor(EOEntity)
. The keys are usually entity.name()
but are
not required to be. The value associated with each key is an NSSet of the
entity names that have a dependency on the key. This dictionary is used
to determine the dependency ordering.protected void generateOrdering()
dependenciesByEntity()
to determine dependencies and processes entities
in allEntities()
to generate the groupedEntities()
dictionary.protected boolean hasDependenciesForEntity(NSDictionary<String,NSSet<String>> dependencies, com.webobjects.eoaccess.EOEntity entity)
dependencies
- dictionary from dependenciesByEntity()
entity
- entity to check for dependenciesgroupedEntities()
has all the entities named in dependentEntities(dependencies, entity)
.protected NSSet<String> dependentEntities(NSDictionary<String,NSSet<String>> dependencies, com.webobjects.eoaccess.EOEntity entity)
dependencies
- result from dependenciesByEntity()
entity
- EOEntity to return dependencies set forprotected String dependencyKeyFor(com.webobjects.eoaccess.EOEntity entity)
entity.name()
.entity
- EOEntity to return key into dependency dictionary forentity
into dependency dictionary returned by dependenciesByEntity()
public void createListOfEntities(com.webobjects.eoaccess.EOModelGroup modelGroup)
modelGroup
.modelGroup
- EOModelGroup to get list of all entities frompublic NSArray<com.webobjects.eoaccess.EOEntity> allEntities()
Copyright © 2002 – 2020 Project Wonder.