raphael 01/07/08 13:51:47
Modified: src/java/org/apache/jetspeed/portal
BasePortletSetConstraints.java
PanedPortletController.java
src/java/org/apache/jetspeed/portal/controllers
AbstractPortletController.java
src/java/org/apache/jetspeed/portal/portlets
AbstractPortlet.java
Added: src/java/org/apache/jetspeed/portal
PortletSetController.java
Log:
- fix various NPE
- fix a wring class casting in BasePortletConstraintSet
- introduce PortletSetController marker interface
- don't make the minimize/close/maximize settings always persistent
by default
Revision Changes Path
1.2 +31 -3
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSetConstraints.java
Index: BasePortletSetConstraints.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSetConstraints.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BasePortletSetConstraints.java 2001/06/04 17:36:35 1.1
+++ BasePortletSetConstraints.java 2001/07/08 20:51:46 1.2
@@ -58,7 +58,7 @@
* Trivial implementation of PortletSetConstraints
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: BasePortletSetConstraints.java,v 1.1 2001/06/04 17:36:35 raphael
Exp $
+ * @version $Id: BasePortletSetConstraints.java,v 1.2 2001/07/08 20:51:46 raphael
Exp $
*/
public class BasePortletSetConstraints extends java.util.HashMap
implements PortletSet.Constraints
@@ -69,7 +69,21 @@
*/
public Integer getColumn()
{
- return (Integer)get("column");
+ Object column = get("column");
+ if (column instanceof String)
+ {
+ try
+ {
+ column = new Integer(Integer.parseInt((String)column));
+ put("column", column);
+ }
+ catch (Exception e)
+ {
+ remove("column");
+ column=null;
+ }
+ }
+ return (Integer)column;
}
/** Set the column the portlet should be displayed in. This
@@ -93,7 +107,21 @@
*/
public Integer getRow()
{
- return (Integer)get("row");
+ Object row = get("row");
+ if (row instanceof String)
+ {
+ try
+ {
+ row = new Integer(Integer.parseInt((String)row));
+ put("row", row);
+ }
+ catch (Exception e)
+ {
+ remove("row");
+ row = null;
+ }
+ }
+ return (Integer)row;
}
/** Set the row the portlet should be displayed in. This
1.6 +2 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PanedPortletController.java
Index: PanedPortletController.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PanedPortletController.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PanedPortletController.java 2001/06/25 10:53:44 1.5
+++ PanedPortletController.java 2001/07/08 20:51:46 1.6
@@ -64,9 +64,9 @@
* to build the correct links for referencing the hidden portlets
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @version $Id: PanedPortletController.java,v 1.5 2001/06/25 10:53:44 raphael Exp $
+ * @version $Id: PanedPortletController.java,v 1.6 2001/07/08 20:51:46 raphael Exp $
*/
-public interface PanedPortletController extends PortletController
+public interface PanedPortletController extends PortletController,
PortletSetController
{
/**
* Test whether the selected portlet is considered selected for the current
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletSetController.java
Index: PortletSetController.java
===================================================================
/* ====================================================================
* 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.portal;
/**
* The PortletSetController is a marker interface denoting that the controller
* implementing this interface only expects to manipulates portlet sets and
* not directly portlets.
* This interface is mainly used by the customization component to decide
* whether to add directly a portlet to the controller or to wrap it inside
* a set.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @version $Id: PortletSetController.java,v 1.1 2001/07/08 20:51:46 raphael Exp $
*/
public interface PortletSetController
{
// simple marker interface
}
1.19 +2 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/AbstractPortletController.java
Index: AbstractPortletController.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controllers/AbstractPortletController.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- AbstractPortletController.java 2001/06/09 15:35:03 1.18
+++ AbstractPortletController.java 2001/07/08 20:51:46 1.19
@@ -75,7 +75,7 @@
/**
@author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
- @version $Id: AbstractPortletController.java,v 1.18 2001/06/09 15:35:03 raphael
Exp $
+ @version $Id: AbstractPortletController.java,v 1.19 2001/07/08 20:51:46 raphael
Exp $
*/
public abstract class AbstractPortletController implements PortletController
{
@@ -271,7 +271,7 @@
public PortletSet.Constraints getConstraints( Map original )
{
PortletSet.Constraints constraints = new BasePortletSetConstraints();
- constraints.putAll(original);
+ if (original != null) constraints.putAll(original);
return constraints;
}
1.43 +7 -2
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java
Index: AbstractPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- AbstractPortlet.java 2001/06/09 15:42:45 1.42
+++ AbstractPortlet.java 2001/07/08 20:51:46 1.43
@@ -92,7 +92,7 @@
@author <A HREF="mailto:[EMAIL PROTECTED]">Kevin A. Burton</A>
@author <A HREF="mailto:[EMAIL PROTECTED]">Rapha�l Luta</A>
-@version $Id: AbstractPortlet.java,v 1.42 2001/06/09 15:42:45 raphael Exp $
+@version $Id: AbstractPortlet.java,v 1.43 2001/07/08 20:51:46 raphael Exp $
*/
public abstract class AbstractPortlet implements Portlet, PortletState, Cacheable
{
@@ -613,7 +613,12 @@
.getService( PersistenceService.class,
rundata, params);
ps.getPage().setAttribute( attrName, attrValue );
- ps.store();
+
+ // only allow to persist if user is logged in
+ if (rundata.getUser().hasLoggedIn())
+ {
+ ps.store();
+ }
}
catch ( Exception e )
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]