Search in sources :

Example 1 with Context

use of org.akaza.openclinica.bean.rule.expression.Context in project OpenClinica by OpenClinica.

the class RuleSetDAO method findByExpression.

public RuleSetBean findByExpression(RuleSetBean ruleSetBean) {
    RuleSetBean ruleSetBeanInDb = new RuleSetBean();
    Context c = ruleSetBean.getTarget().getContext() == null ? Context.OC_RULES_V1 : ruleSetBean.getTarget().getContext();
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), c.getCode());
    variables.put(new Integer(2), ruleSetBean.getTarget().getValue());
    String sql = digester.getQuery("findByExpression");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();
    if (it.hasNext()) {
        ruleSetBeanInDb = (RuleSetBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
    }
    if (alist.isEmpty()) {
        ruleSetBeanInDb = null;
    }
    return ruleSetBeanInDb;
}
Also used : Context(org.akaza.openclinica.bean.rule.expression.Context) HashMap(java.util.HashMap) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Aggregations

HashMap (java.util.HashMap)1 RuleSetBean (org.akaza.openclinica.bean.rule.RuleSetBean)1 Context (org.akaza.openclinica.bean.rule.expression.Context)1