use of org.akaza.openclinica.bean.odmbeans.EventDefinitionDetailsBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method getStudyEventAndFormMetaOC1_3.
public void getStudyEventAndFormMetaOC1_3(int parentStudyId, int studyId, MetaDataVersionBean metadata, String odmVersion, boolean isIncludedSite) {
ArrayList<StudyEventDefBean> seds = (ArrayList<StudyEventDefBean>) metadata.getStudyEventDefs();
ArrayList<FormDefBean> forms = (ArrayList<FormDefBean>) metadata.getFormDefs();
for (StudyEventDefBean sed : seds) {
List<ElementRefBean> formRefs = sed.getFormRefs();
for (ElementRefBean formRef : formRefs) {
ConfigurationParameters conf = new ConfigurationParameters();
EventDefinitionCRFBean edc = getEventDefCRF(sed, formRef, studyId);
CRFBean cBean = (CRFBean) crfdao.findByPK(edc.getCrfId());
String crfPath = sed.getOid() + "." + cBean.getOid();
conf = populateConfigurationParameters(edc, conf, crfPath);
formRef.setConfigurationParameters(conf);
int defaultVersionId = edc.getDefaultVersionId();
formRef.setFormLayoutRefs(getFormLayoutRefs(formRef, defaultVersionId));
}
}
HashMap<String, EventDefinitionDetailsBean> sedDetails = new HashMap<String, EventDefinitionDetailsBean>();
HashMap<String, FormDetailsBean> formDetails = new HashMap<String, FormDetailsBean>();
this.setStudyEventAndFormMetaOC1_3TypesExpected();
logger.debug("Begin to execute GetStudyEventAndFormMetaOC1_3Sql");
logger.debug("getStudyEventAndFormMetaOC1_3SQl= " + this.getStudyEventAndFormMetaOC1_3Sql(parentStudyId, studyId, isIncludedSite));
ArrayList rows = this.select(this.getStudyEventAndFormMetaOC1_3Sql(parentStudyId, studyId, isIncludedSite));
Iterator iter = rows.iterator();
String sedOIDs = "";
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
Integer cvId = (Integer) row.get("crf_version_id");
String sedOID = (String) row.get("definition_oid");
String cvOID = (String) row.get("cv_oid");
String sedDesc = (String) row.get("description");
String category = (String) row.get("category");
String cvDesc = (String) row.get("version_description");
String notes = (String) row.get("revision_notes");
String cOID = (String) row.get("crf_oid");
String crfDescription = (String) row.get("crf_description");
String nullValue = (String) row.get("null_values");
Integer dvId = (Integer) row.get("default_version_id");
Boolean pwdRequired = (Boolean) row.get("electronic_signature");
Boolean doubleEntry = (Boolean) row.get("double_entry");
Boolean hideCrf = (Boolean) row.get("hide_crf");
Boolean participantForm = (Boolean) row.get("participant_form");
Boolean allowAnonymousSubmission = (Boolean) row.get("allow_anonymous_submission");
String submissionUrl = (String) row.get("submission_url");
Integer sdvId = (Integer) row.get("source_data_verification_code");
Boolean offline = (Boolean) row.get("active");
if (sedDetails.containsKey(sedOID)) {
} else {
EventDefinitionDetailsBean sedDetail = new EventDefinitionDetailsBean();
sedDetail.setOid(sedOID);
sedDetail.setCategory(category);
sedDetail.setDescription(sedDesc);
sedDetails.put(sedOID, sedDetail);
}
if (formDetails.containsKey(cOID)) {
FormDetailsBean formDetail = formDetails.get(cOID);
PresentInEventDefinitionBean p = new PresentInEventDefinitionBean();
p.setStudyEventOid(sedOID);
p.setDoubleDataEntry(doubleEntry == false ? "No" : "Yes");
p.setHideCrf(hideCrf == false ? "No" : "Yes");
p.setParticipantForm(participantForm == false ? "No" : "Yes");
p.setIsDefaultVersion(cvId.equals(dvId) ? "Yes" : "No");
p.setNullValues(nullValue);
p.setPasswordRequired(pwdRequired == false ? "No" : "Yes");
p.setAllowAnonymousSubmission(allowAnonymousSubmission == false ? "No" : "Yes");
p.setOffline((offline == false) ? "No" : "Yes");
p.setSubmissionUrl(submissionUrl);
p.setSourceDataVerification(SourceDataVerification.getByCode(sdvId > 0 ? sdvId : 3).getDescription());
formDetail.getPresentInEventDefinitions().add(p);
} else {
FormDetailsBean formDetail = new FormDetailsBean();
formDetail.setOid(cOID);
formDetail.setRevisionNotes(notes);
formDetail.setParentFormOid(cOID);
formDetail.setVersionDescription(cvDesc);
formDetail.setDescription(crfDescription);
// ArrayList sectionBeansRows = this.select(this.getSectionDetails(cvOID),cvId);
formDetail = setSectionBean(formDetail, cvId);
PresentInEventDefinitionBean p = new PresentInEventDefinitionBean();
p.setStudyEventOid(sedOID);
p.setDoubleDataEntry(doubleEntry == false ? "No" : "Yes");
p.setHideCrf(hideCrf == false ? "No" : "Yes");
p.setParticipantForm(participantForm == false ? "No" : "Yes");
p.setIsDefaultVersion(cvId.equals(dvId) ? "Yes" : "No");
p.setNullValues(nullValue);
p.setPasswordRequired(pwdRequired == false ? "No" : "Yes");
p.setAllowAnonymousSubmission(allowAnonymousSubmission == false ? "No" : "Yes");
p.setOffline((offline == false) ? "No" : "Yes");
p.setSubmissionUrl(submissionUrl);
p.setSourceDataVerification(SourceDataVerification.getByCode(sdvId > 0 ? sdvId : 3).getDescription());
formDetail.getPresentInEventDefinitions().add(p);
formDetails.put(cOID, formDetail);
}
}
for (StudyEventDefBean sedef : seds) {
sedef.setEventDefinitionDetais(sedDetails.get(sedef.getOid()));
}
for (FormDefBean formdef : forms) {
List<ElementRefBean> formLayoutRefs = getFormLayoutRefs(formdef);
formdef.setFormLayoutRefs(formLayoutRefs);
formdef.setFormDetails(formDetails.get(formdef.getOid()));
}
}
Aggregations