Ensure a ModelField is set for rhs EntityConditionValues that don't already have it, such as the EntityFunction classes
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1736922 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -126,6 +126,9 @@ public abstract class EntityComparisonOperator<L, R> extends EntityOperator<L, R
|
||||
protected void makeRHSWhereStringValue(ModelEntity entity, List<EntityConditionParam> entityConditionParams, StringBuilder sql, ModelField field, R rhs, Datasource datasourceInfo) {
|
||||
if (rhs instanceof EntityConditionValue) {
|
||||
EntityConditionValue ecv = (EntityConditionValue) rhs;
|
||||
if (ecv.getModelField(entity) == null) {
|
||||
ecv.setModelField(field);
|
||||
}
|
||||
ecv.addSqlValue(sql, entity, entityConditionParams, false, datasourceInfo);
|
||||
} else {
|
||||
addValue(sql, field, rhs, entityConditionParams);
|
||||
|
||||
@@ -131,6 +131,11 @@ public class EntityConditionSubSelect extends EntityConditionValue {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModelField(ModelField modelEntity) {
|
||||
// do nothing for now
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comparable<?> getValue(Delegator delegator, Map<String, ? extends Object> map) {
|
||||
// do nothing for now
|
||||
|
||||
@@ -64,6 +64,11 @@ public abstract class EntityConditionValue extends EntityConditionBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModelField(ModelField field) {
|
||||
// Do nothing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(Delegator delegator, Map<String, ? extends Object> map) {
|
||||
return value;
|
||||
@@ -81,6 +86,8 @@ public abstract class EntityConditionValue extends EntityConditionBase {
|
||||
|
||||
public abstract ModelField getModelField(ModelEntity modelEntity);
|
||||
|
||||
public abstract void setModelField(ModelField modelEntity);
|
||||
|
||||
public void addSqlValue(StringBuilder sql, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean includeTableNamePrefix,
|
||||
Datasource datasourceinfo) {
|
||||
addSqlValue(sql, emptyAliases, modelEntity, entityConditionParams, includeTableNamePrefix, datasourceinfo);
|
||||
|
||||
@@ -122,6 +122,12 @@ public class EntityFieldValue extends EntityConditionValue {
|
||||
return getField(modelEntity, fieldName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setModelField(ModelField field) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSqlValue(StringBuilder sql, Map<String, String> tableAliases, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean includeTableNamePrefix, Datasource datasourceInfo) {
|
||||
if (this.modelViewEntity != null) {
|
||||
|
||||
@@ -131,6 +131,7 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
|
||||
protected final EntityConditionValue nested;
|
||||
protected final Object value;
|
||||
protected final Fetcher<T> fetcher;
|
||||
protected ModelField field;
|
||||
|
||||
protected EntityFunction(Fetcher<T> fetcher, SQLFunction function, EntityConditionValue nested) {
|
||||
this.fetcher = fetcher;
|
||||
@@ -216,9 +217,14 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond
|
||||
if (nested != null) {
|
||||
return nested.getModelField(modelEntity);
|
||||
}
|
||||
return null;
|
||||
return field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModelField(ModelField field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateSql(ModelEntity modelEntity) throws GenericModelException {
|
||||
if (nested != null) {
|
||||
|
||||
Reference in New Issue
Block a user