}
}
// Temporarily set portlet namespace, WebTML scope
BaseTagStatus tag = getTMLContext().getDesignContext().getTag();
TMLOptionPreserver preserver = new TMLOptionPreserver(tag);
preserver.preserve(Base.OPTION_PORTLET_NAMESPACE, actionLink.getPortletKey());
preserver.preserve(Base.OPTION_WEBTML_SCOPE, actionLink.getWebtmlScope());
try {
// Inner call, depends, if this a default action or not
if (actionLink.isDefaultAction()) {
actionContext.callDefaultAction(actionLink.getDefaultAction(), params);
if (actionLink.getPortletmode() != null && actionContext.getportlet() != null) {
actionContext.getportlet().setmode(actionLink.getPortletmode());
}
applyPortletContext(actionLink, actionContext);
return null;
}
else {
TMLAction tmlAction = (TMLAction) getTMLContext().getActionRegistration().get(actionLink.getActionKeyInteger());
if (tmlAction == null) {
throw new TMLActionException("Could not find action for key " + actionLink.getActionKey());
}
actionContext.callCustomAction(tmlAction, params);
if (actionLink.getPortletmode() != null && actionContext.getportlet() != null) {
if (getTMLContext().isdefined("actionresult")) {
ExpressionResult expressionResult = (ExpressionResult) getTMLContext().item("actionresult");
if (!expressionResult.isError() && (expressionResult.getResult() == null || expressionResult.getResult() instanceof String || !expressionResult.isFalse())) {
actionContext.getportlet().setmode(actionLink.getPortletmode());
}
}
}
applyPortletContext(actionLink, actionContext);
return tmlAction;
}
}
finally {
preserver.restore();
}
}