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.GenericModelException; 32 import org.ofbiz.entity.GenericEntity; 33 import org.ofbiz.entity.model.ModelEntity; 34 35 49 public abstract class EntityCondition extends EntityConditionBase { 50 51 public String toString() { 52 return makeWhereString(null, new ArrayList ()); 53 } 54 55 public void accept(EntityConditionVisitor visitor) { 56 throw new IllegalArgumentException (getClass().getName() + ".accept not implemented"); 57 } 58 59 abstract public String makeWhereString(ModelEntity modelEntity, List entityConditionParams); 60 61 abstract public void checkCondition(ModelEntity modelEntity) throws GenericModelException; 62 63 public boolean entityMatches(GenericEntity entity) { 64 return mapMatches(entity.getDelegator(), entity); 65 } 66 67 public Object eval(GenericEntity entity) { 68 return eval(entity.getDelegator(), entity); 69 } 70 71 public Object eval(GenericDelegator delegator, Map map) { 72 return mapMatches(delegator, map) ? Boolean.TRUE : Boolean.FALSE; 73 } 74 75 abstract public boolean mapMatches(GenericDelegator delegator, Map map); 76 77 abstract public EntityCondition freeze(); 78 79 abstract public void encryptConditionFields(ModelEntity modelEntity, GenericDelegator delegator); 80 81 public void visit(EntityConditionVisitor visitor) { 82 throw new IllegalArgumentException (getClass().getName() + ".visit not implemented"); 83 } 84 } 85 | Popular Tags |