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;
}
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);
}
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;
}
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);
}
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;
}
Aggregations