You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2002/03/08 02:21:00 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util/template JetspeedTool.java

taylor      02/03/07 17:21:00

  Modified:    src/java/org/apache/jetspeed/util/template JetspeedTool.java
  Log:
  - added support for new tool: PortalEntry(id) which can be used to request a single portal element (portlet)
  
  Revision  Changes    Path
  1.13      +64 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTool.java
  
  Index: JetspeedTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/JetspeedTool.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JetspeedTool.java	7 Jan 2002 13:18:13 -0000	1.12
  +++ JetspeedTool.java	8 Mar 2002 01:21:00 -0000	1.13
  @@ -87,7 +87,7 @@
    * shared between threads and/or requests</strong>
    *
    * @author <a href="mailto:raphael@apache.org">Rapha�l Luta</a>
  - * @version $Id: JetspeedTool.java,v 1.12 2002/01/07 13:18:13 kimptoc Exp $
  + * @version $Id: JetspeedTool.java,v 1.13 2002/03/08 01:21:00 taylor Exp $
    */
   public class JetspeedTool implements ApplicationTool
   {
  @@ -299,4 +299,67 @@
               
           return customizer;
       }
  +
  +    /** 
  +     * Return the content of a portal element given the id of the element. 
  +     *
  +     * @param id The portlet id
  +     * @return the rendered content of the portlet
  +     */
  +    public ConcreteElement getPortalElement(String id)
  +    {
  +        ConcreteElement result = null;
  +        
  +        if (null != rundata)
  +        {
  +            Profile profile = rundata.getProfile();
  +            try
  +            {
  +                if (null == profile)
  +                {
  +                    System.out.println("profile is null");
  +                    profile = Profiler.getProfile(rundata);
  +                    rundata.setProfile(profile);
  +                }
  + 
  +                PSMLDocument doc = profile.getDocument();
  +                if (null != doc)
  +                {                
  +                    Entry entry = doc.getEntryById(id);
  +                    if (null == entry)
  +                    {
  +                        // FIXME: need to write this function
  +                        // Portlets ps = doc.getPortletsById(id);
  +                        result = new  StringElement("not implemented");
  +                    }
  +                    else
  +                    {
  +                        Portlet p = PortletFactory.getPortlet( entry );
  +                        if (p != null)
  +                        {
  +                            result = p.getContent(rundata);
  +                            System.out.println("id = " + p.getID());
  +                            System.out.println("name = " + p.getName());
  +                        }
  +                        else
  +                           result = new  StringElement("error retrieving");
  +
  +                    }
  +                }                
  +            }
  +            catch (Exception e)
  +            {
  +                Log.error(e);
  +            }
  +        }
  +        
  +        if (result == null)
  +        {
  +            result = new StringElement("Error fetching pane");
  +        }
  +
  +        return result;
  +
  +    }
  +
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>