missed.setName(name.getValue());
// set the class
Attribute clazz = elem.attribute("class");
missed.setClazz(clazz.getValue());
List<Element> props =elem.elements("property");
Properties property = new SortedProperties();
for (Element prop:props) {
String propName = prop.attributeValue("name");
String propValue = prop.attributeValue("value");
if ("prompt.type".equals(propName)) {
missed.setType(propValue);
} else if ("prompt.query".equals(propName)) {
// extract the native query to database
String queryName = propValue;
if(!StringUtil.isEmpty(queryName)){
//try to match :[paramName]
Matcher matcher = Pattern.compile(":(\\w+)").matcher(queryName);
while (matcher.find()) {
String paramName = matcher.group(0).substring(1);
if (!StringUtil.isEmpty(paramName) && requestParams.get(paramName)!=null){
String[] paramValueArr = requestParams.get(paramName);
String paramValue = StringUtil.explode(',', paramValueArr);
queryName = queryName.replaceAll(":" + paramName, paramValue);
}
}
}
List<Object[]> rs = ((ReportDAO) getDao()).getParamOptionResults(queryName);
for (Object[] option : rs) {
property.put(Long.valueOf(option[1].toString()), option[0].toString());
}
}else if("prompt.command".equals(propName)){
missed.setType(propName);
property.put(propValue, dynamicParameters.get(propValue));
}else
property.put(propName, propValue);
}
missed.setProperties(property);
missing.add(missed);
}
}