Search in sources :

Example 6 with RuleBean

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;
}
Also used : HashMap(java.util.HashMap) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 7 with RuleBean

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;
}
Also used : HashMap(java.util.HashMap) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 8 with RuleBean

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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 9 with RuleBean

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;
}
Also used : RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Aggregations

RuleBean (org.akaza.openclinica.bean.rule.RuleBean)9 HashMap (java.util.HashMap)8 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 RuleSetRuleBean (org.akaza.openclinica.bean.rule.RuleSetRuleBean)2