ERXModelGroup Class Reference

Inherits com::webobjects::eoaccess::EOModelGroup.

Collaboration diagram for ERXModelGroup:

Collaboration graph
[legend]

List of all members.

Classes

class  LocalizedAttributeProcessor
class  Model

Public Member Functions

void addModel (EOModel eomodel)
EOModel addModelWithPathURL (URL url)
void checkForMismatchedJoinTypes ()
void checkInheritanceRelationships ()
int entityCode (EOEntity entity)
int entityCode (String ename)
 ERXModelGroup ()
boolean isPrototypeModel (EOModel model)
void loadModelsFromLoadedBundles ()
void modelAddedHandler (NSNotification n)
void resetConnectionDictionaryInModel (EOModel model)

Static Public Member Functions

static int _enumForKey (String key)
static boolean _isKeyEnumOverriden (EOAttribute att, int key)
static Object _keyForEnum (int key)
static NSArray _prototypeKeys ()
static boolean isPrototypeEntity (EOEntity entity)
static boolean isPrototypeEntityName (String entityName)
static boolean patchModelsOnLoad ()
static String prototypeEntityNameForModel (EOModel model)
static String sqlDumpDirectory ()

Static Public Attributes

static final String LANGUAGES_KEY = "ERXLanguages"
static final Logger log = Logger.getLogger(ERXModelGroup.class)
static final String ModelGroupAddedNotification = "ERXModelGroupAddedNotification"

Protected Member Functions

void fixFlatDictionary (EOModel model)
void fixJDBCDictionary (EOModel model)
void fixJNDIDictionary (EOModel model)
void fixOpenBaseDictionary (EOModel model)
void fixOracleDictionary (EOModel model)
void modifyModelsFromProperties ()
void preloadERXConstantClassesForModel (EOModel model)

Static Protected Member Functions

static NSDictionary databaseConfigForModel (EOModel model)

Protected Attributes

NSArray< String_modelLoadOrder = ERXProperties.componentsSeparatedByStringWithDefault("er.extensions.ERXModelGroup.modelLoadOrder", ",", NSArray.EmptyArray)
NSArray< String_prototypeModelNames = ERXProperties.componentsSeparatedByStringWithDefault("er.extensions.ERXModelGroup.prototypeModelNames", "," ,new NSArray<String>(ERXProperties.stringForKeyWithDefault("er.extensions.ERXModelGroup.prototypeModelName", "erprototypes")))

Static Protected Attributes

static final boolean flattenPrototypes = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXModelGroup.flattenPrototypes", true)
static final boolean patchModelsOnLoad = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXModelGroup.patchModelsOnLoad", false)

Static Package Functions

 [static initializer]

Private Member Functions

void dumpSchemaSQL (EOModel eomodel)
void fixPrototypesForModel (EOModel model)
void flattenPrototypeAttribute (EOAttribute prototypeAttribute, EOAttribute attribute)
void flattenPrototypes ()

Static Private Member Functions

static String decryptProperty (String key, String alternateKey)
static String getProperty (String key, String alternateKey)
static String getProperty (String key, String alternateKey, String defaultValue)

Private Attributes

Hashtable cache
boolean raiseOnUnmatchingConnectionDictionaries = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXModelGroup.raiseOnUnmatchingConnectionDictionaries", true)

Static Private Attributes

static final NSArray _prototypeKeys = new NSArray(new Object[] { "externalType", "columnName", "readOnly", "valueClassName", "valueType", "width", "precision", "scale", "writeFormat", "readFormat", "userInfo", "serverTimeZone", "valueFactoryMethodName", "adaptorValueConversionMethodName", "factoryMethodArgumentType", "allowsNull", "parameterDirection", "_internalInfo" })


Constructor & Destructor Documentation

er extensions ERXModelGroup[entityName].externalName change the table name for the given entityNameer.extensions.ERXModelGroup.[entityName].[attributeName].columnName change the column name for the given attribute (  ) 

Default public constructor

Modifies various settings of the entities and attributes in this model group based on System properties.


Member Function Documentation

[static initializer] (  )  [static, package]

static int _enumForKey ( String  key  )  [static]

static boolean _isKeyEnumOverriden ( EOAttribute  att,
int  key 
) [static]

static Object _keyForEnum ( int  key  )  [static]

static NSArray _prototypeKeys (  )  [static]

void addModel ( EOModel  eomodel  ) 

This implementation will load models that have entity name conflicts, removing the offending entity. The reason this is needed is because multiple models might have JDBC prototype entities which would cause problems for the model group.

Parameters:
eomodel model to be added

EOModel addModelWithPathURL ( URL  url  ) 

Overridden to use our model class in the runtime.

void checkForMismatchedJoinTypes (  ) 

Looks for foreign key attributes that have a different type from the destination attribute. The classic example of this is a long foreign key pointing to an integer primary key, which has a terrible consequence that is nearly impossible to track down.

void checkInheritanceRelationships (  ) 

Corrects a strange EOF inheritance issue where if a model gets loaded and an entity that has children located in a different model that hasn't been loaded yet will not be setup correctly. Specifically when those child entities are loaded they will not have their parentEntity relationship set correctly.

static NSDictionary databaseConfigForModel ( EOModel  model  )  [static, protected]

static String decryptProperty ( String  key,
String  alternateKey 
) [static, private]

void dumpSchemaSQL ( EOModel  eomodel  )  [private]

int entityCode ( EOEntity  entity  ) 

Looks up the userInfo for the Entity with the specified entityName and returns it if the code could be found.

Parameters:
entity the Entity for which we want to the get entityCode
Returns:
either the userInfo.entityCode or 0 if no entry could be found

int entityCode ( String  ename  ) 

Looks up the userInfo for the Entity with the specified entityName and returns it if the code could be found.

Parameters:
ename the name from the Entity for which we want to the get entityCode
Returns:
either the userInfo.entityCode or 0 if no entry could be found

void fixFlatDictionary ( EOModel  model  )  [protected]

void fixJDBCDictionary ( EOModel  model  )  [protected]

void fixJNDIDictionary ( EOModel  model  )  [protected]

void fixOpenBaseDictionary ( EOModel  model  )  [protected]

void fixOracleDictionary ( EOModel  model  )  [protected]

void fixPrototypesForModel ( EOModel  model  )  [private]

void flattenPrototypeAttribute ( EOAttribute  prototypeAttribute,
EOAttribute  attribute 
) [private]

Flattens a single attribute with the respective prototype.

Parameters:
prototypeAttribute 
attribute 

void flattenPrototypes (  )  [private]

If a prototypeEntityName is specified for a given model, go through and flatten the specified prototype down into all of the attributes of the model. This allows support for multiple databases in a single EOModelGroup, each using the correct database-specified variant of the prototype. Without flattening, you could not use ERPrototypes with a PostgreSQL and FrontBase database loaded at the same time, because the attribute names overlap. To get the most out of this behavior, you should use the Wonder-style prototype entity naming (EOJDBCFrontBasePrototypes) rather than the traditional EOPrototypes or EOJDBCPrototypes to provide unique namespaces for your prototype attributes.

static String getProperty ( String  key,
String  alternateKey 
) [static, private]

static String getProperty ( String  key,
String  alternateKey,
String  defaultValue 
) [static, private]

static boolean isPrototypeEntity ( EOEntity  entity  )  [static]

Returns whether or not the given entity is a prototype.

Parameters:
entity the entity to check
Returns:
whether or not the entity is a prototype

static boolean isPrototypeEntityName ( String  entityName  )  [static]

Returns whether or not the given entity name is a prototype entity

boolean isPrototypeModel ( EOModel  model  ) 

Returns whether the given model is listed as a prototype model in the properties.

void loadModelsFromLoadedBundles (  ) 

The only reason this method is needed is so our model group subclass is used. Other than that it does the exact same thing as EOModelGroup's implementation.

void modelAddedHandler ( NSNotification  n  ) 

Called when a model is loaded. This will reset the connection dictionary and insert the correct EOPrototypes if those are used

Parameters:
n notification posted when a model is loaded. The object is the model.

void modifyModelsFromProperties (  )  [protected]

static boolean patchModelsOnLoad (  )  [static]

void preloadERXConstantClassesForModel ( EOModel  model  )  [protected]

The classes referenced in the ERXConstantClassName field of an attribute's userInfo needs to be class-loaded before the attribute is used. This method enumerates all the attributes of all the entities in a model looking for those class names, and class loads them. Because the constant class name could be an inner class, it tries the raw value first, then replaces the last dot of the class name with a dollar sign and tries again.

Parameters:
model the model to load constants for
Exceptions:
IllegalArgumentException if the ERXConstantClassName cannot be resolved.

static String prototypeEntityNameForModel ( EOModel  model  )  [static]

void resetConnectionDictionaryInModel ( EOModel  model  ) 

Resets the connection dictionary to the specified values that are in the defaults. This method will look for defaults in the form:


   		<MODELNAME>.DBServer
   		<MODELNAME>.DBUser
   		<MODELNAME>.DBPassword
   		<MODELNAME>.URL (for JDBC)        
 

if the serverName and username both exists, we overwrite the connection dict (password is optional). Otherwise we fall back to what's in the model.

Likewise default values can be specified of the form:


   dbConnectUserGLOBAL
   dbConnectPasswordGLOBAL
   dbConnectURLGLOBAL
 

Parameters:
model to be reset

static String sqlDumpDirectory (  )  [static]


Member Data Documentation

NSArray<String> _modelLoadOrder = ERXProperties.componentsSeparatedByStringWithDefault("er.extensions.ERXModelGroup.modelLoadOrder", ",", NSArray.EmptyArray) [protected]

er.extensions.ERXModelGroup.modelLoadOrder defines the load order of the models. When you use this property the bundle loading will be disregarded. There is no default value.

final NSArray _prototypeKeys = new NSArray(new Object[] { "externalType", "columnName", "readOnly", "valueClassName", "valueType", "width", "precision", "scale", "writeFormat", "readFormat", "userInfo", "serverTimeZone", "valueFactoryMethodName", "adaptorValueConversionMethodName", "factoryMethodArgumentType", "allowsNull", "parameterDirection", "_internalInfo" }) [static, private]

NSArray<String> _prototypeModelNames = ERXProperties.componentsSeparatedByStringWithDefault("er.extensions.ERXModelGroup.prototypeModelNames", "," ,new NSArray<String>(ERXProperties.stringForKeyWithDefault("er.extensions.ERXModelGroup.prototypeModelName", "erprototypes"))) [protected]

er.extensions.ERXModelGroup.prototypeModelNames defines the names of the models that are prototypes. They get put in front of the model load order. The default is erprototypes

Hashtable cache [private]

final boolean flattenPrototypes = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXModelGroup.flattenPrototypes", true) [static, protected]

er.extensions.ERXModelGroup.flattenPrototypes defines if the prototypes should get flattened. Default is true.

Note: the default of true may be incompatible with ERXModel#isUseExtendedPrototypesEnabled.

final String LANGUAGES_KEY = "ERXLanguages" [static]

Key for languages, can be either in properties or in the model object's user info.

final Logger log = Logger.getLogger(ERXModelGroup.class) [static]

logging support

final String ModelGroupAddedNotification = "ERXModelGroupAddedNotification" [static]

Notification that is sent when the model group was created form the bundle loading.

final boolean patchModelsOnLoad = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXModelGroup.patchModelsOnLoad", false) [static, protected]

er.extensions.ERXModelGroup.patchModelsOnLoad is a boolean that defines is the created should be a Model not a EOModel. Default is false.

boolean raiseOnUnmatchingConnectionDictionaries = ERXProperties.booleanForKeyWithDefault("er.extensions.ERXModelGroup.raiseOnUnmatchingConnectionDictionaries", true) [private]


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

Generated on Sat May 26 06:43:11 2012 for Project Wonder by  doxygen 1.5.8