Package org.apache.jetspeed.om.portlet

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


                       
                        if (!StringUtils.isBlank(cloneName))
                        {
                            PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
                            PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                            PortletDefinition def = app.getPortlet(paNodeBean.getName());
                            registry.clonePortletDefinition(def, cloneName);
                            StringResourceModel resModel = new StringResourceModel("pam.details.action.status.portlet.cloneOK", this, null, new Object [] { paNodeBean.getName() } );
                            feed.info(resModel.getString());
                        }
                        else
View Full Code Here


    // }

    protected void verifyData(boolean afterUpdates) throws Exception
    {
        PortletApplication app;
        PortletDefinition portlet;

        app = null;

        app = registry.getPortletApplication("App_1");

        portlet = (PortletDefinitionImpl) app.getPortlet("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("Portlet was not saved along with the portlet app.", app.getPortlet("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 = 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
                .getApplication());
        assertNotNull("French description was not materialized for the app.", app.getDescription(Locale.FRENCH));
        assertNotNull("French display name was not materialized for the app.", app.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.getInitParam("testparam"));
        // TODO: fix the following line. just comments out for now.
        //assertNotNull("\"preference 1\" was not found.", portlet.getPortletPreferences().getPortletPreference("preference 1"));
        assertNotNull("Language information not found for Portlet 1", portlet.getLanguage(Locale.getDefault()));
        assertNotNull("Content Type html not found.", portlet.getSupports("html/text"));
        assertNotNull("Content Type wml not found.", portlet.getSupports("wml"));
        // TODO: fix the following lines. just comments out for now.
        //Iterator itr = portlet.getPortletPreferences().getPortletPreference("preference 1").getValues().iterator();
        //int valueCount = 0;
        //while (itr.hasNext())
        //{
View Full Code Here

        else
            portlets = searchEngine.search(filter).getResults().iterator();
       
        while (portlets.hasNext())
        {
            PortletDefinition portlet = null;
            if (filter == null)
                portlet = (PortletDefinition)portlets.next();
            else
                portlet = this.getPortletFromParsedObject((ParsedObject)portlets.next());
           
            if (portlet == null)
                continue;
           
            // Do not display Jetspeed Layout Applications
            PortletApplication pa = (PortletApplication)portlet.getApplication();
            if (pa.isLayoutApplication())
                continue;
                
            // SECURITY filtering
            String uniqueName = pa.getName() + "::" + portlet.getPortletName();
            if (securityAccessController.checkPortletAccess(portlet, JetspeedActions.MASK_VIEW))
            {
                InitParam param = portlet.getInitParam(PORTLET_ICON);
                String image;
                if (param != null)
                {
                    //String relativeImagePath = param.getValue();
                    //String context = muta.getWebApplicationDefinition().getContextRoot();
                    // Have to use a supported icon in jetspeed, otherwise image can be out of skew
                    image = "images/portlets/" + param.getParamValue();
                }
                else
                {                                       
                    image = "images/portlets/applications-internet.png";
                }               
                list.add(new PortletInfo(uniqueName, portlet.getDisplayNameText(locale), portlet.getDescriptionText(locale), image));
            }
        }           
        Collections.sort(list, this);
        return list;
    }
View Full Code Here

    }
   
    private PortletWindow createPortletWindow(ContentFragment fragment)
    {
        PortletWindow window = null;
        PortletDefinition pd = rcc.getPortletRegistry().getPortletDefinitionByUniqueName(fragment.getName(), true);
        if (pd != null)
        {
            window = new PortletWindowImpl(this, fragment, pd);
        }
        else
View Full Code Here

                        privateParameters.put(entry.getKey(), combined);
                    }
                }
            }
           
            PortletDefinition portletDef = window.getPortletDefinition();
            GenericMetadata metaData = portletDef.getMetadata();
            if (!mergeRequestParameters)
            {
                mergeRequestParameters =
                    getMetaDataBooleanValue(
                        metaData,
View Full Code Here

    }

    protected JetspeedPortletInvoker getInvoker(PortletRequestContext requestContext)
    {
        JetspeedPortletInvoker invoker;
        PortletDefinition portletDefinition = (PortletDefinition)requestContext.getPortletWindow().getPortletDefinition();
        if (portletDefinition.getApplication().getApplicationType() == PortletApplication.LOCAL)
        {
            invoker = new LocalPortletInvoker(portalContext, requestResponseUnwrapper);
        }
        else
        {
View Full Code Here

    public void invoke(PortletRequestContext requestContext, PortletRequest portletRequest, PortletResponse portletResponse,
                       PortletWindow.Action action, FilterManager filter)
        throws PortletException, IOException
    {
        PortletWindowImpl window = (PortletWindowImpl)requestContext.getPortletWindow();
        PortletDefinition portletDefinition = window.getPortletDefinition();
        PortletApplication app = portletDefinition.getApplication();

        String appContextPath = app.getContextPath();

        ServletContext appContext = jetspeedContext.getContext(appContextPath);
        if (null == appContext)
View Full Code Here

        PortletApplicationDefinition pa = registry.getPortletApplication(TEST_APP);
        assertNotNull("Portlet Application", pa);
        System.out.println("pa = " + pa.getName());
        List<PortletDefinition> portlets = (List<PortletDefinition>) pa.getPortlets(); // .get(JetspeedObjectID.createFromString(TEST_PORTLET));
        Iterator pi = portlets.iterator();
        PortletDefinition pd = null;
        while (pi.hasNext())
        {
            pd = (PortletDefinition) pi.next();
            assertTrue("Portlet Def not found", pd.getPortletName().equals("EntityTestPortlet"));
        }
        assertNotNull("Portlet Def is null", pd);

        Mock mockf1 = new Mock(Fragment.class);
        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getName").will(new ReturnStub(pd.getUniqueName()));
        mockf1.expects(new InvokeAtLeastOnceMatcher()).method("getId").will(new ReturnStub(TEST_ENTITY));
        ContentFragment f1 = new ContentFragmentTestImpl((Fragment) mockf1.proxy(), new HashMap());

        PortletEntity entity = entityAccess
                .generateEntityFromFragment(new ContentFragmentTestImpl(f1, new HashMap()));
View Full Code Here

        PortletApplicationDefinitionImpl app = new PortletApplicationDefinitionImpl();
        app.setName(TEST_APP);
        app.setContextPath("/app1");

        PortletDefinition portlet = app.addPortlet(TEST_PORTLET);
        portlet.setPortletClass("org.apache.Portlet");
        portlet.addDescription(lang).setDescription("Portlet description.");
        portlet.addDisplayName(lang).setDisplayName("Portlet display Name.");
       
        InitParam initParam = portlet.addInitParam("testparam");
        initParam.setParamValue("test value");
        initParam.addDescription(lang).setDescription("This is a test portlet parameter");
       
        Preferences prefs = portlet.getPortletPreferences();
        Preference pref = prefs.addPreference("pref1");
        pref.addValue("1");

        registry.registerPortletApplication(app);
    }
View Full Code Here

        this.portletFactory = portletFactory;
    }
   
    public FilterManager getFilterManager(PortletWindow window, String lifeCycle)
    {
        PortletDefinition def = ((org.apache.jetspeed.container.PortletWindow) window).getPortletDefinition();
        return new JetspeedFilterManager(this.portletFactory, def.getApplication(), def.getPortletName(), lifeCycle);
    }
View Full Code Here

TOP

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