Search in sources :

Example 1 with RuleSetRuleBean

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

the class RuleSetRuleDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    RuleSetRuleBean ruleSetRuleBean = new RuleSetRuleBean();
    this.setEntityAuditInformation(ruleSetRuleBean, hm);
    ruleSetRuleBean.setId(((Integer) hm.get("rule_set_rule_id")).intValue());
    int ruleBeanId = ((Integer) hm.get("rule_id")).intValue();
    ruleSetRuleBean.setRuleBean((RuleBean) getRuleDao().findByPK(ruleBeanId));
    return ruleSetRuleBean;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean)

Example 2 with RuleSetRuleBean

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

the class RuleSetRuleDAO method findByPK.

public EntityBean findByPK(int ID) {
    RuleSetRuleBean ruleSetRuleBean = null;
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), new Integer(ID));
    String sql = digester.getQuery("findByPK");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        ruleSetRuleBean = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap) it.next(), true);
    }
    return ruleSetRuleBean;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 3 with RuleSetRuleBean

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

the class RuleSetRuleDAO method findByRuleSetAndRule.

public ArrayList<RuleSetRuleBean> findByRuleSetAndRule(RuleSetBean ruleSet, RuleBean rule) {
    ArrayList<RuleSetRuleBean> ruleSetRuleBeans = new ArrayList<RuleSetRuleBean>();
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    Integer ruleSetId = Integer.valueOf(ruleSet.getId());
    Integer ruleId = Integer.valueOf(rule.getId());
    variables.put(new Integer(1), ruleSetId);
    variables.put(new Integer(2), new Integer(Status.AVAILABLE.getId()));
    variables.put(new Integer(3), ruleId);
    String sql = digester.getQuery("findByRuleSetIdAndRuleId");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();
    while (it.hasNext()) {
        RuleSetRuleBean ruleSetRule = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
        ruleSetRule.setRuleSetBean(ruleSet);
        ruleSetRuleBeans.add(ruleSetRule);
    }
    return ruleSetRuleBeans;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 4 with RuleSetRuleBean

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

the class RuleSetRuleDAO method findByRuleSet.

public ArrayList<RuleSetRuleBean> findByRuleSet(RuleSetBean ruleSet) {
    ArrayList<RuleSetRuleBean> ruleSetRuleBeans = new ArrayList<RuleSetRuleBean>();
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    Integer ruleSetId = Integer.valueOf(ruleSet.getId());
    variables.put(new Integer(1), ruleSetId);
    // variables.put(new Integer(2), new Integer(Status.AVAILABLE.getId()));
    String sql = digester.getQuery("findByRuleSetId");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();
    while (it.hasNext()) {
        RuleSetRuleBean ruleSetRule = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
        ruleSetRule.setRuleSetBean(ruleSet);
        ruleSetRuleBeans.add(ruleSetRule);
    }
    return ruleSetRuleBeans;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 5 with RuleSetRuleBean

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

the class RuleSetRuleDAO method remove.

public void remove(RuleSetRuleBean eb, UserAccountBean ub) {
    RuleSetRuleBean ruleSetRuleBean = eb;
    HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
    variables.put(new Integer(1), ub.getId());
    variables.put(new Integer(2), Status.DELETED.getId());
    variables.put(new Integer(3), ruleSetRuleBean.getId());
    execute(digester.getQuery("updateStatus"), variables);
    if (isQuerySuccessful()) {
        ruleSetRuleBean.setStatus(Status.DELETED);
        getRuleSetRuleAuditDao().create(ruleSetRuleBean, ub);
    }
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap)

Aggregations

RuleSetRuleBean (org.akaza.openclinica.bean.rule.RuleSetRuleBean)11 HashMap (java.util.HashMap)8 ArrayList (java.util.ArrayList)4 Iterator (java.util.Iterator)2 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)1 RuleBean (org.akaza.openclinica.bean.rule.RuleBean)1 RuleSetRuleAuditBean (org.akaza.openclinica.bean.rule.RuleSetRuleAuditBean)1