use of org.akaza.openclinica.bean.rule.action.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleSetRuleBean method getAllActionsWithEvaluatesToAsKey.
public HashMap<String, ArrayList<RuleActionBean>> getAllActionsWithEvaluatesToAsKey(String actionEvaluatesTo) {
HashMap<String, ArrayList<RuleActionBean>> h = new HashMap<String, ArrayList<RuleActionBean>>();
for (RuleActionBean action : actions) {
String key = action.getExpressionEvaluatesTo().toString();
if (actionEvaluatesTo == null || actionEvaluatesTo.equals(key)) {
if (h.containsKey(key)) {
h.get(key).add(action);
} else {
ArrayList<RuleActionBean> a = new ArrayList<RuleActionBean>();
a.add(action);
h.put(key, a);
}
}
}
return h;
}
use of org.akaza.openclinica.bean.rule.action.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleSetRuleBean method getAllActionsWithEvaluatesToAsKey.
public HashMap<String, ArrayList<RuleActionBean>> getAllActionsWithEvaluatesToAsKey() {
HashMap<String, ArrayList<RuleActionBean>> h = new HashMap<String, ArrayList<RuleActionBean>>();
for (RuleActionBean action : actions) {
String key = action.getExpressionEvaluatesTo().toString();
if (h.containsKey(key)) {
h.get(key).add(action);
} else {
ArrayList<RuleActionBean> a = new ArrayList<RuleActionBean>();
a.add(action);
h.put(key, a);
}
}
return h;
}
use of org.akaza.openclinica.bean.rule.action.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleActionDAO method findByRuleSetRule.
public ArrayList<RuleActionBean> findByRuleSetRule(RuleSetRuleBean ruleSetRule) {
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
Integer ruleSetRuleId = Integer.valueOf(ruleSetRule.getId());
variables.put(new Integer(1), ruleSetRuleId);
String sql = digester.getQuery("findByRuleSetRule");
ArrayList<?> alist = this.select(sql, variables);
ArrayList<RuleActionBean> ruleActionBeans = new ArrayList<RuleActionBean>();
Iterator<?> it = alist.iterator();
while (it.hasNext()) {
RuleActionBean ruleActionBean = this.getEntityFromHashMap((HashMap<?, ?>) it.next());
ruleActionBean.setRuleSetRule(ruleSetRule);
ruleActionBeans.add(ruleActionBean);
}
return ruleActionBeans;
}
use of org.akaza.openclinica.bean.rule.action.RuleActionBean 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.RuleActionBean in project OpenClinica by OpenClinica.
the class RuleSetRuleBean method getActionsAsKeyPair.
public HashMap<String, ArrayList<String>> getActionsAsKeyPair(String actionEvaluatesTo) {
HashMap<String, ArrayList<String>> h = new HashMap<String, ArrayList<String>>();
for (RuleActionBean action : actions) {
String key = action.getExpressionEvaluatesTo().toString();
if (actionEvaluatesTo.equals(key)) {
if (h.containsKey(key)) {
h.get(key).add(action.getSummary());
} else {
ArrayList<String> a = new ArrayList<String>();
a.add(action.getSummary());
h.put(key, a);
}
}
}
return h;
}
Aggregations