use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method findByOid.
public RuleBean findByOid(RuleBean ruleBean) {
RuleBean ruleBeanInDb = new RuleBean();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
variables.put(new Integer(1), new String(ruleBean.getOid()));
String sql = digester.getQuery("findByOid");
ArrayList<?> alist = this.select(sql, variables);
Iterator<?> it = alist.iterator();
if (it.hasNext()) {
ruleBeanInDb = (RuleBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
}
if (alist.isEmpty()) {
ruleBeanInDb = null;
}
return ruleBeanInDb;
}
use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method findByOid.
public RuleBean findByOid(String oid) {
RuleBean ruleBeanInDb = new RuleBean();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
variables.put(new Integer(1), new String(oid));
String sql = digester.getQuery("findByOid");
ArrayList<?> alist = this.select(sql, variables);
Iterator<?> it = alist.iterator();
if (it.hasNext()) {
ruleBeanInDb = (RuleBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
}
if (alist.isEmpty()) {
ruleBeanInDb = null;
}
return ruleBeanInDb;
}
use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method findByRuleSet.
public ArrayList<RuleBean> findByRuleSet(RuleSetBean ruleSet) {
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
Integer eventCrfBeanId = Integer.valueOf(ruleSet.getId());
variables.put(new Integer(1), eventCrfBeanId);
String sql = digester.getQuery("findByRuleSet");
ArrayList alist = this.select(sql, variables);
ArrayList<RuleBean> ruleSetBeans = new ArrayList<RuleBean>();
Iterator it = alist.iterator();
while (it.hasNext()) {
RuleBean ruleBean = (RuleBean) this.getEntityFromHashMap((HashMap) it.next());
ruleSetBeans.add(ruleBean);
}
return ruleSetBeans;
}
use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
RuleBean ruleBean = new RuleBean();
this.setEntityAuditInformation(ruleBean, hm);
ruleBean.setId(((Integer) hm.get("rule_id")).intValue());
ruleBean.setName(((String) hm.get("name")));
ruleBean.setOid(((String) hm.get("oc_oid")));
ruleBean.setEnabled(((Boolean) hm.get("enabled")));
int expressionId = ((Integer) hm.get("rule_expression_id")).intValue();
ruleBean.setExpression((ExpressionBean) getExpressionDao().findByPK(expressionId));
return ruleBean;
}
Aggregations