use of org.akaza.openclinica.bean.rule.RuleSetRuleBean in project OpenClinica by OpenClinica.
the class RuleSetRuleDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
RuleSetRuleBean ruleSetRuleBean = new RuleSetRuleBean();
this.setEntityAuditInformation(ruleSetRuleBean, hm);
ruleSetRuleBean.setId(((Integer) hm.get("rule_set_rule_id")).intValue());
int ruleBeanId = ((Integer) hm.get("rule_id")).intValue();
ruleSetRuleBean.setRuleBean((RuleBean) getRuleDao().findByPK(ruleBeanId));
return ruleSetRuleBean;
}
use of org.akaza.openclinica.bean.rule.RuleSetRuleBean in project OpenClinica by OpenClinica.
the class RuleSetRuleDAO method findByPK.
public EntityBean findByPK(int ID) {
RuleSetRuleBean ruleSetRuleBean = null;
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()) {
ruleSetRuleBean = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap) it.next(), true);
}
return ruleSetRuleBean;
}
use of org.akaza.openclinica.bean.rule.RuleSetRuleBean in project OpenClinica by OpenClinica.
the class RuleSetRuleDAO method findByRuleSetAndRule.
public ArrayList<RuleSetRuleBean> findByRuleSetAndRule(RuleSetBean ruleSet, RuleBean rule) {
ArrayList<RuleSetRuleBean> ruleSetRuleBeans = new ArrayList<RuleSetRuleBean>();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
Integer ruleSetId = Integer.valueOf(ruleSet.getId());
Integer ruleId = Integer.valueOf(rule.getId());
variables.put(new Integer(1), ruleSetId);
variables.put(new Integer(2), new Integer(Status.AVAILABLE.getId()));
variables.put(new Integer(3), ruleId);
String sql = digester.getQuery("findByRuleSetIdAndRuleId");
ArrayList<?> alist = this.select(sql, variables);
Iterator<?> it = alist.iterator();
while (it.hasNext()) {
RuleSetRuleBean ruleSetRule = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
ruleSetRule.setRuleSetBean(ruleSet);
ruleSetRuleBeans.add(ruleSetRule);
}
return ruleSetRuleBeans;
}
use of org.akaza.openclinica.bean.rule.RuleSetRuleBean in project OpenClinica by OpenClinica.
the class RuleSetRuleDAO method findByRuleSet.
public ArrayList<RuleSetRuleBean> findByRuleSet(RuleSetBean ruleSet) {
ArrayList<RuleSetRuleBean> ruleSetRuleBeans = new ArrayList<RuleSetRuleBean>();
this.setTypesExpected();
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
Integer ruleSetId = Integer.valueOf(ruleSet.getId());
variables.put(new Integer(1), ruleSetId);
// variables.put(new Integer(2), new Integer(Status.AVAILABLE.getId()));
String sql = digester.getQuery("findByRuleSetId");
ArrayList<?> alist = this.select(sql, variables);
Iterator<?> it = alist.iterator();
while (it.hasNext()) {
RuleSetRuleBean ruleSetRule = (RuleSetRuleBean) this.getEntityFromHashMap((HashMap<?, ?>) it.next());
ruleSetRule.setRuleSetBean(ruleSet);
ruleSetRuleBeans.add(ruleSetRule);
}
return ruleSetRuleBeans;
}
use of org.akaza.openclinica.bean.rule.RuleSetRuleBean in project OpenClinica by OpenClinica.
the class RuleSetRuleDAO method remove.
public void remove(RuleSetRuleBean eb, UserAccountBean ub) {
RuleSetRuleBean ruleSetRuleBean = eb;
HashMap<Integer, Integer> variables = new HashMap<Integer, Integer>();
variables.put(new Integer(1), ub.getId());
variables.put(new Integer(2), Status.DELETED.getId());
variables.put(new Integer(3), ruleSetRuleBean.getId());
execute(digester.getQuery("updateStatus"), variables);
if (isQuerySuccessful()) {
ruleSetRuleBean.setStatus(Status.DELETED);
getRuleSetRuleAuditDao().create(ruleSetRuleBean, ub);
}
}
Aggregations