portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets CustomizeSetAction.java
Date Tue, 05 Mar 2002 18:45:38 GMT
paulsp      02/03/05 10:45:38

  Modified:    src/java/org/apache/jetspeed/om/profile
                        BasePSMLDocument.java PSMLDocument.java
               src/java/org/apache/jetspeed/modules/actions/portlets
                        CustomizeSetAction.java
  Log:
  Set id attribute on Portlet and Entry element in PSML.
  
  Revision  Changes    Path
  1.5       +87 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BasePSMLDocument.java
  
  Index: BasePSMLDocument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/BasePSMLDocument.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BasePSMLDocument.java	22 Jul 2001 20:31:11 -0000	1.4
  +++ BasePSMLDocument.java	5 Mar 2002 18:45:38 -0000	1.5
  @@ -64,7 +64,7 @@
    * document.
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: BasePSMLDocument.java,v 1.4 2001/07/22 20:31:11 raphael Exp $
  + * @version $Id: BasePSMLDocument.java,v 1.5 2002/03/05 18:45:38 paulsp Exp $
    */
   public class BasePSMLDocument implements PSMLDocument
   {
  @@ -150,6 +150,17 @@
           return getEntry(this.portlets, name);
       }
   
  +    /** Returns the first entry in the current PSML resource corresponding 
  +     *  to the given entry id
  +     * 
  +     *  @param entryId the portlet's entry id to seek
  +     *  @return the found entry description or null
  +     */
  +    public Entry getEntryById(String entryId)
  +    {
  +        return getEntryById(this.portlets, entryId);
  +    }
  +
       /** Returns the first portlets element in the current PSML resource corresponding 
        *  to the given name
        * 
  @@ -176,6 +187,18 @@
           return p;
       }
   
  +    /** Returns the first portlets element in the current PSML resource corresponding 
  +     *  to the given id
  +     * 
  +     *  @param name the portlets id to seek
  +     *  @return the found portlets description or null
  +     */
  +    public Portlets getPortletsById(String portletId)
  +    {        
  +        Portlets p = getPortletsById(this.portlets, portletId);
  +        return p;
  +    }
  +
       /** Returns the first portlets element in the current PSML resource 
        *  found at the specified position. The position is computed using
        *  a left-most tree traversal algorithm of the existing portlets (thus
  @@ -223,6 +246,69 @@
           return (entry);
       }
   
  +    /** Returns the first entry in the specified PSML resource corresponding 
  +     *  to the given portlet Id
  +     * 
  +     *  @param portlets the PSML description to look into
  +     *  @param entryId the portlet's entry id to seek
  +     *  @return the found entry description or null
  +     */
  +    public static Entry getEntryById(Portlets portlets, String entryId)
  +    {
  +        Entry entry = null;
  +
  +        for (Enumeration e1 = portlets.enumerateEntry (); e1.hasMoreElements (); )
  +        {
  +            entry = (Entry) e1.nextElement ();
  +            if ((entry.getId()!=null) && entry.getId().equals (entryId))
  +                 return (entry);
  +        }
  +
  +        entry = null;
  +
  +        for (Enumeration e2 = portlets.enumeratePortlets (); e2.hasMoreElements (); )
  +        {
  +            Portlets p = (Portlets) e2.nextElement ();
  +
  +            entry = getEntryById(p, entryId);
  +
  +            if (entry != null)
  +                 break;
  +        }
  +
  +        return (entry);
  +    }
  +
  +    /** Returns the first portlets element in the specified PSML resource corresponding

  +     *  to the given Id
  +     * 
  +     *  @param portlets the PSML description to look into
  +     *  @param portletId the portlet's id to seek
  +     *  @return the found portlets description or null
  +     */
  +    public static Portlets getPortletsById(Portlets portlets, String portletId)
  +    {
  +        Portlets entry = portlets;
  +        
  +        if ( (entry.getId()!=null) && entry.getId().equals(portletId) )
  +        {
  +            return entry;
  +        }
  +
  +        entry = null;
  +        
  +        for (Enumeration e2 = portlets.enumeratePortlets (); e2.hasMoreElements (); )
  +        {
  +            Portlets p = (Portlets) e2.nextElement ();
  +
  +            entry = getPortletsById(p, portletId);
  +
  +            if (entry != null) break;
  +        }
  +
  +        return (entry);
  +    }
  +
       /** Returns the first portlets element in the specified PSML resource corresponding

        *  to the given name
        * 
  @@ -252,7 +338,6 @@
   
           return (entry);
       }
  -
       /** Returns the first portlets element in the specified PSML resource 
        *  in the given position
        * 
  
  
  
  1.3       +17 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/PSMLDocument.java
  
  Index: PSMLDocument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/om/profile/PSMLDocument.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PSMLDocument.java	7 Jan 2002 12:54:20 -0000	1.2
  +++ PSMLDocument.java	5 Mar 2002 18:45:38 -0000	1.3
  @@ -63,7 +63,7 @@
    * document.
    *
    * @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
  - * @version $Id: PSMLDocument.java,v 1.2 2002/01/07 12:54:20 kimptoc Exp $
  + * @version $Id: PSMLDocument.java,v 1.3 2002/03/05 18:45:38 paulsp Exp $
    */
   public interface PSMLDocument
   {
  @@ -102,6 +102,14 @@
        */
       public Entry getEntry(String name);
   
  +    /** Returns the first entry in the current PSML resource corresponding 
  +     *  to the given entry id
  +     * 
  +     *  @param entryId the portlet's entry id to seek
  +     *  @return the found entry description or null
  +     */
  +    public Entry getEntryById(String entryId);
  +
       /** Returns the first portlets element in the current PSML resource corresponding 
        *  to the given name
        * 
  @@ -109,6 +117,14 @@
        *  @return the found portlets description or null
        */
       public Portlets getPortlets(String name);
  +
  +    /** Returns the first portlets element in the current PSML resource corresponding 
  +     *  to the given name
  +     * 
  +     *  @param portletId the portlet's entry id to seek
  +     *  @return the found portlets description or null
  +     */
  +    public Portlets getPortletsById(String portletId);
   
       /** Returns the first portlets element in the current PSML resource 
        *  found at the specified position. The position is computed using
  
  
  
  1.12      +11 -2     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java
  
  Index: CustomizeSetAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/CustomizeSetAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CustomizeSetAction.java	10 Dec 2001 17:28:00 -0000	1.11
  +++ CustomizeSetAction.java	5 Mar 2002 18:45:38 -0000	1.12
  @@ -84,6 +84,8 @@
   import org.apache.turbine.util.Log;
   import org.apache.turbine.util.RunData;
   import org.apache.turbine.services.template.TurbineTemplate;
  +import org.apache.turbine.services.uniqueid.TurbineUniqueId;
  +
   
   // Velocity Stuff
   import org.apache.velocity.context.Context;
  @@ -160,7 +162,7 @@
             rundata.getUser().setTemp("mode",mode);
           }
   
  -        System.out.println (mode);  
  +        System.out.println("In CustomizeSetAction.buildNormalContext(), Mode = " + mode);
 
           
           String template = (String)context.get("template");
   
  @@ -313,6 +315,7 @@
           PortletSet set = (PortletSet)((JetspeedRunData)rundata).getCustomized();
           String title = rundata.getParameters().getString("title","My Pane");
           
  +System.out.println("In CustomizeSetAction.doAddSet()");  
           if (set!=null)
           {
               Portlets portlets = ((JetspeedRunData)rundata).getProfile()
  @@ -324,6 +327,8 @@
                   Portlets p = new Portlets();
                   p.setMetainfo(new Metainfo());
                   p.getMetainfo().setTitle(title);
  +                p.setId( Long.toHexString(System.currentTimeMillis()) + "-" + TurbineUniqueId.getUniqueId());
  +System.out.println("In CustomizeSetAction.doAddSet() Entry.id = " + p.getId());
                   portlets.addPortlets(p);
               }
           }
  @@ -347,6 +352,7 @@
           PortletSet set = (PortletSet)((JetspeedRunData)rundata).getCustomized();
           String[] pnames = rundata.getParameters().getStrings("pname");
   
  +System.out.println("In CustomizeSetAction.doAdd()");  
           // Create a ClearPortletControl
           Control ctrl = new Control();
           ctrl.setName ("ClearPortletControl");
  @@ -372,6 +378,7 @@
                   {
                   
                       addIt = true;
  + /*
                       for (cc=0; cc<usedPortlets.size(); cc++)
                       {
                         usedEntry = (Entry) usedPortlets.get(cc);
  @@ -382,7 +389,7 @@
                         }
                         
                       }
  -                
  +*/
                       if (addIt)
                       {
                         Entry p = new Entry();
  @@ -391,6 +398,8 @@
                           p.setControl (ctrl);
                       
                         p.setParent(pnames[i]);
  +                      p.setId( Long.toHexString(System.currentTimeMillis()) + "-" + TurbineUniqueId.getUniqueId());
  +System.out.println("In CustomizeSetAction.doAdd() Entry.id = " + p.getId());
                         portlets.addEntry(p);
                       }
                   }
  
  
  

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