portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util/template JetspeedTool.java
Date Fri, 08 Mar 2002 01:21:00 GMT
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:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message