public void loadDBValue() { ResponseSetBean rsb = metadata.getResponseSet(); org.akaza.openclinica.bean.core.ResponseType rt = rsb.getResponseType(); String dbValue = data.getValue(); // System.out.println("setting dbValue: " + dbValue); if (rt.equals(org.akaza.openclinica.bean.core.ResponseType.CHECKBOX) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.SELECTMULTI)) { String dbValues[] = dbValue.split(","); if (dbValues != null) { for (String element : dbValues) { if (element != null) { rsb.setSelected(element.trim(), true); } } } } else if (rt.equals(org.akaza.openclinica.bean.core.ResponseType.TEXT) || rt.equals( org.akaza.openclinica.bean.core.ResponseType .TEXTAREA) // || rt.equals(org.akaza.openclinica.bean.core.ResponseType.CODING) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.CALCULATION) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.GROUP_CALCULATION)) { rsb.setValue(dbValue); } else if (rt.equals(org.akaza.openclinica.bean.core.ResponseType.FILE)) { // Here assume dbValue from database should be a valid file pathname if (dbValue.length() > 0) { dbData.setValue(dbValue); File f = new File(dbValue); String filename = f.getName(); if (f.isFile()) { rsb.setValue(filename); } else { // File does not exist, rsb.setValue("fileNotFound#" + filename); } } else { rsb.setValue(dbValue); } } else { if (dbValue != null) { dbValue = dbValue.trim(); } rsb.setSelected(dbValue, true); } metadata.setResponseSet(rsb); }
/** * Loads a set of values from the form into the bean. This means that the selected property of the * ResponseOptionBean objects metadata.responseSet.opresponseOption value is set properly, and * * @param values */ public void loadFormValue(ArrayList values) { ResponseSetBean rsb = metadata.getResponseSet(); String valueForDB = ""; String glue = ""; for (int i = 0; i < values.size(); i++) { String value = (String) values.get(i); if (value == null || value.equals("")) { continue; } rsb.setSelected(value.trim(), true); valueForDB += glue + value; glue = ","; } metadata.setResponseSet(rsb); data.setValue(valueForDB); }
public void loadFormValue(String value) { ResponseSetBean rsb = metadata.getResponseSet(); org.akaza.openclinica.bean.core.ResponseType rt = rsb.getResponseType(); if (rt.equals(org.akaza.openclinica.bean.core.ResponseType.TEXT) || rt.equals( org.akaza.openclinica.bean.core.ResponseType .TEXTAREA) // || rt.equals(org.akaza.openclinica.bean.core.ResponseType.CODING) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.CALCULATION) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.GROUP_CALCULATION) || rt.equals(org.akaza.openclinica.bean.core.ResponseType.FILE)) { rsb.setValue(value); } else { if (value != null) { rsb.setSelected(value.trim(), true); } } // logger.info("loadFormValue, line 241, DisplayItemBean // "+rsb.getResponseType().getName()); metadata.setResponseSet(rsb); // System.out.println("data value:" + data.getId() + " " + value); data.setValue(value); // comment set by tbh, 112007 }