Search in sources :

Example 1 with RuleSetRuleAuditBean

use of org.akaza.openclinica.bean.rule.RuleSetRuleAuditBean 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 2 with RuleSetRuleAuditBean

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

the class RuleSetRuleAuditDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    RuleSetRuleAuditBean ruleSetRuleAudit = new RuleSetRuleAuditBean();
    ruleSetRuleAudit.setId((Integer) hm.get("rule_set_rule_audit_id"));
    int ruleSetRuleId = (Integer) hm.get("rule_set_rule_id");
    int userAccountId = (Integer) hm.get("updater_id");
    int statusId = (Integer) hm.get("status_id");
    Date dateUpdated = (Date) hm.get("date_updated");
    ruleSetRuleAudit.setDateUpdated(dateUpdated);
    ruleSetRuleAudit.setStatus(Status.get(statusId));
    ruleSetRuleAudit.setRuleSetRuleBean((RuleSetRuleBean) getRuleSetRuleDao().findByPK(ruleSetRuleId));
    ruleSetRuleAudit.setUpdater((UserAccountBean) getUserAccountDao().findByPK(userAccountId));
    return ruleSetRuleAudit;
}
Also used : Date(java.util.Date) RuleSetRuleAuditBean(org.akaza.openclinica.bean.rule.RuleSetRuleAuditBean)

Example 3 with RuleSetRuleAuditBean

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

the class RuleSetRuleAuditDAO method findByPK.

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

Example 4 with RuleSetRuleAuditBean

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

the class RuleSetRuleAuditDAO method findAllByRuleSet.

public ArrayList<RuleSetRuleAuditBean> findAllByRuleSet(RuleSetBean ruleSet) {
    ArrayList<RuleSetRuleAuditBean> ruleSetRuleAuditBeans = new ArrayList<RuleSetRuleAuditBean>();
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), ruleSet.getId());
    String sql = digester.getQuery("findAllByRuleSet");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();
    while (it.hasNext()) {
        RuleSetRuleAuditBean ruleSetRuleAudit = (RuleSetRuleAuditBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
        ruleSetRuleAuditBeans.add(ruleSetRuleAudit);
    }
    return ruleSetRuleAuditBeans;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RuleSetRuleAuditBean(org.akaza.openclinica.bean.rule.RuleSetRuleAuditBean)

Aggregations

RuleSetRuleAuditBean (org.akaza.openclinica.bean.rule.RuleSetRuleAuditBean)4 HashMap (java.util.HashMap)3 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 RuleSetRuleBean (org.akaza.openclinica.bean.rule.RuleSetRuleBean)1