throws ExpressionEvaluationException
{
if (_logger.isDebugEnabled())
_logger.debug("assign index to name: " + dap.getDataSource());
Expression parsedDataSource = getExpressionEvaluator().parseExpression(dap.getDataSource());
assert parsedDataSource != null;
// @todo: perf
boolean isContainerBound = (parsedDataSource.getTokens().get(0)).toString().equals("container");
// rewrite the name of the current IDataAccessProvider.
String parentName = null;
// if the current DAP has a parent IDataAccessProvider, rewrite the name of the parent
if (dap.getProviderParent() != null)
parentName = rewriteNameInternal(dap.getProviderParent());
// if the current DAP has no parent, or it does not reference the "container." binding context,
// we've found the "root" IDataAccessProvider
else if (dap.getProviderParent() == null || (dap.getProviderParent() != null && !isContainerBound)) {
return dap.getDataSource();
}
// now, we've found the root and can start rewriting the expressions throughout
// the rest of the DAP hierarchy
if (_logger.isDebugEnabled()) {
_logger.debug("changeContext: DAP.dataSource=" + dap.getDataSource() + " oldContext=container newContext=" +
parentName + " currentIndex=" + dap.getProviderParent().getCurrentIndex() +
" parentName is container: " + isContainerBound);
}
String retVal = null;
String ds = dap.getDataSource();
// If the current DAP's dataSource is "container.item", the binding context needs to change to that
// of the parent. This case should only occur for the last token -- the "name" passed into
// the method. Oterwise, just replace the "container" to that of the parent. Both are
// qualified with the DAP's current index so that "actionForm.customers" becomes
// "actionForm.customers[12]".
boolean isContainerItemBound = false;
if (isContainerBound && (parsedDataSource.getTokens().get(1)).toString().equals("item"))
isContainerItemBound = true;
if (isContainerItemBound)
retVal = changeContext(ds, "container.item", parentName, dap.getProviderParent().getCurrentIndex());
else