Search in sources :

Example 1 with ItemBean

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

the class ExtractBean method getMetadata.

/**
     * Implements the Column algorithm in "Dataset Export Algorithms" Must be
     * called after DatasetDAO.getDatasetData();
     */
public void getMetadata() {
    StudyEventDefinitionDAO seddao = new StudyEventDefinitionDAO(ds);
    CRFDAO cdao = new CRFDAO(ds);
    CRFVersionDAO cvdao = new CRFVersionDAO(ds);
    ItemDAO idao = new ItemDAO(ds);
    ItemFormMetadataDAO ifmDAO = new ItemFormMetadataDAO(this.ds);
    StudyGroupDAO studygroupDAO = new StudyGroupDAO(ds);
    StudyGroupClassDAO studygroupclassDAO = new StudyGroupClassDAO(ds);
    // SubjectGroupMapDAO subjectGroupMapDAO = new SubjectGroupMapDAO(ds);
    studyGroupClasses = new ArrayList();
    studyGroupMap = new HashMap();
    studyGroupMaps = new HashMap<Integer, ArrayList>();
    sedCrfColumns = new HashMap();
    displayed = new HashMap();
    sedCrfItemFormMetadataBeans = new HashMap();
    studyEvents = seddao.findAllByStudy(study);
    ArrayList finalStudyEvents = new ArrayList();
    if (dataset.isShowSubjectGroupInformation()) {
        // logger.info("found study id for maps: "+study.getId());
        studyGroupMaps = studygroupDAO.findSubjectGroupMaps(study.getId());
        // below is for a given subject; we need a data structure for
        // all subjects
        // studyGroupMap = studygroupDAO.findByStudySubject(currentSubject);
        // problem: can't use currentSubject here, since it's not 'set up'
        // properly
        // how to get the current subject?
        logger.info("found subject group ids: " + dataset.getSubjectGroupIds().toString());
        // studyGroupClasses = dataset.getSubjectGroupIds();
        for (int h = 0; h < dataset.getSubjectGroupIds().size(); h++) {
            Integer groupId = (Integer) dataset.getSubjectGroupIds().get(h);
            StudyGroupClassBean sgclass = (StudyGroupClassBean) studygroupclassDAO.findByPK(groupId.intValue());
            // logger.info();
            // hmm how to link groups to subjects though? only through
            // subject group map
            logger.info("found a studygroupclass bean: " + sgclass.getName());
            studyGroupClasses.add(sgclass);
        }
    }
    for (int i = 0; i < studyEvents.size(); i++) {
        StudyEventDefinitionBean sed = (StudyEventDefinitionBean) studyEvents.get(i);
        if (!selectedSED(sed)) {
            continue;
        }
        ArrayList CRFs = (ArrayList) cdao.findAllActiveByDefinition(sed);
        ArrayList CRFsDisplayedInThisSED = new ArrayList();
        for (int j = 0; j < CRFs.size(); j++) {
            CRFBean cb = (CRFBean) CRFs.get(j);
            if (!selectedSEDCRF(sed, cb)) {
                continue;
            } else {
                CRFsDisplayedInThisSED.add(cb);
                ArrayList CRFVersions = cvdao.findAllByCRFId(cb.getId());
                for (int k = 0; k < CRFVersions.size(); k++) {
                    CRFVersionBean cvb = (CRFVersionBean) CRFVersions.get(k);
                    ArrayList Items = idao.findAllItemsByVersionId(cvb.getId());
                    // sort by ordinal/name
                    Collections.sort(Items);
                    for (int l = 0; l < Items.size(); l++) {
                        ItemBean ib = (ItemBean) Items.get(l);
                        if (selected(ib) && !getDisplayed(sed, cb, ib)) {
                            // logger.info("found at
                            // itemformmetadatadao: "+ib.getId()+",
                            // "+cvb.getId());
                            ItemFormMetadataBean ifmb = ifmDAO.findByItemIdAndCRFVersionId(ib.getId(), cvb.getId());
                            addColumn(sed, cb, ib);
                            addItemFormMetadataBeans(sed, cb, ifmb);
                            markDisplayed(sed, cb, ib);
                        }
                    }
                }
            }
        // else
        }
        // for
        sed.setCrfs(CRFsDisplayedInThisSED);
        // make the setCrfs call "stick"
        finalStudyEvents.add(sed);
    }
    this.studyEvents = finalStudyEvents;
}
Also used : CRFDAO(org.akaza.openclinica.dao.admin.CRFDAO) ItemBean(org.akaza.openclinica.bean.submit.ItemBean) CRFVersionDAO(org.akaza.openclinica.dao.submit.CRFVersionDAO) ItemDAO(org.akaza.openclinica.dao.submit.ItemDAO) HashMap(java.util.HashMap) StudyGroupClassDAO(org.akaza.openclinica.dao.managestudy.StudyGroupClassDAO) ArrayList(java.util.ArrayList) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyGroupDAO(org.akaza.openclinica.dao.managestudy.StudyGroupDAO) EventCRFBean(org.akaza.openclinica.bean.submit.EventCRFBean) CRFBean(org.akaza.openclinica.bean.admin.CRFBean) StudyEventDefinitionDAO(org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO) StudyGroupClassBean(org.akaza.openclinica.bean.managestudy.StudyGroupClassBean) CRFVersionBean(org.akaza.openclinica.bean.submit.CRFVersionBean) ItemFormMetadataDAO(org.akaza.openclinica.dao.submit.ItemFormMetadataDAO) ItemFormMetadataBean(org.akaza.openclinica.bean.submit.ItemFormMetadataBean)

Example 2 with ItemBean

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

the class ExtractCRFVersionBean method addItem.

public ItemBean addItem(Integer itemId, String itemName) {
    if (itemId == null || itemName == null) {
        logger.info("item null!");
        return new ItemBean();
    }
    ItemBean ib = new ItemBean();
    ib.setId(itemId.intValue());
    ib.setName(itemName);
    if (!items.contains(ib)) {
    // logger.info("adding item: " + itemId.intValue() + "-" +
    // itemName);
    }
    return (ItemBean) items.add(ib);
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean)

Example 3 with ItemBean

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

the class CRFVersionDAO method findItemUsedByOtherVersion.

public Collection findItemUsedByOtherVersion(int versionId) {
    this.unsetTypeExpected();
    this.setTypeExpected(1, TypeNames.INT);
    this.setTypeExpected(2, TypeNames.STRING);
    this.setTypeExpected(3, TypeNames.INT);
    HashMap variables = new HashMap();
    variables.put(new Integer(1), new Integer(versionId));
    String sql = digester.getQuery("findItemUsedByOtherVersion");
    ArrayList alist = this.select(sql, variables);
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        ItemBean eb = new ItemBean();
        HashMap hm = (HashMap) it.next();
        eb.setId(((Integer) hm.get("item_id")).intValue());
        eb.setName((String) hm.get("name"));
        eb.setOwnerId(((Integer) hm.get("owner_id")).intValue());
        al.add(eb);
    }
    return al;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator)

Example 4 with ItemBean

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

the class ItemDAO method findByOid.

public List<ItemBean> findByOid(String oid) {
    this.setTypesExpected();
    HashMap<Integer, String> variables = new HashMap<Integer, String>();
    variables.put(1, oid);
    List listofMaps = this.select(digester.getQuery("findItemByOid"), variables);
    List<ItemBean> beanList = new ArrayList<ItemBean>();
    ItemBean bean;
    for (Object map : listofMaps) {
        bean = (ItemBean) this.getEntityFromHashMap((HashMap) map);
        beanList.add(bean);
    }
    return beanList;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with ItemBean

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

the class ItemDAO method update.

public EntityBean update(EntityBean eb) {
    ItemBean ib = (ItemBean) eb;
    HashMap variables = new HashMap();
    variables.put(new Integer(1), ib.getName());
    variables.put(new Integer(2), ib.getDescription());
    variables.put(new Integer(3), ib.getUnits());
    variables.put(new Integer(4), new Boolean(ib.isPhiStatus()));
    variables.put(new Integer(5), new Integer(ib.getItemDataTypeId()));
    variables.put(new Integer(6), new Integer(ib.getItemReferenceTypeId()));
    variables.put(new Integer(7), new Integer(ib.getStatus().getId()));
    variables.put(new Integer(8), new Integer(ib.getUpdaterId()));
    variables.put(new Integer(9), new Integer(ib.getId()));
    this.execute(digester.getQuery("update"), variables);
    return eb;
}
Also used : ItemBean(org.akaza.openclinica.bean.submit.ItemBean) HashMap(java.util.HashMap)

Aggregations

ItemBean (org.akaza.openclinica.bean.submit.ItemBean)132 ArrayList (java.util.ArrayList)77 DisplayItemBean (org.akaza.openclinica.bean.submit.DisplayItemBean)56 HashMap (java.util.HashMap)50 ItemDAO (org.akaza.openclinica.dao.submit.ItemDAO)43 ItemDataBean (org.akaza.openclinica.bean.submit.ItemDataBean)42 ItemFormMetadataBean (org.akaza.openclinica.bean.submit.ItemFormMetadataBean)36 ItemGroupBean (org.akaza.openclinica.bean.submit.ItemGroupBean)26 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)25 Iterator (java.util.Iterator)23 CRFBean (org.akaza.openclinica.bean.admin.CRFBean)22 ItemDataDAO (org.akaza.openclinica.dao.submit.ItemDataDAO)22 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)21 ItemFormMetadataDAO (org.akaza.openclinica.dao.submit.ItemFormMetadataDAO)20 CRFVersionBean (org.akaza.openclinica.bean.submit.CRFVersionBean)15 SectionBean (org.akaza.openclinica.bean.submit.SectionBean)15 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)15 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)13 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)13 DisplayItemGroupBean (org.akaza.openclinica.bean.submit.DisplayItemGroupBean)13