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

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


                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)
View Full Code Here


    {
        if (src.description != null)
        {
            for (DescriptionType d : src.description)
            {
                Description desc = target.addDescription(d.lang);
                desc.setDescription(d.value);
            }
        }
        if (src.displayName != null)
        {
            for (DisplayNameType d : src.displayName)
            {
                DisplayName dname = target.addDisplayName(d.lang);
                dname.setDisplayName(d.value);
            }
        }
        target.setPortletClass(src.portletClass);
        if (src.expirationCache != null)
        {
            target.setExpirationCache(src.expirationCache.intValue());
        }
        if (src.initParam != null)
        {
            for (InitParamType p : src.initParam)
            {
                InitParam param = target.addInitParam(p.name);
                param.setParamValue(p.value);
                if (p.description != null)
                {
                    for (DescriptionType d : p.description)
                    {
                        Description desc = param.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
        if (src.supports != null)
        {
            for (SupportsType st : src.supports)
            {
                Supports s = target.addSupports(st.mimeType);
                if (st.portletMode != null)
                {
                    for (String mode : st.portletMode)
                    {
                        s.addPortletMode(mode);
                    }
                }
            }
        }
        if (src.supportedLocale != null)
        {
            for (String lang : src.supportedLocale)
            {
                target.addSupportedLocale(lang);
            }
        }
        target.setResourceBundle(src.resourceBundle);
        if (src.portletInfo != null)
        {
            PortletInfo pi = target.getPortletInfo();
            pi.setTitle(src.portletInfo.title);
            pi.setShortTitle(src.portletInfo.shortTitle);
            pi.setKeywords(src.portletInfo.keywords);
        }
        if (src.portletPreferences != null)
        {
            Preferences prefs = target.getPortletPreferences();
            prefs.setPreferencesValidator(src.portletPreferences.preferencesValidator);
            if (src.portletPreferences.preference != null)
            {
                for (PreferenceType p : src.portletPreferences.preference)
                {
                    Preference pref = prefs.addPreference(p.name);
                    if (p.value != null)
                    {
                        for (String value : p.value)
                        {
                            pref.addValue(value);
                        }
                    }
                    if (p.readOnly != null)
                    {
                        pref.setReadOnly(p.readOnly.booleanValue());
                    }
                }
            }
        }
        if (src.securityRoleRef != null)
        {
            for (SecurityRoleRefType rrt : src.securityRoleRef)
            {
                SecurityRoleRef srr = target.addSecurityRoleRef(rrt.roleName);
                srr.setRoleLink(rrt.roleLink);
                if (rrt.description != null)
                {
                    for (DescriptionType d : rrt.description)
                    {
                        Description desc = srr.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
    }
View Full Code Here

                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)
View Full Code Here

    {
        if (src.description != null)
        {
            for (DescriptionType d : src.description)
            {
                Description desc = target.addDescription(d.lang);
                desc.setDescription(d.value);
            }
        }
        if (src.displayName != null)
        {
            for (DisplayNameType d : src.displayName)
            {
                DisplayName dname = target.addDisplayName(d.lang);
                dname.setDisplayName(d.value);
            }
        }
        target.setPortletClass(src.portletClass);
        if (src.expirationCache != null)
        {
            target.setExpirationCache(src.expirationCache.intValue());
        }
        if (src.initParam != null)
        {
            for (InitParamType p : src.initParam)
            {
                InitParam param = target.addInitParam(p.name);
                param.setParamValue(p.value);
                if (p.description != null)
                {
                    for (DescriptionType d : p.description)
                    {
                        Description desc = param.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
        if (src.supports != null)
        {
            for (SupportsType st : src.supports)
            {
                Supports s = target.addSupports(st.mimeType);
                if (st.portletMode != null)
                {
                    for (String mode : st.portletMode)
                    {
                        s.addPortletMode(mode);
                    }
                }
            }
        }
        if (src.supportedLocale != null)
        {
            for (String lang : src.supportedLocale)
            {
                target.addSupportedLocale(lang);
            }
        }
        target.setResourceBundle(src.resourceBundle);
        if (src.portletInfo != null)
        {
            PortletInfo pi = target.getPortletInfo();
            pi.setTitle(src.portletInfo.title);
            pi.setShortTitle(src.portletInfo.shortTitle);
            pi.setKeywords(src.portletInfo.keywords);
        }
        if (src.portletPreferences != null)
        {
            Preferences prefs = target.getPortletPreferences();
            prefs.setPreferencesValidator(src.portletPreferences.preferencesValidator);
            if (src.portletPreferences.preference != null)
            {
                for (PreferenceType p : src.portletPreferences.preference)
                {
                    Preference pref = prefs.addPreference(p.name);
                    if (p.value != null)
                    {
                        for (String value : p.value)
                        {
                            pref.addValue(value);
                        }
                    }
                    if (p.readOnly != null)
                    {
                        pref.setReadOnly(p.readOnly.booleanValue());
                    }
                }
            }
        }
        if (src.securityRoleRef != null)
        {
            for (SecurityRoleRefType rrt : src.securityRoleRef)
            {
                SecurityRoleRef srr = target.addSecurityRoleRef(rrt.roleName);
                srr.setRoleLink(rrt.roleLink);
                if (rrt.description != null)
                {
                    for (DescriptionType d : rrt.description)
                    {
                        Description desc = srr.addDescription(d.lang);
                        desc.setDescription(d.value);
                    }
                }
            }
        }
    }
View Full Code Here

        // retrieve description entries
        nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"description", document, XPathConstants.NODESET);
        if (nodes != null)
        {
            Description d;
            for (int i = 0, size = nodes.getLength(); i < size; i++)
            {
                element = (Element)nodes.item(i);
                String lang = element.getAttributeNS(XMLConstants.XML_NS_URI, "lang");
                if (lang == null)
                {
                    lang = "en";
                }
                d = pa.getDescription(JetspeedLocale.convertStringToLocale(lang));
                if (d == null)
                {
                    d = pa.addDescription(lang);
                }
                // else: overwrite description with last found entry
               
                d.setDescription(element.getTextContent().trim());
            }
        }
       
        // retrieve security-role
        nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"security-role", document, XPathConstants.NODESET);
        if (nodes != null)
        {
            String roleName;
            SecurityRole r;
            Description d;
            for (int i = 0, nsize = nodes.getLength(); i < nsize; i++)
            {
                element = (Element)nodes.item(i);
                children = element.getElementsByTagName("role-name");
                if (children != null && children.getLength() != 0)
                {
                    roleName = children.item(0).getTextContent().trim();
                    if (roleName.length() > 0)
                    {
                        r = null;
                        for (SecurityRole sr : pa.getSecurityRoles())
                        {
                            if (sr.getName().equals(roleName))
                            {
                                r = sr;
                                break;
                            }
                        }
                        if (r == null)
                        {
                            r = pa.addSecurityRole(roleName);
                        }
                        // else: overwrite or merge existing descriptions with those of this last found entry
                       
                        children = element.getElementsByTagName("description");
                        if (children != null)
                        {
                            for (int j = 0, csize = children.getLength(); j < csize; j++)
                            {
                                element = (Element)children.item(j);
                                String lang = element.getAttributeNS(XMLConstants.XML_NS_URI, "lang");
                                if (lang == null)
                                {
                                    lang = "en";
                                }
                                if (r.getDescription(JetspeedLocale.convertStringToLocale(lang)) == null)
                                {
                                    d = r.addDescription(lang);
                                    d.setDescription(element.getTextContent());
                                }
                            }
                        }
                    }
                }
View Full Code Here

        {
            CustomPortletMode jcpm = jpa.addCustomPortletMode(cpm.getPortletMode());
            jcpm.setPortalManaged(cpm.isPortalManaged());
            for (org.apache.pluto.container.om.portlet.Description desc : cpm.getDescriptions())
            {
                Description jdesc = jcpm.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }           
        }
        for (org.apache.pluto.container.om.portlet.CustomWindowState cws : pa.getCustomWindowStates())
        {
            CustomWindowState jcws = jpa.addCustomWindowState(cws.getWindowState());
            for (org.apache.pluto.container.om.portlet.Description desc : cws.getDescriptions())
            {
                Description jdesc = jcws.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }           
        }       
        for (org.apache.pluto.container.om.portlet.EventDefinition ed : pa.getEventDefinitions())
        {
            EventDefinition jed = null;
            if (ed.getQName() != null)
            {
                jed = jpa.addEventDefinition(ed.getQName());
            }
            else
            {
                jed =jpa.addEventDefinition(ed.getName());
            }
            jed.setValueType(ed.getValueType());
            for (QName alias : ed.getAliases())
            {
                jed.addAlias(alias);
            }
            for (org.apache.pluto.container.om.portlet.Description desc : ed.getDescriptions())
            {
                Description jdesc = jed.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                       
        }
        for (org.apache.pluto.container.om.portlet.FilterMapping fm : pa.getFilterMappings())
        {
            FilterMapping jfm = jpa.addFilterMapping(fm.getFilterName());
            for (String portletName : fm.getPortletNames())
            {
                jfm.addPortletName(portletName);
            }
        }
        for (org.apache.pluto.container.om.portlet.Filter f : pa.getFilters())
        {
            Filter jf = jpa.addFilter(f.getFilterName());
            jf.setFilterClass(f.getFilterClass());
            for (org.apache.pluto.container.om.portlet.Description desc : f.getDescriptions())
            {
                Description jdesc = jf.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                  
            for (org.apache.pluto.container.om.portlet.DisplayName dn : f.getDisplayNames())
            {
                DisplayName jdn = jf.addDisplayName(dn.getLang());
                jdn.setDisplayName(dn.getDisplayName());
            }
            for (org.apache.pluto.container.om.portlet.InitParam ip : f.getInitParams())
            {
                InitParam jip = jf.addInitParam(ip.getParamName());
                jip.setParamValue(ip.getParamValue());
                for (org.apache.pluto.container.om.portlet.Description desc : ip.getDescriptions())
                {
                    Description jdesc = jip.addDescription(desc.getLang());
                    jdesc.setDescription(desc.getDescription());
                }                                       
            }
            for (String lc : f.getLifecycles())
            {
                jf.addLifecycle(lc);
            }           
        }
        for (org.apache.pluto.container.om.portlet.Listener l : pa.getListeners())
        {
            Listener jl = jpa.addListener(l.getListenerClass());
            for (org.apache.pluto.container.om.portlet.Description desc : l.getDescriptions())
            {
                Description jdesc = jl.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                       
            for (org.apache.pluto.container.om.portlet.DisplayName dn : l.getDisplayNames())
            {
                DisplayName jdn = jl.addDisplayName(dn.getLang());
                jdn.setDisplayName(dn.getDisplayName());
            }
        }
        for (org.apache.pluto.container.om.portlet.PublicRenderParameter prd : pa.getPublicRenderParameters())
        {           
            PublicRenderParameter jprp = null;
            if (prd.getQName() != null)
            {
                jprp = jpa.addPublicRenderParameter(prd.getQName(), prd.getIdentifier());
            }
            else
            {
                jprp = jpa.addPublicRenderParameter(prd.getName(), prd.getIdentifier());
            }
            for (QName alias : prd.getAliases())
            {
                jprp.addAlias(alias);
            }
            for (org.apache.pluto.container.om.portlet.Description desc : prd.getDescriptions())
            {
                Description jdesc = jprp.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }
        }
        for (org.apache.pluto.container.om.portlet.SecurityConstraint sc :  pa.getSecurityConstraints())
        {
            SecurityConstraint jsc = jpa.addSecurityConstraint(sc.getUserDataConstraint().getTransportGuarantee());
            for (org.apache.pluto.container.om.portlet.DisplayName dn : sc.getDisplayNames())
            {
                DisplayName jdn = jsc.addDisplayName(dn.getLang());
                jdn.setDisplayName(dn.getDisplayName());
            }
            for (String portletName : sc.getPortletNames())
            {
                jsc.addPortletName(portletName);
            }           
        }
        for (org.apache.pluto.container.om.portlet.UserAttribute ua : pa.getUserAttributes())
        {
            UserAttribute jua = jpa.addUserAttribute(ua.getName());
            for (org.apache.pluto.container.om.portlet.Description desc : ua.getDescriptions())
            {
                Description jdesc = jua.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                                   
        }
        return jpa;
    }
View Full Code Here

                jcro.addValue(value);
            }
        }
        for (org.apache.pluto.container.om.portlet.Description desc : pd.getDescriptions())
        {
            Description jdesc = jpd.addDescription(desc.getLang());
            jdesc.setDescription(desc.getDescription());
        }                       
        for (org.apache.pluto.container.om.portlet.DisplayName dn : pd.getDisplayNames())
        {
            DisplayName jdn = jpd.addDisplayName(dn.getLang());
            jdn.setDisplayName(dn.getDisplayName());
        }
        for (org.apache.pluto.container.om.portlet.InitParam ip : pd.getInitParams())
        {
            InitParam jip = jpd.addInitParam(ip.getParamName());
            jip.setParamValue(ip.getParamValue());
            for (org.apache.pluto.container.om.portlet.Description desc : ip.getDescriptions())
            {
                Description jdesc = jip.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                       
        }
        for (org.apache.pluto.container.om.portlet.SecurityRoleRef srr : pd.getSecurityRoleRefs())
        {
            SecurityRoleRef jsrr = jpd.addSecurityRoleRef(srr.getRoleName());
View Full Code Here

            }
            for (org.apache.jetspeed.om.portlet.jetspeed.jaxb.UserAttributeRef ref : pa.getUserAttributeRefs())
            {
                UserAttributeRef jref = app.addUserAttributeRef(ref.getName());
                jref.setNameLink(ref.getNameLink());
                Description desc = jref.addDescription("en");
                desc.setDescription(ref.getDescription());
            }
        }
        catch (JAXBException je)
        {
            throw new IOException(je.getMessage());
View Full Code Here

        // retrieve description entries
        nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"description", document, XPathConstants.NODESET);
        if (nodes != null)
        {
            Description d;
            for (int i = 0, size = nodes.getLength(); i < size; i++)
            {
                element = (Element)nodes.item(i);
                String lang = element.getAttributeNS(XMLConstants.XML_NS_URI, "lang");
                if (lang == null)
                {
                    lang = "en";
                }
                d = pa.getDescription(JetspeedLocale.convertStringToLocale(lang));
                if (d == null)
                {
                    d = pa.addDescription(lang);
                }
                // else: overwrite description with last found entry
               
                d.setDescription(element.getTextContent().trim());
            }
        }
       
        // retrieve security-role
        nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"security-role", document, XPathConstants.NODESET);
        if (nodes != null)
        {
            String roleName;
            SecurityRole r;
            Description d;
            for (int i = 0, nsize = nodes.getLength(); i < nsize; i++)
            {
                element = (Element)nodes.item(i);
                children = element.getElementsByTagName("role-name");
                if (children != null && children.getLength() != 0)
                {
                    roleName = children.item(0).getTextContent().trim();
                    if (roleName.length() > 0)
                    {
                        r = null;
                        for (SecurityRole sr : pa.getSecurityRoles())
                        {
                            if (sr.getName().equals(roleName))
                            {
                                r = sr;
                                break;
                            }
                        }
                        if (r == null)
                        {
                            r = pa.addSecurityRole(roleName);
                        }
                        // else: overwrite or merge existing descriptions with those of this last found entry
                       
                        children = element.getElementsByTagName("description");
                        if (children != null)
                        {
                            for (int j = 0, csize = children.getLength(); j < csize; j++)
                            {
                                element = (Element)children.item(j);
                                String lang = element.getAttributeNS(XMLConstants.XML_NS_URI, "lang");
                                if (lang == null)
                                {
                                    lang = "en";
                                }
                                if (r.getDescription(JetspeedLocale.convertStringToLocale(lang)) == null)
                                {
                                    d = r.addDescription(lang);
                                    d.setDescription(element.getTextContent());
                                }
                            }
                        }
                    }
                }
View Full Code Here

        {
            CustomPortletMode jcpm = jpa.addCustomPortletMode(cpm.getPortletMode());
            jcpm.setPortalManaged(cpm.isPortalManaged());
            for (org.apache.pluto.container.om.portlet.Description desc : cpm.getDescriptions())
            {
                Description jdesc = jcpm.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }           
        }
        for (org.apache.pluto.container.om.portlet.CustomWindowState cws : pa.getCustomWindowStates())
        {
            CustomWindowState jcws = jpa.addCustomWindowState(cws.getWindowState());
            for (org.apache.pluto.container.om.portlet.Description desc : cws.getDescriptions())
            {
                Description jdesc = jcws.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }           
        }       
        for (org.apache.pluto.container.om.portlet.EventDefinition ed : pa.getEventDefinitions())
        {
            EventDefinition jed = null;
            if (ed.getQName() != null)
            {
                jed = jpa.addEventDefinition(ed.getQName());
            }
            else
            {
                jed =jpa.addEventDefinition(ed.getName());
            }
            jed.setValueType(ed.getValueType());
            for (QName alias : ed.getAliases())
            {
                jed.addAlias(alias);
            }
            for (org.apache.pluto.container.om.portlet.Description desc : ed.getDescriptions())
            {
                Description jdesc = jed.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                       
        }
        for (org.apache.pluto.container.om.portlet.FilterMapping fm : pa.getFilterMappings())
        {
            FilterMapping jfm = jpa.addFilterMapping(fm.getFilterName());
            for (String portletName : fm.getPortletNames())
            {
                jfm.addPortletName(portletName);
            }
        }
        for (org.apache.pluto.container.om.portlet.Filter f : pa.getFilters())
        {
            Filter jf = jpa.addFilter(f.getFilterName());
            jf.setFilterClass(f.getFilterClass());
            for (org.apache.pluto.container.om.portlet.Description desc : f.getDescriptions())
            {
                Description jdesc = jf.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                  
            for (org.apache.pluto.container.om.portlet.DisplayName dn : f.getDisplayNames())
            {
                DisplayName jdn = jf.addDisplayName(dn.getLang());
                jdn.setDisplayName(dn.getDisplayName());
            }
            for (org.apache.pluto.container.om.portlet.InitParam ip : f.getInitParams())
            {
                InitParam jip = jf.addInitParam(ip.getParamName());
                jip.setParamValue(ip.getParamValue());
                for (org.apache.pluto.container.om.portlet.Description desc : ip.getDescriptions())
                {
                    Description jdesc = jip.addDescription(desc.getLang());
                    jdesc.setDescription(desc.getDescription());
                }                                       
            }
            for (String lc : f.getLifecycles())
            {
                jf.addLifecycle(lc);
            }           
        }
        for (org.apache.pluto.container.om.portlet.Listener l : pa.getListeners())
        {
            Listener jl = jpa.addListener(l.getListenerClass());
            for (org.apache.pluto.container.om.portlet.Description desc : l.getDescriptions())
            {
                Description jdesc = jl.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                       
            for (org.apache.pluto.container.om.portlet.DisplayName dn : l.getDisplayNames())
            {
                DisplayName jdn = jl.addDisplayName(dn.getLang());
                jdn.setDisplayName(dn.getDisplayName());
            }
        }
        for (org.apache.pluto.container.om.portlet.PublicRenderParameter prd : pa.getPublicRenderParameters())
        {           
            PublicRenderParameter jprp = null;
            if (prd.getQName() != null)
            {
                jprp = jpa.addPublicRenderParameter(prd.getQName(), prd.getIdentifier());
            }
            else
            {
                jprp = jpa.addPublicRenderParameter(prd.getName(), prd.getIdentifier());
            }
            for (QName alias : prd.getAliases())
            {
                jprp.addAlias(alias);
            }
            for (org.apache.pluto.container.om.portlet.Description desc : prd.getDescriptions())
            {
                Description jdesc = jprp.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }
        }
        for (org.apache.pluto.container.om.portlet.SecurityConstraint sc :  pa.getSecurityConstraints())
        {
            SecurityConstraint jsc = jpa.addSecurityConstraint(sc.getUserDataConstraint().getTransportGuarantee());
            for (org.apache.pluto.container.om.portlet.DisplayName dn : sc.getDisplayNames())
            {
                DisplayName jdn = jsc.addDisplayName(dn.getLang());
                jdn.setDisplayName(dn.getDisplayName());
            }
            for (String portletName : sc.getPortletNames())
            {
                jsc.addPortletName(portletName);
            }           
        }
        for (org.apache.pluto.container.om.portlet.UserAttribute ua : pa.getUserAttributes())
        {
            UserAttribute jua = jpa.addUserAttribute(ua.getName());
            for (org.apache.pluto.container.om.portlet.Description desc : ua.getDescriptions())
            {
                Description jdesc = jua.addDescription(desc.getLang());
                jdesc.setDescription(desc.getDescription());
            }                                                   
        }
        return jpa;
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.container.om.portlet.Description

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.