use of org.akaza.openclinica.bean.rule.RuleSetBean in project OpenClinica by OpenClinica.
the class RuleSetDAO 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;
}
use of org.akaza.openclinica.bean.rule.RuleSetBean in project OpenClinica by OpenClinica.
the class RuleSetDAO 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) {
RuleSetBean ruleSetBean = (RuleSetBean) eb;
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), getExpressionDao().create(ruleSetBean.getTarget()).getId());
variables.put(new Integer(2), new Integer(ruleSetBean.getStudyEventDefinition().getId()));
if (ruleSetBean.getCrf() == null) {
nullVars.put(new Integer(3), new Integer(Types.INTEGER));
variables.put(new Integer(3), null);
} else {
variables.put(new Integer(3), new Integer(ruleSetBean.getCrf().getId()));
}
if (ruleSetBean.getCrfVersion() == null) {
nullVars.put(new Integer(4), new Integer(Types.INTEGER));
variables.put(new Integer(4), null);
} else {
variables.put(new Integer(4), new Integer(ruleSetBean.getCrfVersion().getId()));
}
variables.put(new Integer(5), new Integer(ruleSetBean.getStudy().getId()));
variables.put(new Integer(6), new Integer(ruleSetBean.getOwnerId()));
variables.put(new Integer(7), new Integer(Status.AVAILABLE.getId()));
executeWithPK(digester.getQuery("create"), variables, nullVars);
if (isQuerySuccessful()) {
ruleSetBean.setId(getLatestPK());
}
}
return ruleSetBean;
}
use of org.akaza.openclinica.bean.rule.RuleSetBean in project OpenClinica by OpenClinica.
the class RuleSetDAO method findByCrfVersionOrCrfAndStudyAndStudyEventDefinition.
public ArrayList<RuleSetBean> findByCrfVersionOrCrfAndStudyAndStudyEventDefinition(CRFVersionBean crfVersion, 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), getStudyId(currentStudy));
variables.put(new Integer(2), sed.getId());
variables.put(new Integer(3), crfVersion.getId());
variables.put(new Integer(4), crfBean.getId());
variables.put(new Integer(5), crfBean.getId());
String sql = digester.getQuery("findByCrfVersionOrCrfStudyAndStudyEventDefinition");
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;
}
use of org.akaza.openclinica.bean.rule.RuleSetBean in project OpenClinica by OpenClinica.
the class RuleSetDAO method findAllByStudy.
@Override
public ArrayList<RuleSetBean> findAllByStudy(StudyBean currentStudy) {
ArrayList<RuleSetBean> ruleSetBeans = new ArrayList<RuleSetBean>();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
variables.put(new Integer(1), getStudyId(currentStudy));
String sql = digester.getQuery("findAllByStudy");
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;
}
use of org.akaza.openclinica.bean.rule.RuleSetBean in project OpenClinica by OpenClinica.
the class RuleSetDAO method findByCrf.
public ArrayList<RuleSetBean> findByCrf(CRFBean crfBean, StudyBean currentStudy) {
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));
String sql = digester.getQuery("findByCrfId");
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;
}
Aggregations