1 25 package org.ofbiz.entity.condition; 26 27 import java.util.List ; 28 import java.util.Map ; 29 30 import org.ofbiz.base.util.Debug; 31 import org.ofbiz.entity.EntityCryptoException; 32 import org.ofbiz.entity.GenericDelegator; 33 import org.ofbiz.entity.GenericModelException; 34 import org.ofbiz.entity.GenericEntity; 35 import org.ofbiz.entity.model.ModelEntity; 36 import org.ofbiz.entity.model.ModelField; 37 38 52 public class EntityWhereString extends EntityCondition { 53 54 protected String sqlString; 55 56 protected EntityWhereString() {} 57 58 public EntityWhereString(String sqlString) { 59 this.sqlString = sqlString; 60 } 61 62 public String makeWhereString(ModelEntity modelEntity, List entityConditionParams) { 63 return sqlString; 64 } 65 66 public void checkCondition(ModelEntity modelEntity) throws GenericModelException { } 68 69 public boolean entityMatches(GenericEntity entity) { 70 throw new UnsupportedOperationException ("Cannot do entityMatches on a WhereString, ie no SQL evaluation in EE; Where String is: " + sqlString); 71 } 72 73 public boolean mapMatches(GenericDelegator delegator, Map map) { 74 throw new UnsupportedOperationException ("Cannot do mapMatches on a WhereString, ie no SQL evaluation in EE; Where String is: " + sqlString); 75 } 76 77 public String getWhereString() { 78 return sqlString; 79 } 80 81 public EntityCondition freeze() { 82 return this; 83 } 84 85 public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator) { 86 } 88 89 public void visit(EntityConditionVisitor visitor) { 90 visitor.acceptEntityWhereString(this); 91 } 92 93 public boolean equals(Object obj) { 94 if (!(obj instanceof EntityWhereString)) return false; 95 EntityWhereString other = (EntityWhereString) obj; 96 return equals(sqlString, other.sqlString); 97 } 98 99 public int hashCode() { 100 return hashCode(sqlString); 101 } 102 } 103 | Popular Tags |