Package org.apache.pluto.om.portlet

Examples of org.apache.pluto.om.portlet.PortletDefinition


            ServletMappingListImpl servletMappings = webApplicationDefinition.getServletMappings();

            Iterator portlets = portletApplicationDefinition.getPortletDefinitionList().iterator();
            while (portlets.hasNext()) {

                PortletDefinition portlet = (PortletDefinition)portlets.next();

                // Check if already exists
                ServletDefinition servlet = webApplicationDefinition.getServletDefinitionList().get(portlet.getName());
                if (servlet != null) {
                    if (!servlet.getServletClass().equals("org.apache.pluto.core.PortletServlet")) {
                        System.out.println("Note: Replaced already existing the servlet with the name '" + portlet.getName() + "' with the wrapper servlet.");
                    }
                    ServletDefinitionCtrl _servletCtrl = (ServletDefinitionCtrl)controllerFactory.get(servlet);
                    _servletCtrl.setServletClass("org.apache.pluto.core.PortletServlet");
                } else {
                    servlet = servletDefinitionSetCtrl.add(portlet.getName(), "org.apache.pluto.core.PortletServlet");
                }

                ServletDefinitionCtrl servletCtrl = (ServletDefinitionCtrl)controllerFactory.get(servlet);

                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(portlet.getName() + " Wrapper");
                dispName.setLocale(Locale.getDefault());
                DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
                dispSet.add(dispName);
                servletCtrl.setDisplayNames((DisplayNameSet)dispSet);
                DescriptionImpl desc = new DescriptionImpl();
                desc.setDescription("Automated generated Portlet Wrapper");
                desc.setLocale(Locale.getDefault());
                DescriptionSetImpl descSet = new DescriptionSetImpl();
                descSet.add(desc);
                servletCtrl.setDescriptions(descSet);
                ParameterSet parameters = servlet.getInitParameterSet();

                ParameterSetCtrl parameterSetCtrl = (ParameterSetCtrl)controllerFactory.get(parameters);

                Parameter parameter1 = parameters.get("portlet-class");
                if (parameter1 == null) {
                    parameterSetCtrl.add("portlet-class", portlet.getClassName());
                } else {
                    ParameterCtrl parameterCtrl = (ParameterCtrl)controllerFactory.get(parameter1);
                    parameterCtrl.setValue(portlet.getClassName());

                }
                Parameter parameter2 = parameters.get("portlet-guid");
                if (parameter2 == null) {
                    parameterSetCtrl.add("portlet-guid", portlet.getId().toString());
                } else {
                    ParameterCtrl parameterCtrl = (ParameterCtrl)controllerFactory.get(parameter2);
                    parameterCtrl.setValue(portlet.getId().toString());

                }

                boolean found = false;
                Iterator mappings = servletMappings.iterator();
                while (mappings.hasNext()) {
                    ServletMappingImpl servletMapping = (ServletMappingImpl)mappings.next();
                    if (servletMapping.getServletName().equals(portlet.getName())) {
                        found = true;
                        servletMapping.setUrlPattern("/" + portlet.getName().replace(' ', '_') + "/*");
                    }
                }
                if (!found) {
                    ServletMappingImpl servletMapping = new ServletMappingImpl();
                    servletMapping.setServletName(portlet.getName());
                    servletMapping.setUrlPattern("/" + portlet.getName().replace(' ', '_') + "/*");
                    servletMappings.add(servletMapping);
                }
               
                // Add in portlet taglib
                TagLibImpl tagLib = new TagLibImpl();
                tagLib.setTaglibUri(WEB_PORTLET_TAGLIB_URI);
                tagLib.setTaglibLocation(WEB_PORTLET_TAGLIB_LOCATION);
                webApplicationDefinition.getTagLibs().add(tagLib);               

                SecurityRoleRefSet servletSecurityRoleRefs = ((ServletDefinitionImpl)servlet).getSecurityRoleRefs();

                SecurityRoleRefSetCtrl servletSecurityRoleRefSetCtrl = (SecurityRoleRefSetCtrl)controllerFactory.get(servletSecurityRoleRefs);

                SecurityRoleSet webAppSecurityRoles = webApplicationDefinition.getSecurityRoles();

                SecurityRoleRefSet portletSecurityRoleRefs = portlet.getInitSecurityRoleRefSet();

                //SecurityRoleRefSetCtrl portletSecurityRoleRefSetCtrl = (SecurityRoleRefSetCtrl)controllerFactory.get(portletSecurityRoleRefs);

                Iterator p = portletSecurityRoleRefs.iterator();

                while (p.hasNext()) {
                    SecurityRoleRef portletSecurityRoleRef = (SecurityRoleRef)p.next();

                    if (portletSecurityRoleRef.getRoleLink() == null && webAppSecurityRoles.get(portletSecurityRoleRef.getRoleName()) == null) {
                        System.out.println(
                            "Note: The web application has no security role defined which matches the role name \""
                                + portletSecurityRoleRef.getRoleName()
                                + "\" of the security-role-ref element defined for the wrapper-servlet with the name '"
                                + portlet.getName()
                                + "'.");
                        break;
                    }
                    SecurityRoleRef servletSecurityRoleRef = servletSecurityRoleRefs.get(portletSecurityRoleRef.getRoleName());
                    if (null != servletSecurityRoleRef) {
                        System.out.println(
                            "Note: Replaced already existing element of type <security-role-ref> with value \""
                                + portletSecurityRoleRef.getRoleName()
                                + "\" for subelement of type <role-name> for the wrapper-servlet with the name '"
                                + portlet.getName()
                                + "'.");
                        servletSecurityRoleRefSetCtrl.remove(servletSecurityRoleRef);
                    }
                    servletSecurityRoleRefSetCtrl.add(portletSecurityRoleRef);
                }
View Full Code Here


     * while more PAs for each portletDef
     * list:entityMan:getPortletEntity(pd)
     */
    PortletDefinitionList portletList = pa.getPortletDefinitionList(); // .get(JetspeedObjectID.createFromString(TEST_PORTLET));
    Iterator pi = portletList.iterator();
    PortletDefinition pd = null;

    JSPortlets portlets = new JSPortlets();
    while (pi.hasNext())
    {
      try
      {
        pd = (PortletDefinition) pi.next();
        JSPortlet p = exportPD(pd);
        if (p != null)
        {
          System.out.println("--processed PA " + pa.getName()
              + " with pd=" + pd.getName());
          portlets.add(p);
        } else
          System.out.println("--processed PA " + pa.getName()
              + " with NULL pd=" + pd.getName());

      } catch (Exception e)
      {
        throw new SerializerException(
            SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
View Full Code Here

   
    Iterator pi = app.getPortlets().iterator();
    while (pi.hasNext())
    {
      JSPortlet portlet = (JSPortlet)pi.next();
      PortletDefinition pd  = pa.getPortletDefinitionByName(portlet.getName());
      if (pd != null)
      {
        importPD(portlet,pd);
      }
    }
View Full Code Here

        if (this.portletContentTypeSet == null)
        {
            try
            {
                JetspeedPortletConfig config = (JetspeedPortletConfig) portlet.getPortletConfig();
                PortletDefinition portletDef = config.getPortletDefinition();
                this.portletContentTypeSet = portletDef.getContentTypeSet();
            }
            catch (Exception e)
            {
            }
        }
View Full Code Here

       
        verifyDemoAppCreated(TEST_PORTLET_APP_NAME, demoApp);
       
        MutablePortletApplication app = portletRegistry.getPortletApplication(TEST_PORTLET_APP_NAME);
       
        PortletDefinition portlet = (PortletDefinition) app.getPortletDefinitionList().iterator().next();
       
        MutablePortletEntity entity = entityAccess.newPortletEntityInstance(portlet);
        entity.setId("testEnity");
       
        entityAccess.storePortletEntity(entity);
View Full Code Here

        portletRegistry.registerPortletApplication(app);
 
        // store.invalidateAll();

  
        PortletDefinition pd = portletRegistry.getPortletDefinitionByUniqueName("HW_App::PreferencePortlet");

        assertNotNull(pd);

        assertNotNull(pd.getPreferenceSet());

        Preference pref1 = pd.getPreferenceSet().get("pref1");

        assertNotNull(pref1);

        Iterator itr = pref1.getValues();
        int count = 0;
View Full Code Here

        MutableWebApplication webApp = paWar.createWebApp();
        assertNotNull("WebApp is null", webApp);

        app.setWebApplicationDefinition(webApp);

        PortletDefinition portlet = app.getPortletDefinitionByName("TestPortlet");
        assertNotNull("TestPortlet is null", portlet);
        checkWebSecurityRoles(webApp);
        checkPortletSecurityRoleRefs(portlet);
        boolean validateFailed = false;
        try
View Full Code Here

    public PortletDefinition get(ObjectID id)
    {
        Iterator itr = innerCollection.iterator();
        while (itr.hasNext())
        {
            PortletDefinition pd = (PortletDefinition) itr.next();
            if (pd.getId().equals(id))
            {
                return pd;
            }
        }
View Full Code Here

    public PortletDefinition get(String name)
    {
        Iterator itr = innerCollection.iterator();
        while (itr.hasNext())
        {
            PortletDefinition pd = (PortletDefinition) itr.next();
            if (pd.getName().equals(name))
            {
                return pd;
            }
        }
View Full Code Here

    /**
     * @see java.util.Collection#add(java.lang.Object)
     */
    public boolean add(Object o)
    {
        PortletDefinition pd = (PortletDefinition) o;       
        return innerCollection.add(pd);
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.om.portlet.PortletDefinition

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.