ERXModel Class Reference

Inherits com::webobjects::eoaccess::EOModel.

Inherited by ERXModelGroup.Model.

Collaboration diagram for ERXModel:

Collaboration graph
[legend]

List of all members.

Public Member Functions

Object _addEntityWithPropertyList (Object propertyList) throws InstantiationException, IllegalAccessException
NSArray availablePrototypeAttributeNames ()
 ERXModel (NSDictionary propertyList, URL url)
 ERXModel (NSDictionary propertyList, String path)
 ERXModel (URL url)
 ERXModel ()
EOAttribute prototypeAttributeNamed (String name)
void setModelGroup (EOModelGroup modelGroup)

Static Public Member Functions

static void createPrototypes (EOModel model)
static boolean isUseExtendedPrototypesEnabled ()

Static Public Attributes

static Object _ERXGlobalModelLock

Protected Member Functions

boolean useExtendedPrototypes ()

Static Package Functions

 [static initializer]

Static Private Member Functions

static void addAttributesToPrototypesCache (EOModel model, NSArray<?extends EOAttribute > prototypeAttributes)
static void addAttributesToPrototypesCache (EOModel model, EOEntity prototypesEntity)
static NSArray< EOAttribute > attributesFromEntity (EOEntity entity)
static NSArray< StringnamesForAttributes (NSArray<?extends EOAttribute > attributes)

Static Private Attributes

static final Logger log = Logger.getLogger(ERXModel.class)


Detailed Description

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

Constructor & Destructor Documentation

ERXModel (  ) 

Creates and returns a new ERXModel.

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 ( NSDictionary  propertyList,
String  path 
)

Parameters:
propertyList 
path 

ERXModel ( NSDictionary  propertyList,
URL  url 
)

Parameters:
propertyList 
url 


Member Function Documentation

[static initializer] (  )  [static, package]

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.

See also:
com.webobjects.eoaccess.EOModel._addEntityWithPropertyList(java.lang.Object)

static void addAttributesToPrototypesCache ( EOModel  model,
NSArray<?extends EOAttribute >  prototypeAttributes 
) [static, private]

Utility to add attributes to the prototype cache for a given model. As the attributes are chosen by name, replace already existing ones.

Parameters:
model - the model to which the prototype attributes will be cached
prototypeAttributes - the prototype attributes to add to the model

static void addAttributesToPrototypesCache ( EOModel  model,
EOEntity  prototypesEntity 
) [static, private]

Utility to add attributes to the prototype cache. As the attributes are chosen by name, replace already existing ones.

Parameters:
model - the model to which the prototype attributes will be cached
prototypesEntity - the entity from which to copy the prototype attributes

static NSArray<EOAttribute> attributesFromEntity ( EOEntity  entity  )  [static, private]

Utility for getting all the attributes off an entity. If the entity is null, an empty array is returned.

Parameters:
entity 
Returns:
array of attributes from the given entity

NSArray availablePrototypeAttributeNames (  ) 

Overridden to use our prototype creation method if er.extensions.ERXModel.useExtendedPrototypes=true.

static void createPrototypes ( EOModel  model  )  [static]

Create the prototype cache for the given model by walking a search order.

Parameters:
model 

static boolean isUseExtendedPrototypesEnabled (  )  [static]

Defaults to false. Note: when enabled, this may be incompatible with ERXModelGroup#flattenPrototypes.

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

static NSArray<String> namesForAttributes ( NSArray<?extends EOAttribute >  attributes  )  [static, private]

Utility for getting all names from an array of attributes.

Parameters:
attributes 
Returns:
array of attribute names

EOAttribute prototypeAttributeNamed ( String  name  ) 

Overridden to use our prototype creation method if er.extensions.ERXModel.useExtendedPrototypes=true.

void setModelGroup ( EOModelGroup  modelGroup  ) 

boolean useExtendedPrototypes (  )  [protected]

Defaults to false as returned by isUseExtendedPrototypesEnabled().

See also:
ERXModel.isUseExtendedPrototypesEnabled()

Reimplemented in ERXModelGroup.Model.


Member Data Documentation

Object _ERXGlobalModelLock [static]

final Logger log = Logger.getLogger(ERXModel.class) [static, private]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:32 2012 for Project Wonder by  doxygen 1.5.8