1 23 package org.mdarad.framework.util.struts.criteria; 24 25 import java.io.Serializable ; 26 import java.util.Locale ; 27 28 import org.mdarad.framework.expr.Criterion; 29 import org.mdarad.framework.expr.Operator; 30 import org.mdarad.framework.expr.OperatorType; 31 32 33 41 public abstract class FormCriterionWithOperator extends FormCriterion 42 implements Serializable { 43 44 55 public FormCriterionWithOperator(String name, Class associatedEntity, CriterionProperty property, String bundleName, Locale locale) { 56 super(name, associatedEntity, property, bundleName, locale); 57 58 } 59 60 72 public FormCriterionWithOperator(String name, Class associatedEntity, CriterionProperty property, String bundleName, Locale locale, boolean isDynamic) { 73 super(name, associatedEntity, property, bundleName, locale, isDynamic); 74 75 } 76 77 85 public FormCriterionWithOperator(FormCriterionWithOperator criterion) { 86 super(criterion); 87 } 88 89 private Operator operator; 90 91 96 abstract public Operator[] getOperators(); 97 98 99 103 public String getOperator() { 104 if (operator != null) { 105 return operator.getKey(); 106 } 107 else return new String (); 108 } 109 110 111 115 public Operator getOperatorObject() { 116 return operator; 117 } 118 119 120 124 public void setOperator(String operator) { 125 Operator [] operators = getOperators(); 126 for (int i = 0; i < operators.length; i++) { 127 if (operators[i].getKey().equals(operator)) { 128 this.operator = operators[i]; 129 } 130 } 131 } 132 133 140 public Criterion getExprCriterion() { 141 Criterion crit = null; 142 OperatorType type = getOperatorObject().getType(); 143 crit = new Criterion(getAssociatedEntity(), getProperty().getName(), type, getValue(), getLocale()); 144 145 return crit; 146 } 147 } 148 | Popular Tags |