classProperties = NSArray.EmptyArray;
}
if (attributesUsedForLocking == null) {
attributesUsedForLocking = NSArray.EmptyArray;
}
NSMutableArray mutableClassProperties = classProperties.mutableClone();
NSMutableArray mutableAttributesUsedForLocking = attributesUsedForLocking.mutableClone();
for (Enumeration e = attributes.objectEnumerator(); e.hasMoreElements();) {
EOAttribute attribute = (EOAttribute) e.nextElement();
NSDictionary userInfo = attribute.userInfo();
String name = attribute.name();
if (userInfo != null) {
Object l = userInfo.valueForKey("ERXLanguages");
if (l != null && !(l instanceof NSArray)) {
l = (entity.model().userInfo() != null ? entity.model().userInfo().valueForKey("ERXLanguages") : null);
}
NSArray languages = (NSArray) l;
if (languages != null && languages.count() > 0) {
String columnName = attribute.columnName();
for (int i = 0; i < languages.count(); i++) {
String language = (String) languages.objectAtIndex(i);
String newName = name + "_" + language;
String newColumnName = columnName + "_" + language;
EOAttribute newAttribute = new EOAttribute();
newAttribute.setName(newName);
entity.addAttribute(newAttribute);
newAttribute.setPrototype(attribute.prototype());
newAttribute.setColumnName(newColumnName);
newAttribute.setAllowsNull(attribute.allowsNull());
newAttribute.setClassName(attribute.className());
newAttribute.setExternalType(attribute.externalType());
newAttribute.setWidth(attribute.width());
newAttribute.setUserInfo(attribute.userInfo());
if (classProperties.containsObject(attribute)) {
mutableClassProperties.addObject(newAttribute);
}
if (attributesUsedForLocking.containsObject(attribute)) {
mutableAttributesUsedForLocking.addObject(newAttribute);
}
}
entity.removeAttribute(attribute);
mutableClassProperties.removeObject(attribute);
mutableAttributesUsedForLocking.removeObject(attribute);
}
}
entity.setClassProperties(mutableClassProperties);
entity.setAttributesUsedForLocking(mutableAttributesUsedForLocking);
}