Search in sources :

Example 1 with RuleSetAuditBean

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()));
}
Also used : RuleSetAuditBean(org.akaza.openclinica.domain.rule.RuleSetAuditBean) HibernateException(org.hibernate.HibernateException)

Example 2 with RuleSetAuditBean

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()));
}
Also used : RuleSetAuditBean(org.akaza.openclinica.domain.rule.RuleSetAuditBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Example 3 with RuleSetAuditBean

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);
    }
}
Also used : RuleSetAuditBean(org.akaza.openclinica.domain.rule.RuleSetAuditBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean) RuleSetRuleAuditBean(org.akaza.openclinica.domain.rule.RuleSetRuleAuditBean)

Example 4 with RuleSetAuditBean

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());
}
Also used : RuleSetAuditBean(org.akaza.openclinica.domain.rule.RuleSetAuditBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean) HibernateException(org.hibernate.HibernateException)

Example 5 with RuleSetAuditBean

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;
}
Also used : RuleSetAuditBean(org.akaza.openclinica.domain.rule.RuleSetAuditBean)

Aggregations

RuleSetAuditBean (org.akaza.openclinica.domain.rule.RuleSetAuditBean)5 RuleSetBean (org.akaza.openclinica.domain.rule.RuleSetBean)3 HibernateException (org.hibernate.HibernateException)2 RuleSetRuleAuditBean (org.akaza.openclinica.domain.rule.RuleSetRuleAuditBean)1