Package org.apache.jetspeed.om.profile

Examples of org.apache.jetspeed.om.profile.Entry


                                                           .getPortletsById(set.getID());

            List usedPortlets = AutoProfile.getPortletList(rundata);
            boolean addIt;
            int cc;
            Entry usedEntry;
                                         
            for (int i = 0; i < pnames.length; i++)
            {
                PortletEntry entry = (PortletEntry) Registry.getEntry(Registry.PORTLET, pnames[i]);

                // add only new portlets!
                if ((entry != null) && (portlets != null))
                {
               
                    addIt = true;
/*
                    for (cc=0; cc<usedPortlets.size(); cc++)
                    {
                      usedEntry = (Entry) usedPortlets.get(cc);
                      if (entry.getName().equals(usedEntry.getParent()))
                      {
                        addIt = false;
                        break;
                      }
                     
                    }
*/
                    if (addIt)
                    {
                      Entry p = new PsmlEntry();
                      // add the ClearPortletControl to wml entries     
                      //if (isWML)
                      //  p.setControl (ctrl);
                   
                      p.setParent(pnames[i]);
                      p.setId(JetspeedIdGenerator.getNextPeid());
//                      SecurityReference defaultRef = PortalToolkit.getDefaultSecurityRef(
//                          ((JetspeedRunData) rundata).getCustomizedProfile());
//                      if (defaultRef != null)
//                      {
//                          if (Log.getLogger().isDebugEnabled())
View Full Code Here


            doCancel(rundata, context);
            return;
        }
        PortletConfig pc = p.getPortletConfig();
        Profile profile = ((JetspeedRunData)rundata).getCustomizedProfile();
        Entry entry = profile.getDocument().getEntryById(p.getID());

        // Only update the security ref if the parent changed
        if ((newSecurityParent != null))
        {
            boolean securityChanged = false;
            SecurityReference currentSecurityRef = pc.getSecurityRef();
            if (currentSecurityRef != null)
            {
                securityChanged = (newSecurityParent.equals(currentSecurityRef.getParent()) == false);
            }
            else
            {
                securityChanged = (newSecurityParent.trim().length() > 0);
            }
            if (securityChanged == true)
            {
                SecurityReference securityRef = null;
                if ((newSecurityParent.trim().length() > 0))
                {
                    securityRef = new BaseSecurityReference();
                    securityRef.setParent( newSecurityParent);
                }
                // Note: setting the portlet's config may not be a good idea -
                // it might be used as the Portlet for other PSMLDocument Entries that
                // have a different idea of security - and the caching of Portlets does
                // NOT include security -ggolden.
                pc.setSecurityRef(securityRef);
                entry.setSecurityRef(securityRef);
                madePcChange = true;
            }
        }

        // Only update the skin if the name changed
        if (newSkinName != null)
        {
            boolean skinChanged = false;
            String currentSkinName = null;

            if  (pc.getSkin() != null)
                currentSkinName = pc.getPortletSkin().getName();

            if (currentSkinName != null)
            {
                skinChanged = (newSkinName.equals(currentSkinName) == false);
            }
            else
            {
                skinChanged = (newSkinName.trim().length() > 0);
            }

            if (skinChanged == true)
            {
                PortletSkin skin = null;
                if ((newSkinName.trim().length() > 0))
                {
                    skin = PortalToolkit.getSkin(newSkinName);
                    if (skin != null)
                    {
                        // Note: setting the portlet's config may not be a good idea -
                        // it might be used as the Portlet for other PSMLDocument Entries that
                        // have a different idea of skin - and the caching of Portlets does
                        // NOT include skin -ggolden.
                        pc.setPortletSkin(skin);

                        Skin psmlSkin = entry.getSkin();
                        if (psmlSkin == null)
                        {
                            entry.setSkin(new PsmlSkin());
                        }
                        entry.getSkin().setName(newSkinName);
                    }
                    else
                    {
                        logger.warn( "Unable to update skin for portlet entry " + entry.getId() + " because skin " + skin + " does not exist.");
                    }
                }
                else
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of skin - and the caching of Portlets does
                    // NOT include skin -ggolden.
                    pc.setPortletSkin( null);
                    entry.setSkin(null);
                }
                madePcChange = true;
            }
        }

        // Only update the title if the title changed
        if (newTitle != null)
        {
            boolean titleChanged = false;
            String currentTitle = entry.getTitle();

            MetaData md = pc.getMetainfo();
            if  (currentTitle == null && md != null && md.getTitle() != null)
                currentTitle = md.getTitle();

            if (currentTitle != null)
            {
                titleChanged = (newTitle.equals(currentTitle) == false);
            }
            else
            {
                titleChanged = (newTitle.trim().length() > 0);
            }

            if (titleChanged == true)
            {

                if ((newTitle.trim().length() > 0))
                {
                    // Note: setting the portlet's config may not be a good idea -
                    // it might be used as the Portlet for other PSMLDocument Entries that
                    // have a different idea of title - and the caching of Portlets does
                    // NOT include title -ggolden.
                    if (md == null) {
                        md = new MetaData();
                        pc.setMetainfo(md);
                    }
                    md.setTitle(newTitle);
                    entry.setTitle(newTitle);
                    madePcChange = true;
                }
            }
        }
View Full Code Here

    /**
     * @see PortletInstance#getAttribute()
     */
    public String getAttribute(String name, String dftValue)
    {
        Entry entry = getEntry();

        if (entry == null)
        {
            return dftValue;
        }
        Parameter attr = entry.getParameter(name);
        if (attr != null)
        {
            return attr.getValue();
        }
        else
View Full Code Here

    /**
     * @see PortletInstance#getAttribute()
     */
    public String getAttribute(String name)
    {
        Entry entry = getEntry();

        if (entry == null)
        {
            return "";
        }
        Parameter attr = entry.getParameter(name);
        if (attr != null)
        {
            return attr.getValue();
        }
        else
View Full Code Here

    public void setAttribute(String name, String value)
    {
        // make sure we are updating and using the clone now
        setupForUpdate();
       
        Entry entry = getEntry();

        Parameter attr = entry.getParameter(name);
        
         // Setting a attribute to null should just remove it.
        if(value == null)
        {
            removeAttribute(name);
        }
        else if (attr != null)
        {
            attr.setValue(value);
        }
        // If an attribute does not exist, then add it.
        else
        {
            PsmlParameter newAttr = new PsmlParameter();
            newAttr.setName(name);
            newAttr.setValue(value);
            entry.addParameter(newAttr);
        }
    }
View Full Code Here

    public void removeAttribute(String name)
    {
        // make sure we are updating and using the clone now
        setupForUpdate();
       
        Entry entry = getEntry();

        // I am assuming that we only allow one parameter per name
        Iterator params = entry.getParameterIterator();
        int index = -1;
        int count = 0;
        while (params.hasNext())
        {
            Parameter param = (Parameter) params.next();
            if (param.getName().equalsIgnoreCase(name))
            {
                index = count;
                break;
            }
            count++;
        }

        // We have to wait until we are outside the loop to remove
        // or else we throw a ConcurrentModificationException   
        if (index != -1)
        {
            entry.removeParameter(index);          
        }
    }
View Full Code Here

    public void removeAllAttributes()
    {
        // make sure we are updating and using the clone now
        setupForUpdate();
       
        Entry entry = getEntry();

        entry.removeAllParameter();
    }
View Full Code Here

    /**
     * @see PortletInstance#getAttributes()
     */
    public Iterator getAttributes()
    {
        Entry entry = getEntry();

        return entry.getParameterIterator();
    }
View Full Code Here

    /**
     * @see PortletInstance#getDescription()
     */
    public String getDescription()
    {
        Entry entry = getEntry();

        String description = null;
        if (entry != null)
        {
            MetaInfo metaInfo = entry.getMetaInfo();
            if (metaInfo != null)
            {
                description = metaInfo.getDescription();
            }
        }
View Full Code Here

    /**
     * @see PortletInstance#getTitle()
     */
    public String getTitle()
    {
        Entry entry = getEntry();

        String title = null;
        if (entry != null)
        {
            MetaInfo metaInfo = entry.getMetaInfo();
            if (metaInfo != null)
            {
                title = metaInfo.getTitle();
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.profile.Entry

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.