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

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


    {
        Iterator windows = this.windowAccessor.getPortletWindows().iterator();
        while (windows.hasNext())
        {
            PortletWindow window = (PortletWindow)windows.next();
            PortletDefinitionComposite pd = (PortletDefinitionComposite)window.getPortletEntity().getPortletDefinition();         
            for (int ix = 0; ix < fullPortletNames.size(); ix++)
            {
                if (pd.getUniqueName().equals(fullPortletNames.get(ix)))
                {
                    putIntoService(window);
                }
            }
        }       
View Full Code Here


        List outs = new ArrayList();
        Iterator windows = this.windowAccessor.getPortletWindows().iterator();
        while (windows.hasNext())
        {
            PortletWindow window = (PortletWindow)windows.next();
            PortletDefinitionComposite pd = (PortletDefinitionComposite)window.getPortletEntity().getPortletDefinition();
            if (pd.getUniqueName().equals(fullPortletName) && isOutOfService(window))
            {
                outs.add(window);
            }
        }
        return outs;
View Full Code Here

    {
        List list = new LinkedList();
        Iterator portlets = registry.getAllPortletDefinitions().iterator();
        while ( portlets.hasNext() )
        {
            PortletDefinitionComposite portlet = (PortletDefinitionComposite)portlets.next();
            MutablePortletApplication muta = (MutablePortletApplication)portlet.getPortletApplicationDefinition();
            String appName = muta.getName();
            if ( appName == null )
                continue;
            if ( ! appName.equals( "jetspeed-layouts" ) )
                continue;

            String uniqueName = appName + "::" + portlet.getName();
            list.add( new LayoutInfoImpl( uniqueName,
                      portlet.getDisplayNameText( request.getLocale() ),
                      portlet.getDescriptionText( request.getLocale() ) ) );

        }
        return list;
    }
View Full Code Here

    {
        BaseParsedObject result = null;
        if(o instanceof PortletDefinitionComposite)
        {
            result = new BaseParsedObject();
            PortletDefinitionComposite pd = (PortletDefinitionComposite)o;
           
            //need to get Locale here
            String displayNameText = pd.getDisplayNameText(JetspeedLocale.getDefaultLocale());
            result.setTitle(displayNameText);
           
            String description = pd.getDescriptionText(JetspeedLocale.getDefaultLocale());
            result.setDescription(description);
           
            result.setClassName(pd.getClass().getName());
            result.setKey(KEY_PREFIX + pd.getUniqueName());
            result.setType(ParsedObject.OBJECT_TYPE_PORTLET);
           
            //TODO: this is common to PAs as well, possible refactor
            MultiHashMap fieldMap = new MultiHashMap();
            fieldMap.put(ID, pd.getName());
           
            PortletApplication pa = (PortletApplication)pd.getPortletApplicationDefinition();
            fieldMap.put(PORTLET_APPLICATION, pa.getName());
           
            Collection mdFields = pd.getMetadata().getFields();
            for (Iterator fieldIter = mdFields.iterator(); fieldIter.hasNext();)
            {
                LocalizedField field = (LocalizedField) fieldIter.next();               
                fieldMap.put(field.getName(), field.getValue());
            }
           
            //Handle descriptions
            Iterator descIter = pd.getDescriptionSet().iterator();
            while (descIter.hasNext())
            {
                Description desc = (Description) descIter.next();
                fieldMap.put(ParsedObject.FIELDNAME_DESCRIPTION, desc.getDescription());
            }
           
            //Handle keywords and titles
            Iterator displayNameIter = pd.getDisplayNameSet().iterator();
            while (displayNameIter.hasNext())
            {
                DisplayName displayName = (DisplayName) displayNameIter.next();
                fieldMap.put(ParsedObject.FIELDNAME_TITLE, displayName.getDisplayName());
            }
           
            HashSet keywordSet = new HashSet();
           
            Iterator langIter = pd.getLanguageSet().iterator();
            while (langIter.hasNext())
            {
                Language lang = (Language) langIter.next();
                fieldMap.put(ParsedObject.FIELDNAME_TITLE, lang.getTitle());
                fieldMap.put(ParsedObject.FIELDNAME_TITLE, lang.getShortTitle());
View Full Code Here

            Locale locale = request.getLocale();
            List list = new ArrayList();
           
            while (portlets.hasNext())
            {
                PortletDefinitionComposite portlet = null;
                if (filter == null)
                    portlet = (PortletDefinitionComposite)portlets.next();
                else
                    portlet = this.getPortletFromParsedObject((ParsedObject)portlets.next());
               
                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))
                {
                    String name = portlet.getDisplayNameText(locale);
                    if (name == null)
                    {
                        name = portlet.getName();
                    }
                    list.add(new PortletInfo(uniqueName, name, portlet.getDescriptionText(locale)));
                }
            }           
            BrowserIterator iterator = new PortletIterator(
                    list, resultSetTitleList, resultSetTypeList,
                    windowSize);
View Full Code Here

                app.getApplicationIdentifier().equals("TestRegistry"));
      
        ExtendedPortletMetadata md = new ExtendedPortletMetadata(new FileReader("./test/testdata/deploy/jetspeed-portlet.xml"), app);
        md.load();
      
        PortletDefinitionComposite def1 = (PortletDefinitionComposite)app.getPortletDefinitionByName(PORTLET_01);
        PortletDefinitionComposite def2 = (PortletDefinitionComposite)app.getPortletDefinitionByName(PORTLET_02);
        PortletDefinitionComposite def3 = (PortletDefinitionComposite)app.getPortletDefinitionByName(PORTLET_03);
        PortletDefinitionComposite def4 = (PortletDefinitionComposite)app.getPortletDefinitionByName(PORTLET_04);
       
        Collection titles = app.getMetadata().getFields("title");
        Collection def1Titles = def1.getMetadata().getFields("title");
        Collection def2Subjects = def2.getMetadata().getFields("subject");
        Collection def3Creators = def3.getMetadata().getFields("creator");
        Collection def4Field1 = def4.getMetadata().getFields("field1");
        Collection def4Fiels2 = def4.getMetadata().getFields("field2");
       
        String securityRef = app.getJetspeedSecurityConstraint();
        assertEquals(titles.size(), 3);
        assertEquals(def1Titles.size(), 4);
        assertEquals(def2Subjects.size(), 5);
        assertEquals(def3Creators.size(), 4);
        assertEquals(def4Field1.size(), 3);
        assertEquals(def4Fiels2.size(), 2);
       
        // Security Constraints tests
        assertEquals(securityRef, "admin-only");
        assertEquals(def1.getJetspeedSecurityConstraint(), "users-1");
        assertEquals(def2.getJetspeedSecurityConstraint(), "users-2");
        assertEquals(def3.getJetspeedSecurityConstraint(), "users-4");
        assertNull(def4.getJetspeedSecurityConstraint());
       
        Collection servicesCollection = app.getJetspeedServices();
        assertNotNull("Metadata services is null", servicesCollection);
        assertEquals("Expected 2 service definitions", servicesCollection.size(), 2);
        Object[] services = servicesCollection.toArray();
View Full Code Here

        if (null != pa)
        {
            request.setAttribute(VIEW_PA, new PortletApplicationBean(pa));
           
            String pdefName = (String) request.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
            PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
           
            request.setAttribute(VIEW_PD, pdef);
           
            request.setAttribute("tabs", paTabMap.values());
            request.setAttribute("portlet_tabs", pdTabMap.values());
View Full Code Here

                action = getAction(PORTLET_ACTION_PREFIX, action);
                String pdefName = (String) actionRequest.getPortletSession().getAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
               
                try
                {
                    PortletDefinitionComposite pdef = (PortletDefinitionComposite) pa.getPortletDefinitionByName(pdefName);
                    if(action.endsWith("metadata"))
                    {
                        processMetadataAction(actionRequest, actionResponse, null, pdef, action);
                    }
                    else if(action.endsWith("portlet"))
View Full Code Here

        buffer.append("\">\n");
       
        Iterator portletDefsIter = pa.getPortletDefinitions().iterator();
        while (portletDefsIter.hasNext())
        {
            PortletDefinitionComposite pDef = (PortletDefinitionComposite) portletDefsIter.next();
            buffer.append(createPortletDefinitionXml(pDef));
        }
       
        buffer.append("</portlet-app>\n");
       
View Full Code Here

    {
        assertNotNull(portletRegistry);
        MutablePortletApplication one = portletRegistry.getPortletApplication("PA-001");
        MutablePortletApplication two = portletRegistry.getPortletApplication("PA-001");
        assertEquals(one, two);
        PortletDefinitionComposite def = portletRegistry.getPortletDefinitionByUniqueName("PA-001::Portlet-1");
        assertNotNull(def);
        assertEquals(def.getPortletApplicationDefinition(), one);
        assertEquals(def, two.getPortletDefinitions().iterator().next());
        MutablePortletApplication o = (MutablePortletApplication)portletRegistry.getPortletApplications().iterator().next();
        assertEquals(one, o);
        assertEquals(portletRegistry.getAllPortletDefinitions().iterator().next(), def);
    }
View Full Code Here

TOP

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

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.