Examples of IUserLayoutChannelDescription


Examples of org.jasig.portal.layout.node.IUserLayoutChannelDescription

        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)));
            }

            //document success for notifications
            Map<String, String> model = new HashMap<String, String>();
            final String channelTitle = channel.getTitle();
            model.put("response",
                    getMessage("favorites.added.favorite", channelTitle,
                            "Added " + channelTitle + " as a favorite.", locale));
            model.put("newNodeId", node.getId());
            return new ModelAndView("jsonView", model);
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.