Search in sources :

Example 1 with RuleSetBean

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

the class RuleSetRuleDAO method autoRemoveByRuleSet.

public void autoRemoveByRuleSet(RuleSetBean eb, UserAccountBean ub) {
    RuleSetBean ruleSetBean = eb;
    HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
    variables.put(new Integer(1), ruleSetBean.getUpdaterId());
    variables.put(new Integer(2), Status.AUTO_DELETED.getId());
    variables.put(new Integer(3), ruleSetBean.getId());
    variables.put(new Integer(4), Status.AVAILABLE.getId());
    execute(digester.getQuery("updateStatusByRuleSetAuto"), variables);
}
Also used : HashMap(java.util.HashMap) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Example 2 with RuleSetBean

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

the class RuleSetDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    RuleSetBean ruleSetBean = new RuleSetBean();
    this.setEntityAuditInformation(ruleSetBean, hm);
    ruleSetBean.setId(((Integer) hm.get("rule_set_id")).intValue());
    int expressionId = ((Integer) hm.get("rule_expression_id")).intValue();
    ExpressionBean expression = (ExpressionBean) getExpressionDao().findByPK(expressionId);
    ruleSetBean.setTarget(expression);
    ruleSetBean.setOriginalTarget(expression);
    ruleSetBean.setItemGroup(getExpressionService().getItemGroupExpression(ruleSetBean.getTarget().getValue()));
    ruleSetBean.setItem(getExpressionService().getItemExpression(ruleSetBean.getTarget().getValue(), ruleSetBean.getItemGroup()));
    int studyEventDefenitionId = ((Integer) hm.get("study_event_definition_id")).intValue();
    ruleSetBean.setStudyEventDefinition((StudyEventDefinitionBean) getStudyEventDefinitionDao().findByPK(studyEventDefenitionId));
    int crfId = ((Integer) hm.get("crf_id")).intValue();
    ruleSetBean.setCrf((CRFBean) getCrfDao().findByPK(crfId));
    if ((Integer) hm.get("crf_version_id") != 0) {
        int crfVersionId = ((Integer) hm.get("crf_version_id")).intValue();
        ruleSetBean.setCrfVersion((CRFVersionBean) getCrfVersionDao().findByPK(crfVersionId));
    } else {
        ruleSetBean.setCrfVersion(null);
    }
    return ruleSetBean;
}
Also used : RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean) ExpressionBean(org.akaza.openclinica.bean.rule.expression.ExpressionBean)

Example 3 with RuleSetBean

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

the class RuleSetDAO method findByCrfVersionStudyAndStudyEventDefinition.

public ArrayList<RuleSetBean> findByCrfVersionStudyAndStudyEventDefinition(CRFVersionBean crfVersionBean, 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), crfVersionBean.getId());
    variables.put(new Integer(2), getStudyId(currentStudy));
    variables.put(new Integer(3), sed.getId());
    String sql = digester.getQuery("findByCrfVersionStudyAndStudyEventDefinition");
    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)

Example 4 with RuleSetBean

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

the class RuleSetDAO method findAll.

public Collection findAll() {
    this.setTypesExpected();
    ArrayList alist = this.select(digester.getQuery("findAll"));
    ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<RuleSetBean>();
    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) Iterator(java.util.Iterator) RuleSetBean(org.akaza.openclinica.bean.rule.RuleSetBean)

Example 5 with RuleSetBean

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

the class RuleSetRuleDAO method findByStudyEventDefinition.

public RuleSetBean findByStudyEventDefinition(StudyEventDefinitionBean studyEventDefinition) {
    RuleSetBean ruleSetBean = null;
    this.setTypesExpected();
    HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
    Integer studyEventDefinitionId = Integer.valueOf(studyEventDefinition.getId());
    variables.put(new Integer(1), studyEventDefinitionId);
    String sql = digester.getQuery("findByStudyEventDefinition");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        ruleSetBean = (RuleSetBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return ruleSetBean;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) 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