use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method create.
public EntityBean create(EntityBean eb) {
RuleBean ruleBean = (RuleBean) eb;
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
HashMap<Integer, Object> nullVars = new HashMap<Integer, Object>();
variables.put(new Integer(1), ruleBean.getName());
variables.put(new Integer(2), ruleBean.getDescription());
variables.put(new Integer(3), ruleBean.getOid());
variables.put(new Integer(4), ruleBean.isEnabled());
variables.put(new Integer(5), getExpressionDao().create(ruleBean.getExpression()).getId());
variables.put(new Integer(6), new Integer(ruleBean.getOwnerId()));
variables.put(new Integer(7), new Integer(Status.AVAILABLE.getId()));
executeWithPK(digester.getQuery("create"), variables, nullVars);
if (isQuerySuccessful()) {
ruleBean.setId(getLatestPK());
}
return ruleBean;
}
use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method update.
public EntityBean update(EntityBean eb) {
RuleBean ruleBean = (RuleBean) eb;
ruleBean.setActive(false);
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
HashMap nullVars = new HashMap();
variables.put(new Integer(1), ruleBean.getName());
variables.put(new Integer(2), ruleBean.getDescription());
variables.put(new Integer(3), ruleBean.getUpdaterId());
variables.put(new Integer(4), ruleBean.getId());
getExpressionDao().update(ruleBean.getExpression());
this.execute(digester.getQuery("update"), variables, nullVars);
if (isQuerySuccessful()) {
ruleBean.setActive(true);
}
return ruleBean;
}
use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleDAO method findByPK.
public EntityBean findByPK(int ID) {
RuleBean ruleBean = new RuleBean();
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()) {
ruleBean = (RuleBean) this.getEntityFromHashMap((HashMap) it.next());
}
return ruleBean;
}
use of org.akaza.openclinica.bean.rule.RuleBean in project OpenClinica by OpenClinica.
the class RuleActionDAO method update.
public EntityBean update(EntityBean eb) {
RuleBean ruleBean = (RuleBean) eb;
ruleBean.setActive(false);
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
HashMap nullVars = new HashMap();
variables.put(new Integer(1), ruleBean.getName());
this.execute(digester.getQuery("update"), variables, nullVars);
if (isQuerySuccessful()) {
ruleBean.setActive(true);
}
return ruleBean;
}
use of org.akaza.openclinica.bean.rule.RuleBean 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;
}
Aggregations