Search in sources :

Example 1 with MetaDataVersionIncludeBean

use of org.akaza.openclinica.bean.odmbeans.MetaDataVersionIncludeBean in project OpenClinica by OpenClinica.

the class MetadataUnit method collectIncludeFromParentInSameFile.

/**
 * Include parent study metadata which is in the same ODM XML file.
 *
 * @return
 */
private void collectIncludeFromParentInSameFile() {
    MetaDataVersionIncludeBean ib = this.odmStudy.getMetaDataVersion().getInclude();
    String metaOid = this.getParentMetaDataVersionOid();
    String pstudyOID = this.parentStudy.getOid();
    if (pstudyOID == null || pstudyOID.length() <= 0) {
        pstudyOID = "" + this.parentStudy.getId();
    }
    ib.setMetaDataVersionOID(metaOid);
    ib.setStudyOID(pstudyOID);
}
Also used : MetaDataVersionIncludeBean(org.akaza.openclinica.bean.odmbeans.MetaDataVersionIncludeBean)

Example 2 with MetaDataVersionIncludeBean

use of org.akaza.openclinica.bean.odmbeans.MetaDataVersionIncludeBean 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)

Aggregations

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