Examples of PortletDefinitionImpl


Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        assertNotNull("statistics service is null", statistics);

        RequestContext request = initRequestContext();
        PortletApplicationDefinitionImpl app = new PortletApplicationDefinitionImpl();
        app.setName("MyApp");
        PortletDefinitionImpl portlet = new PortletDefinitionImpl();
        portlet.setPortletApplicationDefinition(app);
        portlet.setName("TestPortlet");
        portlet.setPortletApplicationDefinition(app);
        long elapsedTime = 123;
        statistics.logPortletAccess(request, portlet.getUniqueName(), "401",
                elapsedTime);
        statistics.logPageAccess(request, "401", elapsedTime);
        statistics.logUserLogin(request, elapsedTime);

        assertEquals("number of users incorrect", 1, statistics
View Full Code Here

Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        for (int i = 0; i < x; i++)
        {
            RequestContext request = initRequestContext();
            PortletApplicationDefinitionImpl app = new PortletApplicationDefinitionImpl();
            app.setName("MyApp");
            PortletDefinitionImpl portlet = new PortletDefinitionImpl();
            portlet.setPortletApplicationDefinition(app);
            portlet.setName("TestPortlet");
            portlet.setPortletApplicationDefinition(app);
            long elapsedTime = 123 + i;
            //System.out.println("logging something, number "+i);
            statistics.logPortletAccess(request, portlet.getUniqueName(),
                    "401", elapsedTime);
            statistics.logPageAccess(request, "401", elapsedTime);
            statistics.logUserLogin(request, elapsedTime);
            assertEquals("number of users incorrect", 1, statistics
                    .getNumberOfCurrentUsers());
View Full Code Here

Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        WebApplicationDefinitionImpl webApp = new WebApplicationDefinitionImpl();
        webApp.setContextRoot("/app1");
        webApp.addDescription(Locale.FRENCH, "Description: Le fromage est dans mon pantalon!");
        webApp.addDisplayName(Locale.FRENCH, "Display Name: Le fromage est dans mon pantalon!");

        PortletDefinitionComposite portlet = new PortletDefinitionImpl();
        portlet.setClassName("org.apache.Portlet");
        portlet.setName("Portlet 1");
        portlet.addDescription(Locale.getDefault(), "POrtlet description.");
        portlet.addDisplayName(Locale.getDefault(), "Portlet display Name.");

        portlet.addInitParameter("testparam", "test value", "This is a test portlet parameter", Locale.getDefault());

        addDublinCore(portlet.getMetadata());

        // PreferenceComposite pc = new PrefsPreference();
        app.addPortletDefinition(portlet);
        PreferenceSetCtrl prefSetCtrl = (PreferenceSetCtrl) portlet.getPreferenceSet();
        PreferenceComposite pc = (PreferenceComposite) prefSetCtrl.add("preference 1", Arrays.asList(new String[]
        { "value 1", "value 2" }));
        pc.addDescription(JetspeedLocale.getDefaultLocale(), "Preference Description");

        assertNotNull(pc.getValueAt(0));

        portlet.addLanguage(portletRegistry.createLanguage(Locale.getDefault(), "Portlet 1", "Portlet 1",
                "This is Portlet 1", null));

        ContentTypeComposite html = new ContentTypeImpl();
        html.setContentType("html/text");
        ContentTypeComposite wml = new ContentTypeImpl();
        html.addPortletMode(new PortletMode(MODE_EDIT));
        html.addPortletMode(new PortletMode(MODE_VIEW));
        html.addPortletMode(new PortletMode(MODE_HELP));
        wml.setContentType("wml");
        wml.addPortletMode(new PortletMode(MODE_HELP));
        wml.addPortletMode(new PortletMode(MODE_VIEW));
        portlet.addContentType(html);
        portlet.addContentType(wml);

        app.setWebApplicationDefinition(webApp);
        portletRegistry.updatePortletApplication(app);
    }
View Full Code Here

Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        WebApplicationDefinitionImpl webApp = new WebApplicationDefinitionImpl();
        webApp.setContextRoot("/app1");
        webApp.addDescription(Locale.FRENCH, "Description: Le fromage est dans mon pantalon!");
        webApp.addDisplayName(Locale.FRENCH, "Display Name: Le fromage est dans mon pantalon!");

        PortletDefinitionComposite portlet = new PortletDefinitionImpl();
        portlet.setClassName("org.apache.Portlet");
        portlet.setName(TEST_PORTLET);
        portlet.addDescription(Locale.getDefault(), "Portlet description.");
        portlet.addDisplayName(Locale.getDefault(), "Portlet display Name.");

        portlet.addInitParameter("testparam", "test value", "This is a test portlet parameter", Locale.getDefault());

        app.addPortletDefinition(portlet);

        app.setWebApplicationDefinition(webApp);

        PreferenceSetComposite prefSet = (PreferenceSetComposite) portlet.getPreferenceSet();
        prefSet.add("pref1", Arrays.asList(new String[]
        { "1" }));

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

Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        WebApplicationDefinitionImpl webApp = new WebApplicationDefinitionImpl();
        webApp.setContextRoot("/app1");
        webApp.addDescription(Locale.FRENCH, "Description: La fromage est dans ma pantalon!");
        webApp.addDisplayName(Locale.FRENCH, "Display Name: La fromage est dans ma pantalon!");

        PortletDefinitionComposite portlet = new PortletDefinitionImpl();
        portlet.setClassName("org.apache.Portlet");
        portlet.setName("Portlet 1");
        portlet.addDescription(Locale.getDefault(), "POrtlet description.");
        portlet.addDisplayName(Locale.getDefault(), "Portlet display Name.");

        portlet.addInitParameter("testparam", "test value", "This is a test portlet parameter", Locale.getDefault());

        addDublinCore(portlet.getMetadata());

        // PreferenceComposite pc = new PrefsPreference();
        app.addPortletDefinition(portlet);
        PreferenceSetCtrl prefSetCtrl = (PreferenceSetCtrl) portlet.getPreferenceSet();
        PreferenceComposite pc = (PreferenceComposite) prefSetCtrl.add("preference 1", Arrays.asList(new String[]{
                "value 1", "value 2"}));
        pc.addDescription(JetspeedLocale.getDefaultLocale(), "Preference Description");

        assertNotNull(pc.getValueAt(0));

        portlet.addLanguage(registry.createLanguage(Locale.getDefault(), "Portlet 1", "Portlet 1", "This is Portlet 1",
                null));

        ContentTypeComposite html = new ContentTypeImpl();
        html.setContentType("html/text");
        ContentTypeComposite wml = new ContentTypeImpl();
        html.addPortletMode(new PortletMode(MODE_EDIT));
        html.addPortletMode(new PortletMode(MODE_VIEW));
        html.addPortletMode(new PortletMode(MODE_HELP));
        wml.setContentType("wml");
        wml.addPortletMode(new PortletMode(MODE_HELP));
        wml.addPortletMode(new PortletMode(MODE_VIEW));
        portlet.addContentType(html);
        portlet.addContentType(wml);

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

Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        WebApplicationDefinitionImpl webApp = new WebApplicationDefinitionImpl();
        webApp.setContextRoot("/app1");
        webApp.addDescription(Locale.FRENCH, "Description: Le fromage est dans mon pantalon!");
        webApp.addDisplayName(Locale.FRENCH, "Display Name: Le fromage est dans mon pantalon!");
       
        PortletDefinitionComposite portlet = new PortletDefinitionImpl();
        portlet.setClassName("org.apache.Portlet");
        portlet.setName(TEST_PORTLET);
        portlet.addDescription(Locale.getDefault(),"Portlet description.");
        portlet.addDisplayName(Locale.getDefault(),"Portlet display Name.");
       
        portlet.addInitParameter("testparam", "test value", "This is a test portlet parameter", Locale.getDefault());
                       
        app.addPortletDefinition(portlet);     
   
        app.setWebApplicationDefinition(webApp);
       
        PreferenceSetComposite prefSet = (PreferenceSetComposite) portlet.getPreferenceSet();
        prefSet.add("pref1", Arrays.asList(new String[]{"1"}));
       
        registry.registerPortletApplication(app);          
    }
View Full Code Here

Examples of org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl

        if (this.portletDefinitionExists(newPortletName, source.getApplication()))
        {
            throw new FailedToStorePortletDefinitionException("Cannot clone to portlet named " + newPortletName + ", name already exists");
        }
       
        PortletDefinitionImpl copy = new PortletDefinitionImpl();
       
        // First set the name and display name
       
        copy.setPortletName(newPortletName);
        DisplayName displayName = copy.addDisplayName(JetspeedLocale.getDefaultLocale().getLanguage());
        displayName.setDisplayName(newPortletName);
       
        // And, then, copy all attributes
       
        copy.setApplication(source.getApplication());
        copy.setPortletClass(source.getPortletClass());
        copy.setResourceBundle(source.getResourceBundle());
        copy.setPreferenceValidatorClassname(source.getPreferenceValidatorClassname());
        copy.setExpirationCache(source.getExpirationCache());
        copy.setCacheScope(source.getCacheScope());
       
        for (LocalizedField field : source.getMetadata().getFields())
        {
            copy.getMetadata().addField(field.getLocale(), field.getName(), field.getValue());
        }
       
        copy.setJetspeedSecurityConstraint(source.getJetspeedSecurityConstraint());
       
        for (Description desc : source.getDescriptions())
        {
            Description copyDesc = copy.addDescription(desc.getLang());
            copyDesc.setDescription(desc.getDescription());
        }

        for (InitParam initParam : source.getInitParams())
        {
            InitParam copyInitParam = copy.addInitParam(initParam.getParamName());
            copyInitParam.setParamValue(initParam.getParamValue());
           
            for (Description desc : initParam.getDescriptions())
            {
                Description copyDesc = copyInitParam.addDescription(desc.getLang());
                copyDesc.setDescription(desc.getDescription());
            }
        }
       
        for (EventDefinitionReference eventDefRef : source.getSupportedProcessingEvents())
        {
            copy.addSupportedProcessingEvent(eventDefRef.getQName());
        }

        for (EventDefinitionReference eventDefRef : source.getSupportedPublishingEvents())
        {
            copy.addSupportedPublishingEvent(eventDefRef.getQName());
        }
       
        for (SecurityRoleRef secRoleRef : source.getSecurityRoleRefs())
        {
            SecurityRoleRef copySecRoleRef = copy.addSecurityRoleRef(secRoleRef.getRoleName());
            copySecRoleRef.setRoleLink(secRoleRef.getRoleLink());
           
            for (Description desc : secRoleRef.getDescriptions())
            {
                Description copyDesc = copySecRoleRef.addDescription(desc.getLang());
                copyDesc.setDescription(desc.getDescription());
            }
        }
       
        for (Supports supports : source.getSupports())
        {
            Supports copySupports = copy.addSupports(supports.getMimeType());
           
            for (String portletMode : supports.getPortletModes())
            {
                copySupports.addPortletMode(portletMode);
            }
           
            for (String windowState : supports.getWindowStates())
            {
                copySupports.addWindowState(windowState);
            }
        }
       
        for (Language language : source.getLanguages())
        {
            Language copyLanguage = copy.addLanguage(language.getLocale());
            copyLanguage.setTitle(language.getTitle());
            copyLanguage.setShortTitle(language.getShortTitle());
            copyLanguage.setKeywords(language.getKeywords());
            copyLanguage.setSupportedLocale(language.isSupportedLocale());
        }
       
        for (ContainerRuntimeOption runtimeOption : source.getContainerRuntimeOptions())
        {
            ContainerRuntimeOption copyRuntimeOption = copy.addContainerRuntimeOption(runtimeOption.getName());
           
            for (String value : runtimeOption.getValues())
            {
                copyRuntimeOption.addValue(value);
            }
        }
       
        copy.getSupportedPublicRenderParameters().addAll(source.getSupportedPublicRenderParameters());
       
        //savePortletDefinition(copy);
        source.getApplication().getPortlets().add(copy);
        try
        {
            updatePortletApplication(source.getApplication());
        }
        catch (RegistryException e)
        {
            throw new FailedToStorePortletDefinitionException(e);
        }
        for (Preference pref : source.getPortletPreferences().getPortletPreferences())
        {
            Preference copyPref = copy.addDescriptorPreference(pref.getName());
            copyPref.setReadOnly(pref.isReadOnly());
           
            for (String value : pref.getValues())
            {
                copyPref.addValue(value);
View Full Code Here

Examples of org.jasig.portal.container.om.portlet.PortletDefinitionImpl

            if (portletDefinitionId == null) {
                throw new PortalException("Missing publish parameter '" + portletDefinitionIdParamName + "'");
            }
           
            // Create the PortletDefinition
            PortletDefinitionImpl portletDefinition = (PortletDefinitionImpl)InformationProviderAccess.getStaticProvider().getPortletDefinition(ObjectIDImpl.createFromString(portletDefinitionId));
            if (portletDefinition == null) {
                throw new PortalException("Unable to find portlet definition for ID '" + portletDefinitionId + "'");
            }
            ChannelDefinition channelDefinition = ChannelRegistryStoreFactory.getChannelRegistryStoreImpl().getChannelDefinition(Integer.parseInt(sd.getChannelPublishId()));
            portletDefinition.setChannelDefinition(channelDefinition);
            portletDefinition.loadPreferences();

            // Create the PortletApplicationEntity
            final PortletApplicationEntityImpl portAppEnt = new PortletApplicationEntityImpl();
            portAppEnt.setId(portletDefinition.getId().toString());
            portAppEnt.setPortletApplicationDefinition(portletDefinition.getPortletApplicationDefinition());
           
            // Create the PortletEntity
            PortletEntityImpl portletEntity = new PortletEntityImpl();
            portletEntity.setId(sd.getChannelPublishId());
            portletEntity.setPortletDefinition(portletDefinition);
            portletEntity.setPortletApplicationEntity(portAppEnt);
            portletEntity.setUserLayout(pcs.getUserPreferencesManager().getUserLayoutManager().getUserLayout());
            portletEntity.setChannelDescription((IUserLayoutChannelDescription)pcs.getUserPreferencesManager().getUserLayoutManager().getNode(sd.getChannelSubscribeId()));
            portletEntity.setPerson(sd.getPerson());
            portletEntity.loadPreferences();
           
            // Add the user information into the request See PLT.17.2.
            Map userInfo = cd.getUserInfo();
           
            if (userInfo == null) {
                UserAttributeListImpl userAttributeList = ((PortletApplicationDefinitionImpl)portletDefinition.getPortletApplicationDefinition()).getUserAttributes();
               
                // here we ask an overridable method to get the user attributes.
                // you can extend CPortletAdapter to change the implementation of
                // how we get user attributes.  This whole initPortletWindow method
                // is also overridable.
                //
                // Note that we will only call getUserInfo() once.
                userInfo = getUserInfo(uid, sd, userAttributeList);
                if (log.isTraceEnabled()) {
                    log.trace("For user [" + uid + "] got user info : [" + userInfo + "]");
                }
                cd.setUserInfo(userInfo);
            }
           
            // Wrap the request
            ServletRequestImpl wrappedRequest = new ServletRequestImpl(pcs.getHttpServletRequest(), sd.getPerson(), portletDefinition.getInitSecurityRoleRefSet());
            
            // Now create the PortletWindow and hold a reference to it
            PortletWindowImpl portletWindow = new PortletWindowImpl();
            portletWindow.setId(sd.getChannelSubscribeId());
            portletWindow.setPortletEntity(portletEntity);
View Full Code Here

Examples of org.jasig.portal.container.om.portlet.PortletDefinitionImpl

        NodeList portletNL = portletAppE.getElementsByTagName("portlet");
        for (int i = 0; i < portletNL.getLength(); i += 1) {
            Element portletE = (Element)portletNL.item(i);
            String portletName = XML.getChildElementText(portletE, "portlet-name");
            String portletDefinitionId = contextName + "." + portletName;
            PortletDefinitionImpl portletDefinition = new PortletDefinitionImpl();
            portletDefinition.setId(portletDefinitionId);
            portletDefinition.setClassName(XML.getChildElementText(portletE, "portlet-class"));          
            portletDefinition.setName(portletName);
            portletDefinition.setDisplayNames(getDisplayNames(portletE));
            portletDefinition.setDescriptions(getDescriptions(portletE));
            portletDefinition.setLanguages(getLanguages(portletE));
            portletDefinition.setInitParameters(getInitParameters(portletE));
            portletDefinition.setPreferences(getPreferences(portletE));
            portletDefinition.setContentTypes(getContentTypes(portletE));
            portletDefinition.setServletDefinition(webApplicationDefinition.getServletDefinitionList().get(portletName));
            portletDefinition.setPortletApplicationDefinition(portletApplicationDefinition);
            portletDefinition.setExpirationCache(XML.getChildElementText(portletE, "expiration-cache"));
            portletDefinition.setInitSecurityRoleRefSet(getSecurityRoleRefs(portletE));
           
            portletDefinitions.add(portletDefinitionId, portletDefinition);
        }       
        return portletDefinitions;
    }
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletDefinitionImpl

        Validate.notNull(clazz);
       
        this.internalId = -1;
        this.channelType = channelType;
        this.portletDefinitions = new LinkedHashSet<IPortletDefinition>();
        this.portletDefinitions.add(new PortletDefinitionImpl(this));
        this.name = name;
        this.fname = fname;
        this.title = title;
        this.clazz = clazz;
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.