use of org.akaza.openclinica.bean.rule.expression.ExpressionBean in project OpenClinica by OpenClinica.
the class ExpressionDAO method update.
public EntityBean update(EntityBean eb) {
ExpressionBean expressionBean = (ExpressionBean) eb;
expressionBean.setActive(false);
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
HashMap nullVars = new HashMap();
variables.put(new Integer(1), expressionBean.getContext().getCode());
variables.put(new Integer(2), expressionBean.getValue());
variables.put(new Integer(3), expressionBean.getUpdaterId());
variables.put(new Integer(4), expressionBean.getId());
this.execute(digester.getQuery("update"), variables, nullVars);
if (isQuerySuccessful()) {
expressionBean.setActive(true);
}
return expressionBean;
}
use of org.akaza.openclinica.bean.rule.expression.ExpressionBean in project OpenClinica by OpenClinica.
the class RuleSetDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
RuleSetBean ruleSetBean = new RuleSetBean();
this.setEntityAuditInformation(ruleSetBean, hm);
ruleSetBean.setId(((Integer) hm.get("rule_set_id")).intValue());
int expressionId = ((Integer) hm.get("rule_expression_id")).intValue();
ExpressionBean expression = (ExpressionBean) getExpressionDao().findByPK(expressionId);
ruleSetBean.setTarget(expression);
ruleSetBean.setOriginalTarget(expression);
ruleSetBean.setItemGroup(getExpressionService().getItemGroupExpression(ruleSetBean.getTarget().getValue()));
ruleSetBean.setItem(getExpressionService().getItemExpression(ruleSetBean.getTarget().getValue(), ruleSetBean.getItemGroup()));
int studyEventDefenitionId = ((Integer) hm.get("study_event_definition_id")).intValue();
ruleSetBean.setStudyEventDefinition((StudyEventDefinitionBean) getStudyEventDefinitionDao().findByPK(studyEventDefenitionId));
int crfId = ((Integer) hm.get("crf_id")).intValue();
ruleSetBean.setCrf((CRFBean) getCrfDao().findByPK(crfId));
if ((Integer) hm.get("crf_version_id") != 0) {
int crfVersionId = ((Integer) hm.get("crf_version_id")).intValue();
ruleSetBean.setCrfVersion((CRFVersionBean) getCrfVersionDao().findByPK(crfVersionId));
} else {
ruleSetBean.setCrfVersion(null);
}
return ruleSetBean;
}
use of org.akaza.openclinica.bean.rule.expression.ExpressionBean in project OpenClinica by OpenClinica.
the class ExpressionDAO method getEntityFromHashMap.
public Object getEntityFromHashMap(HashMap hm) {
ExpressionBean expressionBean = new ExpressionBean();
this.setEntityAuditInformation(expressionBean, hm);
expressionBean.setId(((Integer) hm.get("rule_expression_id")).intValue());
expressionBean.setContext(Context.getByCode(((Integer) hm.get("context"))));
expressionBean.setValue(((String) hm.get("value")));
return expressionBean;
}
use of org.akaza.openclinica.bean.rule.expression.ExpressionBean in project OpenClinica by OpenClinica.
the class ExpressionDAO method findByPK.
public EntityBean findByPK(int ID) {
ExpressionBean expressionBean = new ExpressionBean();
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()) {
expressionBean = (ExpressionBean) this.getEntityFromHashMap((HashMap) it.next());
}
return expressionBean;
}
use of org.akaza.openclinica.bean.rule.expression.ExpressionBean in project OpenClinica by OpenClinica.
the class ExpressionDAO method create.
public EntityBean create(EntityBean eb) {
ExpressionBean expressionBean = (ExpressionBean) eb;
HashMap<Integer, Object> variables = new HashMap<Integer, Object>();
HashMap<Integer, Object> nullVars = new HashMap<Integer, Object>();
variables.put(new Integer(1), expressionBean.getContext().getCode());
variables.put(new Integer(2), expressionBean.getValue());
variables.put(new Integer(3), new Integer(expressionBean.getOwnerId()));
variables.put(new Integer(4), new Integer(Status.AVAILABLE.getId()));
executeWithPK(digester.getQuery("create"), variables, nullVars);
if (isQuerySuccessful()) {
expressionBean.setId(getLatestPK());
}
return expressionBean;
}
Aggregations