use of org.akaza.openclinica.bean.odmbeans.TranslatedTextBean in project OpenClinica by OpenClinica.
the class OdmExtractDAO method getBasicDefinitions.
public void getBasicDefinitions(int studyId, BasicDefinitionsBean basicDef) {
ArrayList<MeasurementUnitBean> units = basicDef.getMeasurementUnits();
String uprev = "";
this.setStudyMeasurementUnitsTypesExpected();
ArrayList rows = this.select(this.getStudyMeasurementUnitsSql(studyId));
Iterator it = rows.iterator();
while (it.hasNext()) {
HashMap row = (HashMap) it.next();
String oid = (String) row.get("mu_oid");
String name = (String) row.get("name");
MeasurementUnitBean u = new MeasurementUnitBean();
SymbolBean symbol = new SymbolBean();
ArrayList<TranslatedTextBean> texts = new ArrayList<TranslatedTextBean>();
if (uprev.equals(oid)) {
u = units.get(units.size() - 1);
symbol = u.getSymbol();
texts = symbol.getTranslatedText();
} else {
u.setOid(oid);
u.setName(name);
units.add(u);
}
TranslatedTextBean t = new TranslatedTextBean();
t.setText(name);
texts.add(t);
symbol.setTranslatedText(texts);
u.setSymbol(symbol);
}
}
use of org.akaza.openclinica.bean.odmbeans.TranslatedTextBean in project OpenClinica by OpenClinica.
the class MetaDataReportBean method addItemDef.
public void addItemDef(boolean isStudy, String currentIndent) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
ArrayList<ItemDefBean> items = (ArrayList<ItemDefBean>) odmstudy.getMetaDataVersion().getItemDefs();
String ODMVersion = this.getODMVersion();
for (ItemDefBean item : items) {
xml.append(currentIndent + "<ItemDef OID=\"" + StringEscapeUtils.escapeXml(item.getOid()) + "\" Name=\"" + StringEscapeUtils.escapeXml(item.getName()) + "\" DataType=\"" + item.getDateType() + "\"");
int len = item.getLength();
if (len > 0) {
xml.append(" Length=\"" + len + "\"");
}
len = item.getSignificantDigits();
if (len > 0) {
xml.append(" SignificantDigits=\"" + len + "\"");
}
xml.append(" SASFieldName=\"" + this.getSasNameValidator().getValidName(item.getPreSASFieldName()) + "\"");
if (item.getComment().length() > 0) {
xml.append(" Comment=\"" + StringEscapeUtils.escapeXml(item.getComment()) + "\"");
}
if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
xml.append(" OpenClinica:FormOID=\"" + item.getFormOIDs() + "\"");
}
boolean hasNode = false;
// add question
TranslatedTextBean t = item.getQuestion().getQuestion();
if (t != null && t.getText() != null && t.getText().length() > 0) {
if (!hasNode) {
hasNode = true;
xml.append(">");
xml.append(nls);
}
if ("oc1.3".equalsIgnoreCase(ODMVersion)) {
String qn = item.getQuestion().getQuestionNumber();
if (qn != null && qn.length() > 0) {
xml.append(currentIndent + indent + "<Question OpenClinica:QuestionNumber=\"" + item.getQuestion().getQuestionNumber() + "\">");
} else {
xml.append(currentIndent + indent + "<Question>");
}
} else {
xml.append(currentIndent + indent + "<Question>");
}
xml.append(nls);
xml.append(currentIndent + indent + indent + "<TranslatedText>");
xml.append(nls);
xml.append(currentIndent + indent + indent + StringEscapeUtils.escapeXml(t.getText()));
xml.append(nls);
xml.append(currentIndent + indent + indent + "</TranslatedText>");
xml.append(nls);
xml.append(currentIndent + indent + "</Question>");
xml.append(nls);
}
// add MeasurementUnitRef
String muRefOid = item.getMeasurementUnitRef().getElementDefOID();
if (muRefOid != null && muRefOid.length() > 0) {
if (!hasNode) {
hasNode = true;
xml.append(">");
xml.append(nls);
}
xml.append(currentIndent + indent + this.measurementUnitRefString(muRefOid));
xml.append(nls);
}
// add RangeCheck
if (item.getRangeCheck() != null) {
ArrayList<RangeCheckBean> rcs = (ArrayList<RangeCheckBean>) item.getRangeCheck();
for (RangeCheckBean rc : rcs) {
if (rc.getComparator().length() > 0) {
if (!hasNode) {
hasNode = true;
xml.append(">");
xml.append(nls);
}
xml.append(currentIndent + indent + "<RangeCheck Comparator=\"" + StringEscapeUtils.escapeXml(rc.getComparator()) + "\" SoftHard=\"" + rc.getSoftHard() + "\">");
xml.append(nls);
xml.append(currentIndent + indent + indent + "<CheckValue>" + StringEscapeUtils.escapeXml(rc.getCheckValue()) + "</CheckValue>");
xml.append(nls);
// supported
if (muRefOid != null && muRefOid.length() > 0) {
xml.append(currentIndent + indent + indent + this.measurementUnitRefString(muRefOid));
xml.append(nls);
}
xml.append(currentIndent + indent + indent + "<ErrorMessage><TranslatedText>" + StringEscapeUtils.escapeXml(rc.getErrorMessage().getText()) + "</TranslatedText></ErrorMessage>");
xml.append(nls);
xml.append(currentIndent + indent + "</RangeCheck>");
xml.append(nls);
}
}
}
// add CodeListRef
String clOid = item.getCodeListOID();
if (clOid != null && clOid.length() > 0) {
if (!hasNode) {
hasNode = true;
xml.append(">");
xml.append(nls);
}
xml.append(currentIndent + indent + "<CodeListRef CodeListOID=\"" + StringEscapeUtils.escapeXml(clOid) + "\"/>");
xml.append(nls);
}
// add MultiSelectListRef
if ("oc1.2".equalsIgnoreCase(ODMVersion) || "oc1.3".equalsIgnoreCase(ODMVersion)) {
if (item.getMultiSelectListRef() != null) {
String mslOid = item.getMultiSelectListRef().getElementDefOID();
if (mslOid != null && mslOid.length() > 0) {
if (!hasNode) {
hasNode = true;
xml.append(">");
xml.append(nls);
}
// xml.append(currentIndent + indent +
// "<OpenClinica:MultiSelectListRef OpenClinica:MultiSelectListID=\""
xml.append(currentIndent + indent + "<OpenClinica:MultiSelectListRef MultiSelectListID=\"" + StringEscapeUtils.escapeXml(mslOid) + "\"/>");
xml.append(nls);
}
}
}
// add ItemDetails for oc1.3
if ("oc1.3".equals(ODMVersion)) {
if (!hasNode) {
hasNode = true;
xml.append(">");
xml.append(nls);
}
// this.addItemDetails(item.getItemDetails(), currentIndent + indent);
}
if (hasNode) {
xml.append(currentIndent + "</ItemDef>");
xml.append(nls);
hasNode = false;
} else {
xml.append("/>");
xml.append(nls);
}
}
}
use of org.akaza.openclinica.bean.odmbeans.TranslatedTextBean in project OpenClinica by OpenClinica.
the class MetaDataReportBean method addCodeList.
public void addCodeList(String currentIndent) {
StringBuffer xml = this.getXmlOutput();
String indent = this.getIndent();
if (odmstudy.getMetaDataVersion().getCodeLists() != null) {
ArrayList<CodeListBean> cls = (ArrayList<CodeListBean>) odmstudy.getMetaDataVersion().getCodeLists();
if (cls.size() > 0) {
for (CodeListBean cl : cls) {
boolean isString = cl.getDataType().equalsIgnoreCase("text") ? true : false;
xml.append(currentIndent + "<CodeList OID=\"" + StringEscapeUtils.escapeXml(cl.getOid()) + "\" Name=\"" + StringEscapeUtils.escapeXml(cl.getName()) + "\" DataType=\"" + cl.getDataType() + "\" SASFormatName=\"" + this.getSasFormValidator().getValidSASFormatName(cl.getName(), isString) + "\">");
xml.append(nls);
ArrayList<CodeListItemBean> clis = (ArrayList<CodeListItemBean>) cl.getCodeListItems();
if (clis != null && clis.size() > 0) {
for (CodeListItemBean cli : clis) {
xml.append(currentIndent + indent + "<CodeListItem CodedValue=\"" + StringEscapeUtils.escapeXml(cli.getCodedVale()) + "\">");
xml.append(nls);
xml.append(currentIndent + indent + indent + "<Decode>");
xml.append(nls);
TranslatedTextBean tt = cli.getDecode();
if (tt.getXmlLang().length() > 0) {
xml.append(currentIndent + indent + indent + indent + "<TranslatedText xml:lang=\"" + tt.getXmlLang() + "\">" + StringEscapeUtils.escapeXml(cli.getDecode().getText()) + "</TranslatedText>");
} else {
xml.append(currentIndent + indent + indent + indent + "<TranslatedText>" + StringEscapeUtils.escapeXml(cli.getDecode().getText()) + "</TranslatedText>");
}
xml.append(nls);
xml.append(currentIndent + indent + indent + "</Decode>");
xml.append(nls);
xml.append(currentIndent + indent + "</CodeListItem>");
xml.append(nls);
}
}
xml.append(currentIndent + "</CodeList>");
xml.append(nls);
}
}
}
}
Aggregations