Search in sources :

Example 6 with RuleSetBean

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

the class RuleSetAuditDAO method create.

public EntityBean create(EntityBean eb, UserAccountBean ub) {
    // INSERT INTO rule_set_audit (rule_set_audit_id,rule_set_id, status_id,updater_id,date_updated) VALUES (?,?,?,?,?)
    RuleSetBean ruleSetBean = (RuleSetBean) eb;
    RuleSetAuditBean ruleSetAudit = new RuleSetAuditBean();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(1, ruleSetBean.getId());
    variables.put(2, ruleSetBean.getStatus().getId());
    variables.put(3, ub.getId());
    this.execute(digester.getQuery("create"), variables);
    if (isQuerySuccessful()) {
        ruleSetAudit.setRuleSetBean(ruleSetBean);
        ruleSetAudit.setId(getCurrentPK());
        ruleSetAudit.setStatus(ruleSetBean.getStatus());
        ruleSetAudit.setUpdater(ub);
    }
    return ruleSetAudit;
}
Also used : RuleSetAuditBean(org.akaza.openclinica.bean.rule.RuleSetAuditBean) HashMap(java.util.HashMap) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Example 7 with RuleSetBean

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

the class RuleSetAuditDAO method create.

public EntityBean create(EntityBean eb) throws OpenClinicaException {
    RuleSetBean ruleSetBean = (RuleSetBean) eb;
    UserAccountBean userAccount = new UserAccountBean();
    userAccount.setId(ruleSetBean.getUpdaterId());
    return create(eb, userAccount);
}
Also used : UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Example 8 with RuleSetBean

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

the class RuleSetDAO method findByExpression.

public RuleSetBean findByExpression(RuleSetBean ruleSetBean) {
    RuleSetBean ruleSetBeanInDb = new RuleSetBean();
    Context c = ruleSetBean.getTarget().getContext() == null ? Context.OC_RULES_V1 : ruleSetBean.getTarget().getContext();
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), c.getCode());
    variables.put(new Integer(2), ruleSetBean.getTarget().getValue());
    String sql = digester.getQuery("findByExpression");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();
    if (it.hasNext()) {
        ruleSetBeanInDb = (RuleSetBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
    }
    if (alist.isEmpty()) {
        ruleSetBeanInDb = null;
    }
    return ruleSetBeanInDb;
}
Also used : Context(org.akaza.openclinica.bean.rule.expression.Context) HashMap(java.util.HashMap) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Example 9 with RuleSetBean

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

the class RuleSetRuleDAO method autoRestoreByRuleSet.

public void autoRestoreByRuleSet(RuleSetBean eb, UserAccountBean ub) {
    RuleSetBean ruleSetBean = 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), ruleSetBean.getId());
    variables.put(new Integer(4), Status.AUTO_DELETED.getId());
    execute(digester.getQuery("updateStatusByRuleSetAuto"), variables);
}
Also used : HashMap(java.util.HashMap) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Example 10 with RuleSetBean

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

the class RuleSetDAO method findByCrfStudyAndStudyEventDefinition.

public ArrayList<RuleSetBean> findByCrfStudyAndStudyEventDefinition(CRFBean crfBean, StudyBean currentStudy, StudyEventDefinitionBean sed) {
    ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<RuleSetBean>();
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    variables.put(new Integer(1), crfBean.getId());
    variables.put(new Integer(2), getStudyId(currentStudy));
    variables.put(new Integer(3), sed.getId());
    String sql = digester.getQuery("findByCrfStudyAndStudyEventDefinition");
    ArrayList<?> alist = this.select(sql, variables);
    Iterator<?> it = alist.iterator();
    while (it.hasNext()) {
        RuleSetBean ruleSet = (RuleSetBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
        ruleSetBeans.add(ruleSet);
    }
    return ruleSetBeans;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Aggregations

RuleSetBean (org.akaza.openclinica.bean.rule.RuleSetBean)19 HashMap (java.util.HashMap)17 ArrayList (java.util.ArrayList)10 Iterator (java.util.Iterator)5 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)1 RuleSetAuditBean (org.akaza.openclinica.bean.rule.RuleSetAuditBean)1 Context (org.akaza.openclinica.bean.rule.expression.Context)1 ExpressionBean (org.akaza.openclinica.bean.rule.expression.ExpressionBean)1