taylor      2002/07/22 21:54:36

  Modified:    build    build.xml
               src/java/org/apache/jetspeed/modules/actions/controls
                        Customize.java
               src/java/org/apache/jetspeed/modules/actions/portlets
                        CustomizeSetAction.java
               src/java/org/apache/jetspeed/services/psmlmanager
                        PsmlImporter.java TestMarshalPsml.java
               src/java/org/apache/jetspeed/services/psmlmanager/db
                        DatabasePsmlManagerService.java
               webapp/WEB-INF/conf JetspeedSecurity.properties
               webapp/WEB-INF/db jetspeed.properties
               webapp/WEB-INF/templates/vm/portlets/html
                        customizer-portletset-add.vm
  Log:
  - Fixed bug 8985 - Cancel button on add portlet customizer page does reset
  - Brought DB-PSML feature up-to-date to work with new 1.4 release.
  - Added support to DB-PSML for query() method to return full profiles
  - Removed auto-run feature of DB-PSML - too many init() problems from users - it now 
must be ran from the cmdline
    (im working on that - see next commit)
  
  Revision  Changes    Path
  1.152     +22 -0     jakarta-jetspeed/build/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/build/build.xml,v
  retrieving revision 1.151
  retrieving revision 1.152
  diff -u -r1.151 -r1.152
  --- build.xml 19 Jul 2002 10:21:46 -0000      1.151
  +++ build.xml 23 Jul 2002 04:54:36 -0000      1.152
  @@ -862,6 +862,28 @@
           </junit>
       </target>
   
  +    <!-- =================================================================== -->
  +    <!-- PSML Importer                                                       -->
  +    <!-- =================================================================== -->
  +    <target name="import" depends="compile"
  +            description="Import PSML">
  +
  +        <junit printsummary="yes" haltonfailure="yes" haltonerror="yes" fork="yes">
  +
  +            <classpath>
  +                <pathelement location="${build.dest.dir}"/>
  +                <path refid="classpath"/>
  +                <pathelement location="${junit.jar}"/>
  +                <pathelement location="${hsql.jar}"/>
  +            </classpath>
  +
  +            <formatter type="plain" usefile="false"/>            
  +
  +            <!-- JUnit unit tests -->
  +            <test name="org.apache.jetspeed.services.psmlmanager.TestPsmlImporter"/>
  +
  +        </junit>
  +    </target>
   
       <!-- =================================================================== -->
       <!-- Run the client JUnit test cases (non-cactus) on the Caching system -->
  
  
  
  1.12      +1 -0      
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Customize.java
  
  Index: Customize.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Customize.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Customize.java    23 Jul 2002 00:03:54 -0000      1.11
  +++ Customize.java    23 Jul 2002 04:54:36 -0000      1.12
  @@ -107,6 +107,7 @@
               jdata.setCustomized(null);
               p = jdata.getCustomized();
             }
  +          jdata.setCustomized(null);
           }
           
   
  
  
  
  1.22      +4 -6      
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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- CustomizeSetAction.java   23 Jul 2002 00:03:54 -0000      1.21
  +++ CustomizeSetAction.java   23 Jul 2002 04:54:36 -0000      1.22
  @@ -186,6 +186,7 @@
               
               template = TemplateLocator.locatePortletTemplate(rundata, 
buffer.toString());
               context.put("feature",template);
  +
           }
       
           if (set==null) return;
  @@ -292,11 +293,9 @@
       /** Clean up the customization state */
       public void doCancel(RunData rundata, Context context)
       {
  -        ((JetspeedRunData)rundata).setCustomized(null);
  -        if (((JetspeedRunData)rundata).getCustomized()==null)
  -        {
  -            rundata.setScreenTemplate("Home");
  -        }
  +        //((JetspeedRunData)rundata).setCustomized(null);
  +        //rundata.setScreenTemplate("Home");
  +        rundata.getUser().setTemp("mode", "layout");
       }
   
       /** Save the general informations for this set */
  @@ -329,7 +328,6 @@
       public void doApply(RunData rundata, Context context)
       {
           doSave(rundata, context);
  -        doCancel(rundata, context);
       }
       
       /** Add a new portlets element in the customized set */
  
  
  
  1.10      +3 -4      
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/PsmlImporter.java
  
  Index: PsmlImporter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/PsmlImporter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PsmlImporter.java 28 Jun 2002 05:37:33 -0000      1.9
  +++ PsmlImporter.java 23 Jul 2002 04:54:36 -0000      1.10
  @@ -156,13 +156,12 @@
       {
           try 
           {
  -            // dst: why not get a count(*) from ANON table?
  -
  +System.out.println("starting import...");
               JetspeedUser user = JetspeedSecurity.getUser("admin");
               QueryLocator ql = new QueryLocator(QueryLocator.QUERY_USER);
               ql.setUser(user);
               Iterator iterator = PsmlManager.query(ql);
  -            while (iterator.hasNext())
  +            if (iterator.hasNext())
               {                      
                   String msg = "PSMLImporter: Detected database is populated. No need 
to import.";
                   System.out.println(msg);
  
  
  
  1.9       +55 -1     
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/TestMarshalPsml.java
  
  Index: TestMarshalPsml.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/TestMarshalPsml.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestMarshalPsml.java      23 Jul 2002 00:03:54 -0000      1.8
  +++ TestMarshalPsml.java      23 Jul 2002 04:54:36 -0000      1.9
  @@ -1,3 +1,57 @@
  +/* ====================================================================
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2000-2001 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 [EMAIL PROTECTED]
  + *
  + * 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.services.psmlmanager;
   
   import java.io.File;
  
  
  
  1.18      +105 -5    
jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java
  
  Index: DatabasePsmlManagerService.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/psmlmanager/db/DatabasePsmlManagerService.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DatabasePsmlManagerService.java   16 Jul 2002 19:10:39 -0000      1.17
  +++ DatabasePsmlManagerService.java   23 Jul 2002 04:54:36 -0000      1.18
  @@ -66,7 +66,9 @@
   import org.apache.jetspeed.om.profile.Profile;
   import org.apache.jetspeed.om.profile.ProfileLocator;
   import org.apache.jetspeed.om.profile.BaseProfileLocator;
  +import org.apache.jetspeed.om.profile.BaseProfile;
   import org.apache.jetspeed.om.profile.QueryLocator;
  +
   //Castor defined API
   import org.apache.jetspeed.om.profile.Portlets;
   import org.apache.jetspeed.om.profile.PSMLDocument;
  @@ -82,8 +84,12 @@
   
   // jetspeed security
   import org.apache.jetspeed.om.security.JetspeedUser;
  +import org.apache.jetspeed.om.security.JetspeedUserFactory;
   import org.apache.jetspeed.om.security.Role;
  +import org.apache.jetspeed.om.security.JetspeedRoleFactory;
   import org.apache.jetspeed.om.security.Group;
  +import org.apache.jetspeed.om.security.JetspeedGroupFactory;
  +import org.apache.jetspeed.services.security.JetspeedSecurityException;
   
   
   //Servlet API
  @@ -131,6 +137,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Atul Dambalkar</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Medha Vaidya</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>David Sean Taylor</a> 
    * @version $Id$
    */
   public class DatabasePsmlManagerService extends TurbineBaseService 
  @@ -217,7 +224,7 @@
       {
           //Mark that we are done
           setInit(true);
  -
  +/*
           try
           {
               PsmlImporter importer = new PsmlImporter();
  @@ -228,6 +235,7 @@
               Log.error("Error importing: " , e);
               e.printStackTrace();
           }
  +  */
       }
   
       protected void loadMapping()
  @@ -784,19 +792,19 @@
               if (obj instanceof JetspeedUserProfile) 
               {
                   portlets = 
DBUtils.bytesToPortlets(((JetspeedUserProfile)obj).getProfile(), this.mapping);
  +                list.add(createUserProfile((JetspeedUserProfile)obj, portlets));
               }
               else if (obj instanceof JetspeedGroupProfile) 
               {
                   portlets = 
DBUtils.bytesToPortlets(((JetspeedGroupProfile)obj).getProfile(), this.mapping);
  -
  +                list.add(createGroupProfile((JetspeedGroupProfile)obj, portlets));
               }
               else if (obj instanceof JetspeedRoleProfile) 
               {
                   portlets = 
DBUtils.bytesToPortlets(((JetspeedRoleProfile)obj).getProfile(), this.mapping);
  - 
  +                list.add(createRoleProfile((JetspeedRoleProfile)obj, portlets));
               }
    
  -            list.add(portlets);
           }
           return list;
       }
  @@ -1049,5 +1057,97 @@
       {
           return this.mapping;
       }
  +
  +    /**
  +     * Creates a user profile from a JetspeedUserProfile database object.
  +     *
  +     * @param entity The user profile entity in the database.
  +     * @param portlets The PSML blob.
  +     * @return A new profile object representing the locator and PSML blob.
  +     */
  +    public Profile createUserProfile(JetspeedUserProfile entity, Portlets portlets)
  +    {
  +        Profile profile = new BaseProfile();
  +        try
  +        {
  +            JetspeedUser user = JetspeedSecurity.getUser(entity.getUserName());
  +            if (null == user)
  +            {
  +                user = JetspeedUserFactory.getInstance();
  +                user.setUserName(entity.getUserName());
  +            }
  +            profile.setUser(user);
  +    
  +            profile.setMediaType(entity.getMediaType());
  +            profile.setLanguage(entity.getLanguage());
  +            profile.setCountry(entity.getCountry());
  +            profile.setName(entity.getPage());
  +        }
  +        catch (JetspeedSecurityException e)
  +        {
  +        }
  +        return profile;
  +    }
  +
  +    /**
  +     * Creates a group profile from a JetspeedGroupProfile database object.
  +     *
  +     * @param entity The group profile entity in the database.
  +     * @param portlets The PSML blob.
  +     * @return A new profile object representing the locator and PSML blob.
  +     */
  +    public Profile createGroupProfile(JetspeedGroupProfile entity, Portlets 
portlets)
  +    {
  +        Profile profile = new BaseProfile();
  +        try
  +        {
  +            Group group = JetspeedSecurity.getGroup(entity.getGroupName());
  +            if (null == group)
  +            {
  +                group = JetspeedGroupFactory.getInstance();
  +                group.setName(entity.getGroupName());
  +            }
  +            profile.setGroup(group);
  +            profile.setMediaType(entity.getMediaType());
  +            profile.setLanguage(entity.getLanguage());
  +            profile.setCountry(entity.getCountry());
  +            profile.setName(entity.getPage());
  +        }
  +        catch (JetspeedSecurityException e)
  +        {
  +        }
  +        return profile;
  +    }
  +
  +    /**
  +     * Creates a role profile from a JetspeedRoleProfile database object.
  +     *
  +     * @param entity The group profile entity in the database.
  +     * @param portlets The PSML blob.
  +     * @return A new profile object representing the locator and PSML blob.
  +     */
  +    public Profile createRoleProfile(JetspeedRoleProfile entity, Portlets portlets)
  +    {
  +        Profile profile = new BaseProfile();
  +        try
  +        {
  +            Role role = JetspeedSecurity.getRole(entity.getRoleName());
  +            if (null == role)
  +            {
  +                role = JetspeedRoleFactory.getInstance();
  +                role.setName(entity.getRoleName());
  +            }
  +            profile.setRole(role);
  +            profile.setMediaType(entity.getMediaType());
  +            profile.setLanguage(entity.getLanguage());
  +            profile.setCountry(entity.getCountry());
  +            profile.setName(entity.getPage());
  +        }
  +        catch (JetspeedSecurityException e)
  +        {
  +        }
  +        return profile;
  +    }
  +
   
   }
  
  
  
  1.20      +0 -0      jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties
  
  Index: JetspeedSecurity.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/JetspeedSecurity.properties,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  
  
  
  1.16      +1 -1      jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.properties
  
  Index: jetspeed.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/db/jetspeed.properties,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jetspeed.properties       23 Jul 2002 00:03:55 -0000      1.15
  +++ jetspeed.properties       23 Jul 2002 04:54:36 -0000      1.16
  @@ -1,4 +1,4 @@
   #Hypersonic SQL database
  -#Mon Jul 22 16:57:40 PDT 2002
  +#Mon Jul 22 18:59:57 PDT 2002
   version=1.4
   modified=yes
  
  
  
  1.10      +14 -3     
jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/customizer-portletset-add.vm
  
  Index: customizer-portletset-add.vm
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/customizer-portletset-add.vm,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- customizer-portletset-add.vm      23 Jul 2002 00:03:56 -0000      1.9
  +++ customizer-portletset-add.vm      23 Jul 2002 04:54:36 -0000      1.10
  @@ -99,7 +99,13 @@
       <tr>
         <td>
           #if ($prev)
  -        <a 
href="$jslink.setTemplate("Customize").addPathInfo("start",$prev)">$l10n.CUSTOMIZER_PREVIOUSBTN</a>
  +          #set ($mtype = $!data.Parameters.getString("mtype"))
  +          #if ($!mtype) 
  +            <a 
href="$jslink.setTemplate("Customize").addPathInfo("start",$prev).addQueryData('mtype',
 $mtype)">$l10n.CUSTOMIZER_PREVIOUSBTN</a>
  +          #else
  +            <a 
href="$jslink.setTemplate("Customize").addPathInfo("start",$prev)">$l10n.CUSTOMIZER_PREVIOUSBTN</a>
  +          #end
  +
           #else
           &nbsp;
           #end
  @@ -108,11 +114,16 @@
           <input type="submit" name="eventSubmit_doAdd" 
value="$l10n.CUSTOMIZER_APPLY">
         </td>
         <td>
  -        <input type="reset" name="eventSubmit_doAdd" 
value="$l10n.CUSTOMIZER_CANCEL">
  +        <input type="submit" name="eventSubmit_doCancel" 
value="$l10n.CUSTOMIZER_CANCEL">
         </td>
         <td>
           #if ($next)
  -        <a 
href="$jslink.setTemplate("Customize").addPathInfo("start",$next)">$l10n.CUSTOMIZER_NEXTBTN</a>
  +          #set ($mtype = $!data.Parameters.getString("mtype"))
  +          #if ($!mtype) 
  +          <a 
href="$jslink.setTemplate("Customize").addPathInfo("start",$next).addQueryData('mtype',
 $mtype)">$l10n.CUSTOMIZER_NEXTBTN</a>
  +          #else
  +          <a 
href="$jslink.setTemplate("Customize").addPathInfo("start",$next)">$l10n.CUSTOMIZER_NEXTBTN</a>
  +          #end
           #else
           &nbsp;
           #end
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to