Package org.jasig.portal.container.om.portlet

Examples of org.jasig.portal.container.om.portlet.PortletDefinitionImpl


            if (portletDefinitionId == null) {
                throw new PortalException("Missing publish parameter '" + portletDefinitionIdParamName + "'");
            }
           
            // Create the PortletDefinition
            PortletDefinitionImpl portletDefinition = (PortletDefinitionImpl)InformationProviderAccess.getStaticProvider().getPortletDefinition(ObjectIDImpl.createFromString(portletDefinitionId));
            if (portletDefinition == null) {
                throw new PortalException("Unable to find portlet definition for ID '" + portletDefinitionId + "'");
            }
            ChannelDefinition channelDefinition = ChannelRegistryStoreFactory.getChannelRegistryStoreImpl().getChannelDefinition(Integer.parseInt(sd.getChannelPublishId()));
            portletDefinition.setChannelDefinition(channelDefinition);
            portletDefinition.loadPreferences();

            // Create the PortletApplicationEntity
            final PortletApplicationEntityImpl portAppEnt = new PortletApplicationEntityImpl();
            portAppEnt.setId(portletDefinition.getId().toString());
            portAppEnt.setPortletApplicationDefinition(portletDefinition.getPortletApplicationDefinition());
           
            // Create the PortletEntity
            PortletEntityImpl portletEntity = new PortletEntityImpl();
            portletEntity.setId(sd.getChannelPublishId());
            portletEntity.setPortletDefinition(portletDefinition);
            portletEntity.setPortletApplicationEntity(portAppEnt);
            portletEntity.setUserLayout(pcs.getUserPreferencesManager().getUserLayoutManager().getUserLayout());
            portletEntity.setChannelDescription((IUserLayoutChannelDescription)pcs.getUserPreferencesManager().getUserLayoutManager().getNode(sd.getChannelSubscribeId()));
            portletEntity.setPerson(sd.getPerson());
            portletEntity.loadPreferences();
           
            // Add the user information into the request See PLT.17.2.
            Map userInfo = cd.getUserInfo();
           
            if (userInfo == null) {
                UserAttributeListImpl userAttributeList = ((PortletApplicationDefinitionImpl)portletDefinition.getPortletApplicationDefinition()).getUserAttributes();
               
                // here we ask an overridable method to get the user attributes.
                // you can extend CPortletAdapter to change the implementation of
                // how we get user attributes.  This whole initPortletWindow method
                // is also overridable.
                //
                // Note that we will only call getUserInfo() once.
                userInfo = getUserInfo(uid, sd, userAttributeList);
                if (log.isTraceEnabled()) {
                    log.trace("For user [" + uid + "] got user info : [" + userInfo + "]");
                }
                cd.setUserInfo(userInfo);
            }
           
            // Wrap the request
            ServletRequestImpl wrappedRequest = new ServletRequestImpl(pcs.getHttpServletRequest(), sd.getPerson(), portletDefinition.getInitSecurityRoleRefSet());
            
            // Now create the PortletWindow and hold a reference to it
            PortletWindowImpl portletWindow = new PortletWindowImpl();
            portletWindow.setId(sd.getChannelSubscribeId());
            portletWindow.setPortletEntity(portletEntity);
View Full Code Here


        NodeList portletNL = portletAppE.getElementsByTagName("portlet");
        for (int i = 0; i < portletNL.getLength(); i += 1) {
            Element portletE = (Element)portletNL.item(i);
            String portletName = XML.getChildElementText(portletE, "portlet-name");
            String portletDefinitionId = contextName + "." + portletName;
            PortletDefinitionImpl portletDefinition = new PortletDefinitionImpl();
            portletDefinition.setId(portletDefinitionId);
            portletDefinition.setClassName(XML.getChildElementText(portletE, "portlet-class"));          
            portletDefinition.setName(portletName);
            portletDefinition.setDisplayNames(getDisplayNames(portletE));
            portletDefinition.setDescriptions(getDescriptions(portletE));
            portletDefinition.setLanguages(getLanguages(portletE));
            portletDefinition.setInitParameters(getInitParameters(portletE));
            portletDefinition.setPreferences(getPreferences(portletE));
            portletDefinition.setContentTypes(getContentTypes(portletE));
            portletDefinition.setServletDefinition(webApplicationDefinition.getServletDefinitionList().get(portletName));
            portletDefinition.setPortletApplicationDefinition(portletApplicationDefinition);
            portletDefinition.setExpirationCache(XML.getChildElementText(portletE, "expiration-cache"));
            portletDefinition.setInitSecurityRoleRefSet(getSecurityRoleRefs(portletE));
           
            portletDefinitions.add(portletDefinitionId, portletDefinition);
        }       
        return portletDefinitions;
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.container.om.portlet.PortletDefinitionImpl

Copyright © 2018 www.massapicom. 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.