Search in sources :

Example 66 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class StudySubjectServiceImpl method getDisplayEventCRFs.

private List<DisplayEventCRFBean> getDisplayEventCRFs(List eventCRFs, UserAccountBean ub, StudyUserRoleBean currentRole, SubjectEventStatus status, StudyBean study, Set<Integer> nonEmptyEventCrf, Map<Integer, FormLayoutBean> formLayoutById, Map<Integer, CRFBean> crfById, Integer studyEventDefinitionId, List eventDefinitionCRFs) {
    ArrayList<DisplayEventCRFBean> answer = new ArrayList<DisplayEventCRFBean>();
    for (int i = 0; i < eventCRFs.size(); i++) {
        EventCRFBean ecb = (EventCRFBean) eventCRFs.get(i);
        // populate the event CRF with its crf bean
        int formLayoutId = ecb.getFormLayoutId();
        FormLayoutBean flb = formLayoutById.get(formLayoutId);
        ecb.setFormLayout(flb);
        CRFBean cb = crfById.get(flb.getCrfId());
        ecb.setCrf(cb);
        EventDefinitionCRFBean edc = null;
        Iterator it = eventDefinitionCRFs.iterator();
        while (it.hasNext()) {
            EventDefinitionCRFBean edcBean = (EventDefinitionCRFBean) it.next();
            if (edcBean.getCrfId() == cb.getId()) {
                edc = edcBean;
                break;
            }
        }
        // rules updated 112007 tbh
        if (status.equals(SubjectEventStatus.LOCKED) || status.equals(SubjectEventStatus.SKIPPED) || status.equals(SubjectEventStatus.STOPPED)) {
            ecb.setStage(DataEntryStage.LOCKED);
        // we need to set a SED-wide flag here, because other edcs
        // in this event can be filled in and change the status, tbh
        } else if (status.equals(SubjectEventStatus.INVALID)) {
            ecb.setStage(DataEntryStage.LOCKED);
        } else if (!cb.getStatus().equals(Status.AVAILABLE)) {
            ecb.setStage(DataEntryStage.LOCKED);
        } else if (!flb.getStatus().equals(Status.AVAILABLE)) {
            ecb.setStage(DataEntryStage.LOCKED);
        }
        // TODO need to refactor since this is similar to other code, tbh
        if (edc != null) {
            // System.out.println("edc is not null, need to set flags");
            DisplayEventCRFBean dec = new DisplayEventCRFBean();
            dec.setEventDefinitionCRF(edc);
            // System.out.println("edc.isDoubleEntry()" +
            // edc.isDoubleEntry() + ecb.getId());
            dec.setFlags(ecb, ub, currentRole, edc.isDoubleEntry());
            if (dec.isLocked()) {
            // System.out.println("*** found a locked DEC:
            // "+edc.getCrfName());
            }
            if (nonEmptyEventCrf.contains(ecb.getId())) {
                // consider an event crf started only if item data get
                // created
                answer.add(dec);
            }
        }
    }
    return answer;
}
Also used : DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) DisplayEventCRFBean(org.akaza.openclinica.bean.submit.DisplayEventCRFBean) EventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)

Example 67 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class OdmExtractDAO method fetchFormDetails.

public FormDefBean fetchFormDetails(CRFVersionBean crfVBean, FormDefBean formDef) {
    CRFDAO<String, ArrayList> crfDao = new CRFDAO(this.ds);
    CRFBean crfBean = (CRFBean) crfDao.findByPK(crfVBean.getCrfId());
    formDef.setOid(crfVBean.getOid());
    formDef.setName(crfBean.getName() + " - " + crfVBean.getName());
    formDef.setRepeating("No");
    FormDetailsBean formDetails = new FormDetailsBean();
    formDetails.setName(crfVBean.getName());
    formDetails.setOid(crfVBean.getOid());
    formDetails.setParentFormOid(crfBean.getOid());
    setSectionBean(formDetails, new Integer(crfVBean.getId()));
    formDef.setFormDetails(formDetails);
    return formDef;
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) ArrayList(java.util.ArrayList) FormDetailsBean(org.akaza.openclinica.bean.odmbeans.FormDetailsBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean)

Example 68 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class CRFDAO method findByItemOid.

public CRFBean findByItemOid(String itemOid) {
    CRFBean eb = new CRFBean();
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), itemOid);
    ArrayList alist = this.select(digester.getQuery("findByItemOid"), variables);
    Iterator it = alist.iterator();
    if (it.hasNext()) {
        eb = (CRFBean) this.getEntityFromHashMap((HashMap) it.next());
    }
    return eb;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CRFBean(org.akaza.openclinica.bean.admin.CRFBean)

Example 69 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class CRFDAO method findAllByLimit.

public Collection findAllByLimit(boolean hasLimit) {
    this.setTypesExpected();
    ArrayList alist = null;
    if (hasLimit) {
        alist = this.select(digester.getQuery("findAllByLimit"));
    } else {
        alist = this.select(digester.getQuery("findAll"));
    }
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        CRFBean eb = (CRFBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CRFBean(org.akaza.openclinica.bean.admin.CRFBean)

Example 70 with CRFBean

use of org.akaza.openclinica.bean.admin.CRFBean in project OpenClinica by OpenClinica.

the class CRFDAO method findAllActiveByDefinition.

public Collection findAllActiveByDefinition(StudyEventDefinitionBean definition) {
    this.setTypesExpected();
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), Integer.valueOf(definition.getId()));
    ArrayList alist = this.select(digester.getQuery("findAllActiveByDefinition"), variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        CRFBean eb = (CRFBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(eb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CRFBean(org.akaza.openclinica.bean.admin.CRFBean)

Aggregations

CRFBean (org.akaza.openclinica.bean.admin.CRFBean)138 ArrayList (java.util.ArrayList)95 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)78 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)78 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)70 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)67 CRFVersionDAO (org.akaza.openclinica.dao.submit.CRFVersionDAO)63 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)56 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)44 HashMap (java.util.HashMap)43 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)43 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)40 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)37 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)29 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)27 Iterator (java.util.Iterator)26 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)26 DisplayEventCRFBean (org.akaza.openclinica.bean.submit.DisplayEventCRFBean)22 ItemBean (org.akaza.openclinica.bean.submit.ItemBean)21 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)20