// Don't replace prototypes if you're already just using "EOPrototypes"
if (replacementPrototypeName.equals(prototypeEntityName)) {
return;
}
NSMutableDictionary removedPrototypeEntities = new NSMutableDictionary();
EOModel prototypesModel = null;
Enumeration modelsEnum = modelGroup.models().objectEnumerator();
while (modelsEnum.hasMoreElements()) {
EOModel model = (EOModel) modelsEnum.nextElement();
EOEntity eoAdaptorPrototypesEntity = _modelGroup.entityNamed("EO" + model.adaptorName() + "Prototypes");
if (eoAdaptorPrototypesEntity != null) {
prototypesModel = eoAdaptorPrototypesEntity.model();
// System.out.println("EOFSQLGenerator.EOFSQLGenerator:
// removing " + eoAdaptorPrototypesEntity.name() + " from "
// + prototypesModel.name());
prototypesModel.removeEntity(eoAdaptorPrototypesEntity);
removedPrototypeEntities.takeValueForKey(eoAdaptorPrototypesEntity, eoAdaptorPrototypesEntity.name());
}
}
EOEntity eoPrototypesEntity = _modelGroup.entityNamed("EOPrototypes");
if (eoPrototypesEntity != null) {
prototypesModel = eoPrototypesEntity.model();
prototypesModel.removeEntity(eoPrototypesEntity);
// System.out.println("EOFSQLGenerator.EOFSQLGenerator: removing
// " + eoPrototypesEntity.name() + " from " +
// prototypesModel.name());
removedPrototypeEntities.takeValueForKey(eoPrototypesEntity, eoPrototypesEntity.name());
}
EOEntity prototypesEntity = _modelGroup.entityNamed(prototypeEntityName);
if (prototypesEntity == null) {
prototypesEntity = (EOEntity) removedPrototypeEntities.valueForKey(prototypeEntityName);
} else {
prototypesModel = prototypesEntity.model();
prototypesModel.removeEntity(prototypesEntity);
}
if (prototypesEntity != null && prototypesModel != null) {