Search in sources :

Example 6 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, Boolean getRuleSet) {
    RuleSetRuleBean ruleSetRuleBean = new RuleSetRuleBean();
    this.setEntityAuditInformation(ruleSetRuleBean, hm);
    ruleSetRuleBean.setId(((Integer) hm.get("rule_set_rule_id")).intValue());
    int ruleSetBeanId = ((Integer) hm.get("rule_set_id")).intValue();
    if (getRuleSet) {
        ruleSetRuleBean.setRuleSetBean((RuleSetBean) getRuleSetDao().findByPK(ruleSetBeanId));
    }
    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 7 with RuleSetRuleBean

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

the class RuleSetRuleDAO method findAll.

public Collection findAll() {
    this.setTypesExpected();
    ArrayList alist = this.select(digester.getQuery("findAll"));
    ArrayList<RuleSetRuleBean> ruleSetBeans = new ArrayList<RuleSetRuleBean>();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        RuleSetRuleBean ruleSetRuleBean = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap) it.next());
        ruleSetBeans.add(ruleSetRuleBean);
    }
    return ruleSetBeans;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 8 with RuleSetRuleBean

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

the class RuleSetRuleAuditDAO method create.

public EntityBean create(EntityBean eb, UserAccountBean ub) {
    // INSERT INTO rule_set_rule_audit (rule_set_rule_id, status_id,updater_id,date_updated) VALUES (?,?,?,?,?)
    RuleSetRuleBean ruleSetRuleBean = (RuleSetRuleBean) eb;
    RuleSetRuleAuditBean ruleSetRuleAudit = new RuleSetRuleAuditBean();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(1, ruleSetRuleBean.getId());
    variables.put(2, ruleSetRuleBean.getStatus().getId());
    variables.put(3, ub.getId());
    this.execute(digester.getQuery("create"), variables);
    if (isQuerySuccessful()) {
        ruleSetRuleAudit.setRuleSetRuleBean(ruleSetRuleBean);
        ruleSetRuleAudit.setId(getCurrentPK());
        ruleSetRuleAudit.setStatus(ruleSetRuleBean.getStatus());
        ruleSetRuleAudit.setUpdater(ub);
    }
    return ruleSetRuleAudit;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap) RuleSetRuleAuditBean(org.akaza.openclinica.bean.rule.RuleSetRuleAuditBean)

Example 9 with RuleSetRuleBean

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

the class RuleSetRuleDAO method create.

/*
     * I am going to attempt to use this create method as we use the saveOrUpdate method in Hibernate.
     */
public EntityBean create(EntityBean eb) {
    RuleSetRuleBean ruleSetRuleBean = (RuleSetRuleBean) eb;
    RuleBean ruleBean = new RuleBean();
    ruleBean.setOid(ruleSetRuleBean.getOid());
    if (eb.getId() == 0) {
        HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
        HashMap<Integer, Object> nullVars = new HashMap<Integer, Object>();
        variables.put(new Integer(1), ruleSetRuleBean.getRuleSetBean().getId());
        variables.put(new Integer(2), getRuleDao().findByOid(ruleBean).getId());
        variables.put(new Integer(3), new Integer(ruleSetRuleBean.getOwnerId()));
        variables.put(new Integer(4), new Integer(Status.AVAILABLE.getId()));
        executeWithPK(digester.getQuery("create"), variables, nullVars);
        if (isQuerySuccessful()) {
            ruleSetRuleBean.setId(getLatestPK());
        }
    }
    return ruleSetRuleBean;
}
Also used : RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) HashMap(java.util.HashMap) RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 10 with RuleSetRuleBean

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

the class RuleSetRuleDAO method restore.

public void restore(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.AVAILABLE.getId());
    variables.put(new Integer(3), ruleSetRuleBean.getId());
    execute(digester.getQuery("updateStatus"), variables);
    if (isQuerySuccessful()) {
        ruleSetRuleBean.setStatus(Status.AVAILABLE);
        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