1 24 package org.ofbiz.entity.condition; 25 26 import java.util.ArrayList ; 27 import java.util.List ; 28 import java.util.Map ; 29 30 import org.ofbiz.entity.GenericDelegator; 31 import org.ofbiz.entity.GenericEntity; 32 import org.ofbiz.entity.GenericModelException; 33 import org.ofbiz.entity.config.DatasourceInfo; 34 import org.ofbiz.entity.model.ModelEntity; 35 import org.ofbiz.entity.model.ModelField; 36 37 46 public abstract class EntityConditionValue extends EntityConditionBase { 47 48 public abstract ModelField getModelField(ModelEntity modelEntity); 49 50 public void addSqlValue(StringBuffer sql, ModelEntity modelEntity, List entityConditionParams, boolean includeTableNamePrefix, 51 DatasourceInfo datasourceinfo) { 52 addSqlValue(sql, emptyMap, modelEntity, entityConditionParams, includeTableNamePrefix, datasourceinfo); 53 } 54 55 public abstract void addSqlValue(StringBuffer sql, Map tableAliases, ModelEntity modelEntity, List entityConditionParams, 56 boolean includeTableNamePrefix, DatasourceInfo datasourceinfo); 57 58 public abstract void validateSql(ModelEntity modelEntity) throws GenericModelException; 59 60 public Object getValue(GenericEntity entity) { 61 if (entity == null) { 62 return null; 63 } 64 return getValue(entity.getDelegator(), entity); 65 } 66 67 public abstract Object getValue(GenericDelegator delegator, Map map); 68 69 public abstract EntityConditionValue freeze(); 70 71 public abstract void visit(EntityConditionVisitor visitor); 72 73 public void accept(EntityConditionVisitor visitor) { 74 throw new IllegalArgumentException ("accept not implemented"); 75 } 76 77 public void toString(StringBuffer sb) { 78 addSqlValue(sb, null, new ArrayList (), false, null); 79 } 80 81 public String toString() { 82 StringBuffer sql = new StringBuffer (); 83 toString(sql); 84 return sql.toString(); 85 } 86 } 87 | Popular Tags |