use of org.akaza.openclinica.domain.rule.RuleSetAuditBean in project OpenClinica by OpenClinica.
the class RuleSetAuditDaoTest method testFindById.
public void testFindById() {
// RuleSetAuditDao ruleSetAuditDao = (RuleSetAuditDao) getContext().getBean("ruleSetAuditDao");
RuleSetAuditBean ruleSetAuditBean = null;
try {
ruleSetAuditBean = ruleSetAuditDao.findById(-1);
} catch (Exception e) {
e.printStackTrace();
}
assertNotNull("ruleSetRuleAuditBean is null", ruleSetAuditBean);
assertEquals("The ruleSetRuleAuditBean.getRuleSetRule.getId should be -1", new Integer(-1), Integer.valueOf(ruleSetAuditBean.getRuleSetBean().getId()));
}
use of org.akaza.openclinica.domain.rule.RuleSetAuditBean in project OpenClinica by OpenClinica.
the class RuleSetAuditDaoTest method testFindAllByRuleSet.
public void testFindAllByRuleSet() {
//RuleSetDao ruleSetDao = (RuleSetDao) getContext().getBean("ruleSetDao");
// RuleSetAuditDao ruleSetAuditDao = (RuleSetAuditDao) getContext().getBean("ruleSetAuditDao");
RuleSetBean ruleSet = ruleSetDao.findById(-1);
List<RuleSetAuditBean> ruleSetAudits = ruleSetAuditDao.findAllByRuleSet(ruleSet);
assertNotNull("ruleSetAudits is null", ruleSetAudits);
assertEquals("The size of the ruleSetAudits is not 2", new Integer(2), Integer.valueOf(ruleSetAudits.size()));
}
use of org.akaza.openclinica.domain.rule.RuleSetAuditBean in project OpenClinica by OpenClinica.
the class ViewRuleSetAuditServlet method processRequest.
@Override
public void processRequest() throws Exception {
String ruleSetId = request.getParameter(RULESET_ID);
if (ruleSetId == null) {
addPageMessage(respage.getString("please_choose_a_CRF_to_view"));
forwardPage(Page.CRF_LIST);
} else {
RuleSetBean ruleSetBean = getRuleSetService().getRuleSetById(currentStudy, ruleSetId);
List<RuleSetAuditBean> ruleSetAudits = getRuleSetAuditDao().findAllByRuleSet(ruleSetBean);
List<RuleSetRuleAuditBean> ruleSetRuleAudits = getRuleSetRuleAuditDao().findAllByRuleSet(ruleSetBean);
for (RuleSetRuleAuditBean ruleSetRuleAuditBean : ruleSetRuleAudits) {
ruleSetRuleAuditBean.setUpdater((UserAccountBean) getUserAccountDAO().findByPK(ruleSetRuleAuditBean.getUpdaterId()));
}
for (RuleSetAuditBean ruleSetAudit : ruleSetAudits) {
ruleSetAudit.setUpdater((UserAccountBean) getUserAccountDAO().findByPK(ruleSetAudit.getUpdaterId()));
}
request.setAttribute(RULESET, ruleSetBean);
request.setAttribute(RULESETAUDITS, ruleSetAudits);
request.setAttribute(RULESETRULEAUDITS, ruleSetRuleAudits);
forwardPage(Page.VIEW_RULESET_AUDITS);
}
}
use of org.akaza.openclinica.domain.rule.RuleSetAuditBean in project OpenClinica by OpenClinica.
the class RuleSetAuditDaoTest method testSaveOrUpdate.
public void testSaveOrUpdate() {
RuleSetBean ruleSetBean = ruleSetDao.findById(-1);
RuleSetAuditBean ruleSetAuditBean = new RuleSetAuditBean();
ruleSetAuditBean.setRuleSetBean(ruleSetBean);
try {
ruleSetAuditBean = ruleSetAuditDao.saveOrUpdate(ruleSetAuditBean);
} catch (Exception e) {
e.printStackTrace();
}
assertNotNull("Persistant id is null", ruleSetAuditBean.getId());
}
use of org.akaza.openclinica.domain.rule.RuleSetAuditBean in project OpenClinica by OpenClinica.
the class RuleSetService method createRuleSetAuditBean.
private RuleSetAuditBean createRuleSetAuditBean(RuleSetBean ruleSetBean, UserAccountBean user, Status status) {
RuleSetAuditBean ruleSetAuditBean = new RuleSetAuditBean();
ruleSetAuditBean.setRuleSetBean(ruleSetBean);
ruleSetAuditBean.setStatus(status);
ruleSetAuditBean.setUpdater(user);
return ruleSetAuditBean;
}
Aggregations