use of org.akaza.openclinica.bean.odmbeans.ItemGroupRepeatBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method getMetadataOC1_3.
public void getMetadataOC1_3(int parentStudyId, int studyId, MetaDataVersionBean metadata, String odmVersion) {
this.getOCMetadata(parentStudyId, studyId, metadata, odmVersion);
// StudyBean study = metadata.getStudy();
// if(study.getId()>0) {
// } else {
// StudyDAO sdao = new StudyDAO(this.ds);
// study = (StudyBean)sdao.findByPK(studyId);
// }
// StudyConfigService studyConfig = new StudyConfigService(this.ds);
// study = studyConfig.setParametersForStudy(study);
this.getStudyEventAndFormMetaOC1_3(parentStudyId, studyId, metadata, odmVersion, false);
String cvIds = metadata.getCvIds();
ArrayList<ItemGroupDefBean> igs = (ArrayList<ItemGroupDefBean>) metadata.getItemGroupDefs();
HashMap<String, Integer> igPoses = getItemGroupOIDPos(metadata);
ArrayList<ItemDefBean> its = (ArrayList<ItemDefBean>) metadata.getItemDefs();
HashMap<String, Integer> itPoses = getItemOIDPos(metadata);
HashMap<String, Integer> inPoses = new HashMap<String, Integer>();
ItemGroupDefBean ig = new ItemGroupDefBean();
ItemDefBean it = new ItemDefBean();
String prevCvIg = "";
HashMap<Integer, String> sectionLabels = this.getSectionLabels(metadata.getSectionIds());
HashMap<Integer, String> parentItemOIDs = this.getParentItemOIDs(cvIds);
this.setItemGroupAndItemMetaOC1_3TypesExpected();
logger.debug("Begin to execute GetItemGroupAndItemMetaWithUnitSql");
logger.debug("getItemGroupandItemMetaWithUnitsql= " + this.getItemGroupAndItemMetaOC1_3Sql(cvIds));
ArrayList rows = select(this.getItemGroupAndItemMetaOC1_3Sql(cvIds));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
// Integer cId = (Integer) row.get("crf_id");
Integer cvId = (Integer) row.get("crf_version_id");
Integer igId = (Integer) row.get("item_group_id");
// Integer itId = (Integer) row.get("item_id");
// Integer rsId = (Integer) row.get("response_set_id");
String cvOID = (String) row.get("crf_version_oid");
String igOID = (String) row.get("item_group_oid");
String itOID = (String) row.get("item_oid");
Integer igRepeatNum = (Integer) row.get("repeat_number");
Integer igRepeatMax = (Integer) row.get("repeat_max");
Boolean showGroup = (Boolean) row.get("show_group");
String itemGroupHeader = (String) row.get("item_group_header");
String itHeader = (String) row.get("item_header");
String left = (String) row.get("left_item_text");
String right = (String) row.get("right_item_text");
String itSubheader = (String) row.get("subheader");
Integer itSecId = (Integer) row.get("section_id");
Integer itPId = (Integer) row.get("parent_id");
Integer itColNum = (Integer) row.get("column_number");
String itpgNum = (String) row.get("page_number_label");
String layout = (String) row.get("response_layout");
Integer rsTypeId = (Integer) row.get("response_type_id");
String dfValue = (String) row.get("default_value");
Boolean phi = (Boolean) row.get("phi_status");
Boolean showItem = (Boolean) row.get("show_item");
Integer orderInForm = (Integer) row.get("item_order");
if ((cvId + "-" + igId).equals(prevCvIg)) {
} else {
prevCvIg = cvId + "-" + igId;
ig = igs.get(igPoses.get(igOID));
ItemGroupDetailsBean igDetail = ig.getItemGroupDetails();
igDetail.setOid(igOID);
PresentInFormBean inForm = new PresentInFormBean();
inForm.setFormOid(cvOID);
ItemGroupRepeatBean igr = new ItemGroupRepeatBean();
igr.setRepeatMax(igRepeatMax);
igr.setRepeatNumber(igRepeatNum);
inForm.setItemGroupRepeatBean(igr);
inForm.setShowGroup(showGroup == true ? "Yes" : "No");
inForm.setItemGroupHeader(itemGroupHeader);
igDetail.getPresentInForms().add(inForm);
}
it = its.get(itPoses.get(itOID));
ItemDetailsBean itDetail = it.getItemDetails();
itDetail.setOid(itOID);
ItemPresentInFormBean itInForm = new ItemPresentInFormBean();
itInForm.setFormOid(cvOID);
itInForm.setColumnNumber(itColNum);
itInForm.setDefaultValue(dfValue);
itInForm.setItemHeader(itHeader);
itInForm.setLeftItemText(left);
itInForm.setRightItemText(right);
itInForm.setItemSubHeader(itSubheader);
itInForm.setPageNumber(itpgNum);
itInForm.setParentItemOid(parentItemOIDs.get(itPId));
itInForm.setSectionLabel(sectionLabels.get(itSecId));
itInForm.setPhi(phi == false ? "No" : "Yes");
itInForm.setOrderInForm(orderInForm);
itInForm.setShowItem(showItem == true ? "Yes" : "No");
ItemResponseBean itemResponse = new ItemResponseBean();
itemResponse.setResponseLayout(layout);
itemResponse.setResponseType(ResponseType.get(rsTypeId).getName());
itInForm.setItemResponse(itemResponse);
itDetail.getItemPresentInForm().add(itInForm);
inPoses.put(itOID + "-" + cvOID, itDetail.getItemPresentInForm().size() - 1);
}
this.getSCDs(cvIds, its, itPoses, inPoses);
}
use of org.akaza.openclinica.bean.odmbeans.ItemGroupRepeatBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method getODMMetadataForForm.
/**
* Metadata to be obtained based on formVersionOID. The studyOID and studyEventOID are irrelevant as these are the global crfs, i.e crfs that do not belong to
* any particular CRF. In order to comply with cdisc ODM, the studyOID, studyeventDefOID etc will be static values which do not exist in the database.
* @param metadata
* @param formVersionOID
*/
// The method underneath tries to reuse the code based on getODMMetadata
public void getODMMetadataForForm(MetaDataVersionBean metadata, String formVersionOID, String odmVersion) {
FormDefBean formDef = new FormDefBean();
String cvIds = new String("");
CRFVersionDAO<String, ArrayList> crfVersionDAO = new CRFVersionDAO<String, ArrayList>(this.ds);
CRFVersionBean crfVersionBean = crfVersionDAO.findByOid(formVersionOID);
cvIds = crfVersionBean.getId() + "";
applyStudyEventDef(metadata, formVersionOID);
fetchItemGroupMetaData(metadata, cvIds, odmVersion);
getOCMetadataForGlobals(crfVersionBean.getId(), metadata, odmVersion);
ArrayList rows = new ArrayList();
ArrayList<ItemGroupDefBean> igs = (ArrayList<ItemGroupDefBean>) metadata.getItemGroupDefs();
HashMap<String, Integer> igPoses = getItemGroupOIDPos(metadata);
ArrayList<ItemDefBean> its = (ArrayList<ItemDefBean>) metadata.getItemDefs();
HashMap<String, Integer> itPoses = getItemOIDPos(metadata);
HashMap<String, Integer> inPoses = new HashMap<String, Integer>();
ItemGroupDefBean ig = new ItemGroupDefBean();
Iterator it;
metadata.setCvIds(cvIds);
HashMap<Integer, Integer> maxLengths = new HashMap<Integer, Integer>();
this.setItemDataMaxLengthTypesExpected();
rows.clear();
logger.debug("Begin to execute GetItemDataMaxLengths");
rows = select(this.getItemDataMaxLengths(cvIds));
it = rows.iterator();
while (it.hasNext()) {
HashMap row = (HashMap) it.next();
maxLengths.put((Integer) row.get("item_id"), (Integer) row.get("max_length"));
}
ItemDefBean itDef = new ItemDefBean();
formDef = fetchFormDetails(crfVersionBean, formDef);
this.setItemGroupAndItemMetaWithUnitTypesExpected();
rows.clear();
String prevCvIg = "";
logger.debug("Begin to execute GetItemGroupAndItemMetaWithUnitSql");
logger.debug("getItemGroupandItemMetaWithUnitsql= " + this.getItemGroupAndItemMetaWithUnitSql(cvIds));
HashMap<Integer, String> sectionLabels = this.getSectionLabels(metadata.getSectionIds());
HashMap<Integer, String> parentItemOIDs = this.getParentItemOIDs(cvIds);
this.setItemGroupAndItemMetaOC1_3TypesExpected();
logger.debug("Begin to execute GetItemGroupAndItemMetaWithUnitSql");
logger.debug("getItemGroupandItemMetaWithUnitsql= " + this.getItemGroupAndItemMetaOC1_3Sql(cvIds));
rows = select(this.getItemGroupAndItemMetaOC1_3Sql(cvIds));
Iterator iter = rows.iterator();
while (iter.hasNext()) {
HashMap row = (HashMap) iter.next();
Integer cvId = (Integer) row.get("crf_version_id");
Integer igId = (Integer) row.get("item_group_id");
String cvOID = (String) row.get("crf_version_oid");
String igOID = (String) row.get("item_group_oid");
String itOID = (String) row.get("item_oid");
Integer igRepeatNum = (Integer) row.get("repeat_number");
Integer igRepeatMax = (Integer) row.get("repeat_max");
Boolean showGroup = (Boolean) row.get("show_group");
String itemGroupHeader = (String) row.get("item_group_header");
String itHeader = (String) row.get("item_header");
String left = (String) row.get("left_item_text");
String right = (String) row.get("right_item_text");
String itSubheader = (String) row.get("subheader");
Integer itSecId = (Integer) row.get("section_id");
Integer itPId = (Integer) row.get("parent_id");
Integer itColNum = (Integer) row.get("column_number");
String itpgNum = (String) row.get("page_number_label");
String layout = (String) row.get("response_layout");
Integer rsTypeId = (Integer) row.get("response_type_id");
String dfValue = (String) row.get("default_value");
Boolean phi = (Boolean) row.get("phi_status");
Boolean showItem = (Boolean) row.get("show_item");
Integer orderInForm = (Integer) row.get("item_order");
if ((cvId + "-" + igId).equals(prevCvIg)) {
} else {
prevCvIg = cvId + "-" + igId;
ig = igs.get(igPoses.get(igOID));
ItemGroupDetailsBean igDetail = ig.getItemGroupDetails();
igDetail.setOid(igOID);
PresentInFormBean inForm = new PresentInFormBean();
inForm.setFormOid(cvOID);
ItemGroupRepeatBean igr = new ItemGroupRepeatBean();
igr.setRepeatMax(igRepeatMax);
igr.setRepeatNumber(igRepeatNum);
inForm.setItemGroupRepeatBean(igr);
inForm.setShowGroup(showGroup == true ? "Yes" : "No");
inForm.setItemGroupHeader(itemGroupHeader);
igDetail.getPresentInForms().add(inForm);
ig.setItemGroupDetails(igDetail);
}
itDef = its.get(itPoses.get(itOID));
ItemDetailsBean itDetail = itDef.getItemDetails();
itDetail.setOid(itOID);
ItemPresentInFormBean itInForm = new ItemPresentInFormBean();
itInForm.setFormOid(cvOID);
itInForm.setColumnNumber(itColNum);
itInForm.setDefaultValue(dfValue);
itInForm.setItemHeader(itHeader);
itInForm.setLeftItemText(left);
itInForm.setRightItemText(right);
itInForm.setItemSubHeader(itSubheader);
itInForm.setPageNumber(itpgNum);
itInForm.setParentItemOid(parentItemOIDs.get(itPId));
itInForm.setSectionLabel(sectionLabels.get(itSecId));
itInForm.setPhi(phi == false ? "No" : "Yes");
itInForm.setOrderInForm(orderInForm);
itInForm.setShowItem(showItem == true ? "Yes" : "No");
ItemResponseBean itemResponse = new ItemResponseBean();
itemResponse.setResponseLayout(layout);
itemResponse.setResponseType(ResponseType.get(rsTypeId).getName());
itInForm.setItemResponse(itemResponse);
itDetail.getItemPresentInForm().add(itInForm);
inPoses.put(itOID + "-" + cvOID, itDetail.getItemPresentInForm().size() - 1);
}
this.getSCDs(cvIds, its, itPoses, inPoses);
metadata.getFormDefs().add(formDef);
}
use of org.akaza.openclinica.bean.odmbeans.ItemGroupRepeatBean in project OpenClinica by OpenClinica.
the class MetaDataReportBean method addItemGroupDetails.
public void addItemGroupDetails(ItemGroupDetailsBean detail, String currentIndent) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
String temp = "";
Integer itemp = -1;
Integer itemp2 = -1;
ArrayList<PresentInFormBean> informs = (ArrayList<PresentInFormBean>) detail.getPresentInForms();
xml.append(currentIndent + "<OpenClinica:ItemGroupDetails ItemGroupOID=\"" + StringEscapeUtils.escapeXml(detail.getOid()) + "\">");
xml.append(nls);
for (PresentInFormBean inform : informs) {
xml.append(currentIndent + indent + "<OpenClinica:PresentInForm FormOID=\"" + inform.getFormOid() + "\" ShowGroup=\"" + inform.getShowGroup() + "\">");
xml.append(nls);
ItemGroupRepeatBean repeat = inform.getItemGroupRepeatBean();
itemp = repeat.getRepeatNumber();
itemp2 = repeat.getRepeatMax();
if (itemp != null && itemp > 0) {
xml.append(currentIndent + indent + indent + "<OpenClinica:ItemGroupRepeat RepeatNumber=\"" + itemp);
if (itemp2 != null && itemp2 > 0) {
xml.append("\" RepeatMax=\"" + itemp2 + "\"/>");
} else {
xml.append("\"/>");
}
xml.append(nls);
} else if (itemp2 != null && itemp2 > 0) {
xml.append(currentIndent + indent + indent + "<OpenClinica:ItemGroupRepeat RepeatMax=\"" + itemp2 + "\"/>");
xml.append(nls);
}
temp = inform.getItemGroupHeader();
xml.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:ItemGroupHeader>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:ItemGroupHeader>" + nls : "");
xml.append(currentIndent + indent + "</OpenClinica:PresentInForm>");
xml.append(nls);
}
xml.append(currentIndent + "</OpenClinica:ItemGroupDetails>");
xml.append(nls);
}
Aggregations