From: Anjo K. <an...@us...> - 2006-10-31 06:09:49
|
Update of /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6309/Sources/er/extensions Modified Files: ERXEntityClassDescription.java ERXGenericRecord.java ERXEOAccessUtilities.java Log Message: - NPE prevention when getting inverse relationship - localizedKey now without unused EC argument Index: ERXEntityClassDescription.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXEntityClassDescription.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** ERXEntityClassDescription.java 30 Oct 2006 10:26:56 -0000 1.60 --- ERXEntityClassDescription.java 31 Oct 2006 06:09:38 -0000 1.61 *************** *** 1128,1132 **** } ! public String localizedKey(EOEditingContext ec, String key) { key = key + "_" + ERXLocalizer.currentLocalizer().languageCode(); if(!allPropertyKeys().containsObject(key)) { --- 1128,1132 ---- } ! public String localizedKey(String key) { key = key + "_" + ERXLocalizer.currentLocalizer().languageCode(); if(!allPropertyKeys().containsObject(key)) { *************** *** 1139,1143 **** String result = null; EORelationship relationship = entity().relationshipNamed(relationshipKey); ! if(relationship.userInfo() != null) { result = (String) relationship.userInfo().objectForKey("ERXInverseRelationshipName"); } --- 1139,1143 ---- String result = null; EORelationship relationship = entity().relationshipNamed(relationshipKey); ! if(relationship != null && relationship.userInfo() != null) { result = (String) relationship.userInfo().objectForKey("ERXInverseRelationshipName"); } *************** *** 1240,1242 **** ! } --- 1240,1242 ---- ! } \ No newline at end of file Index: ERXGenericRecord.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXGenericRecord.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** ERXGenericRecord.java 23 Oct 2006 14:11:22 -0000 1.85 --- ERXGenericRecord.java 31 Oct 2006 06:09:38 -0000 1.86 *************** *** 70,74 **** EOClassDescription cd = classDescription(); if(cd instanceof ERXEntityClassDescription) { ! return ((ERXEntityClassDescription)cd).localizedKey(editingContext(), key); } return null; --- 70,74 ---- EOClassDescription cd = classDescription(); if(cd instanceof ERXEntityClassDescription) { ! return ((ERXEntityClassDescription)cd).localizedKey(key); } return null; *************** *** 83,88 **** public Object valueInObject(Object object) { ERXGenericRecord eo = (ERXGenericRecord) object; ! String key = eo.localizedKey(_key); ! Object value = eo.valueForKey(key); return value; } --- 83,88 ---- public Object valueInObject(Object object) { ERXGenericRecord eo = (ERXGenericRecord) object; ! String localizedKey = eo.localizedKey(_key); ! Object value = eo.valueForKey(localizedKey); return value; } *************** *** 90,95 **** public void setValueInObject(Object value, Object object) { ERXGenericRecord eo = (ERXGenericRecord) object; ! String key = eo.localizedKey(_key); ! eo.takeValueForKey(value, key); } } --- 90,95 ---- public void setValueInObject(Object value, Object object) { ERXGenericRecord eo = (ERXGenericRecord) object; ! String localizedKey = eo.localizedKey(_key); ! eo.takeValueForKey(value, localizedKey); } } Index: ERXEOAccessUtilities.java =================================================================== RCS file: /cvsroot/wonder/Wonder/Common/Frameworks/ERExtensions/Sources/er/extensions/ERXEOAccessUtilities.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ERXEOAccessUtilities.java 30 Oct 2006 10:34:31 -0000 1.68 --- ERXEOAccessUtilities.java 31 Oct 2006 06:09:38 -0000 1.69 *************** *** 1571,1579 **** prefix += part + "."; } - if(entity.attributeNamed(attributeName) == null) { ! String localizedKey = attributeName + "_" + ERXLocalizer.currentLocalizer().languageCode(); ! if(entity.attributeNamed(localizedKey) != null) { ! item = new EOSortOrdering(prefix + localizedKey, item.selector()); } } --- 1571,1581 ---- prefix += part + "."; } if(entity.attributeNamed(attributeName) == null) { ! EOClassDescription cd = entity.classDescriptionForInstances(); ! if(cd instanceof ERXEntityClassDescription) { ! String localizedKey = ((ERXEntityClassDescription)cd).localizedKey(attributeName); ! if(localizedKey != null) { ! item = new EOSortOrdering(prefix + localizedKey, item.selector()); ! } } } |