Examples of IUserLayoutManager


Examples of org.jasig.portal.layout.IUserLayoutManager

    public ModelAndView addFavorite(@RequestParam String channelId, HttpServletRequest request) {
        //setup
        IUserInstance ui = userInstanceManager.getUserInstance(request);

        UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
        IUserLayoutManager ulm = upm.getUserLayoutManager();
       
        IUserLayoutChannelDescription channel = new UserLayoutChannelDescription(portletDefinitionRegistry.getPortletDefinition(channelId));
       
        final Locale locale = RequestContextUtils.getLocale(request);
       
        //get favorite tab
        String favoriteTabNodeId = FavoritesUtils.getFavoriteTabNodeId(ulm.getUserLayout());

        if(favoriteTabNodeId != null) {
            //add portlet to favorite tab
            IUserLayoutNodeDescription node = addNodeToTab(ulm, channel, favoriteTabNodeId);

            if (node == null) {
                return new ModelAndView("jsonView",
                        Collections.singletonMap("response",
                                getMessage("error.add.portlet.in.tab", "Can''t add a new favorite", locale)));
            }

            try {
                // save the user's layout
                ulm.saveUserLayout();
            } catch (Exception e) {
                log.warn("Error saving layout", e);
                return new ModelAndView("jsonView",
                        Collections.singletonMap("response",
                                getMessage("error.persisting.layout.change", "Can''t add a new favorite", locale)));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.