Always use directly mapped property as first choice when resolving ${column_name} in appendFilter().

Only use id/name/prototype if that doesn't give us a value.
This commit is contained in:
hns 2005-05-18 08:33:47 +00:00
parent 3c8f9f8890
commit d26b968ae8

View file

@ -838,19 +838,20 @@ public final class Relation {
Object value = null;
if (columnName != null) {
DbMapping dbmap = nonvirtual.getDbMapping();
if (columnName.equals(dbmap.getIDField())) {
value = nonvirtual.getID();
} else if (columnName.equals(dbmap.getNameField())) {
value = nonvirtual.getName();
} else if (columnName.equals(dbmap.getPrototypeField())) {
value = nonvirtual.getPrototype();
} else {
String propertyName = dbmap.columnNameToProperty(columnName);
if (propertyName != null) {
IProperty property = nonvirtual.get(propertyName);
if (property != null) {
value = property.getValue();
}
String propertyName = dbmap.columnNameToProperty(columnName);
if (propertyName != null) {
IProperty property = nonvirtual.get(propertyName);
if (property != null) {
value = property.getValue();
}
}
if (value == null) {
if (columnName.equals(dbmap.getIDField())) {
value = nonvirtual.getID();
} else if (columnName.equals(dbmap.getNameField())) {
value = nonvirtual.getName();
} else if (columnName.equals(dbmap.getPrototypeField())) {
value = nonvirtual.getPrototype();
}
}
}