@ RenderMapping public String initializeView ( Model model , RenderRequest renderRequest ) { IUserInstance ui = userInstanceManager . getUserInstance ( portalRequestUtils . getCurrentPortalRequest ( ) ) ; UserPreferencesManager upm = ( UserPreferencesManager ) ui . getPreferencesManager ( ) ; IUserLayoutManager ulm = upm . getUserLayoutManager ( ) ; IUserLayout userLayout = ulm . getUserLayout ( ) ; // TODO: the portlet could predicate including a non-null marketplace portlet fname // on the accessing user having permission to render the portlet referenced by that fname // so that portlet would gracefully degrade when configured with bad marketplace portlet // fname // and also gracefully degrade when the accessing user doesn't have permission to access an // otherwise // viable configured marketplace. This complexity may not be worth it. Anyway it is not // yet implemented. model . addAttribute ( "marketplaceFname" , this . marketplaceFName ) ; List < IUserLayoutNodeDescription > collections = favoritesUtils . getFavoriteCollections ( userLayout ) ; model . addAttribute ( "collections" , collections ) ; List < IUserLayoutNodeDescription > favorites = favoritesUtils . getFavoritePortletLayoutNodes ( userLayout ) ; model . addAttribute ( "favorites" , favorites ) ; model . addAttribute ( "successMessageCode" , renderRequest . getParameter ( "successMessageCode" ) ) ; model . addAttribute ( "errorMessageCode" , renderRequest . getParameter ( "errorMessageCode" ) ) ; model . addAttribute ( "nameOfFavoriteActedUpon" , renderRequest . getParameter ( "nameOfFavoriteActedUpon" ) ) ; // default to the regular old edit view String viewName = "jsp/Favorites/edit" ; if ( collections . isEmpty ( ) && favorites . isEmpty ( ) ) { // use the special case view viewName = "jsp/Favorites/edit_zero" ; } logger . trace ( "Favorites Portlet EDIT mode built model [{}] and selected view {}." , model , viewName ) ; return viewName ; }
Handles all Favorites portlet EDIT mode renders . Populates model with user s favorites and selects a view to display those favorites .