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;
}
Aggregations