protected DynamicURI forwardInternal(RunData rundata,
String forwardName,
Map staticParams,
Map dynamicParams)
{
DynamicURI duri = null;
Forward forward = null;
try
{
JetspeedLink link = JetspeedLinkFactory.getInstance(rundata);
int rootType = JetspeedLink.DEFAULT;
int elementType = JetspeedLink.DEFAULT;
String rootValue = null;
String pageName = null;
String elementValue = null;
String actionName = null;
String templateName = null;
String mediaType = null;
String language = null;
String country = null;
forward = (Forward)this.forwards.get(forwardName);
if (null != forward)
{
Pane pane = forward.getPane();
if (null != pane)
{
elementValue = pane.getId();
elementType = JetspeedLink.PANE_ID;
if (elementValue == null)
{
elementValue = pane.getName();
elementType = JetspeedLink.PANE_NAME;
}
}
else // can't have both portlet and pane
{
Portlet portlet = forward.getPortlet();
if (null != portlet)
{
elementValue = portlet.getId();
elementType = JetspeedLink.PORTLET_ID;
if (elementValue == null)
{
elementValue = portlet.getName();
elementType = JetspeedLink.PORTLET_NAME;
}
actionName = portlet.getAction();
}
}
Page page = forward.getPage();
if (null != page)
{
pageName = page.getName();
String user = page.getUser();
if (user != null)
{
rootType = JetspeedLink.USER;
rootValue = user;
}
else
{
String role = page.getRole();
if (role != null)
{
rootType = JetspeedLink.ROLE;
rootValue = role;
}
else
{
String group = page.getGroup();
if (group != null)
{
rootType = JetspeedLink.GROUP;
rootValue = group;
}
else
{
rootType = JetspeedLink.CURRENT;
}
}
}
}
duri = link.getLink(rootType,
rootValue,
pageName,
elementType,
elementValue,
actionName,
templateName, // not yet implemented
mediaType, // not yet implemented
language, // not yet implemented
country); // not yet implemented
}
else
{
// forward not found, log it and return to home page
// TODO: perhaps this could be configurable to go to a default error page
logger.error("Forward not found, going to Home Page:" + forwardName);
duri = link.getHomePage();
}
if (null == duri)
{
duri = link.getPage();
}
Map baseQueryParams = null;
if (null != forward)
{
baseQueryParams = forward.getQueryParams();
}
setQueryParams(duri, baseQueryParams, staticParams, dynamicParams);
rundata.setRedirectURI(duri.toString());
JetspeedLinkFactory.putInstance(link);
}
catch (Throwable t)
{
logger.error("Exception in Forward",t);