use of org.akaza.openclinica.bean.odmbeans.ItemResponseBean 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.ItemResponseBean 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 formOID, String odmVersion) {
FormDefBean formDef = new FormDefBean();
String cvIds = new String("");
CRFBean crfBean = crfdao.findByOid(formOID);
List<CRFVersionBean> crfVersions = (List<CRFVersionBean>) cvdao.findAllActiveByCRF(crfBean.getId());
CRFVersionBean crfVersionBean = crfVersions.get(0);
cvIds = crfVersionBean.getId() + "";
applyStudyEventDef(metadata, formOID);
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(crfBean, 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.ItemResponseBean in project OpenClinica by OpenClinica.
the class MetaDataReportBean method addItemDetails.
public void addItemDetails(ItemDetailsBean detail, String currentIndent) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
String temp = "";
Integer itemp = -1;
ArrayList<ItemPresentInFormBean> informs = (ArrayList<ItemPresentInFormBean>) detail.getItemPresentInForm();
xml.append(currentIndent + "<OpenClinica:ItemDetails ItemOID=\"" + StringEscapeUtils.escapeXml(detail.getOid()) + "\">");
xml.append(nls);
for (ItemPresentInFormBean inform : informs) {
xml.append(currentIndent + indent + "<OpenClinica:ItemPresentInForm FormOID=\"" + inform.getFormOid() + "\"");
temp = inform.getParentItemOid();
xml.append(temp != null && temp.length() > 0 ? " ParentItemOID=\"" + temp + "\"" : "");
itemp = inform.getColumnNumber();
xml.append(itemp != null && itemp > 0 ? " ColumnNumber=\"" + itemp + "\"" : "");
temp = inform.getPageNumber();
xml.append(temp != null && temp.length() > 0 ? " PageNumber=\"" + StringEscapeUtils.escapeXml(temp) + "\"" : "");
temp = inform.getDefaultValue();
xml.append(temp != null && temp.length() > 0 ? " DefaultValue=\"" + StringEscapeUtils.escapeXml(temp) + "\"" : "");
xml.append(" PHI=\"" + inform.getPhi() + "\" ShowItem=\"" + inform.getShowItem() + "\" OrderInForm= \"" + inform.getOrderInForm() + "\">");
xml.append(nls);
temp = inform.getLeftItemText();
xml.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:LeftItemText>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:LeftItemText>" + nls : "");
temp = inform.getRightItemText();
xml.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:RightItemText>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:RightItemText>" + nls : "");
temp = inform.getItemHeader();
xml.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:ItemHeader>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:ItemHeader>" + nls : "");
temp = inform.getItemSubHeader();
xml.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:ItemSubHeader>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:ItemSubHeader>" + nls : "");
temp = inform.getSectionLabel();
xml.append(temp != null && temp.length() > 0 ? currentIndent + indent + indent + "<OpenClinica:SectionLabel>" + StringEscapeUtils.escapeXml(temp) + "</OpenClinica:SectionLabel>" + nls : "");
ItemResponseBean response = inform.getItemResponse();
xml.append(currentIndent + indent + indent + "<OpenClinica:ItemResponse ResponseType=\"" + StringEscapeUtils.escapeXml(response.getResponseType()));
temp = response.getResponseLayout();
if (temp != null && temp.length() > 0) {
xml.append("\" ResponseLayout=\"" + StringEscapeUtils.escapeXml(temp) + "\"/>");
} else {
xml.append("\"/>");
}
xml.append(nls);
if ("no".equalsIgnoreCase(inform.getShowItem())) {
addSimpleConditionalDisplay(inform, currentIndent + indent + indent);
}
xml.append(currentIndent + indent + "</OpenClinica:ItemPresentInForm>");
xml.append(nls);
}
xml.append(currentIndent + "</OpenClinica:ItemDetails>");
xml.append(nls);
}
Aggregations