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));
}
}
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();
}
}
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;
}
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;
}
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());
}
}
Aggregations