Search in sources :

Example 26 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class MetadataUnit method collectMetaDataVersion.

private void collectMetaDataVersion() {
    ArrayList<StudyEventDefinitionBean> sedBeansInStudy = (ArrayList<StudyEventDefinitionBean>) studyBase.getSedBeansInStudy();
    if (sedBeansInStudy == null || sedBeansInStudy.size() < 1) {
        logger.info("null, because there is no study event definition in this study.");
        return;
    }
    StudyBean study = studyBase.getStudy();
    StudyConfigService studyConfig = new StudyConfigService(this.ds);
    study = studyConfig.setParametersForStudy(study);
    MetaDataVersionBean metadata = this.odmStudy.getMetaDataVersion();
    metadata.setStudy(study);
    StudyParameterValueDAO spvdao = new StudyParameterValueDAO(this.ds);
    int parentId = study.getParentStudyId() > 0 ? study.getParentStudyId() : study.getId();
    StudyParameterValueBean spv = spvdao.findByHandleAndStudy(parentId, "discrepancyManagement");
    metadata.setSoftHard(spv.getValue().equalsIgnoreCase("true") ? "Hard" : "Soft");
    OdmExtractDAO oedao = new OdmExtractDAO(this.ds);
    int studyId = study.getId();
    int parentStudyId = study.getParentStudyId() > 0 ? study.getParentStudyId() : studyId;
    if (this.getCategory() == 1 && study.isSite(study.getParentStudyId())) {
        // populate MetaDataVersion attributes
        if (dataset != null) {
            metadata.setOid(dataset.getODMMetaDataVersionOid() + "-" + study.getOid());
            metadata.setName(dataset.getODMMetaDataVersionName() + "-" + study.getOid());
            this.setParentMetaDataVersionOid(dataset.getODMMetaDataVersionOid());
        }
        if (metadata.getOid() == null || metadata.getOid().length() <= 0) {
            metadata.setOid("v1.0.0" + "-" + study.getOid());
            this.setParentMetaDataVersionOid("v1.0.0");
        }
        if (metadata.getName() == null || metadata.getName().length() <= 0) {
            metadata.setName("MetaDataVersion_v1.0.0" + "-" + study.getOid());
        }
        // populate Include
        this.collectIncludeFromParentInSameFile();
        // populate protocol
        oedao.getUpdatedSiteMetadata(parentStudyId, studyId, metadata, this.odmBean.getODMVersion());
    } else {
        if (dataset != null) {
            metadata.setOid(dataset.getODMMetaDataVersionOid());
            metadata.setName(dataset.getODMMetaDataVersionName());
        }
        if (metadata.getOid() == null || metadata.getOid().length() <= 0) {
            metadata.setOid("v1.0.0");
        }
        if (metadata.getName() == null || metadata.getName().length() <= 0) {
            metadata.setName("MetaDataVersion_v1.0.0");
        }
        // populate Include
        String psOid = new String();
        String pmOid = new String();
        if (dataset != null) {
            psOid = dataset.getODMPriorStudyOid();
            pmOid = dataset.getODMPriorMetaDataVersionOid();
        }
        if (pmOid != null && pmOid.length() > 0) {
            MetaDataVersionIncludeBean ib = metadata.getInclude();
            ib.setMetaDataVersionOID(pmOid);
            if (psOid != null && psOid.length() > 0) {
                ib.setStudyOID(psOid);
            } else {
                ib.setStudyOID(study.getOid());
            }
        }
        // populate protocol
        // Set<Integer> nullCodeSet = oedao.getMetadata(parentStudyId,
        // studyId,
        // metadata, this.getODMBean().getODMVersion());
        // studyBase.setNullClSet(nullCodeSet);
        oedao.getMetadata(parentStudyId, studyId, metadata, this.odmBean.getODMVersion());
        metadata.setRuleSetRules(getRuleSetRuleDao().findByRuleSetStudyIdAndStatusAvail(parentStudyId));
    }
}
Also used : StudyConfigService(org.akaza.openclinica.dao.service.StudyConfigService) StudyParameterValueBean(org.akaza.openclinica.bean.service.StudyParameterValueBean) MetaDataVersionIncludeBean(org.akaza.openclinica.bean.odmbeans.MetaDataVersionIncludeBean) MetaDataVersionBean(org.akaza.openclinica.bean.odmbeans.MetaDataVersionBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) OdmStudyBean(org.akaza.openclinica.bean.odmbeans.OdmStudyBean) ArrayList(java.util.ArrayList) OdmExtractDAO(org.akaza.openclinica.dao.extract.OdmExtractDAO) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) StudyParameterValueDAO(org.akaza.openclinica.dao.service.StudyParameterValueDAO)

Example 27 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class MetadataUnit method collectOdmStudy.

public void collectOdmStudy(String formVersionOID) {
    StudyBean study = studyBase.getStudy();
    String studyOID = study.getOid();
    if (studyOID == null || studyOID.length() <= 0) {
        logger.info("Constructed studyOID using study_id because oc_oid is missing from the table - study.");
        studyOID = "" + study.getId();
    }
    odmStudy.setOid(studyOID);
    if (studyOID.equals(FAKE_STUDY_OID)) {
        collectGlobalVariables();
        collectBasicDefinitions(formVersionOID);
        collectMetaDataVersion(formVersionOID);
    } else {
        collectGlobalVariables();
        collectBasicDefinitions();
        collectMetaDataVersion();
    }
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) OdmStudyBean(org.akaza.openclinica.bean.odmbeans.OdmStudyBean)

Example 28 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class OdmDataCollector method populateCompletedStudyBaseMap.

/**
     * Populate a HashMap<String, OdmStudyBase> of a study and its sites if
     * appliable, the key is study/site oc_oid.
     * 
     * @param parentStudyId
     * @return
     */
public LinkedHashMap<String, OdmStudyBase> populateCompletedStudyBaseMap(int parentStudyId) {
    LinkedHashMap<String, OdmStudyBase> Bases = new LinkedHashMap<String, OdmStudyBase>();
    StudyDAO sdao = new StudyDAO(this.ds);
    for (StudyBean s : (ArrayList<StudyBean>) sdao.findAllByParentStudyIdOrderedByIdAsc(parentStudyId)) {
        Bases.put(s.getOid(), new OdmStudyBase(ds, s));
    }
    return Bases;
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) StudyDAO(org.akaza.openclinica.dao.managestudy.StudyDAO) LinkedHashMap(java.util.LinkedHashMap)

Example 29 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class OdmDataCollector method createFakeStudyObj.

private void createFakeStudyObj() {
    dataset = new DatasetBean();
    odmbean = new ODMBean();
    StudyBean studyBean = new StudyBean();
    studyBean.setName(MetadataUnit.FAKE_STUDY_NAME);
    studyBean.setOid(MetadataUnit.FAKE_STUDY_OID);
    studyBean.setParentStudyId(0);
    StudyEventDefinitionBean sedFake = new StudyEventDefinitionBean();
    sedFake.setName(MetadataUnit.FAKE_SE_NAME);
    sedFake.setOid(MetadataUnit.FAKE_STUDY_EVENT_OID);
    List<StudyEventDefinitionBean> seds = new ArrayList<StudyEventDefinitionBean>();
    seds.add(sedFake);
    LinkedHashMap<String, OdmStudyBase> Bases = new LinkedHashMap<String, OdmStudyBase>();
    Bases.put(studyBean.getOid(), new OdmStudyBase(ds, studyBean, seds));
    //this.studyBaseMap = new LinkedHashMap<String, OdmStudyBase>();
    this.studyBaseMap = Bases;
}
Also used : DatasetBean(org.akaza.openclinica.bean.extract.DatasetBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) ArrayList(java.util.ArrayList) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean) LinkedHashMap(java.util.LinkedHashMap)

Example 30 with StudyBean

use of org.akaza.openclinica.bean.managestudy.StudyBean in project OpenClinica by OpenClinica.

the class MetaDataCollector method collectMetadataUnitMap.

public void collectMetadataUnitMap(String formVersionOID) {
    Iterator<OdmStudyBase> it = this.getStudyBaseMap().values().iterator();
    MetaDataVersionProtocolBean protocol = new MetaDataVersionProtocolBean();
    while (it.hasNext()) {
        JobTerminationMonitor.check();
        OdmStudyBase u = it.next();
        StudyBean study = u.getStudy();
        MetadataUnit meta = new MetadataUnit(this.ds);
        meta.setStudyBase(u);
        meta.setOdmStudy(new OdmStudyBean());
        meta.setParentStudy(new StudyBean());
        meta.collectOdmStudy(formVersionOID);
        if (this.getCategory() == 1) {
            if (study.isSite(study.getParentStudyId())) {
                meta.getOdmStudy().setParentStudyOID(meta.getParentOdmStudyOid());
                MetaDataVersionProtocolBean p = meta.getOdmStudy().getMetaDataVersion().getProtocol();
                if (p != null && p.getStudyEventRefs().size() > 0) {
                } else {
                    logger.error("site " + study.getName() + " will be assigned protocol with StudyEventRefs size=" + protocol.getStudyEventRefs().size());
                    meta.getOdmStudy().getMetaDataVersion().setProtocol(protocol);
                }
            } else {
                protocol = meta.getOdmStudy().getMetaDataVersion().getProtocol();
            }
        }
        odmStudyMap.put(u.getStudy().getOid(), meta.getOdmStudy());
    }
}
Also used : OdmStudyBean(org.akaza.openclinica.bean.odmbeans.OdmStudyBean) StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) OdmStudyBean(org.akaza.openclinica.bean.odmbeans.OdmStudyBean) MetaDataVersionProtocolBean(org.akaza.openclinica.bean.odmbeans.MetaDataVersionProtocolBean)

Aggregations

StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)350 ArrayList (java.util.ArrayList)183 StudyDAO (org.akaza.openclinica.dao.managestudy.StudyDAO)175 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)92 HashMap (java.util.HashMap)84 StudySubjectBean (org.akaza.openclinica.bean.managestudy.StudySubjectBean)66 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)65 StudyEventDefinitionDAO (org.akaza.openclinica.dao.managestudy.StudyEventDefinitionDAO)62 Date (java.util.Date)59 StudyEventBean (org.akaza.openclinica.bean.managestudy.StudyEventBean)58 StudyEventDAO (org.akaza.openclinica.dao.managestudy.StudyEventDAO)57 UserAccountBean (org.akaza.openclinica.bean.login.UserAccountBean)56 StudySubjectDAO (org.akaza.openclinica.dao.managestudy.StudySubjectDAO)54 EventCRFBean (org.akaza.openclinica.bean.submit.EventCRFBean)52 EventCRFDAO (org.akaza.openclinica.dao.submit.EventCRFDAO)52 EventDefinitionCRFDAO (org.akaza.openclinica.dao.managestudy.EventDefinitionCRFDAO)45 Locale (java.util.Locale)39 UserAccountDAO (org.akaza.openclinica.dao.login.UserAccountDAO)39 EventDefinitionCRFBean (org.akaza.openclinica.bean.managestudy.EventDefinitionCRFBean)37 Iterator (java.util.Iterator)36