use of org.akaza.openclinica.bean.rule.action.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleActionDAO method findByPK.
public EntityBean findByPK(int ID) {
RuleActionBean action = new RuleActionBean();
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()) {
action = this.getEntityFromHashMap((HashMap) it.next());
}
return action;
}
use of org.akaza.openclinica.bean.rule.action.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleActionDAO method findAll.
public Collection findAll() {
this.setTypesExpected();
ArrayList alist = this.select(digester.getQuery("findAll"));
ArrayList<RuleActionBean> ruleSetBeans = new ArrayList<RuleActionBean>();
Iterator it = alist.iterator();
while (it.hasNext()) {
RuleActionBean ruleSet = this.getEntityFromHashMap((HashMap) it.next());
ruleSetBeans.add(ruleSet);
}
return ruleSetBeans;
}
use of org.akaza.openclinica.bean.rule.action.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleActionDAO method create.
public EntityBean create(EntityBean eb) {
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
HashMap<Integer, Object> nullVars = new HashMap<Integer, Object>();
RuleActionBean ruleAction = null;
if (eb instanceof DiscrepancyNoteActionBean) {
DiscrepancyNoteActionBean dnActionBean = (DiscrepancyNoteActionBean) eb;
Boolean expressionEvaluates = dnActionBean.getExpressionEvaluatesTo() == null ? true : dnActionBean.getExpressionEvaluatesTo();
variables.put(new Integer(1), new Integer(dnActionBean.getRuleSetRule().getId()));
variables.put(new Integer(2), dnActionBean.getActionType().getCode());
variables.put(new Integer(3), expressionEvaluates);
variables.put(new Integer(4), dnActionBean.getMessage());
variables.put(new Integer(5), new Integer(dnActionBean.getOwnerId()));
variables.put(new Integer(6), new Integer(Status.AVAILABLE.getId()));
executeWithPK(digester.getQuery("create_dn"), variables, nullVars);
if (isQuerySuccessful()) {
dnActionBean.setId(getLatestPK());
}
ruleAction = dnActionBean;
}
if (eb instanceof EmailActionBean) {
EmailActionBean emailActionBean = (EmailActionBean) eb;
Boolean expressionEvaluates = emailActionBean.getExpressionEvaluatesTo() == null ? true : emailActionBean.getExpressionEvaluatesTo();
variables.put(new Integer(1), new Integer(emailActionBean.getRuleSetRule().getId()));
variables.put(new Integer(2), emailActionBean.getActionType().getCode());
variables.put(new Integer(3), expressionEvaluates);
variables.put(new Integer(4), emailActionBean.getMessage());
variables.put(new Integer(5), emailActionBean.getTo());
variables.put(new Integer(6), new Integer(emailActionBean.getOwnerId()));
variables.put(new Integer(7), new Integer(Status.AVAILABLE.getId()));
executeWithPK(digester.getQuery("create_email"), variables, nullVars);
if (isQuerySuccessful()) {
emailActionBean.setId(getLatestPK());
}
ruleAction = emailActionBean;
}
return ruleAction;
}
Aggregations