use of org.akaza.openclinica.bean.odmbeans.ElementRefBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method setOCItemDataDNs.
protected void setOCItemDataDNs(OdmClinicalDataBean data, String idataIds, HashMap<Integer, String> idataOidPoses) {
this.setOCItemDataDNsTypesExpected();
HashMap<String, ArrayList<ChildNoteBean>> pDNs = new HashMap<String, ArrayList<ChildNoteBean>>();
// HashMap<String, ArrayList<DiscrepancyNoteBean>> sDNs = new HashMap<String, ArrayList<DiscrepancyNoteBean>>();
logger.debug("Begin to execute GetOCItemDataDNsSql");
logger.debug("getOCItemDataDNsSql= " + this.getOCItemDataDNsSql(idataIds));
ArrayList rows = select(this.getOCItemDataDNsSql(idataIds));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
Integer idataId = (Integer) row.get("item_data_id");
Integer pdnId = (Integer) row.get("parent_dn_id");
Integer dnId = (Integer) row.get("dn_id");
String description = (String) row.get("description");
String detailedNote = (String) row.get("detailed_notes");
Integer ownerId = (Integer) row.get("owner_id");
Date dateCreated = (Date) row.get("date_created");
String status = (String) row.get("status");
String noteType = (String) row.get("name");
if (pdnId != null && pdnId > 0) {
String key = idataId + "-" + pdnId;
ChildNoteBean cn = new ChildNoteBean();
cn.setDateCreated(dateCreated);
cn.setDescription(description);
cn.setDetailedNote(detailedNote);
cn.setStatus(status);
cn.setOid("CDN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
cn.setUserRef(userRef);
ArrayList<ChildNoteBean> cns = pDNs.containsKey(key) ? pDNs.get(key) : new ArrayList<ChildNoteBean>();
cns.add(cn);
pDNs.put(key, cns);
} else {
DiscrepancyNoteBean dn = new DiscrepancyNoteBean();
String k = idataId + "-" + dnId;
if (pDNs != null && pDNs.containsKey(k)) {
dn.setChildNotes(pDNs.get(k));
dn.setNumberOfChildNotes(dn.getChildNotes().size());
}
dn.setDateUpdated(dateCreated);
dn.setNoteType(noteType);
dn.setStatus(status);
dn.setOid("DN_" + dnId);
ElementRefBean userRef = new ElementRefBean();
userRef.setElementDefOID("USR_" + ownerId);
if (idataOidPoses.containsKey(idataId)) {
String[] poses = idataOidPoses.get(idataId).split("---");
int p0 = Integer.parseInt(poses[0]);
int p1 = Integer.parseInt(poses[1]);
int p2 = Integer.parseInt(poses[2]);
int p3 = Integer.parseInt(poses[3]);
int p4 = Integer.parseInt(poses[4]);
String entityID = data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getItemGroupData().get(p3).getItemData().get(p4).getItemOID();
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getItemGroupData().get(p3).getItemData().get(p4).getDiscrepancyNotes().setEntityID(entityID);
data.getExportSubjectData().get(p0).getExportStudyEventData().get(p1).getExportFormData().get(p2).getItemGroupData().get(p3).getItemData().get(p4).getDiscrepancyNotes().getDiscrepancyNotes().add(dn);
}
}
}
}
use of org.akaza.openclinica.bean.odmbeans.ElementRefBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method applyStudyEventDef.
private void applyStudyEventDef(MetaDataVersionBean metadata, String formOID) {
StudyEventDefBean studyEventDef = new StudyEventDefBean();
studyEventDef.setOid(MetadataUnit.FAKE_STUDY_EVENT_OID);
studyEventDef.setName(MetadataUnit.FAKE_SE_NAME);
studyEventDef.setRepeating(MetadataUnit.FAKE_SE_REPEATING);
ElementRefBean formRefBean = new ElementRefBean();
formRefBean.setElementDefOID(formOID);
studyEventDef.getFormRefs().add(formRefBean);
metadata.getStudyEventDefs().add(studyEventDef);
}
use of org.akaza.openclinica.bean.odmbeans.ElementRefBean 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()));
}
}
use of org.akaza.openclinica.bean.odmbeans.ElementRefBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method getFormLayoutRefs.
List<ElementRefBean> getFormLayoutRefs(FormDefBean formDef) {
CRFBean crfBean = crfdao.findByOid(formDef.getOid());
List<FormLayoutBean> formLayouts = fldao.findAllByCRFId(crfBean.getId());
List<ElementRefBean> elementRefs = new ArrayList<>();
ElementRefBean element;
for (FormLayoutBean formLayout : formLayouts) {
element = new ElementRefBean();
element.setName(formLayout.getName());
element.setUrl(formLayout.getUrl());
elementRefs.add(element);
}
return elementRefs;
}
Aggregations