Search in sources :

Example 6 with AuditableEntityBean

use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.

the class AuditableEntityDAO method findAllByStudy.

/**
     * Note: The subclass must define findAllByStudyName before calling this
     * method. Otherwise an empty array will be returned.
     *
     * @param study
     *            The study to which the entities belong.
     * @return An array containing all the entities which belong to
     *         <code>study</code>.
     */
public ArrayList findAllByStudy(StudyBean study) {
    ArrayList answer = new ArrayList();
    if (findAllByStudyName == null) {
        return answer;
    }
    setTypesExpected();
    HashMap variables = new HashMap();
    // study.study_id=?
    variables.put(Integer.valueOf(1), Integer.valueOf(study.getId()));
    // or study.parent_study_id=?
    variables.put(Integer.valueOf(2), Integer.valueOf(study.getId()));
    String sql = digester.getQuery(findAllByStudyName);
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        AuditableEntityBean aeb = (AuditableEntityBean) this.getEntityFromHashMap((HashMap) it.next());
        answer.add(aeb);
    }
    return answer;
}
Also used : AuditableEntityBean(org.akaza.openclinica.bean.core.AuditableEntityBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 7 with AuditableEntityBean

use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.

the class ViewEventCRFContentServlet method getStudyEvent.

/*
     * Get the Study Event to display on screen as well as print some of its
     * information. Krikor 10/19/2006
     */
private StudyEventBean getStudyEvent(int eventId) throws Exception {
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudyBean studyWithSED = currentStudy;
    if (currentStudy.getParentStudyId() > 0) {
        studyWithSED = new StudyBean();
        studyWithSED.setId(currentStudy.getParentStudyId());
    }
    AuditableEntityBean aeb = sedao.findByPKAndStudy(eventId, studyWithSED);
    if (!aeb.isActive()) {
        addPageMessage(respage.getString("the_SE_you_attempting_enter_data_not_belong"));
        throw new InsufficientPermissionException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("SE_does_not_belong_current_study"), "1");
    // >> changed tbh, 06/2009
    }
    StudyEventBean seb = (StudyEventBean) aeb;
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
    StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) seddao.findByPK(seb.getStudyEventDefinitionId());
    seb.setStudyEventDefinition(sedb);
    return seb;
}
Also used : AuditableEntityBean(org.akaza.openclinica.bean.core.AuditableEntityBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Example 8 with AuditableEntityBean

use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.

the class TableOfContentsServlet method getEventCRFAndAction.

private void getEventCRFAndAction() {
    ecdao = new EventCRFDAO(sm.getDataSource());
    ecb = (EventCRFBean) request.getAttribute(INPUT_EVENT_CRF_BEAN);
    if (ecb == null) {
        int ecid = fp.getInt(INPUT_ID, true);
        AuditableEntityBean aeb = ecdao.findByPKAndStudy(ecid, currentStudy);
        if (!aeb.isActive()) {
            ecb = new EventCRFBean();
        } else {
            ecb = (EventCRFBean) aeb;
        }
        action = fp.getString(INPUT_ACTION, true);
    } else {
        action = getActionForStage(ecb.getStage());
    }
}
Also used : EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) AuditableEntityBean(org.akaza.openclinica.bean.core.AuditableEntityBean) EventCRFDAO(org.akaza.openclinica.dao.submit.EventCRFDAO)

Example 9 with AuditableEntityBean

use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.

the class Validator method entityExistsInStudy.

protected boolean entityExistsInStudy(String fieldName, AuditableEntityDAO dao, StudyBean study) {
    String fieldValue = getFieldValue(fieldName);
    if (fieldValue == null) {
        return false;
    }
    try {
        int id = Integer.parseInt(fieldValue);
        AuditableEntityBean e = dao.findByPKAndStudy(id, study);
        if (!e.isActive()) {
            return false;
        }
    } catch (Exception e) {
        return false;
    }
    return true;
}
Also used : AuditableEntityBean(org.akaza.openclinica.bean.core.AuditableEntityBean) ParseException(java.text.ParseException) PatternSyntaxException(java.util.regex.PatternSyntaxException)

Example 10 with AuditableEntityBean

use of org.akaza.openclinica.bean.core.AuditableEntityBean in project OpenClinica by OpenClinica.

the class EnterDataForStudyEventServlet method getStudyEvent.

private StudyEventBean getStudyEvent(int eventId) throws Exception {
    StudyEventDAO sedao = new StudyEventDAO(sm.getDataSource());
    StudyBean studyWithSED = currentStudy;
    if (currentStudy.getParentStudyId() > 0) {
        studyWithSED = new StudyBean();
        studyWithSED.setId(currentStudy.getParentStudyId());
    }
    AuditableEntityBean aeb = sedao.findByPKAndStudy(eventId, studyWithSED);
    if (!aeb.isActive()) {
        addPageMessage(respage.getString("study_event_to_enter_data_not_belong_study"));
        throw new InsufficientPermissionException(Page.LIST_STUDY_SUBJECTS_SERVLET, resexception.getString("study_event_not_belong_study"), "1");
    }
    StudyEventBean seb = (StudyEventBean) aeb;
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(sm.getDataSource());
    StudyEventDefinitionBean sedb = (StudyEventDefinitionBean) seddao.findByPK(seb.getStudyEventDefinitionId());
    seb.setStudyEventDefinition(sedb);
    // A. Hamid mantis issue 5048
    if (!(currentRole.isDirector() || currentRole.isCoordinator()) && seb.getSubjectEventStatus().isLocked()) {
        seb.setEditable(false);
    }
    return seb;
}
Also used : AuditableEntityBean(org.akaza.openclinica.bean.core.AuditableEntityBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudyEventDAO(org.akaza.openclinica.dao.managestudy.StudyEventDAO) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) InsufficientPermissionException(org.akaza.openclinica.web.InsufficientPermissionException) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyEventBean(org.akaza.openclinica.bean.managestudy.StudyEventBean)

Aggregations

AuditableEntityBean (org.akaza.openclinica.bean.core.AuditableEntityBean)11 ArrayList (java.util.ArrayList)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)6 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)6 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)6 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)6 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)5 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)4 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)4 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)4 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)4 Date (java.util.Date)3 HashMap (java.util.HashMap)3 Iterator (java.util.Iterator)3 EntityBean (org.akaza.openclinica.bean.core.EntityBean)3 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)3 DisplayEventCRFBean (org.akaza.openclinica.bean.submit.DisplayEventCRFBean)2 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)2 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)2 InconsistentStateException (org.akaza.openclinica.web.InconsistentStateException)2