use of org.akaza.openclinica.domain.xform.dto.Input in project OpenClinica by OpenClinica.
the class ResponseSetService method getOptionsText.
private String getOptionsText(Html html, String submittedXformText, XformItem xformItem, ResponseType responseType) throws Exception {
String optionsText = "";
List<Group> groups = html.getBody().getGroup();
for (Group group : groups) {
List<UserControl> controls = null;
if (group.getRepeat() != null)
controls = group.getRepeat().getUsercontrol();
else
controls = group.getUsercontrol();
for (UserControl control : controls) {
if (control.getRef().equals(xformItem.getItemPath())) {
List<Item> items = null;
ItemSet itemSet = null;
if (control instanceof Input) {
return responseType.getName();
} else if (control instanceof Select) {
items = ((Select) control).getItem();
itemSet = ((Select) control).getItemSet();
} else if (control instanceof Select1) {
items = ((Select1) control).getItem();
itemSet = ((Select1) control).getItemSet();
} else if (control instanceof Upload && control.getMediatype().equals("image/*")) {
return responseType.getName();
} else {
logger.debug("Found Unsupported UserControl (" + control.getClass().getName() + ". Returning null text.");
return null;
}
if (itemSet != null)
optionsText = getOptionsTextFromItemSet(submittedXformText, itemSet, html);
else {
for (Item option : items) {
String label = lookupLabel(html, option.getLabel());
label = label.replaceAll(",", "\\\\,");
if (optionsText.isEmpty())
optionsText = label;
else
optionsText += "," + label;
}
}
}
}
}
return optionsText;
}
use of org.akaza.openclinica.domain.xform.dto.Input in project OpenClinica by OpenClinica.
the class ResponseSetService method getOptionsValues.
private String getOptionsValues(Html html, String submittedXformText, XformItem xformItem, ResponseType responseType) throws Exception {
String optionsValues = "";
List<Group> groups = html.getBody().getGroup();
for (Group group : groups) {
List<UserControl> controls = null;
if (group.getRepeat() != null)
controls = group.getRepeat().getUsercontrol();
else
controls = group.getUsercontrol();
for (UserControl control : controls) {
if (control.getRef().equals(xformItem.getItemPath())) {
List<Item> items = null;
ItemSet itemSet = null;
if (control instanceof Input) {
return responseType.getName();
} else if (control instanceof Select) {
items = ((Select) control).getItem();
itemSet = ((Select) control).getItemSet();
} else if (control instanceof Select1) {
items = ((Select1) control).getItem();
itemSet = ((Select1) control).getItemSet();
} else if (control instanceof Upload && control.getMediatype().equals("image/*")) {
return responseType.getName();
} else {
logger.debug("Found Unsupported UserControl (" + control.getClass().getName() + ". Returning null text.");
return null;
}
if (itemSet != null)
optionsValues = getOptionsValuesFromItemSet(submittedXformText, itemSet, html);
else {
for (Item option : items) {
String value = option.getValue();
if (optionsValues.isEmpty())
optionsValues = value;
else
optionsValues += "," + value;
}
}
}
}
}
return optionsValues;
}
Aggregations