Search in sources :

Example 1 with RuleBean

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;
}
Also used : HashMap(java.util.HashMap) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 2 with 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;
}
Also used : HashMap(java.util.HashMap) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 3 with 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;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 4 with 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;
}
Also used : HashMap(java.util.HashMap) RuleSetRuleBean(org.akaza.openclinica.bean.rule.RuleSetRuleBean) RuleBean(org.akaza.openclinica.bean.rule.RuleBean)

Example 5 with 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;
}
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)

Aggregations

RuleBean (org.akaza.openclinica.bean.rule.RuleBean)9 HashMap (java.util.HashMap)8 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 RuleSetRuleBean (org.akaza.openclinica.bean.rule.RuleSetRuleBean)2