use of org.akaza.openclinica.bean.odmbeans.MetaDataVersionBean 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.odmbeans.MetaDataVersionBean in project OpenClinica by OpenClinica.
the class MetaDataReportBean method addStudyMetaDataVersion.
public void addStudyMetaDataVersion(boolean isDataset) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
String currentIndent = indent + indent;
String ODMVersion = this.getODMVersion();
MetaDataVersionBean meta = odmstudy.getMetaDataVersion();
xml.append(currentIndent + "<MetaDataVersion OID=\"" + StringEscapeUtils.escapeXml(meta.getOid()) + "\" Name=\"" + StringEscapeUtils.escapeXml(meta.getName()) + "\">");
xml.append(nls);
if (meta.getInclude() != null) {
String pmOid = meta.getInclude().getMetaDataVersionOID();
if (pmOid != null && pmOid.length() > 0) {
xml.append(currentIndent + indent);
String psOid = meta.getInclude().getStudyOID();
if (psOid != null && psOid.length() > 0) {
xml.append("<Include StudyOID =\"" + StringEscapeUtils.escapeXml(psOid) + "\"");
} else {
xml.append("<Include StudyOID =\"" + StringEscapeUtils.escapeXml(odmstudy.getOid()) + "\"");
}
xml.append(" MetaDataVersionOID=\"" + StringEscapeUtils.escapeXml(pmOid) + "\"/>");
xml.append(nls);
}
}
//
addProtocol(currentIndent + indent);
boolean isStudy = meta.getStudy().getParentStudyId() > 0 ? false : true;
if (meta.getStudyEventDefs().size() > 0) {
addStudyEventDef(isStudy, currentIndent + indent);
if (meta.getItemGroupDefs().size() > 0) {
addFormDef(isStudy, currentIndent + indent);
addItemGroupDef(isStudy, currentIndent + indent);
addItemDef(isStudy, currentIndent + indent);
addCodeList(currentIndent + indent);
if ("oc1.2".equalsIgnoreCase(ODMVersion)) {
addMultiSelectList(currentIndent + indent);
addStudyGroupClassList(currentIndent + indent);
} else if ("oc1.3".equalsIgnoreCase(ODMVersion)) {
addMultiSelectList(currentIndent + indent);
addStudyGroupClassList(currentIndent + indent);
if (meta.getStudy().getParentStudyId() > 0) {
this.addStudyDetails(currentIndent + indent);
} else {
this.addStudyDetails(currentIndent + indent);
}
}
}
} else if (odmstudy.getOid().equals(MetadataUnit.FAKE_STUDY_OID)) {
addFormDef(isStudy, currentIndent + indent);
addItemGroupDef(isStudy, currentIndent + indent);
addItemDef(isStudy, currentIndent + indent);
}
addNodeRulesData(meta);
xml.append(currentIndent + "</MetaDataVersion>");
xml.append(nls);
}
use of org.akaza.openclinica.bean.odmbeans.MetaDataVersionBean 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());
}
Aggregations