Search in sources :

Example 6 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class FormLayoutDAO method findAll.

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

Example 7 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class FormLayoutDAO method update.

public EntityBean update(EntityBean eb) {
    // UPDATE CRF_VERSION SET CRF_ID=?,STATUS_ID=?,NAME=?,
    // DESCRIPTION=?,DATE_UPDATED=NOW(),UPDATE_ID=?,REVISION_NOTES =? WHERE
    // CRF_VERSION_ID=?
    FormLayoutBean ib = (FormLayoutBean) eb;
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(ib.getCrfId()));
    variables.put(new Integer(2), new Integer(ib.getStatus().getId()));
    variables.put(new Integer(3), ib.getName());
    variables.put(new Integer(4), ib.getDescription());
    variables.put(new Integer(5), new Integer(ib.getUpdater().getId()));
    variables.put(new Integer(6), ib.getRevisionNotes());
    variables.put(new Integer(7), new Integer(ib.getId()));
    this.execute(digester.getQuery("update"), variables);
    return eb;
}
Also used : HashMap(java.util.HashMap) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean)

Example 8 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class StudySubjectServiceImpl method populateUncompletedCRFsWithCRFAndVersions.

@SuppressWarnings({ "rawtypes", "unchecked" })
public void populateUncompletedCRFsWithCRFAndVersions(ArrayList<DisplayEventDefinitionCRFBean> uncompletedEventDefinitionCRFs, Map<Integer, FormLayoutBean> formLayoutById, Map<Integer, CRFBean> crfById) {
    FormLayoutDAO formLayoutDAo = new FormLayoutDAO(dataSource);
    int size = uncompletedEventDefinitionCRFs.size();
    for (int i = 0; i < size; i++) {
        DisplayEventDefinitionCRFBean dedcrf = uncompletedEventDefinitionCRFs.get(i);
        CRFBean cb = crfById.get(dedcrf.getEdc().getCrfId());
        dedcrf.getEdc().setCrf(cb);
        ArrayList<FormLayoutBean> theVersions = (ArrayList<FormLayoutBean>) formLayoutDAo.findAllActiveByCRF(dedcrf.getEdc().getCrfId());
        ArrayList<FormLayoutBean> versions = new ArrayList<FormLayoutBean>();
        HashMap<String, FormLayoutBean> formLayoutIds = new HashMap<String, FormLayoutBean>();
        for (int j = 0; j < theVersions.size(); j++) {
            FormLayoutBean formLayout = theVersions.get(j);
            formLayoutIds.put(String.valueOf(formLayout.getId()), formLayout);
        }
        if (!dedcrf.getEdc().getSelectedVersionIds().equals("")) {
            String[] kk = dedcrf.getEdc().getSelectedVersionIds().split(",");
            for (String string : kk) {
                if (formLayoutIds.get(string) != null) {
                    versions.add(formLayoutIds.get(string));
                }
            }
        } else {
            versions = theVersions;
        }
        dedcrf.getEdc().setVersions(versions);
        uncompletedEventDefinitionCRFs.set(i, dedcrf);
    }
}
Also used : HashMap(java.util.HashMap) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) DisplayEventDefinitionCRFBean(org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean) 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 9 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class BatchCRFMigrationServlet method processRequest.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void processRequest() throws Exception {
    FormProcessor fp = new FormProcessor(request);
    ArrayList<CRFVersionBean> crfVersionList = null;
    ArrayList<FormLayoutBean> formLayoutList = null;
    ArrayList<StudyEventDefinitionBean> eventList = null;
    ArrayList<StudyBean> siteList = null;
    // checks which module the requests are from, manage or admin
    String module = fp.getString(MODULE);
    request.setAttribute(MODULE, module);
    int crfId = fp.getInt(CRF_ID);
    if (crfId == 0) {
        addPageMessage(respage.getString("please_choose_a_CRF_to_view"));
        forwardPage(Page.CRF_LIST);
    } else {
        CRFDAO cdao = new CRFDAO(sm.getDataSource());
        // CRFVersionDAO vdao = new CRFVersionDAO(sm.getDataSource());
        FormLayoutDAO fldao = new FormLayoutDAO(sm.getDataSource());
        CRFBean crf = (CRFBean) cdao.findByPK(crfId);
        request.setAttribute("crfName", crf.getName());
        // ArrayList<CRFVersionBean> versions = (ArrayList<CRFVersionBean>) vdao.findAllByCRF(crfId);
        ArrayList<FormLayoutBean> formLayouts = (ArrayList<FormLayoutBean>) fldao.findAllByCRF(crfId);
        crfVersionList = new ArrayList<CRFVersionBean>();
        formLayoutList = new ArrayList<FormLayoutBean>();
        for (FormLayoutBean version : formLayouts) {
            if (version.getStatus().isAvailable())
                formLayoutList.add(version);
        }
        // for (CRFVersionBean version : versions) {
        // if (version.getStatus().isAvailable())
        // crfVersionList.add(version);
        // }
        // crf.setVersions(crfVersionList);
        crf.setFormLayouts(formLayoutList);
        ArrayList<StudyBean> listOfSites = (ArrayList<StudyBean>) sdao().findAllByParent(currentStudy.getId());
        siteList = new ArrayList<StudyBean>();
        StudyBean studyBean = new StudyBean();
        studyBean.setOid(currentStudy.getOid());
        studyBean.setName(resterm.getString("Study_Level_Subjects_Only"));
        siteList.add(studyBean);
        for (StudyBean s : listOfSites) {
            if (s.getStatus().isAvailable()) {
                siteList.add(s);
            }
        }
        ArrayList<StudyEventDefinitionBean> listOfDefn = seddao().findAllByStudy(currentStudy);
        eventList = new ArrayList<StudyEventDefinitionBean>();
        for (StudyEventDefinitionBean d : listOfDefn) {
            if (d.getStatus().isAvailable()) {
                eventList.add(d);
            }
        }
        // if coming from change crf version -> display message
        String crfVersionChangeMsg = fp.getString("isFromCRFVersionBatchChange");
        if (crfVersionChangeMsg != null && !crfVersionChangeMsg.equals("")) {
            addPageMessage(crfVersionChangeMsg);
        }
        request.setAttribute("study", currentStudy);
        request.setAttribute("siteList", siteList);
        request.setAttribute("eventList", eventList);
        request.setAttribute(CRF, crf);
        forwardPage(Page.BATCH_CRF_MIGRATION);
    }
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) FormProcessor(org.akaza.openclinica.control.form.FormProcessor) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) FormLayoutDAO(org.akaza.openclinica.dao.submit.FormLayoutDAO) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean)

Example 10 with FormLayoutBean

use of org.akaza.openclinica.bean.submit.FormLayoutBean in project OpenClinica by OpenClinica.

the class ViewCRFServlet method populate.

private Collection<TableColumnHolder> populate(CRFBean crf, ArrayList<FormLayoutBean> versions) {
    HashMap<FormLayoutBean, ArrayList<TableColumnHolder>> hm = new HashMap<FormLayoutBean, ArrayList<TableColumnHolder>>();
    List<TableColumnHolder> tableColumnHolders = new ArrayList<TableColumnHolder>();
    for (FormLayoutBean versionBean : versions) {
        hm.put(versionBean, new ArrayList<TableColumnHolder>());
    }
    List<RuleSetBean> ruleSets = getRuleSetService().getRuleSetsByCrfAndStudy(crf, currentStudy);
    ruleSets = getRuleSetService().filterByStatusEqualsAvailable(ruleSets);
    for (RuleSetBean ruleSetBean : ruleSets) {
        if (ruleSetBean.getCrfVersion() == null) {
            for (FormLayoutBean version : versions) {
                hm.get(version).addAll(createFromRuleSet(ruleSetBean, version));
            }
        }
        if (ruleSetBean.getCrfVersion() != null) {
            hm.get(ruleSetBean.getCrfVersion()).addAll(createFromRuleSet(ruleSetBean, ruleSetBean.getFormLayout()));
        }
    }
    for (ArrayList<TableColumnHolder> list : hm.values()) {
        tableColumnHolders.addAll(list);
    }
    return tableColumnHolders;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FormLayoutBean(org.akaza.openclinica.bean.submit.FormLayoutBean) RuleSetBean(org.akaza.openclinica.domain.rule.RuleSetBean)

Aggregations

FormLayoutBean (org.akaza.openclinica.bean.submit.FormLayoutBean)41 ArrayList (java.util.ArrayList)32 FormLayoutDAO (org.akaza.openclinica.dao.submit.FormLayoutDAO)23 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)22 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)21 HashMap (java.util.HashMap)20 CRFDAO (org.akaza.openclinica.dao.admin.CRFDAO)16 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)14 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)13 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)12 Iterator (java.util.Iterator)10 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)10 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)9 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)9 StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)8 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)8 DisplayEventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.DisplayEventDefinitionCRFBean)7 DisplayEventCRFBean (org.akaza.openclinica.bean.submit.DisplayEventCRFBean)7 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)6 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)5