Package org.apache.jetspeed.om.common.portlet

Examples of org.apache.jetspeed.om.common.portlet.MutablePortletApplication


    root.addChild(portletApps);
   
    Iterator it = apps.iterator();
        while (it.hasNext())
        {
            MutablePortletApplication pa = (MutablePortletApplication)it.next();
            TreeControlNode appNode = new TreeControlNode(pa.getName(),
                                                          null,
                                                          pa.getName(),
                                                          PortletApplicationResources.PORTLET_URL,
                                                          null,
                                                          false,
                                                          "PA_APP_DOMAIN"  );
            portletApps.addChild(appNode);
           
            Iterator pdefIter = pa.getPortletDefinitionList().iterator();
            while (pdefIter.hasNext())
            {
                PortletDefinitionComposite portlet = (PortletDefinitionComposite) pdefIter.next();
                TreeControlNode portletNode = new TreeControlNode(pa.getName() + "::" + portlet.getName(),
                                                                  null,
                                                                  portlet.getDisplayNameText(locale),
                                                                  PortletApplicationResources.PORTLET_URL,
                                                                  null,
                                                                  false,
View Full Code Here


    public void testLoadPortletApplicationTree() throws Exception
    {
        System.out.println("Testing loadPortletApplicationTree");
        PortletApplicationDescriptor pad = new PortletApplicationDescriptor(new FileReader("./test/testdata/deploy/portlet.xml"), "unit-test");
        MutablePortletApplication app = pad.createPortletApplication();
        assertNotNull("App is null", app);
        assertNotNull("Version is null", app.getVersion());
        assertTrue("Version invalid: " + app.getVersion(), app.getVersion().equals("1.0"));
        assertNotNull("PA Identifier is null", app.getApplicationIdentifier());
        assertTrue(
            "PA Identifier invalid: " + app.getApplicationIdentifier(),
            app.getApplicationIdentifier().equals("TestRegistry"));

        validateUserInfo(app);

        // portlets
        PortletDefinitionList portletsList = app.getPortletDefinitionList();
        Iterator it = portletsList.iterator();
        int count = 0;
        while (it.hasNext())
        {
            PortletDefinitionComposite portlet = (PortletDefinitionComposite) it.next();
View Full Code Here

    public void testWritingToDB() throws Exception
    {
       
       
        MutablePortletApplication app = portletRegistry.getPortletApplication("HW_App");
        if (app != null)
        {
            portletRegistry.removeApplication(app);
         
        }

        PortletApplicationDescriptor pad = new PortletApplicationDescriptor(new FileReader("./test/testdata/deploy/portlet2.xml"), "HW_App");
        app = pad.createPortletApplication();

        app.setName("HW_App");

        portletRegistry.registerPortletApplication(app);
 
        // store.invalidateAll();
View Full Code Here

        portletRegistry.updatePortletApplication(app);
    }

    protected void verifyData(boolean afterUpdates) throws Exception
    {
        MutablePortletApplication app;
        WebApplicationDefinitionImpl webApp;
        PortletDefinitionComposite portlet;

        // Now makes sure everthing got persisted

        app = null;

        app = (PortletApplicationDefinitionImpl) portletRegistry.getPortletApplication("App_1");

        assertNotNull(app);

        webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
        portlet = (PortletDefinitionImpl) app.getPortletDefinitionByName("Portlet 1");

        assertNotNull("Failed to reteive portlet application", app);

        validateDublinCore(app.getMetadata());

        Collection services = app.getJetspeedServices();
        assertNotNull("jetspeed services is null", services);
        System.out.println("services is " + services);

        assertNotNull("Failed to reteive portlet application via registry", portletRegistry
                .getPortletApplication("App_1"));
        assertNotNull("Web app was not saved along with the portlet app.", webApp);
        assertNotNull("Portlet was not saved along with the portlet app.", app.getPortletDefinitionByName("Portlet 1"));
        if (!afterUpdates)
        {
            assertTrue("\"user.name.family\" user attribute was not found.", app.getUserAttributes().size() == 1);
        }
        else
        {
            assertTrue("\"user.name.family\" and user.pets user attributes were not found.", app.getUserAttributes()
                    .size() == 2);

        }

        portlet = (PortletDefinitionComposite) portletRegistry.getPortletDefinitionByUniqueName("App_1::Portlet 1");

        assertNotNull("Portlet could not be retreived by unique name.", portlet);

        validateDublinCore(portlet.getMetadata());

        assertNotNull("Portlet Application was not set in the portlet defintion.", portlet
                .getPortletApplicationDefinition());
        assertNotNull("French description was not materialized for the web app.", webApp.getDescription(Locale.FRENCH));
        assertNotNull("French display name was not materialized for the web app.", webApp.getDisplayName(Locale.FRENCH));
        assertNotNull("description was not materialized for the portlet.", portlet.getDescription(Locale.getDefault()));
        assertNotNull("display name was not materialized for the portlet.", portlet.getDisplayName(Locale.getDefault()));
        assertNotNull("\"testparam\" portlet parameter was not saved", portlet.getInitParameterSet().get("testparam"));
        assertNotNull("\"preference 1\" was not found.", portlet.getPreferenceSet().get("preference 1"));
        assertNotNull("Language information not found for Portlet 1", portlet.getLanguageSet().get(Locale.getDefault()));
        assertNotNull("Content Type html not found.", portlet.getContentTypeSet().get("html/text"));
        assertNotNull("Content Type wml not found.", portlet.getContentTypeSet().get("wml"));
        Iterator itr = portlet.getPreferenceSet().get("preference 1").getValues();
        int valueCount = 0;

        while (itr.hasNext())
        {
            itr.next();
            valueCount++;
        }
        assertEquals("\"preference 1\" did not have 2 values.", 2, valueCount);

        // Pull out our Web app and add a Description to it
        webApp = null;

        app = portletRegistry.getPortletApplication("App_1");

        webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
        assertNotNull("Web app was not located by query.", webApp);
        webApp.addDescription(Locale.getDefault(), "Web app description");

        webApp = null;

        app = portletRegistry.getPortletApplication("App_1");
        webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();

        assertNotNull("Web app was not located by query.", webApp);
        assertNotNull("Web app did NOT persist its description", webApp.getDescription(Locale.FRENCH));

    }
View Full Code Here

           
            if (portlet == null)
                continue;
           
            // Do not display Jetspeed Layout Applications
            MutablePortletApplication pa = (MutablePortletApplication)portlet.getPortletApplicationDefinition();
            if (pa.isLayoutApplication())
                continue;
                
            // SECURITY filtering
            String uniqueName = pa.getName() + "::" + portlet.getName();
            if (securityAccessController.checkPortletAccess(portlet, JetspeedActions.MASK_VIEW))
            {
                Parameter param = portlet.getInitParameterSet().get(PORTLET_ICON);
                String image;
                if (param != null)
View Full Code Here

    // persistenceStore.getTransaction().commit();
    // }

    protected void verifyData(boolean afterUpdates) throws Exception
    {
        MutablePortletApplication app;
        WebApplicationDefinitionImpl webApp;
        PortletDefinitionComposite portlet;

        app = null;

        app = (PortletApplicationDefinitionImpl) registry.getPortletApplication("App_1");

        webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
        portlet = (PortletDefinitionImpl) app.getPortletDefinitionByName("Portlet 1");

        assertNotNull("Failed to reteive portlet application", app);

        validateDublinCore(app.getMetadata());

        Collection services = app.getJetspeedServices();
        assertNotNull("jetspeed services is null", services);
        System.out.println("services is " + services);

        assertNotNull("Failed to reteive portlet application via registry", registry.getPortletApplication("App_1"));
        assertNotNull("Web app was not saved along with the portlet app.", webApp);
        assertNotNull("Portlet was not saved along with the portlet app.", app.getPortletDefinitionByName("Portlet 1"));
        if (!afterUpdates)
        {
            assertTrue("\"user.name.family\" user attribute was not found.", app.getUserAttributes().size() == 1);
        }
        else
        {
            assertTrue("\"user.name.family\" and user.pets user attributes were not found.", app.getUserAttributes()
                    .size() == 2);

        }

        portlet = (PortletDefinitionComposite) registry.getPortletDefinitionByUniqueName("App_1::Portlet 1");

        assertNotNull("Portlet could not be retreived by unique name.", portlet);

        validateDublinCore(portlet.getMetadata());

        assertNotNull("Portlet Application was not set in the portlet defintion.", portlet
                .getPortletApplicationDefinition());
        assertNotNull("French description was not materialized for the web app.", webApp.getDescription(Locale.FRENCH));
        assertNotNull("French display name was not materialized for the web app.", webApp.getDisplayName(Locale.FRENCH));
        assertNotNull("description was not materialized for the portlet.", portlet.getDescription(Locale.getDefault()));
        assertNotNull("display name was not materialized for the portlet.", portlet.getDisplayName(Locale.getDefault()));
        assertNotNull("\"testparam\" portlet parameter was not saved", portlet.getInitParameterSet().get("testparam"));
        assertNotNull("\"preference 1\" was not found.", portlet.getPreferenceSet().get("preference 1"));
        assertNotNull("Language information not found for Portlet 1", portlet.getLanguageSet().get(Locale.getDefault()));
        assertNotNull("Content Type html not found.", portlet.getContentTypeSet().get("html/text"));
        assertNotNull("Content Type wml not found.", portlet.getContentTypeSet().get("wml"));
        Iterator itr = portlet.getPreferenceSet().get("preference 1").getValues();
        int valueCount = 0;

        while (itr.hasNext())
        {
            itr.next();
            valueCount++;
        }
        assertEquals("\"preference 1\" did not have 2 values.", 2, valueCount);

        // Pull out our Web app and add a Description to it

        webApp = null;

        app = registry.getPortletApplication("App_1");

        webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();
        assertNotNull("Web app was not located by query.", webApp);
        webApp.addDescription(Locale.getDefault(), "Web app description");

        webApp = null;

        app = registry.getPortletApplication("App_1");
        webApp = (WebApplicationDefinitionImpl) app.getWebApplicationDefinition();

        assertNotNull("Web app was not located by query.", webApp);
        assertNotNull("Web app did NOT persist its description", webApp.getDescription(Locale.FRENCH));

    }
View Full Code Here

        {
            List list = new ArrayList();
            Iterator apps = registry.getPortletApplications().iterator();
            while (apps.hasNext())
            {
                MutablePortletApplication pa = (MutablePortletApplication)apps.next();
                PortletApplicationStatusBean bean = new PortletApplicationStatusBean(pa, portletFactory.isPortletApplicationRegistered(pa));
                list.add(bean);
            }           
            request.getPortletSession().setAttribute("list",list);
        }
View Full Code Here

                // enforce list is rebuild next doView
                request.getPortletSession().removeAttribute("list");
               
                if (!action.equals("refresh") && !isEmpty(value))
                {
                    MutablePortletApplication pa = registry.getPortletApplication(value);
                    if ( pa == null )
                    {
                        publishStatusMessage(request, "PALM", "status", null, "Portlet Application "+pa.getName()+" no longer exists");
                    }
                    else if ( pa.getApplicationType() == MutablePortletApplication.LOCAL )
                    {
                        // TODO
                    }
                    else // ( pa.getApplicationType() == MutablePortletApplication.WEBAPP )
                    {
View Full Code Here

    }
    while (list.hasNext())
    {
      try
      {
        MutablePortletApplication pa = (MutablePortletApplication) list
            .next();
        // PortletApplicationDefinition pa =
        // (PortletApplicationDefinition)list.next();
        applications.add(exportPA(pa));
      } catch (Exception e)
View Full Code Here

    }
    Iterator it = applications.iterator();
    while (it.hasNext())
    {
      JSApplication app = (JSApplication)it.next();
      MutablePortletApplication portletApp = registry.getPortletApplication(app.getName());
      if (portletApp != null)
      {
        importPA(app,portletApp);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.common.portlet.MutablePortletApplication

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.