public Properties getUserInputValues() { Properties prop = new Properties(); for (int i = 0; i < uiList.size(); i++) { UserInput ui = (UserInput) uiList.get(i); XmlUIElement el = (XmlUIElement) uiElementsList.get(i); ui.setValue(el.getValue()); prop.put("$UserInput$" + ui.getID(), el.getValue()); } return prop; }
/** This replaces the user input variables in the XML template * */ public String replaceVariablesInString(String xmlStringArg) { String modXmlString = xmlStringArg; Properties prop = new Properties(); for (int i = 0; i < uiList.size(); i++) { UserInput ui = (UserInput) uiList.get(i); XmlUIElement el = (XmlUIElement) uiElementsList.get(i); ui.setValue(el.getValue()); prop.put("$UserInput$" + ui.getID(), el.getValue()); // modXmlString = StringUtil.replaceStringBySpecifiedString(modXmlString,"$UserInput$" + // ui.getID(),el.getValue()); } Template template = null; try { template = new Template(xmlStringArg); // template = PopulateTemplateParams.substituteParams(template, prop, 3); template = PopulateTemplateParams.substituteParams(template, prop); } catch (Exception exc) { exc.printStackTrace(); } // return modXmlString; return template.toString(); }
public Properties getPropertiesValue() { Properties props = new Properties(); for (int i = 0; i < propKeyList.size(); i++) { String propName = (String) propKeyList.get(i); // Since $Template$Params is being appended (before replacement)in the server side latest code // it is removed here using substring(15). // If not removed, this results in $Template$Params$Template$ParamsSource as the key to be // replaced by the user specified value. // Check to be introduced in server side. // propName = propName.trim().substring(15); XmlUIElement el = (XmlUIElement) propValueList.get(i); props.put(propName, el.getValue()); } return props; }