EOModel
Inherits from: NSObject
Package: com.apple.yellow.eoaccess
Class Description
An EOModel represents a mapping between a database schema and a set of classes based on the entity-relationship model. The model contains a number of EOEntity objects representing the entities (tables) of the database schema. Each EOEntity object has a number of EOAttribute and EORelationship objects representing the properties (columns or fields) of the entity in the database schema. For more information on attributes and relationships, see their respective class specifications.
An EOModel maintains a mapping between each of its EOEntity objects and a corresponding enterprise object class for use with the database level of the Enterprise Objects Framework. You can determine the EOEntity for a particular enterprise object with the entityForObject method.
An EOModel is specific to a particular database server, and stores information needed to connect to that server. This includes the name of an adaptor framework to load so that the Enterprise Objects Framework can communicate with the database. Models are stored in the file system in a manner similar to adaptor framework. EOModel objects are usually loaded from model files built with the EOModeler application rather than built programmatically. If you need to programmatically load a model file, see the section "Loading a Model File" .
Models can have relationships that reference other models in the same model group. The other models may map to different databases and types of servers.
Models are organized into model groups; see the EOModelGroup class specification for more information.
Creating an EOModel Programmatically
The EOAdaptorChannel class declares methods for reading basic schema information from a relational database. You can use this information to build up an EOModel programmatically, and then enhance that model by defining extra relationships, flattening attributes, and so on. See the class description in the EOAdaptorChannel class specification for information on reading basic schema information, and see the other modeling classes' specifications for information on creating additional attributes and relationships.
Constants
EOModel defines a String constant for the name of the notification it posts. For more information, see "Notifications" .
Method Types
- Constructors
- EOModel
- Saving a model
- encodeTableOfContentsIntoPropertyList
- writeToFile
- Loading a model's objects
- loadAllModelObjects
- Working with entities
- addEntity
- removeEntity
- removeEntityAndReferences
- entityNames
- entityNamed
- entities
- entitiesWithSharedObjects
- Naming a model's components
- beautifyNames
- Accessing the model's name
- setName
- name
- path
- Checking references
- referencesToProperty
- externalModelsReferenced
- Getting an object's entity
- entityForObject
- Accessing the adaptor bundle
- adaptorName
- setAdaptorName
- Accessing the connection dictionary
- setConnectionDictionary
- connectionDictionary
- Accessing the user dictionary
- setUserInfo
- userInfo
- Working with stored procedures
- addStoredProcedure
- removeStoredProcedure
- storedProcedureNames
- storedProcedureNamed
- storedProcedures
- Accessing the model's group
- setModelGroup
- modelGroup
- Accessing prototype attributes
- availablePrototypeAttributeNames
- prototypeAttributeNamed
Constructors
EOModel
public EOModel(String path)
public EOModel(
NSDictionary tableOfContents,
String path)
See Also: name, path, encodeTableOfContentsIntoPropertyList
Instance Methods
adaptorName
public String adaptorName()
addEntity
public void addEntity(EOEntity anEntity)
exception
if
an error occurs (for example, if anEntity doesn't exist,
if the entity belongs to another model, or if an entity of the same
name is already in the receiver).See Also: entities, removeEntity, removeEntityAndReferences
addStoredProcedure
public void addStoredProcedure(EOStoredProcedure storedProcedure)
See Also: removeStoredProcedure, storedProcedures, storedProcedureNamed
availablePrototypeAttributeNames
public NSArray availablePrototypeAttributeNames()
See Also: prototypeAttributeNamed
beautifyNames
public void beautifyNames()
See Also: nameForExternalName (EOEntity), beautifyName ( EOEntity, EOAttribute, EORelationship, EOStoredProcedure), name
connectionDictionary
public NSDictionary connectionDictionary()
encodeTableOfContentsIntoPropertyList
public void encodeTableOfContentsIntoPropertyList(NSMutableDictionary propertyList)
See Also: EOModel constructors
entities
public NSArray entities()
See Also: entityNames
entitiesWithSharedObjects
public NSArray entitiesWithSharedObjects()
entityForObject
public EOEntity entityForObject(Object anEO)
entityNamed
public EOEntity entityNamed(String name)
See Also: entityNames, entities
entityNames
public NSArray entityNames()
See Also: entities, entityNamed
externalModelsReferenced
public NSArray externalModelsReferenced()
See Also: referencesToProperty
loadAllModelObjects
public void loadAllModelObjects()
See Also: attributes (EOEntity), entities, relationships (EOEntity), storedProcedures
modelGroup
public EOModelGroup modelGroup()
See Also: setModelGroup
name
public String name()
See Also: path, EOModel constructors
path
public String path()
See Also: name, EOModel constructors
prototypeAttributeNamed
public EOAttribute prototypeAttributeNamed(String attributeName)
See Also: availablePrototypeAttributeNames
referencesToProperty
public NSArray referencesToProperty(Object aProperty)
See Also: externalModelsReferenced
removeEntity
public void removeEntity(EOEntity name)
See Also: addEntity, removeEntityAndReferences
removeEntityAndReferences
public void removeEntityAndReferences(EOEntity entity)
See Also: removeEntity, addEntity
removeStoredProcedure
public void removeStoredProcedure(EOStoredProcedure storedProcedure)
See Also: addStoredProcedure, storedProcedures
setAdaptorName
public void setAdaptorName(String adaptorName)
See Also: availableAdaptorNames (EOAdaptor)
setConnectionDictionary
public void setConnectionDictionary(NSDictionary connectionDictionary)
See Also: adaptorWithModel (EOAdaptor)
setModelGroup
public void setModelGroup(EOModelGroup group)
See Also: modelGroup
setName
public void setName(String name)
setUserInfo
public void setUserInfo(NSDictionary dictionary)
storedProcedureNamed
public EOStoredProcedure storedProcedureNamed(String name)
See Also: storedProcedureNames, storedProcedures
storedProcedureNames
public NSArray storedProcedureNames()
See Also: storedProcedureNamed, storedProcedures
storedProcedures
public NSArray storedProcedures()
See Also: storedProcedureNames, storedProcedureNamed
userInfo
public NSDictionary userInfo()
See Also: setUserInfo
writeToFile
public void writeToFile(String path)
Throws an exception on any error which prevents the file from being written.
See Also: path
Notifications
EOModel declares and posts the following notification.
EntityLoadedNotification
Posted after an EOEntity is loaded into memory. The notification contains:Notification Object | The entity that was loaded. |
Userinfo | None |