/* (non-Javadoc)
* @see org.jasig.portal.url.IPortalUrlProvider#getPortletUrlByNodeId(javax.servlet.http.HttpServletRequest, java.lang.String)
*/
public IPortalPortletUrl getPortletUrlByNodeId(HttpServletRequest request, String portletNodeId) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
//Find the channel and portlet definitions
final IUserLayoutChannelDescription channelNode = (IUserLayoutChannelDescription)userLayoutManager.getNode(portletNodeId);
final String channelPublishId = channelNode.getChannelPublishId();
final IChannelDefinition channelDefinition = this.channelRegistryStore.getChannelDefinition(channelPublishId);
if(null == channelDefinition) {
throw new IllegalArgumentException("No channel definition found for publish id: " + channelPublishId);
}
final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinition(channelDefinition.getId());
if (portletDefinition == null) {
throw new IllegalArgumentException("No portlet defintion found for channel definition '" + channelDefinition.getId() + "'.");
}
//Determine the appropriate portlet window ID
final IPerson person = userInstance.getPerson();
final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreatePortletEntity(portletDefinition.getPortletDefinitionId(), portletNodeId, person.getID());
final IPortletWindow defaultPortletWindow = this.portletWindowRegistry.createDefaultPortletWindow(request, portletEntity.getPortletEntityId());
final IPortletWindowId portletWindowId = this.portletWindowRegistry.createTransientPortletWindowId(request, defaultPortletWindow.getPortletWindowId());
return this.getPortletUrl(request, portletWindowId);