portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morci...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util PortletUtils.java
Date Wed, 05 Mar 2003 23:07:04 GMT
morciuch    2003/03/05 15:07:04

  Modified:    src/java/org/apache/jetspeed/services/profiler
                        JetspeedProfilerService.java
  Added:       src/java/org/apache/jetspeed/util PortletUtils.java
  Log:
  Moved utility method for regenerating portlet ids into its own class (believe it or not,
still related to Bugzilla issue# 17289)
  
  Revision  Changes    Path
  1.46      +2 -27     jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java
  
  Index: JetspeedProfilerService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/profiler/JetspeedProfilerService.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- JetspeedProfilerService.java	4 Mar 2003 00:05:09 -0000	1.45
  +++ JetspeedProfilerService.java	5 Mar 2003 23:07:03 -0000	1.46
  @@ -98,7 +98,6 @@
   import org.apache.jetspeed.om.profile.Skin;
   import org.apache.jetspeed.om.profile.psml.PsmlSkin;
   import org.apache.jetspeed.om.profile.BasePSMLDocument;
  -import org.apache.jetspeed.om.profile.Entry;
   
   // jetspeed.capability
   import org.apache.jetspeed.capability.CapabilityMap;
  @@ -109,7 +108,6 @@
   import org.apache.jetspeed.services.rundata.JetspeedRunData;
   import org.apache.jetspeed.services.JetspeedSecurity;
   import org.apache.jetspeed.services.PsmlManager;
  -import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
   import org.apache.jetspeed.services.PortalToolkit;
   
   // jetspeed.util
  @@ -415,7 +413,7 @@
                   locator.setName(this.resourceDefault + this.resourceExt);
   
                   // Regenerate the portlet ids so they are unique
  -                this.regenerateIds(portlets);
  +                org.apache.jetspeed.util.PortletUtils.regenerateIds(portlets);
   
                   // Save the new profile to permament storage
                   result = this.createProfile(locator, portlets);
  @@ -427,29 +425,6 @@
           }
   
           return result;
  -    }
  -
  -    /**
  -     * Regenerates jspeid for all portlets and entries
  -     *
  -     * @param profile Profile to process
  -     * @return Profile with portlet ids regenerated
  -     */
  -    private void regenerateIds(Portlets topPortlets)
  -    throws Exception
  -    {
  -        // Display some portlets
  -        Portlets[] portlets = topPortlets.getPortletsArray();
  -        for (int i = 0; i < portlets.length; i++)
  -        {
  -            portlets[i].setId(JetspeedIdGenerator.getNextPeid());
  -            Entry[] entries = portlets[i].getEntriesArray();
  -            for (int j = 0; j < entries.length; j++)
  -            {
  -                entries[j].setId(JetspeedIdGenerator.getNextPeid());
  -            }
  -            regenerateIds(portlets[i]);
  -        }
       }
   
       /**
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/util/PortletUtils.java
  
  Index: PortletUtils.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.jetspeed.util;
  
  import org.apache.jetspeed.om.profile.Portlets;
  import org.apache.jetspeed.om.profile.Entry;
  import org.apache.jetspeed.services.idgenerator.JetspeedIdGenerator;
  
  /**
   * This class provides static util methods for portlet manaipulation that 
   * aren't part of the default services.
   *
   * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a> 
   * @version $Id: PortletUtils.java,v 1.1 2003/03/05 23:07:04 morciuch Exp $
   */
  public class PortletUtils 
  {
      /**
       * Regenerates jspeid for all portlets and entries
       *
       * @param profile Profile to process
       * @return Profile with portlet ids regenerated
       */
      public static void regenerateIds(Portlets topPortlets)
      throws Exception
      {
          // Display some portlets
          Portlets[] portlets = topPortlets.getPortletsArray();
          for (int i = 0; i < portlets.length; i++)
          {
              portlets[i].setId(JetspeedIdGenerator.getNextPeid());
              Entry[] entries = portlets[i].getEntriesArray();
              for (int j = 0; j < entries.length; j++)
              {
                  entries[j].setId(JetspeedIdGenerator.getNextPeid());
              }
              regenerateIds(portlets[i]);
          }
      }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message