Menu

#75 Multi values from simpleXmlToContext

v2.4.1.0
open
nobody
core (38)
5
2007-11-01
2007-11-01
Oskar Hek
No

When a simpleXmlToContextMapping is configured to set multiple values the key+"_rowsize" row size is not set and the context.getValueAsList returns an empty arraylist.
ForEachGroupItemAction doesn't work.

SimpleXMLtoContextMapping:
if (isMultiple()) {
List values = getValues(node, xPathExpression, pr);
for (int i=0; i < values.size(); i++) {
String numberedKey = baseKey + "_" + (i+1);
String value = values.get(i).toString();
epc.setValue(numberedKey, valueFor(value, epc));
}
}

EplatformContext:
public ArrayList getValueAsList(String key) {
ArrayList result = new ArrayList();
//determine size
String sizeString = getValue(key +
GROUP_ROWSIZE_APPEND_KEY);
if (sizeString == null) {
// this check is for backward compatability
sizeString = getValue(key);
}
if(sizeString != null) {
try{
int size = Integer.parseInt(sizeString);
return getValueAsList(key, size);
}catch(NumberFormatException nfe) {
//this is not a list field
}
}
return result;
}

Discussion


Log in to post a comment.

Auth0 Logo