Search in sources :

Example 1 with OdmExtractDAO

use of org.akaza.openclinica.dao.extract.OdmExtractDAO in project OpenClinica by OpenClinica.

the class MetadataUnit method collectBasicDefinitions.

private void collectBasicDefinitions() {
    int studyid = studyBase.getStudy().getParentStudyId() > 0 ? studyBase.getStudy().getParentStudyId() : studyBase.getStudy().getId();
    new OdmExtractDAO(this.ds).getBasicDefinitions(studyid, odmStudy.getBasicDefinitions());
}
Also used : OdmExtractDAO(org.akaza.openclinica.dao.extract.OdmExtractDAO)

Example 2 with OdmExtractDAO

use of org.akaza.openclinica.dao.extract.OdmExtractDAO 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 3 with OdmExtractDAO

use of org.akaza.openclinica.dao.extract.OdmExtractDAO in project OpenClinica by OpenClinica.

the class AdminDataUnit method collectOdmAdminData.

public void collectOdmAdminData() {
    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();
    }
    odmAdminData.setStudyOID(studyOID);
    OdmExtractDAO oedao = new OdmExtractDAO(this.ds);
    if (this.getCategory() == 1 && study.isSite(study.getParentStudyId())) {
        String mvoid = "";
        if (this.dataset != null && this.dataset.getId() > 0) {
            mvoid = this.dataset.getODMMetaDataVersionOid();
        }
        if (mvoid.length() > 0) {
            mvoid += "-" + studyOID;
        } else {
            mvoid = "v1.0.0" + "-" + studyOID;
        }
        odmAdminData.setMetaDataVersionOID(mvoid);
    } else {
        odmAdminData.setMetaDataVersionOID(this.dataset.getODMMetaDataVersionOid());
        if (odmAdminData.getMetaDataVersionOID() == null || odmAdminData.getMetaDataVersionOID().length() <= 0) {
            odmAdminData.setMetaDataVersionOID("v1.0.0");
        }
    }
    oedao.getAdminData(study, this.dataset, odmAdminData, this.odmBean.getODMVersion());
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) OdmExtractDAO(org.akaza.openclinica.dao.extract.OdmExtractDAO)

Example 4 with OdmExtractDAO

use of org.akaza.openclinica.dao.extract.OdmExtractDAO in project OpenClinica by OpenClinica.

the class ClinicalDataUnit method collectOdmClinicalData.

public void collectOdmClinicalData() {
    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();
    }
    odmClinicalData.setStudyOID(studyOID);
    OdmExtractDAO oedao = new OdmExtractDAO(this.ds);
    if (this.getCategory() == 1 && study.isSite(study.getParentStudyId())) {
        String mvoid = "";
        if (this.dataset != null) {
            mvoid = this.dataset.getODMMetaDataVersionOid();
        }
        if (mvoid.length() > 0) {
            mvoid += "-" + studyOID;
        } else {
            mvoid = "v1.0.0" + "-" + studyOID;
        }
        odmClinicalData.setMetaDataVersionOID(mvoid);
    } else {
        odmClinicalData.setMetaDataVersionOID(this.dataset.getODMMetaDataVersionOid());
        if (odmClinicalData.getMetaDataVersionOID() == null || odmClinicalData.getMetaDataVersionOID().length() <= 0) {
            odmClinicalData.setMetaDataVersionOID("v1.0.0");
        }
    }
    oedao.getClinicalData(study, this.dataset, odmClinicalData, this.odmBean.getODMVersion(), studySubjectIds, this.odmBean.getOdmType());
}
Also used : StudyBean(org.akaza.openclinica.bean.managestudy.StudyBean) OdmExtractDAO(org.akaza.openclinica.dao.extract.OdmExtractDAO)

Example 5 with OdmExtractDAO

use of org.akaza.openclinica.dao.extract.OdmExtractDAO in project OpenClinica by OpenClinica.

the class MetadataUnit method collectMetaDataVersion.

/**
 * To retrieve the ODM with form version OID as one of the parameters
 * @param formVersionOID
 */
private void collectMetaDataVersion(String formVersionOID) {
    StudyBean study = studyBase.getStudy();
    OdmExtractDAO oedao = new OdmExtractDAO(this.ds);
    MetaDataVersionBean metadata = this.odmStudy.getMetaDataVersion();
    ODMBean odmBean = new ODMBean();
    odmBean.setODMVersion("oc1.3");
    setOdmBean(odmBean);
    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;
    }
    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");
    }
    oedao.getODMMetadataForForm(metadata, formVersionOID, this.odmBean.getODMVersion());
}
Also used : 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) ODMBean(org.akaza.openclinica.bean.odmbeans.ODMBean) StudyEventDefinitionBean(org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)

Aggregations

OdmExtractDAO (org.akaza.openclinica.dao.extract.OdmExtractDAO)5 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)4 ArrayList (java.util.ArrayList)2 StudyEventDefinitionBean (org.akaza.openclinica.bean.managestudy.StudyEventDefinitionBean)2 MetaDataVersionBean (org.akaza.openclinica.bean.odmbeans.MetaDataVersionBean)2 OdmStudyBean (org.akaza.openclinica.bean.odmbeans.OdmStudyBean)2 MetaDataVersionIncludeBean (org.akaza.openclinica.bean.odmbeans.MetaDataVersionIncludeBean)1 ODMBean (org.akaza.openclinica.bean.odmbeans.ODMBean)1 StudyParameterValueBean (org.akaza.openclinica.bean.service.StudyParameterValueBean)1 StudyConfigService (org.akaza.openclinica.dao.service.StudyConfigService)1 StudyParameterValueDAO (org.akaza.openclinica.dao.service.StudyParameterValueDAO)1