Package org.apache.jetspeed.om.portlet

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


       
        // retrieve display-name entries
        nodes = (NodeList)xpath.evaluate("/"+prefix+"web-app/"+prefix+"display-name", document, XPathConstants.NODESET);
        if (nodes != null)
        {
            DisplayName 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.getDisplayName(JetspeedLocale.convertStringToLocale(lang));
                if (d == null)
                {
                    d = pa.addDisplayName(lang);
                }
                // else: overwrite display-name with last found entry
               
                d.setDisplayName(element.getTextContent().trim());
            }
        }

        // 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


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

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

        PortletDefinition copy = source.getApplication().addClone(newPortletName);
        PortletApplication destApp = source.getApplication();

        // First set display name

        DisplayName displayName = copy.addDisplayName(JetspeedLocale.getDefaultLocale().getLanguage());
        displayName.setDisplayName(newPortletName);

        // And, then, copy all attributes

        copy.setPortletClass(source.getPortletClass());
        copy.setResourceBundle(source.getResourceBundle());
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.portlet.DisplayName

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.