1 package nl.hippo.cms.workflow.queries; 2 3 import com.opensymphony.workflow.query.Expression; 4 import com.opensymphony.workflow.query.FieldExpression; 5 6 public abstract class BinaryCondition extends Condition 7 { 8 private Field field; 9 10 private Object value; 11 12 public BinaryCondition() 13 { 14 super(); 15 } 16 17 public Field getField() 18 { 19 return field; 20 } 21 22 public void setField(Field field) 23 { 24 this.field = field; 25 } 26 27 public Object getValue() 28 { 29 return value; 30 } 31 32 public void setValue(Object value) 33 { 34 this.value = value; 35 } 36 37 public Expression toOSWorkflowExpression() 38 { 39 Expression result; 40 41 result = new FieldExpression(field.getOSWorkflow(), field.getOSWorkflowContext(), getOperator(), value, isNegated()); 42 return result; 43 } 44 45 protected abstract int getOperator(); 46 47 protected abstract String getOperatorText(); 48 49 protected abstract boolean isNegated(); 50 51 public void toString(StringBuffer text) 52 { 53 field.toString(text); 54 text.append(' '); 55 text.append(getOperatorText()); 56 text.append(' '); 57 text.append(value); 58 } 59 } 60 | Popular Tags |