EOModelGroup
Inherits from: NSObject
Package: com.apple.yellow.eoaccess
Class Description
An EOModelGroup represents an aggregation of related models (see the EOModel class specification for more information on models). When a model in the group needs to resolve a relationship to an entity in another model, it looks for that model in its group. Model groups allow applications to load entities and their properties only as they're needed, by distributing them among separate EOModels.
The default model group contains all models for an application, as well as any frameworks the application references. It is automatically created on demand. The entity name space among all of these models is global; consequently, the same entity name shouldn't appear in any two of the models. All cross-model information is represented in the models by entity name only. Binding the entity name to an actual entity is done at run-time within the EOModelGroup.
In the majority of applications, the automatic creation of the default model group is sufficient. However, your code can override this automatic creation; see "Setting Up A Model Group Programmatically" .
Accessing Models Within a Model Group
Each model lives within a group and can form connections to other models in its group. A model can find a related model using the statement:
this.modelGroup().modelNamed(name);
A data source can locate a model using the statement:
EOModelGroup.defaultGroup().modelNamed(name);
EOModeler puts models with identical names in separate groups to allow you to load two models with the same name at the same time.
EOModelGroup Delegates
Your EOModelGroup object should have a delegate which can influence how it finds and loads models. In addition to the delegates you assign to EOModelGroup instances, the EOModelGroup class itself can have a delegate. The class delegate implements a single method- defaultModelGroup-while the instance delegate can implement the methods defined in the EOModelGroup.Delegate interface. For more information on EOModelGroup class delegate and instance delegate methods, see the EOModelGroup.ClassDelegate and EOModelGroup.Delegate interface specifications, respectively. Note that the following delegate methods are set on EOModelGroup, rather than EOEntity, to provide a single point in the code where you can alter the database-to-objects mapping:
- classForObjectWithGlobalID
- entityFailedToLookupClassNamed
- entityRelationshipForRow
- subEntityForEntity
Constants
EOModelGroup defines String constants for the names of the notifications it posts. For more information on these notifications, see "Notifications" .
Method Types
- Accessing models
- addModelWithPath
- modelNamed
- modelNames
- models
- modelWithPath
- removeModel
- Accessing model groups
- defaultGroup
- setDefaultGroup
- globalModelGroup
- modelGroupForObjectStoreCoordinator
- setModelGroup
- Searching a group
- entityNamed
- entityForObject
- entitiesWithSharedObjects
- fetchSpecificationNamed
- storedProcedureNamed
- Loading all of a group's objects
- loadAllModelObjects
- Assigning a delegate
- classDelegate
- delegate
- setClassDelegate
- setClassDelegate
Static Methods
classDelegate
public static Object classDelegate()
See Also: setClassDelegate
defaultGroup
public static EOModelGroup defaultGroup()
null
value,
this method is equivalent to globalModelGroup.See Also: classDelegate
globalModelGroup
public static EOModelGroup globalModelGroup()
See Also: defaultGroup
modelGroupForObjectStoreCoordinator
public static EOModelGroup modelGroupForObjectStoreCoordinator(com.apple.yellow.eocontrol.EOObjectStoreCoordinator anObjectStoreCoordinator)
See Also: setModelGroup
setClassDelegate
public static void setClassDelegate(Object anObject)
See Also: classDelegate, defaultModelGroup
setDefaultGroup
public static void setDefaultGroup(EOModelGroup group)
null
value,
the delegate's return value overrides group as
the default model group.See Also: defaultGroup, setClassDelegate
setModelGroup
public static void setModelGroup(
EOModelGroup group,
com.apple.yellow.eocontrol.EOObjectStoreCoordinator anObjectStoreCoordinator)
See Also: modelGroupForObjectStoreCoordinator
Instance Methods
addModel
public void addModel(EOModel model)
addModelWithPath
public EOModel addModelWithPath(String path)
delegate
public Object delegate()
See Also: setClassDelegate, classDelegate
entitiesWithSharedObjects
public NSArray entitiesWithSharedObjects()
entityForObject
public EOEntity entityForObject(Object object)
See Also: entityForObject (EOModel)
entityNamed
public EOEntity entityNamed(String entityName)
See Also: entityNamed (EOModel)
fetchSpecificationNamed
public com.apple.yellow.eocontrol.EOFetchSpecification fetchSpecificationNamed(
String fetchSpecName,
String entityName)
loadAllModelObjects
public void loadAllModelObjects()
See Also: loadAllModelObjects (EOModel)
modelNamed
public EOModel modelNamed(String modelName)
modelNames
public NSArray modelNames()
models
public NSArray models()
modelWithPath
public EOModel modelWithPath(String path)
See Also: path (EOModel)
removeModel
public void removeModel(EOModel aModel)
See Also: EOModelGroup, models
setDelegate
public void setDelegate(Object anObject)
See Also: delegate
storedProcedureNamed
public EOStoredProcedure storedProcedureNamed(String aName)
Notifications
EOModelGroup declares and posts the following notifications.
ModelAddedNotification
Posted by an EOModelGroup when an EOModel is added to the group. This notification is sent, for instance, inside Interface Builder when the user has saved changes to a model in EOModeler and the objects in Interface Builder must be brought back in sync. The old model is flushed and receivers of the notification (like data sources) can invoke modelNamed to re-fetch their models.Notification Object | The newly added model. |
Userinfo | None |
ModelInvalidatedNotification
Posted by an EOModelGroup when an EOModel is removed from the group. This notification is sent, for instance, inside Interface Builder when the user has saved changes to a model in EOModeler and the objects in Interface Builder must be brought back in sync. The old model is flushed and receivers of the notification (like data sources) can invoke modelNamed to re-fetch their models.Notification Object | The invalidated model. |
Userinfo | None |