public void setParameters(Map parameters) {
this.parameters = parameters;
}
public String toString() {
PortalControlURL url = provider.getPortalURL();
if (mode != null) {
url.setPortletMode(portletWindow, mode);
}
if (state != null) {
url.setPortletWindowState(portletWindow, state);
}
if (clearParameters) {
url.clearRenderParameters(portletWindow);
}
/*
* If the request does not contain a _pid or an _ac parameter
* it is a general request from infoglue. The parameters on the query
* is then assumed to be infoglue parameters such as siteNodeId..
*/
// Render request... set _ig parameters
if (!url.isTargeted()) {
Map params = url.getQueryParameterMap();
for (Iterator it = params.keySet().iterator(); it.hasNext();) {
String name = (String) it.next();
String[] values = (String[]) params.get(name);
url.setPathParameter(PortalControlURL.IG + name, values);
}
}
// set portlet id for associated request parms
url.clearActionParameter();
if (action) {
url.setActionParameter(portletWindow);
} else {
url.setPortletId(portletWindow);
}
url.clearQueryParameters();
if (parameters != null) {
Iterator names = parameters.keySet().iterator();
while (names.hasNext()) {
String name = (String) names.next();
Object value = parameters.get(name);
String[] values = value instanceof String ? new String[] {(String) value }
: (String[]) value;
if (action) {
url.setQueryParameter(portletWindow, name, values);
} else {
url.setRenderParameter(portletWindow, name, values);
}
}
}
String str = url.toString();
//log.debug("Generated URL: " + str);
return str;
}