}
_entities = new NSMutableArray();
_model = _modelGroup.modelNamed(modelName);
NSDictionary defaultConnectionDictionary;
Map overrideConnectionDictionary = (Map) databaseConfig.get("connectionDictionary");
if (overrideConnectionDictionary != null) {
NSDictionary connectionDictionary = (NSDictionary) EOFSQLUtils56.toWOCollections(overrideConnectionDictionary);
_model.setConnectionDictionary(connectionDictionary);
String eomodelProcessorClassName = (String) connectionDictionary.valueForKey("eomodelProcessorClassName");
if (eomodelProcessorClassName != null) {
findModelProcessor(eomodelProcessorClassName, true);
}
defaultConnectionDictionary = connectionDictionary;
} else {
defaultConnectionDictionary = _model.connectionDictionary();
}
Enumeration modelsEnum = _modelGroup.models().objectEnumerator();
while (modelsEnum.hasMoreElements()) {
EOModel model = (EOModel) modelsEnum.nextElement();
if (model.connectionDictionary() == null) {
model.setConnectionDictionary(defaultConnectionDictionary);
}
}
if (_modelProcessor == null) {
findModelProcessor("org.objectstyle.wolips.eomodeler.EOModelProcessor", false);
}
if (entityNames == null || entityNames.size() == 0) {
Enumeration entitiesEnum = _model.entities().objectEnumerator();
while (entitiesEnum.hasMoreElements()) {
EOEntity entity = (EOEntity) entitiesEnum.nextElement();
if (!isPrototype(entity)) {// &&
// entityUsesSeparateTable(entity))
// {
_entities.addObject(entity);
}
}
} else {
Iterator entityNamesIter = entityNames.iterator();
while (entityNamesIter.hasNext()) {
String entityName = (String) entityNamesIter.next();
EOEntity entity = _model.entityNamed(entityName);
if (entity != null) {
_entities.addObject(entity);
}
}
}
// MS: Remove jdbc2Info prior to SQL generation
NSDictionary connectionDictionary = _model.connectionDictionary();
if (connectionDictionary != null) {
NSMutableDictionary mutableConnectionDictionary = connectionDictionary.mutableClone();
mutableConnectionDictionary.removeObjectForKey("jdbc2Info");
_model.setConnectionDictionary(mutableConnectionDictionary);
}
// MS: Add the "inEntityModeler" flag so that plugins can adjust their
// behavior
// if they need to.
if (runInEntityModeler) {
NSMutableDictionary modelUserInfo = _model.userInfo().mutableClone();
NSDictionary entityModelerDict = (NSDictionary) modelUserInfo.valueForKey("_EntityModeler");
NSMutableDictionary mutableEntityModelerDict;
if (entityModelerDict == null) {
mutableEntityModelerDict = new NSMutableDictionary();
} else {
mutableEntityModelerDict = entityModelerDict.mutableClone();
}
mutableEntityModelerDict.takeValueForKey(Boolean.TRUE, "inEntityModeler");
modelUserInfo.takeValueForKey(mutableEntityModelerDict, "_EntityModeler");
_model.setUserInfo(modelUserInfo);
}