use of org.akaza.openclinica.bean.rule.action.DiscrepancyNoteActionBean in project OpenClinica by OpenClinica.
the class RuleActionDAO method getEntityFromHashMap.
public RuleActionBean getEntityFromHashMap(HashMap hm) {
int actionTypeId = ((Integer) hm.get("action_type")).intValue();
ActionType actionType = ActionType.getByCode(actionTypeId);
RuleActionBean ruleAction = null;
switch(actionType) {
case FILE_DISCREPANCY_NOTE:
ruleAction = new DiscrepancyNoteActionBean();
((DiscrepancyNoteActionBean) ruleAction).setMessage(((String) hm.get("message")));
case EMAIL:
ruleAction = new EmailActionBean();
((EmailActionBean) ruleAction).setMessage(((String) hm.get("message")));
((EmailActionBean) ruleAction).setTo(((String) hm.get("email_to")));
}
this.setEntityAuditInformation(ruleAction, hm);
ruleAction.setActionType(actionType);
ruleAction.setId(((Integer) hm.get("rule_action_id")).intValue());
ruleAction.setExpressionEvaluatesTo(((Boolean) hm.get("expression_evaluates_to")).booleanValue());
return ruleAction;
}
use of org.akaza.openclinica.bean.rule.action.DiscrepancyNoteActionBean 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