Package org.apache.pluto.container.om.portlet

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


   
    @Override
    protected Preference load()
    {
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = app.getPortlet(paNodeBean.getName());
        Preference preference = (Preference) def.getPortletPreferences().getPortletPreference(name);
        return preference;
    }
View Full Code Here


        app.setVersion(version);
        if (portlet != null)
        {
            for (PortletType src : portlet)
            {
                PortletDefinition target = app.addPortlet(src.portletName);
                upgradePortlet(src, target);
            }
        }
        if (customPortletMode != null)
        {
            for (CustomPortletModeType src : customPortletMode)
            {
                CustomPortletMode target = app.addCustomPortletMode(src.portletMode);
                if (src.description != null)
                {
                    for (DescriptionType d : src.description)
                    {
                        Description desc = target.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
        if (customWindowState != null)
        {
            for (CustomWindowStateType src : customWindowState)
            {
                CustomWindowState target = app.addCustomWindowState(src.windowState);
                if (src.description != null)
                {
                    for (DescriptionType d : src.description)
                    {
                        Description desc = target.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
        if (userAttribute != null)
        {
            for (UserAttributeType src : userAttribute)
            {
                UserAttribute target = app.addUserAttribute(src.name);
                if (src.description != null)
                {
                    for (DescriptionType d : src.description)
                    {
                        Description desc = target.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
        if (securityConstraint != null)
        {
            for (SecurityConstraintType src : securityConstraint)
            {
                SecurityConstraint target = app.addSecurityConstraint(src.userDataConstraint.transportGuarantee);
                if (src.displayName != null)
                {
                    for (DisplayNameType d : src.displayName)
                    {
                        DisplayName dname = target.addDisplayName(d.lang);
                        dname.setDisplayName(d.value);
                    }
                }
                if (src.portletCollection != null && src.portletCollection.portletName != null)
                {
                    for (String pname : src.portletCollection.portletName)
                    {
                        target.addPortletName(pname);
                    }
                }
            }
        }
        return app;
View Full Code Here

            }
            PortletApplicationDefinition ctx = portletRegistry.getPortletApplication(applicationName);
            Iterator i = ctx.getPortlets().iterator();
            while (i.hasNext())
            {
                PortletDefinition dd = (PortletDefinition) i.next();
                if (portletName.equals(dd.getPortletName()))
                {
                    Iterator i2 = dd.getSupports().iterator();
                    while (i2.hasNext())
                    {
                        Supports sd = (Supports) i2.next();
                        if (sd.getPortletModes() == null)
                        {
View Full Code Here

        }
        PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
        Iterator i = portletApp.getPortlets().iterator();
        while (i.hasNext())
        {
            PortletDefinition dd = (PortletDefinition) i.next();
            if (portletName.equals(dd.getPortletName()))
            {
                Iterator i2 = dd.getSupports().iterator();
                while (i2.hasNext())
                {
                    Supports sd = (Supports) i2.next();
                    if (sd.getPortletModes() == null)
                    {
View Full Code Here

     */
    protected final void internalStore() throws IOException, ValidatorException {
        // Validate the preferences before storing, if a validator is defined.
        //   If the preferences cannot pass the validation,
        //   an ValidatorException will be thrown out.
        PortletDefinition portletD = window.getPortletDefinition();
        PreferencesValidator validator = preferencesService.getPreferencesValidator(portletD);
        if (validator != null)
        {
            validator.validate(this);
        }
View Full Code Here

                throw new PortletContainerException("Optional Portlet Registry Service not found.");
            }
            PortletApplicationDefinition ctx = portletRegistry.getPortletApplication(applicationName);
            Iterator i = ctx.getPortlets().iterator();
            while(i.hasNext()) {
                PortletDefinition dd = (PortletDefinition)i.next();
                if(portletName.equals(dd.getPortletName())) {
                    Iterator i2 = dd.getSupports().iterator();
                    while(i2.hasNext()) {
                        Supports sd = (Supports)i2.next();
                        if (sd.getPortletModes()==null){
                          if (mode.equalsIgnoreCase(PortletMode.VIEW.toString()))
                            return true;
View Full Code Here

                throw new PortletContainerException("Optional Portlet Registry Service not found.");
            }
            PortletApplicationDefinition portletApp = portletRegistry.getPortletApplication(applicationName);
            Iterator i =  portletApp.getPortlets().iterator();
            while(i.hasNext()) {
                PortletDefinition dd = (PortletDefinition)i.next();
                if(portletName.equals(dd.getPortletName())) {
                    Iterator i2 = dd.getSupports().iterator();
                    while(i2.hasNext()) {
                        Supports sd = (Supports)i2.next();
                        if (sd.getPortletModes()== null){
                          modeSet.add(PortletMode.VIEW);
                        }
View Full Code Here

      PortletApplicationDefinition portletApp168 = jaxb.read("test", "/test", in);
     
      // test if portlet has the right params:
     
      // test jsr168 compliant portlets
      PortletDefinition portlet168 = (PortletDefinition)portletApp168.getPortlets().get(0);
      assertTrue(portlet168.getExpirationCache()==50);
      assertEquals(portlet168.getPortletName(),"portlet168");
      assertEquals(portlet168.getInitParams().get(0).getParamValue(),"value");
      assertEquals(portlet168.getSecurityRoleRefs().get(0).getRoleLink(), "role-link");
      assertEquals(portletApp168.getCustomPortletModes().get(0).getPortletMode(), "portlet-mode");
      assertEquals(portletApp168.getCustomWindowStates().get(0).getWindowState(), "window-state");
      assertEquals(portletApp168.getUserAttributes().get(0).getName(), "name" );
      assertEquals(portletApp168.getSecurityConstraints().get(0).getPortletNames().get(0), "portlet-name");
      assertEquals(portlet168.getExpirationCache(), 50);
      // id (isn't supported yet)
//      assertFalse(portletApp.getId().equals("id2"));
//      assertTrue(portletApp.getId().equals("id1"));
     
      jaxb.write(portletApp168, System.out);
      // portlet id
      PortletDefinition portlet286 = (PortletDefinition)portletApp286.getPortlets().get(0);
//      assertTrue(portlet1.getId().equals("id2"));
     
      // portlet class
      assertTrue(portlet286.getPortletClass().equals("portlet-class"));
     
      // portlet info
      // id isn't supported yet
//      assertTrue(portlet1.getPortletInfo().getId().equals("info1"));
      assertTrue(portlet286.getPortletInfo().getTitle().equals("title"));
     
      assertEquals("supports size should be 3", 3, portlet286.getSupports().size());
     
      assertEquals(portletApp286.getCustomPortletModes().get(0).getPortletMode(), "portlet-mode");
      assertEquals(portletApp286.getCustomWindowStates().get(0).getWindowState(), "window-state");
      assertEquals(portletApp286.getUserAttributes().get(0).getName(), "name" );
      assertEquals(portletApp286.getSecurityConstraints().get(0).getPortletNames().get(0), "portlet-name");
      assertEquals(portletApp286.getEventDefinitions().get(0).getValueType(), "java-class");
//      assertEquals(portletApp286.getRender().get(0).getName(), "QName");
      assertEquals(portletApp286.getFilters().get(0).getLifecycles().get(0), "lifecycle");
      assertEquals(portletApp286.getFilterMappings().get(0).getPortletNames().get(0), "portlet-name");
      assertEquals(portletApp286.getResourceBundle(), "resource-bundle");
      assertEquals(portletApp286.getVersion(), "2.0");
     
      // test container runtime options
      assertEquals(portletApp286.getContainerRuntimeOptions().size(),1);
      assertEquals(portletApp286.getContainerRuntimeOptions().get(0).getName(),"Runtime-Option-Portlet-App");
      assertEquals(portletApp286.getContainerRuntimeOptions().get(0).getValues().get(0),"false");
     
      assertEquals(portlet286.getContainerRuntimeOptions().size(),1);
      assertEquals(portlet286.getContainerRuntimeOptions().get(0).getName(),"Runtime-Option");
      assertEquals(portlet286.getContainerRuntimeOptions().get(0).getValues().get(0),"true");
            assertEquals(portlet286.getExpirationCache(), 100);
     
            jaxb.write(portletApp286, System.out);
     
    } catch (IOException e) {
      fail("exception was thrown");
View Full Code Here

        PortletApplicationDefinition portletDD = jaxb.read( "test", "/test", inputStream );

        assertEquals( "1.0", portletDD.getVersion() );
        assertEquals( 1, portletDD.getPortlets().size() );

        PortletDefinition pd = (PortletDefinition) portletDD.getPortlets().get( 0 );
        assertEquals( pd.getExpirationCache(), 0 );
    }
View Full Code Here

        PortletApplicationDefinition portletDD = jaxb.read( "test", "/test", inputStream );

        assertEquals( "2.0", portletDD.getVersion() );
        assertEquals( 1, portletDD.getPortlets().size() );

        PortletDefinition pd = (PortletDefinition) portletDD.getPortlets().get( 0 );
        assertEquals( pd.getExpirationCache(), 0 );
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.container.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.