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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations