log.info("Not adding model, it's only a temp file: " + indexPath);
continue;
}
String modelPath = NSPathUtilities.stringByDeletingLastPathComponent(indexPath);
String modelName = (NSPathUtilities.stringByDeletingPathExtension(NSPathUtilities.lastPathComponent(modelPath)));
EOModel eomodel = modelNamed(modelName);
if (eomodel == null) {
URL url = nsbundle.pathURLForResourcePath(modelPath);
modelNameURLDictionary.setObjectForKey(url, modelName);
modelNames.addObject(modelName);
}
else if (NSLog.debugLoggingAllowedForLevelAndGroups(1, 32768L)) {
NSLog.debug.appendln("Ignoring model at path \"" + modelPath + "\" because the model group " + this + " already contains the model from the path \"" + eomodel.pathURL() + "\"");
}
}
}
NSMutableArray<URL> modelURLs = new NSMutableArray<URL>();
// First, add prototyes if specified
for(Enumeration prototypeModelNamesEnum = _prototypeModelNames.objectEnumerator(); prototypeModelNamesEnum.hasMoreElements(); ) {
String prototypeModelName = (String) prototypeModelNamesEnum.nextElement();
URL prototypeModelURL = (URL) modelNameURLDictionary.removeObjectForKey(prototypeModelName); // WO53
modelNames.removeObject(prototypeModelName);
if (prototypeModelURL != null) {
modelURLs.addObject(prototypeModelURL);
} else {
// AK: we throw for everything except erprototypes, as it is set by default
if(!"erprototypes".equals(prototypeModelName)) {
throw new IllegalArgumentException("You specified the prototype model '" + prototypeModelName + "' in your prototypeModelNames array, but it can not be found.");
}
}
}
// Next, add all models that are stated explicitely
for(Enumeration<String> modelLoadOrderEnum = _modelLoadOrder.objectEnumerator(); modelLoadOrderEnum.hasMoreElements(); ) {
String modelName = modelLoadOrderEnum.nextElement();
URL modelURL = modelNameURLDictionary.removeObjectForKey(modelName);
modelNames.removeObject(modelName);
if (modelURL == null) {
throw new IllegalArgumentException("You specified the model '" + modelName + "' in your modelLoadOrder array, but it can not be found.");
}
modelURLs.addObject(modelURL);
}
// Finally add all the rest
for (Enumeration<String> e = modelNames.objectEnumerator(); e.hasMoreElements();) {
String name = e.nextElement();
modelURLs.addObject(modelNameURLDictionary.objectForKey(name));
}
Enumeration<URL> modelURLEnum = modelURLs.objectEnumerator();
while (modelURLEnum.hasMoreElements()) {
URL url = modelURLEnum.nextElement();
addModelWithPathURL(url);
}
// correcting an EOF Inheritance bug
checkInheritanceRelationships();
if (!patchModelsOnLoad) {
modifyModelsFromProperties();
flattenPrototypes();
Enumeration<EOModel> modelsEnum = models().objectEnumerator();
while (modelsEnum.hasMoreElements()) {
EOModel model = modelsEnum.nextElement();
preloadERXConstantClassesForModel(model);
}
}
NSNotificationCenter.defaultCenter().postNotification(ModelGroupAddedNotification, this);