Project Wonder 5.0

com.webobjects.eoaccess
Class ERXModel

java.lang.Object
  extended by com.webobjects.eoaccess.EOModel
      extended by com.webobjects.eoaccess.ERXModel
All Implemented Interfaces:
NSDisposable
Direct Known Subclasses:
ERXModelGroup.Model

public class ERXModel
extends EOModel

This EOModel subclass primarily provides the opportunity to subclass EOEntity.

Note the package com.webobjects.eoaccess is used to allow any protected or default access superclass instance methods to resolve at runtime.

To allow for extended prototypes set er.extensions.ERXModel.useExtendedPrototypes=true. Note: this may be incompatible with ERXModelGroup#flattenPrototypes.

The existence of prototype entities based on specific conventions is checked and the attributes of those prototype entities are added to the model's prototype attributes cache in a specific order. The search order ensures that the same prototype attribute names in different prototype entities get chosen in a predictable way.

Consequently, you can use this search order knowledge to over-ride Wonder's ERPrototypes for your entire set of application eomodels or just for specific named eomodels.

To understand the variables used in deriving the prototype entity names that are searched a few definitions are appropriate
<pluginName>
Relates to the database type. Examples of pluginName are MySQL, Derby, FrontBase, OpenBase, Oracle, Postgresql
<adaptorName>
Relates to the general persistence mechanism. Examples of adaptorName are JDBC, Memory, REST
<modelName>
The name of an eomodel in your app or frameworks
The priority order (which is basically the reverse of the search order) for prototype entities is as follows:

Author:
ldeck

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.eoaccess.EOModel
EOModel._DefaultModelCreator, EOModel.EOModelFileNameFilter
 
Field Summary
static Object _ERXGlobalModelLock
           
 
Fields inherited from class com.webobjects.eoaccess.EOModel
_adaptorName, _connectionDictionary, _entities, _entitiesByClass, _entitiesByName, _EOGlobalModelLock, _extraRefCount, _group, _internalInfo, _name, _prototypesByName, _sharedObjectEntities, _storedProcedures, _subEntitiesCache, _url, _userInfo, EntityLoadedNotification
 
Fields inherited from interface com.webobjects.foundation.NSDisposable
_CLASS
 
Constructor Summary
ERXModel()
          Creates and returns a new ERXModel.
ERXModel(NSDictionary propertyList, String path)
           
ERXModel(NSDictionary propertyList, URL url)
           
ERXModel(URL url)
          Creates a new EOModel object by reading the contents of the model archive at url.
 
Method Summary
 Object _addEntityWithPropertyList(Object propertyList)
          Sets the default EOEntity class to com.webobjects.eoaccess.ERXEntity.
 NSArray availablePrototypeAttributeNames()
          Overridden to use our prototype creation method if er.extensions.ERXModel.useExtendedPrototypes=true.
static void createPrototypes(EOModel model)
          Create the prototype cache for the given model by walking a search order.
static boolean isUseExtendedPrototypesEnabled()
          Defaults to false.
 EOAttribute prototypeAttributeNamed(String name)
          Overridden to use our prototype creation method if er.extensions.ERXModel.useExtendedPrototypes=true.
 void setModelGroup(EOModelGroup modelGroup)
           
protected  boolean useExtendedPrototypes()
          Defaults to false as returned by isUseExtendedPrototypesEnabled().
 
Methods inherited from class com.webobjects.eoaccess.EOModel
_addEntity, _addFakeEntityWithPropertyList, _childrenForEntityNamed, _classDescriptionNeededForClass, _classDescriptionNeededForEntityName, _entityForClass, _externalModelsReferencedByEntities, _filenameForFetchSpecificationDictionaryForEntityNamedWithModelPath, _initWithPropertyListOwner, _initWithTableOfContentsPropertyListPathURL, _instantiatedEntities, _internalInfo, _isPrototypesEntity, _loadFetchSpecificationDictionaryForEntityNamed, _registerChildForParent, _removeEntity, _removePropertiesReferencingEntity, _resetPrototypeCache, _setEntitiesWithSharedObjects, _setEntityForEntityNameClassName, _setInheritanceLinks, _setInternalInfo, _setPathURL, _toString, _writeFetchSpecificationDictionaryForEntityNamedToModelPath, adaptorName, addEntity, addStoredProcedure, beautifyNames, connectionDictionary, dispose, encodeTableOfContentsIntoPropertyList, entities, entitiesWithSharedObjects, entityForObject, entityNamed, entityNames, entityPrototypeNameForAdaptor, entityPrototypePlugInNameForAdaptor, externalModelsReferenced, loadAllModelObjects, modelGroup, name, path, pathURL, referencesToProperty, removeEntity, removeEntityAndReferences, removeStoredProcedure, setAdaptorName, setConnectionDictionary, setName, setUserInfo, storedProcedureNamed, storedProcedureNames, storedProcedures, toString, userInfo, writeToFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_ERXGlobalModelLock

public static Object _ERXGlobalModelLock
Constructor Detail

ERXModel

public ERXModel()
Creates and returns a new ERXModel.


ERXModel

public ERXModel(URL url)
Creates a new EOModel object by reading the contents of the model archive at url. Sets the EOModel's name and path from the context of the model archive. Throws an IllegalArgumentException if url is null or if unable to read content from url. Throws a runtime exception if unable for any other reason to initialize the model from the specified java.net.URL; the error text indicates the nature of the exception.

Parameters:
url - - The java.net.URL to a model archive.

ERXModel

public ERXModel(NSDictionary propertyList,
                String path)
Parameters:
propertyList -
path -

ERXModel

public ERXModel(NSDictionary propertyList,
                URL url)
Parameters:
propertyList -
url -
Method Detail

createPrototypes

public static void createPrototypes(EOModel model)
Create the prototype cache for the given model by walking a search order.

Parameters:
model -

isUseExtendedPrototypesEnabled

public static boolean isUseExtendedPrototypesEnabled()
Defaults to false. Note: when enabled, this may be incompatible with ERXModelGroup#flattenPrototypes.

Returns:
the boolean property value for er.extensions.ERXModel.useExtendedPrototypes.

_addEntityWithPropertyList

public Object _addEntityWithPropertyList(Object propertyList)
                                  throws InstantiationException,
                                         IllegalAccessException
Sets the default EOEntity class to com.webobjects.eoaccess.ERXEntity. You can provide your own via the property er.extensions.ERXModel.defaultEOEntityClassName however your class must be in the same package unless you plan on re-implementing eof itself.

Overrides:
_addEntityWithPropertyList in class EOModel
Throws:
InstantiationException
IllegalAccessException
See Also:
EOModel._addEntityWithPropertyList(java.lang.Object)

availablePrototypeAttributeNames

public NSArray availablePrototypeAttributeNames()
Overridden to use our prototype creation method if er.extensions.ERXModel.useExtendedPrototypes=true.

Overrides:
availablePrototypeAttributeNames in class EOModel

prototypeAttributeNamed

public EOAttribute prototypeAttributeNamed(String name)
Overridden to use our prototype creation method if er.extensions.ERXModel.useExtendedPrototypes=true.

Overrides:
prototypeAttributeNamed in class EOModel

setModelGroup

public void setModelGroup(EOModelGroup modelGroup)
Overrides:
setModelGroup in class EOModel

useExtendedPrototypes

protected boolean useExtendedPrototypes()
Defaults to false as returned by isUseExtendedPrototypesEnabled().

See Also:
ERXModel#isUseExtendedPrototypesEnabled()

Last updated: Wed, Feb 22, 2012 • 07:00 AM EST

Copyright © 2002 – 2011 Project Wonder.