protected String getResultUrl ( HttpServletRequest httpServletRequest , SearchResult result , IPortletWindowId portletWindowId ) { final String externalUrl = result . getExternalUrl ( ) ; if ( externalUrl != null ) { return externalUrl ; } UrlType urlType = UrlType . RENDER ; final PortletUrl portletUrl = result . getPortletUrl ( ) ; if ( portletUrl != null ) { final PortletUrlType type = portletUrl . getType ( ) ; if ( type != null ) { switch ( type ) { case ACTION : { urlType = UrlType . ACTION ; break ; } default : case RENDER : { urlType = UrlType . RENDER ; break ; } case RESOURCE : { urlType = UrlType . RESOURCE ; break ; } } } } final IPortalUrlBuilder portalUrlBuilder = this . portalUrlProvider . getPortalUrlBuilderByPortletWindow ( httpServletRequest , portletWindowId , urlType ) ; final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder . getTargetedPortletUrlBuilder ( ) ; if ( portletUrl != null ) { final String portletMode = portletUrl . getPortletMode ( ) ; if ( portletMode != null ) { portletUrlBuilder . setPortletMode ( PortletUtils . getPortletMode ( portletMode ) ) ; } final String windowState = portletUrl . getWindowState ( ) ; if ( windowState != null ) { portletUrlBuilder . setWindowState ( PortletUtils . getWindowState ( windowState ) ) ; } for ( final PortletUrlParameter param : portletUrl . getParam ( ) ) { final String name = param . getName ( ) ; final List < String > values = param . getValue ( ) ; portletUrlBuilder . addParameter ( name , values . toArray ( new String [ values . size ( ) ] ) ) ; } } return portalUrlBuilder . getUrlString ( ) ; }
Determine the url for the search result