portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r350066 [3/3] - in /portals/jetspeed-2/trunk: components/page-manager/ components/page-manager/src/java/JETSPEED-INF/castor/ components/page-manager/src/java/JETSPEED-INF/ojb/ components/page-manager/src/java/org/apache/jetspeed/om/folder/i...
Date Wed, 30 Nov 2005 22:53:59 GMT
Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsImpl.java Wed Nov 30 14:53:22 2005
@@ -18,6 +18,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.ListIterator;
 
 import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
@@ -37,179 +38,68 @@
     private List constraints;
     private List constraintsRefs;
 
-    private List securityConstraints;
-    private List securityConstraintsRefs;
+    private SecurityConstraintList securityConstraints;
+    private SecurityConstraintsRefList securityConstraintsRefs;
 
     private List allConstraints;
 
     /**
-     * beforeUpdate
+     * accessConstraintsRefs
      *
-     * Update persistent constraints using transient constraints.
+     * Access mutable persistent collection member for List wrappers.
+     *
+     * @return persistent collection
      */
-    public void beforeUpdate()
+    List accessConstraintsRefs()
     {
-        // synchronize persistent constraints
-        if ((securityConstraints != null) && !securityConstraints.isEmpty())
-        {
-            // update constraints collection size
-            if (constraints == null)
-            {
-                constraints = new ArrayList(securityConstraints.size());
-            }
-            while (constraints.size() < securityConstraints.size())
-            {
-                BaseSecurityConstraint constraint = newSecurityConstraint();
-                constraint.setApplyOrder(constraints.size());
-                constraints.add(constraint);
-            }
-            while (constraints.size() > securityConstraints.size())
-            {
-                constraints.remove(constraints.size()-1);
-            }
-            // update constraints
-            Iterator updateIter0 = securityConstraints.iterator();
-            Iterator updateIter1 = constraints.iterator();
-            while (updateIter0.hasNext() && updateIter1.hasNext())
-            {
-                SecurityConstraint securityConstraint = (SecurityConstraint)updateIter0.next();
-                BaseSecurityConstraint constraint = (BaseSecurityConstraint)updateIter1.next();
-                constraint.setUserPrincipals(securityConstraint.getUsersList());
-                constraint.setRolePrincipals(securityConstraint.getRolesList());
-                constraint.setGroupPrincipals(securityConstraint.getGroupsList());
-                constraint.setPermissions(securityConstraint.getPermissionsList());
-            }
-        }
-        else
+        // create initial collection if necessary
+        if (constraintsRefs == null)
         {
-            // empty constraints collection
-            if (constraints != null)
-            {
-                constraints.clear();
-            }
-        }
-
-        // synchronize persistent constraints references
-        if ((securityConstraintsRefs != null) && !securityConstraintsRefs.isEmpty())
-        {
-            // update constraints references collection size
-            if (constraintsRefs == null)
-            {
-                constraintsRefs = new ArrayList(securityConstraintsRefs.size());
-            }
-            while (constraintsRefs.size() < securityConstraintsRefs.size())
-            {
-                BaseSecurityConstraintsRef constraintsRef = newSecurityConstraintsRef();
-                constraintsRef.setApplyOrder(constraintsRefs.size());
-                constraintsRefs.add(constraintsRef);
-            }
-            while (constraintsRefs.size() > securityConstraintsRefs.size())
-            {
-                constraintsRefs.remove(constraintsRefs.size()-1);
-            }
-            // update constraints references
-            Iterator updateIter0 = securityConstraintsRefs.iterator();
-            Iterator updateIter1 = constraintsRefs.iterator();
-            while (updateIter0.hasNext() && updateIter1.hasNext())
-            {
-                String securityConstraintsRef = (String)updateIter0.next();
-                BaseSecurityConstraintsRef constraintsRef = (BaseSecurityConstraintsRef)updateIter1.next();
-                constraintsRef.setName(securityConstraintsRef);
-            }
-        }
-        else
-        {
-            // empty constraints references collection
-            if (constraintsRefs != null)
-            {
-                constraintsRefs.clear();
-            }
+            constraintsRefs = new ArrayList(4);
         }
+        return constraintsRefs;
     }
 
     /**
-     * afterLookup
+     * accessConstraints
      *
-     * Update transient constraints from persistent constraints.
+     * Access mutable persistent collection member for List wrappers.
+     *
+     * @return persistent collection
      */
-    public void afterLookup()
+    List accessConstraints()
     {
-        // synchronize constraints
-        if ((constraints != null) && !constraints.isEmpty())
-        {
-            // initialize security constraints collection
-            if (securityConstraints == null)
-            {
-                securityConstraints = new ArrayList(constraints.size());
-            }
-            else
-            {
-                securityConstraints.clear();
-            }
-            // construct security constraints
-            Iterator updateIter = constraints.iterator();
-            while (updateIter.hasNext())
-            {
-                BaseSecurityConstraint constraint = (BaseSecurityConstraint)updateIter.next();
-                SecurityConstraint securityConstraint = new SecurityConstraintImpl();
-                securityConstraint.setUsers(constraint.getUserPrincipals());
-                securityConstraint.setRoles(constraint.getRolePrincipals());
-                securityConstraint.setGroups(constraint.getGroupPrincipals());
-                securityConstraint.setPermissions(constraint.getPermissions());
-                securityConstraints.add(securityConstraint);
-            }
-        }
-        else
-        {
-            // remove security constraints collection
-            securityConstraints = null;
-        }
-
-        // synchronize constraints references
-        if ((constraintsRefs != null) && !constraintsRefs.isEmpty())
-        {
-            // update security constraints references
-            if (securityConstraintsRefs == null)
-            {
-                securityConstraintsRefs = new ArrayList(constraintsRefs.size());
-            }
-            else
-            {
-                securityConstraintsRefs.clear();
-            }
-            Iterator updateIter = constraintsRefs.iterator();
-            while (updateIter.hasNext())
-            {
-                BaseSecurityConstraintsRef constraintsRef = (BaseSecurityConstraintsRef)updateIter.next();
-                securityConstraintsRefs.add(constraintsRef.getName());
-            }
-        }
-        else
+        // create initial collection if necessary
+        if (constraints == null)
         {
-            // remove security constraints references collection
-            securityConstraintsRefs = null;
+            constraints = new ArrayList(4);
         }
+        return constraints;
     }
 
     /**
-     * newSecurityConstraint
+     * getSecurityConstraintClass
+     *
+     * Return class of persistent constraint instance.
      *
-     * Create new persistent constraint instance.
+     * @return constraint class
      */
-    public BaseSecurityConstraint newSecurityConstraint()
+    public Class getSecurityConstraintClass()
     {
-        // transient by default
+        // none by default
         return null;
     }
 
     /**
-     * newSecurityConstraintsRef
+     * getSecurityConstraintsRefClass
      *
-     * Create new persistent constraints reference instance.
+     * Return class of persistent constraints reference instance.
+     *
+     * @return constraints reference class
      */
-    public BaseSecurityConstraintsRef newSecurityConstraintsRef()
+    public Class getSecurityConstraintsRefClass()
     {
-        // transient by default
+        // none by default
         return null;
     }
 
@@ -323,9 +213,9 @@
         }
 
         // add any security constraints references
-        if ((securityConstraintsRefs != null) && !securityConstraintsRefs.isEmpty())
+        if ((getSecurityConstraintsRefs() != null) && !getSecurityConstraintsRefs().isEmpty())
         {
-            List referencedConstraints = dereferenceSecurityConstraintsRefs(securityConstraintsRefs, pageSecurity);
+            List referencedConstraints = dereferenceSecurityConstraintsRefs(getSecurityConstraintsRefs(), pageSecurity);
             if (referencedConstraints != null)
             {
                 allConstraints.addAll(referencedConstraints);
@@ -352,7 +242,7 @@
     /**
      * clearAllSecurityConstraints
      */
-    private synchronized void clearAllSecurityConstraints()
+    synchronized void clearAllSecurityConstraints()
     {
         // clear previously cached security constraints
         allConstraints = null;
@@ -412,6 +302,12 @@
      */
     public List getSecurityConstraints()
     {
+        // return mutable inline constraint list
+        // by using list wrapper to manage apply order
+        if (securityConstraints == null)
+        {
+            securityConstraints = new SecurityConstraintList(this);
+        }
         return securityConstraints;
     }
     
@@ -420,8 +316,20 @@
      */
     public void setSecurityConstraints(List constraints)
     {
-        // save new setting and reset cached security constraints
-        securityConstraints = constraints;
+        // set inline constraints by replacing existing
+        // entries with new elements if new collection
+        // is specified
+        List securityConstraints = getSecurityConstraints();
+        if (constraints != securityConstraints)
+        {
+            // replace all constraints
+            securityConstraints.clear();
+            if (constraints != null)
+            {
+                securityConstraints.addAll(constraints);
+            }
+        }
+        // reset cached security constraints
         clearAllSecurityConstraints();
     }
 
@@ -430,6 +338,13 @@
      */
     public List getSecurityConstraintsRefs()
     {
+        // return mutable constraints refs list
+        // by using list wrapper to manage apply
+        // order and element uniqueness
+        if (securityConstraintsRefs == null)
+        {
+            securityConstraintsRefs = new SecurityConstraintsRefList(this);
+        }
         return securityConstraintsRefs;
     }
     
@@ -438,8 +353,20 @@
      */
     public void setSecurityConstraintsRefs(List constraintsRefs)
     {
-        // save new setting and reset cached security constraints
-        securityConstraintsRefs = constraintsRefs;
+        // set constraints refs using ordered ref
+        // names by replacing existing entries with
+        // new elements if new collection is specified
+        List securityConstraintsRefs = getSecurityConstraintsRefs();
+        if (constraintsRefs != securityConstraintsRefs)
+        {
+            // replace all constraints ref names
+            securityConstraintsRefs.clear();
+            if (constraintsRefs != null)
+            {
+                securityConstraintsRefs.addAll(constraintsRefs);
+            }
+        }
+        // reset cached security constraints
         clearAllSecurityConstraints();
     }
 

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java?rev=350066&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java Wed Nov 30 14:53:22 2005
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.page.impl;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SecurityConstraintsRefList
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+class SecurityConstraintsRefList extends AbstractList
+{
+    private SecurityConstraintsImpl constraints;
+
+    private List removedConstraintsRefs;
+
+    SecurityConstraintsRefList(SecurityConstraintsImpl constraints)
+    {
+        super();
+        this.constraints = constraints;
+    }
+
+    /**
+     * wrapNameStringForAdd
+     *
+     * Wraps and validates constraints ref name string
+     * to be added to this list.
+     *
+     * @param name constraints ref name string to add
+     * @return list element to add
+     */
+    private BaseSecurityConstraintsRef wrapNameStringForAdd(String name)
+    {
+        // only non-null names supported
+        if (name == null)
+        {
+            throw new NullPointerException("Unable to add null to list.");
+        }
+        // wrap constraints ref name string
+        BaseSecurityConstraintsRef constraintsRef = null;
+        if (constraints.getSecurityConstraintsRefClass() != null)
+        {
+            // use specific constraints ref name string wrapper
+            try
+            {
+                constraintsRef = (BaseSecurityConstraintsRef)constraints.getSecurityConstraintsRefClass().newInstance();
+            }
+            catch (InstantiationException ie)
+            {
+                throw new ClassCastException("Unable to create constratins reference list element instance: " + constraints.getSecurityConstraintsRefClass().getName() + ", (" + ie + ").");
+            }
+            catch (IllegalAccessException iae)
+            {
+                throw new ClassCastException("Unable to create constraints reference list element instance: " + constraints.getSecurityConstraintsRefClass().getName() + ", " + iae + ").");
+            }
+        }
+        else
+        {
+            // use generic constraints ref name string wrapper
+            constraintsRef = new BaseSecurityConstraintsRef();
+        }
+        constraintsRef.setName(name);
+        // make sure element is unique
+        if (constraints.accessConstraintsRefs().contains(constraintsRef))
+        {
+            throw new IllegalArgumentException("Unable to add duplicate entry to list: " + constraintsRef.getName());
+        }
+        // retrieve from removed list to reuse
+        // previously removed element
+        if (removedConstraintsRefs != null)
+        {
+            int removedIndex = removedConstraintsRefs.indexOf(constraintsRef);
+            if (removedIndex >= 0)
+            {
+                constraintsRef = (BaseSecurityConstraintsRef)removedConstraintsRefs.remove(removedIndex);
+            }
+        }
+        return constraintsRef;
+    }
+
+    /**
+     * getRemovedConstraintsRefs
+     *
+     * @return removed constraints refs tracking collection
+     */
+    private List getRemovedConstraintsRefs()
+    {
+        if (removedConstraintsRefs == null)
+        {
+            removedConstraintsRefs = new ArrayList(constraints.accessConstraintsRefs().size());
+        }
+        return removedConstraintsRefs;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#add(int,java.lang.Object)
+     */
+    public void add(int index, Object element)
+    {
+        // implement for modifiable AbstractList:
+        // validate index
+        if ((index < 0) || (index > constraints.accessConstraintsRefs().size()))
+        {
+            throw new IndexOutOfBoundsException("Unable to add to list at index: " + index);
+        }
+        // wrap and verify constraints ref name string
+        BaseSecurityConstraintsRef constraintsRef = wrapNameStringForAdd((String)element);
+        // add to underlying ordered list
+        constraints.accessConstraintsRefs().add(index, constraintsRef);
+        // set apply order in added element
+        if (index > 0)
+        {
+            constraintsRef.setApplyOrder(((BaseSecurityConstraintsRef)constraints.accessConstraintsRefs().get(index-1)).getApplyOrder() + 1);
+        }
+        else
+        {
+            constraintsRef.setApplyOrder(0);
+        }
+        // maintain apply order in subsequent elements
+        for (int i = index, limit = constraints.accessConstraintsRefs().size() - 1; (i < limit); i++)
+        {
+            BaseSecurityConstraintsRef nextConstraintsRef = (BaseSecurityConstraintsRef)constraints.accessConstraintsRefs().get(i + 1);
+            if (nextConstraintsRef.getApplyOrder() <= constraintsRef.getApplyOrder())
+            {
+                // adjust apply order for next element
+                nextConstraintsRef.setApplyOrder(constraintsRef.getApplyOrder() + 1);
+                constraintsRef = nextConstraintsRef;
+            }
+            else
+            {
+                // apply order maintained for remaining list elements
+                break;
+            }
+        }
+        // clear all cached security constraints
+        constraints.clearAllSecurityConstraints();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#get(int)
+     */
+    public Object get(int index)
+    {
+        // implement for modifiable AbstractList:
+        // unwrap constraints ref name string
+        return ((BaseSecurityConstraintsRef)constraints.accessConstraintsRefs().get(index)).getName();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#remove(int)
+     */
+    public Object remove(int index)
+    {
+        // implement for modifiable AbstractList
+        BaseSecurityConstraintsRef removed = (BaseSecurityConstraintsRef)constraints.accessConstraintsRefs().remove(index);
+        if (removed != null)
+        {
+            // save removed element 
+            getRemovedConstraintsRefs().add(removed);
+            // clear all cached security constraints
+            constraints.clearAllSecurityConstraints();
+        }
+        return removed;
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#set(int,java.lang.Object)
+     */
+    public Object set(int index, Object element)
+    {
+        // implement for modifiable AbstractList:
+        // wrap and verify constraints ref name string
+        BaseSecurityConstraintsRef newConstraintsRef = wrapNameStringForAdd((String)element);
+        // set in underlying ordered list
+        BaseSecurityConstraintsRef constraintsRef = (BaseSecurityConstraintsRef)constraints.accessConstraintsRefs().set(index, newConstraintsRef);
+        // set apply order in new element
+        newConstraintsRef.setApplyOrder(constraintsRef.getApplyOrder());
+        // save replaced element
+        getRemovedConstraintsRefs().add(constraintsRef);
+        // clear all cached security constraints
+        constraints.clearAllSecurityConstraints();
+        // return unwrapped constraints ref name string
+        return constraintsRef.getName();
+    }
+
+    /* (non-Javadoc)
+     * @see java.util.List#size()
+     */
+    public int size()
+    {
+        // implement for modifiable AbstractList
+        return constraints.accessConstraintsRefs().size();
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/SecurityConstraintsRefList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java Wed Nov 30 14:53:22 2005
@@ -301,6 +301,14 @@
 
     }
 
+    /**
+     * <p>
+     * getPreferences
+     * </p>
+     * 
+     * @see org.apache.jetspeed.om.page.Fragment#getPreferences()
+     * @param name
+     */
     public List getPreferences()
     {
         return preferences;
@@ -311,7 +319,7 @@
         this.preferences = preferences;  
     } 
     
-        /**
+    /**
      * unmarshalled - notification that this instance has been
      *                loaded from the persistent store
      */

Copied: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsDefImpl.java (from r345429, portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/SecurityConstraintsDefImpl.java)
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsDefImpl.java?p2=portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsDefImpl.java&p1=portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/SecurityConstraintsDefImpl.java&r1=345429&r2=350066&rev=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/SecurityConstraintsDefImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/SecurityConstraintsDefImpl.java Wed Nov 30 14:53:22 2005
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jetspeed.om.page;
+package org.apache.jetspeed.om.page.psml;
 
 import java.util.List;
 

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java Wed Nov 30 14:53:22 2005
@@ -40,6 +40,8 @@
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.document.Node;
 import org.apache.jetspeed.portalsite.MenuElement;
 
@@ -68,6 +70,7 @@
     protected Class securityConstraintsClass;
     protected Class securityConstraintClass;
     protected Class securityConstraintsDefClass;
+    protected Class fragmentPreferenceClass;
 
     private boolean permissionsEnabled;
 
@@ -98,6 +101,7 @@
         this.securityConstraintsClass = (Class)modelClasses.get("SecurityConstraintsImpl.class");
         this.securityConstraintClass = (Class)modelClasses.get("SecurityConstraintImpl.class");
         this.securityConstraintsDefClass = (Class)modelClasses.get("SecurityConstraintsDefImpl.class");
+        this.fragmentPreferenceClass = (Class)modelClasses.get("FragmentPreferenceImpl.class");
     }
     
     /**
@@ -413,6 +417,25 @@
         catch (ClassCastException e)
         {
             String message = "Failed to create security constraints definition object for " + this.securityConstraintsDefClass;
+            log.error(message, e);
+        }
+        return null;
+    }
+
+    /**
+     * newFragmentPreference - creates a new security constraints definition
+     *
+     * @return a newly created FragmentPreference object
+     */
+    public FragmentPreference newFragmentPreference()
+    {
+        try
+        {
+            return (FragmentPreference)createObject(this.fragmentPreferenceClass);
+        }
+        catch (ClassCastException e)
+        {
+            String message = "Failed to create security constraints definition object for " + this.fragmentPreferenceClass;
             log.error(message, e);
         }
         return null;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/document/impl/NodeImpl.java Wed Nov 30 14:53:22 2005
@@ -112,7 +112,7 @@
         {
             if (metadataFields == null)
             {
-                metadataFields = new ArrayList(4);
+                metadataFields = new ArrayList(1);
             }
             pageMetadata = newPageMetadata(metadataFields);
         }

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java Wed Nov 30 14:53:22 2005
@@ -40,11 +40,13 @@
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.SecurityConstraintImpl;
 import org.apache.jetspeed.om.page.SecurityConstraintsDef;
-import org.apache.jetspeed.om.page.SecurityConstraintsDefImpl;
 import org.apache.jetspeed.om.page.impl.FragmentImpl;
+import org.apache.jetspeed.om.page.impl.FragmentPreferenceImpl;
 import org.apache.jetspeed.om.page.impl.PageImpl;
 import org.apache.jetspeed.om.page.impl.PageSecurityImpl;
+import org.apache.jetspeed.om.page.impl.SecurityConstraintsDefImpl;
 import org.apache.jetspeed.om.page.impl.SecurityConstraintsImpl;
+import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.DelegatingPageManager;
 import org.apache.jetspeed.page.FolderNotRemovedException;
 import org.apache.jetspeed.page.FolderNotUpdatedException;
@@ -95,6 +97,7 @@
         modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
         modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
         modelClasses.put("SecurityConstraintsDefImpl.class", SecurityConstraintsDefImpl.class);
+        modelClasses.put("FragmentPreferenceImpl.class", FragmentPreferenceImpl.class);
     }
 
     private DelegatingPageManager delegator;
@@ -268,6 +271,14 @@
     public SecurityConstraintsDef newSecurityConstraintsDef()
     {
         return delegator.newSecurityConstraintsDef();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newFragmentPreference()
+     */
+    public FragmentPreference newFragmentPreference()
+    {
+        return delegator.newFragmentPreference();
     }
 
     /* (non-Javadoc)

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/psml/CastorXmlPageManager.java Wed Nov 30 14:53:22 2005
@@ -45,12 +45,14 @@
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.SecurityConstraintImpl;
-import org.apache.jetspeed.om.page.SecurityConstraintsDefImpl;
 import org.apache.jetspeed.om.page.psml.FragmentImpl;
 import org.apache.jetspeed.om.page.psml.LinkImpl;
 import org.apache.jetspeed.om.page.psml.PageImpl;
 import org.apache.jetspeed.om.page.psml.PageSecurityImpl;
+import org.apache.jetspeed.om.page.psml.SecurityConstraintsDefImpl;
 import org.apache.jetspeed.om.page.psml.SecurityConstraintsImpl;
+import org.apache.jetspeed.om.preference.FragmentPreference;
+import org.apache.jetspeed.om.preference.impl.FragmentPreferenceImpl;
 import org.apache.jetspeed.page.AbstractPageManager;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.page.PageNotFoundException;
@@ -92,6 +94,7 @@
         modelClasses.put("SecurityConstraintsImpl.class", SecurityConstraintsImpl.class);
         modelClasses.put("SecurityConstraintImpl.class", SecurityConstraintImpl.class);
         modelClasses.put("SecurityConstraintsDefImpl.class", SecurityConstraintsDefImpl.class);
+        modelClasses.put("FragmentPreferenceImpl.class", FragmentPreferenceImpl.class);
     }
 
     private IdGenerator generator = null;

Added: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/PageManagerTestShared.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/PageManagerTestShared.java?rev=350066&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/PageManagerTestShared.java (added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/PageManagerTestShared.java Wed Nov 30 14:53:22 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.page;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * PageManagerTestShared
+ * 
+ * @author <a href="rwatler@apache.org">Randy Watler</a>
+ * @version $Id: $
+ *          
+ */
+interface PageManagerTestShared
+{
+    class Shared
+    {
+        /**
+         * makeListFromCSV
+         *
+         * Create List of String values from CSV String for principals/permissions.
+         * 
+         * @param csv CSV string
+         * @return values list
+         */
+        static List makeListFromCSV(String csv)
+        {
+            if (!csv.equals("*"))
+            {
+                List csvList = new ArrayList();
+                if (csv.indexOf(',') != -1)
+                {
+                    StringTokenizer csvTokens = new StringTokenizer(csv, ",");
+                    while (csvTokens.hasMoreTokens())
+                    {
+                        csvList.add(csvTokens.nextToken().trim());
+                    }
+                }
+                else
+                {
+                    csvList.add(csv);
+                }
+                return csvList;
+            }
+            return null;        
+        }
+
+        /**
+         * makeCSVFromList
+         *
+         * Create CSV String for principals/permissions from List of String values
+         * 
+         * @param list values list
+         * @return CSV string
+         */
+        static String makeCSVFromList(List list)
+        {
+            if ((list != null) && !list.isEmpty())
+            {
+                StringBuffer csv = new StringBuffer();
+                Iterator listIter = list.iterator();
+                while (listIter.hasNext())
+                {
+                    if (csv.length() > 0)
+                    {
+                        csv.append(",");
+                    }
+                    csv.append((String)listIter.next());
+                }
+                return csv.toString();
+            }
+            return null;
+        }
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/PageManagerTestShared.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestCastorXmlPageManager.java Wed Nov 30 14:53:22 2005
@@ -51,6 +51,7 @@
 import org.apache.jetspeed.om.page.psml.LinkImpl;
 import org.apache.jetspeed.om.page.psml.PageImpl;
 import org.apache.jetspeed.om.page.psml.PageSecurityImpl;
+import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.document.DocumentHandler;
 import org.apache.jetspeed.page.document.DocumentHandlerFactory;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
@@ -69,7 +70,7 @@
  * @version $Id: TestCastorXmlPageManager.java,v 1.9 2004/08/24 21:33:05 weaver
  *          Exp $
  */
-public class TestCastorXmlPageManager extends TestCase
+public class TestCastorXmlPageManager extends TestCase implements PageManagerTestShared 
 {
     private String testPage002 = "/test002.psml";
     private String testPage003 = "/test003.psml";
@@ -242,6 +243,21 @@
         assertEquals("0", f.getProperty(Fragment.ROW_PROPERTY_NAME));
         assertEquals(0, f.getIntProperty(Fragment.COLUMN_PROPERTY_NAME));
 
+        List preferences = f.getPreferences();
+        assertNotNull(preferences);
+        assertTrue(preferences.size() == 2);
+        assertEquals("pref0", ((FragmentPreference)preferences.get(0)).getName());
+        assertTrue(((FragmentPreference)preferences.get(0)).isReadOnly());
+        assertNotNull(((FragmentPreference)preferences.get(0)).getValueList());
+        assertEquals(2, ((FragmentPreference)preferences.get(0)).getValueList().size());
+        assertEquals("pref0-value0", (String)((FragmentPreference)preferences.get(0)).getValueList().get(0));
+        assertEquals("pref0-value1", (String)((FragmentPreference)preferences.get(0)).getValueList().get(1));
+        assertEquals("pref1", ((FragmentPreference)preferences.get(1)).getName());
+        assertFalse(((FragmentPreference)preferences.get(1)).isReadOnly());
+        assertNotNull(((FragmentPreference)preferences.get(1)).getValueList());
+        assertEquals(1, ((FragmentPreference)preferences.get(1)).getValueList().size());
+        assertEquals("pref1-value", (String)((FragmentPreference)preferences.get(1)).getValueList().get(0));
+
         f = (Fragment) children.get(1);
         assertTrue(f.getId().equals("pe002"));
         assertTrue(f.getName().equals("JMXPortlet"));
@@ -294,9 +310,9 @@
         constraints.setOwner("new-user");
         List constraintsList = new ArrayList(1);
         SecurityConstraint constraint = pageManager.newSecurityConstraint();
-        constraint.setUsers("user10,user11");
-        constraint.setRoles("*");
-        constraint.setPermissions(page.EDIT_ACTION + "," + page.VIEW_ACTION);
+        constraint.setUsers(Shared.makeListFromCSV("user10,user11"));
+        constraint.setRoles(Shared.makeListFromCSV("*"));
+        constraint.setPermissions(Shared.makeListFromCSV(page.EDIT_ACTION + "," + page.VIEW_ACTION));
         constraintsList.add(constraint);
         constraints.setSecurityConstraints(constraintsList);
         List constraintsRefsList = new ArrayList(1);
@@ -934,9 +950,13 @@
         assertTrue(secs.size() == 1);
         SecurityConstraint constraint = (SecurityConstraint)secs.get(0);
         assertNotNull(constraint);
-        assertTrue(constraint.getUsers().equals("user10,user11"));
-        assertTrue(constraint.getRoles().equals("*"));
-        assertTrue(constraint.getPermissions().equals("edit,view"));
+        assertTrue(constraint.getUsers() != null);
+        assertTrue(constraint.getUsers().size() == 2);
+        assertTrue(Shared.makeCSVFromList(constraint.getUsers()).equals("user10,user11"));
+        assertTrue(constraint.getRoles() == null);
+        assertTrue(constraint.getPermissions() != null);
+        assertTrue(constraint.getPermissions().size() == 2);
+        assertTrue(Shared.makeCSVFromList(constraint.getPermissions()).equals("edit,view"));
         List refs = constraints.getSecurityConstraintsRefs();
         assertNotNull(refs);
         assertTrue(refs.size() == 1);

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java Wed Nov 30 14:53:22 2005
@@ -16,8 +16,10 @@
 package org.apache.jetspeed.page;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.StringTokenizer;
 
 import org.apache.jetspeed.components.util.DatasourceEnabledSpringTestCase;
 import org.apache.jetspeed.om.common.GenericMetadata;
@@ -29,6 +31,7 @@
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
 import org.apache.jetspeed.page.document.FailedToUpdateDocumentException;
 import org.apache.jetspeed.page.document.Node;
@@ -45,7 +48,7 @@
  * @version $Id: $
  *          
  */
-public class TestDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerEventListener
+public class TestDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerTestShared, PageManagerEventListener
 {
     private String deepFolderPath = "/__subsite-rootx/_user/userx/_role/rolex/_group/groupx/_mediatype/xhtml/_language/en/_country/us/_custom/customx";
     private String deepPagePath = deepFolderPath + "/default-page.psml";
@@ -144,13 +147,13 @@
         folderConstraints.setOwner("admin");
         List inlineFolderConstraints = new ArrayList(2);
         SecurityConstraint folderConstraint = pageManager.newSecurityConstraint();
-        folderConstraint.setUsers("user,admin");
-        folderConstraint.setRoles("manager");
-        folderConstraint.setGroups("*");
-        folderConstraint.setPermissions("view,edit");
+        folderConstraint.setUsers(Shared.makeListFromCSV("user,admin"));
+        folderConstraint.setRoles(Shared.makeListFromCSV("manager"));
+        folderConstraint.setGroups(Shared.makeListFromCSV("*"));
+        folderConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
         inlineFolderConstraints.add(folderConstraint);
         folderConstraint = pageManager.newSecurityConstraint();
-        folderConstraint.setPermissions("edit");
+        folderConstraint.setPermissions(Shared.makeListFromCSV("edit"));
         inlineFolderConstraints.add(folderConstraint);
         folderConstraints.setSecurityConstraints(inlineFolderConstraints);
         List folderConstraintsRefs = new ArrayList(2);
@@ -158,6 +161,10 @@
         folderConstraintsRefs.add("public-edit");
         folderConstraints.setSecurityConstraintsRefs(folderConstraintsRefs);
         folder.setSecurityConstraints(folderConstraints);
+        List documentOrder = new ArrayList(2);
+        documentOrder.add("some-other-page.psml");
+        documentOrder.add("default-page.psml");
+        folder.setDocumentOrder(documentOrder);
         pageManager.updateFolder(folder);
         
         assertNull(folder.getParent());
@@ -176,8 +183,8 @@
         pageConstraints.setOwner("user");
         List inlinePageConstraints = new ArrayList(1);
         SecurityConstraint pageConstraint = pageManager.newSecurityConstraint();
-        pageConstraint.setUsers("jetspeed");
-        pageConstraint.setPermissions("edit");
+        pageConstraint.setUsers(Shared.makeListFromCSV("jetspeed"));
+        pageConstraint.setPermissions(Shared.makeListFromCSV("edit"));
         inlinePageConstraints.add(pageConstraint);
         pageConstraints.setSecurityConstraints(inlinePageConstraints);
         List pageConstraintsRefs = new ArrayList(1);
@@ -202,6 +209,22 @@
         portlet.setState("Normal");
         portlet.setLayoutRow(88);
         portlet.setLayoutColumn(99);
+        List preferences = new ArrayList(2);
+        FragmentPreference preference = pageManager.newFragmentPreference();
+        preference.setName("pref0");
+        preference.setReadOnly(true);
+        List preferenceValues = new ArrayList(2);
+        preferenceValues.add("pref0-value0");
+        preferenceValues.add("pref0-value1");
+        preference.setValueList(preferenceValues);
+        preferences.add(preference);
+        preference = pageManager.newFragmentPreference();
+        preference.setName("pref1");
+        preferenceValues = new ArrayList(1);
+        preferenceValues.add("pref1-value");
+        preference.setValueList(preferenceValues);
+        preferences.add(preference);
+        portlet.setPreferences(preferences);
         root.getFragments().add(portlet);
         portlet = pageManager.newPortletFragment();
         portlet.setName("some-app::SomePortlet");
@@ -228,8 +251,8 @@
         constraintsDef.setName("public-view");
         List defConstraints = new ArrayList(1);
         SecurityConstraint defConstraint = pageManager.newSecurityConstraint();
-        defConstraint.setUsers("*");
-        defConstraint.setPermissions("view");
+        defConstraint.setUsers(Shared.makeListFromCSV("*"));
+        defConstraint.setPermissions(Shared.makeListFromCSV("view"));
         defConstraints.add(defConstraint);
         constraintsDef.setSecurityConstraints(defConstraints);
         constraintsDefs.add(constraintsDef);
@@ -237,11 +260,11 @@
         constraintsDef.setName("admin-all");
         defConstraints = new ArrayList(2);
         defConstraint = pageManager.newSecurityConstraint();
-        defConstraint.setRoles("admin");
-        defConstraint.setPermissions("view,edit");
+        defConstraint.setRoles(Shared.makeListFromCSV("admin"));
+        defConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
         defConstraints.add(defConstraint);
         defConstraint = pageManager.newSecurityConstraint();
-        defConstraint.setRoles("nobody");
+        defConstraint.setRoles(Shared.makeListFromCSV("nobody"));
         defConstraints.add(defConstraint);
         constraintsDef.setSecurityConstraints(defConstraints);
         constraintsDefs.add(constraintsDef);
@@ -314,7 +337,7 @@
         assertNotNull(page.getParent());
         assertEquals(page.getParent().getId(), folder.getId());
     }
-    
+
     public void testGets() throws Exception
     {
         // reset page manager cache
@@ -331,11 +354,11 @@
             assertEquals("admin-all", ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getName());
             assertNotNull(((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints());
             assertEquals(2, ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints().size());
-            assertEquals("view,edit", ((SecurityConstraint)((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints().get(0)).getPermissions());
+            assertEquals("view,edit", Shared.makeCSVFromList(((SecurityConstraint)((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(0)).getSecurityConstraints().get(0)).getPermissions()));
             assertEquals("public-view", ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getName());
             assertNotNull(((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints());
             assertEquals(1, ((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints().size());
-            assertEquals("view", ((SecurityConstraint)((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints().get(0)).getPermissions());
+            assertEquals("view", Shared.makeCSVFromList(((SecurityConstraint)((SecurityConstraintsDef)check.getSecurityConstraintsDefs().get(1)).getSecurityConstraints().get(0)).getPermissions()));
             assertNotNull(check.getGlobalSecurityConstraintsRefs());
             assertEquals(2, check.getGlobalSecurityConstraintsRefs().size());
             assertEquals("admin-all", (String)check.getGlobalSecurityConstraintsRefs().get(0));
@@ -367,7 +390,7 @@
             assertEquals("manager-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(0));
             assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
             assertEquals(1, check.getSecurityConstraints().getSecurityConstraints().size());
-            assertEquals("jetspeed", ((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers());
+            assertEquals("jetspeed", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers()));
             assertNotNull(check.getRootFragment());
             assertEquals("blue-gradient", check.getRootFragment().getDecorator());
             assertEquals("jetspeed-layouts::VelocityTwoColumns", check.getRootFragment().getName());
@@ -379,22 +402,37 @@
             assertEquals("custom-prop-value1", check.getRootFragment().getProperty("custom-prop1"));
             assertNotNull(check.getRootFragment().getFragments());
             assertEquals(2, check.getRootFragment().getFragments().size());
-            assertEquals("security::LoginPortlet", ((Fragment)check.getRootFragment().getFragments().get(0)).getName());
-            assertEquals("Portlet", ((Fragment)check.getRootFragment().getFragments().get(0)).getShortTitle());
-            assertEquals("Portlet Fragment", ((Fragment)check.getRootFragment().getFragments().get(0)).getTitle());
-            assertEquals("Normal", ((Fragment)check.getRootFragment().getFragments().get(0)).getState());
-            assertEquals(88, ((Fragment)check.getRootFragment().getFragments().get(0)).getLayoutRow());
-            assertEquals(88, ((Fragment)check.getRootFragment().getFragments().get(0)).getIntProperty(Fragment.ROW_PROPERTY_NAME));
-            assertEquals(99, ((Fragment)check.getRootFragment().getFragments().get(0)).getLayoutColumn());
-            assertEquals("some-app::SomePortlet", ((Fragment)check.getRootFragment().getFragments().get(1)).getName());
-            assertEquals("Some Portlet", ((Fragment)check.getRootFragment().getFragments().get(1)).getShortTitle());
-            assertEquals("Some Portlet Fragment", ((Fragment)check.getRootFragment().getFragments().get(1)).getTitle());
-            assertEquals("Normal", ((Fragment)check.getRootFragment().getFragments().get(1)).getState());
-            assertEquals(22, ((Fragment)check.getRootFragment().getFragments().get(1)).getLayoutRow());
-            assertEquals(11, ((Fragment)check.getRootFragment().getFragments().get(1)).getLayoutColumn());
-            assertNotNull(((Fragment)check.getRootFragment().getFragments().get(1)).getSecurityConstraints());
-            assertEquals("user", ((Fragment)check.getRootFragment().getFragments().get(1)).getSecurityConstraints().getOwner());
-            assertNotNull(check.getFragmentById(((Fragment)check.getRootFragment().getFragments().get(0)).getId()));
+            Fragment check0 = (Fragment)check.getRootFragment().getFragments().get(0);
+            assertEquals("security::LoginPortlet", check0.getName());
+            assertEquals("Portlet", check0.getShortTitle());
+            assertEquals("Portlet Fragment", check0.getTitle());
+            assertEquals("Normal", check0.getState());
+            assertEquals(88, check0.getLayoutRow());
+            assertEquals(88, check0.getIntProperty(Fragment.ROW_PROPERTY_NAME));
+            assertEquals(99, check0.getLayoutColumn());
+            assertNotNull(check0.getPreferences());
+            assertEquals(2, check0.getPreferences().size());
+            assertEquals("pref0", ((FragmentPreference)check0.getPreferences().get(0)).getName());
+            assertTrue(((FragmentPreference)check0.getPreferences().get(0)).isReadOnly());
+            assertNotNull(((FragmentPreference)check0.getPreferences().get(0)).getValueList());
+            assertEquals(2, ((FragmentPreference)check0.getPreferences().get(0)).getValueList().size());
+            assertEquals("pref0-value0", (String)((FragmentPreference)check0.getPreferences().get(0)).getValueList().get(0));
+            assertEquals("pref0-value1", (String)((FragmentPreference)check0.getPreferences().get(0)).getValueList().get(1));
+            assertEquals("pref1", ((FragmentPreference)check0.getPreferences().get(1)).getName());
+            assertFalse(((FragmentPreference)check0.getPreferences().get(1)).isReadOnly());
+            assertNotNull(((FragmentPreference)check0.getPreferences().get(1)).getValueList());
+            assertEquals(1, ((FragmentPreference)check0.getPreferences().get(1)).getValueList().size());
+            assertEquals("pref1-value", (String)((FragmentPreference)check0.getPreferences().get(1)).getValueList().get(0));
+            Fragment check1 = (Fragment)check.getRootFragment().getFragments().get(1);
+            assertEquals("some-app::SomePortlet", check1.getName());
+            assertEquals("Some Portlet", check1.getShortTitle());
+            assertEquals("Some Portlet Fragment", check1.getTitle());
+            assertEquals("Normal", check1.getState());
+            assertEquals(22, check1.getLayoutRow());
+            assertEquals(11, check1.getLayoutColumn());
+            assertNotNull(check1.getSecurityConstraints());
+            assertEquals("user", check1.getSecurityConstraints().getOwner());
+            assertNotNull(check.getFragmentById(check0.getId()));
             assertNotNull(check.getFragmentsByName("some-app::SomePortlet"));
             assertEquals(1, check.getFragmentsByName("some-app::SomePortlet").size());
             assertNotNull(check.getParent());
@@ -420,8 +458,14 @@
             assertEquals("public-edit", (String)check.getSecurityConstraints().getSecurityConstraintsRefs().get(1));
             assertNotNull(check.getSecurityConstraints().getSecurityConstraints());
             assertEquals(2, check.getSecurityConstraints().getSecurityConstraints().size());
-            assertEquals("user,admin", ((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers());
-            assertEquals("edit", ((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(1)).getPermissions());
+            assertEquals("user,admin", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getUsers()));
+            assertEquals("manager", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getRoles()));
+            assertNull(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(0)).getGroups());
+            assertEquals("edit", Shared.makeCSVFromList(((SecurityConstraint)check.getSecurityConstraints().getSecurityConstraints().get(1)).getPermissions()));
+            assertNotNull(check.getDocumentOrder());
+            assertEquals(2, check.getDocumentOrder().size());
+            assertEquals("some-other-page.psml", (String)check.getDocumentOrder().get(0));
+            assertEquals("default-page.psml", (String)check.getDocumentOrder().get(1));
             assertNull(check.getParent());
             assertNotNull(check.getPageSecurity());
             assertNotNull(check.getPages());
@@ -470,11 +514,19 @@
         Page page = pageManager.getPage("/default-page.psml");
         assertEquals("/default-page.psml", page.getPath());
         page.setTitle("UPDATED");
+        page.getRootFragment().getProperties().remove("custom-prop1");
+        page.getRootFragment().getProperties().put("UPDATED", "UPDATED");
+        SecurityConstraint pageConstraint = pageManager.newSecurityConstraint();
+        pageConstraint.setUsers(Shared.makeListFromCSV("UPDATED"));
+        page.getSecurityConstraints().getSecurityConstraints().add(0, pageConstraint);
         pageManager.updatePage(page);
 
         Folder folder = pageManager.getFolder("/");
         assertEquals("/", folder.getPath());
         folder.setTitle("UPDATED");
+        folder.getDocumentOrder().remove("some-other-page.psml");
+        folder.getDocumentOrder().add("UPDATED");
+        folder.getDocumentOrder().add("some-other-page.psml");
         pageManager.updateFolder(folder);
     }
 

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java (original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestSecureDatabasePageManager.java Wed Nov 30 14:53:22 2005
@@ -48,7 +48,7 @@
  * @version $Id: $
  *          
  */
-public class TestSecureDatabasePageManager extends DatasourceEnabledSpringTestCase
+public class TestSecureDatabasePageManager extends DatasourceEnabledSpringTestCase implements PageManagerTestShared
 {
     protected PageManager pageManager;
 
@@ -57,7 +57,7 @@
     public static void main(String args[])
     {
         junit.awtui.TestRunner.main(new String[]
-        { TestDatabasePageManager.class.getName() });
+        { TestSecureDatabasePageManager.class.getName() });
     }
     
     protected void setUp() throws Exception
@@ -131,8 +131,8 @@
                         constraintsDef.setName("public-view");
                         List defConstraints = new ArrayList(1);
                         SecurityConstraint defConstraint = pageManager.newSecurityConstraint();
-                        defConstraint.setUsers("*");
-                        defConstraint.setPermissions("view");
+                        defConstraint.setUsers(Shared.makeListFromCSV("*"));
+                        defConstraint.setPermissions(Shared.makeListFromCSV("view"));
                         defConstraints.add(defConstraint);
                         constraintsDef.setSecurityConstraints(defConstraints);
                         constraintsDefs.add(constraintsDef);
@@ -140,8 +140,8 @@
                         constraintsDef.setName("admin-all");
                         defConstraints = new ArrayList(1);
                         defConstraint = pageManager.newSecurityConstraint();
-                        defConstraint.setRoles("admin");
-                        defConstraint.setPermissions("view,edit");
+                        defConstraint.setRoles(Shared.makeListFromCSV("admin"));
+                        defConstraint.setPermissions(Shared.makeListFromCSV("view,edit"));
                         defConstraints.add(defConstraint);
                         constraintsDef.setSecurityConstraints(defConstraints);
                         constraintsDefs.add(constraintsDef);
@@ -156,8 +156,8 @@
                         constraints.setOwner("admin");
                         List inlineConstraints = new ArrayList(1);
                         SecurityConstraint constraint = pageManager.newSecurityConstraint();
-                        constraint.setRoles("manager");
-                        constraint.setPermissions("edit");
+                        constraint.setRoles(Shared.makeListFromCSV("manager"));
+                        constraint.setPermissions(Shared.makeListFromCSV("edit"));
                         inlineConstraints.add(constraint);
                         constraints.setSecurityConstraints(inlineConstraints);
                         constraintsRefs = new ArrayList(1);
@@ -187,8 +187,8 @@
                         constraints = pageManager.newSecurityConstraints();
                         inlineConstraints = new ArrayList(1);
                         constraint = pageManager.newSecurityConstraint();
-                        constraint.setUsers("user");
-                        constraint.setPermissions("view,edit");
+                        constraint.setUsers(Shared.makeListFromCSV("user"));
+                        constraint.setPermissions(Shared.makeListFromCSV("view,edit"));
                         inlineConstraints.add(constraint);
                         constraints.setSecurityConstraints(inlineConstraints);
                         page.setSecurityConstraints(constraints);

Modified: portals/jetspeed-2/trunk/components/page-manager/testdata/pages/test001.psml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/testdata/pages/test001.psml?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
Binary files - no diff available.

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletAggregatorFragmentImpl.java Wed Nov 30 14:53:22 2005
@@ -304,9 +304,18 @@
         return null;
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#getPreferences()
+     */
     public List getPreferences()
     {
-        // TODO Auto-generated method stub
         return null;
     }    
+
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.Fragment#setPreferences(java.util.List)
+     */
+    public void setPreferences(List preferences)
+    {
+    }
 }

Copied: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreferenceImpl.java (from r345429, portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreference.java)
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreferenceImpl.java?p2=portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreferenceImpl.java&p1=portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreference.java&r1=345429&r2=350066&rev=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreference.java (original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/preference/impl/FragmentPreferenceImpl.java Wed Nov 30 14:53:22 2005
@@ -18,18 +18,19 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.pluto.om.common.Preference;
 import org.apache.pluto.om.common.PreferenceCtrl;
 
 /**
  * 
- * Castor-friendly Preference implementation to be used with Fragment-based
+ * Preference implementation to be used with Fragment-based
  * portlet Preferences.
  * 
  * @author <href a="mailto:weaver@apache.org">Scott T. Weaver</a>
  *
  */
-public class FragmentPreference implements Preference, PreferenceCtrl
+public class FragmentPreferenceImpl implements Preference, PreferenceCtrl, FragmentPreference
 {
     private String name;
     private List values;

Modified: portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java (original)
+++ portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityDAO.java Wed Nov 30 14:53:22 2005
@@ -391,6 +391,13 @@
         }
 
         /**
+         * @see org.apache.jetspeed.om.page.Fragment#setPreferences()
+         */
+        public void setPreferences(List preferences)
+        {
+        }
+
+        /**
          * @see org.apache.jetspeed.om.page.Fragment#getProperties()
          */
         public Map getProperties()

Modified: portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml (original)
+++ portals/jetspeed-2/trunk/etc/schema/phase2-schema.xml Wed Nov 30 14:53:22 2005
@@ -97,6 +97,27 @@
         <index name="IX_FOLDER_CONSTRAINTS_REF_1">
             <index-column name="FOLDER_ID"/>
         </index>
+        <unique name="UN_FOLDER_CONSTRAINTS_REF_1">
+            <unique-column name="FOLDER_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
+    </table>
+
+    <table name="FOLDER_ORDER">
+        <column name="ORDER_ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="FOLDER_ID" type="INTEGER" required="true"/>
+        <column name="SORT_ORDER" type="INTEGER" required="true"/>
+        <column name="NAME" size="80" type="VARCHAR" required="true"/>
+        <foreign-key foreignTable="FOLDER" onDelete="cascade">
+            <reference foreign="FOLDER_ID" local="FOLDER_ID"/>
+        </foreign-key>
+        <index name="IX_FOLDER_ORDER_1">
+            <index-column name="FOLDER_ID"/>
+        </index>
+        <unique name="UN_FOLDER_ORDER_1">
+            <unique-column name="FOLDER_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
     </table>
 
     <!--
@@ -182,6 +203,10 @@
         <index name="IX_PAGE_CONSTRAINTS_REF_1">
             <index-column name="PAGE_ID"/>
         </index>
+        <unique name="UN_PAGE_CONSTRAINTS_REF_1">
+            <unique-column name="PAGE_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
     </table>
 
     <!--
@@ -248,6 +273,40 @@
         <index name="IX_FRAGMENT_CONSTRAINTS_REF_1">
             <index-column name="FRAGMENT_ID"/>
         </index>
+        <unique name="UN_FRAGMENT_CONSTRAINTS_REF_1">
+            <unique-column name="FRAGMENT_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
+    </table>
+
+    <table name="FRAGMENT_PREF">
+        <column name="PREF_ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="FRAGMENT_ID" type="INTEGER" required="true"/>
+        <column name="NAME" size="40" type="VARCHAR" required="true"/>
+        <column name="IS_READ_ONLY" required="true" type="BOOLEANINT"/>
+        <foreign-key foreignTable="FRAGMENT" onDelete="cascade">
+            <reference foreign="FRAGMENT_ID" local="FRAGMENT_ID"/>
+        </foreign-key>
+        <index name="IX_FRAGMENT_PREF_1">
+            <index-column name="FRAGMENT_ID"/>
+        </index>
+        <unique name="UN_FRAGMENT_PREF_1">
+            <unique-column name="FRAGMENT_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
+    </table>
+
+    <table name="FRAGMENT_PREF_VALUE">
+        <column name="PREF_VALUE_ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="PREF_ID" type="INTEGER" required="true"/>
+        <column name="VALUE_ORDER" type="INTEGER" required="true"/>
+        <column name="VALUE" required="true" size="100" type="VARCHAR"/>
+        <foreign-key foreignTable="FRAGMENT_PREF" onDelete="cascade">
+            <reference foreign="PREF_ID" local="PREF_ID"/>
+        </foreign-key>
+        <index name="IX_FRAGMENT_PREF_VALUE_1">
+            <index-column name="PREF_ID"/>
+        </index>
     </table>
 
     <!--
@@ -283,16 +342,31 @@
         <column name="CONSTRAINTS_DEF_ID" primaryKey="true" required="true" type="INTEGER"/>
         <column name="PAGE_SECURITY_ID" type="INTEGER" required="true"/>
         <column name="NAME" required="true" size="40" type="VARCHAR"/>
+        <foreign-key foreignTable="PAGE_SECURITY" onDelete="cascade">
+            <reference foreign="PAGE_SECURITY_ID" local="PAGE_SECURITY_ID"/>
+        </foreign-key>
+        <index name="IX_PAGE_SEC_CONSTRAINTS_DEF_1">
+            <index-column name="PAGE_SECURITY_ID"/>
+        </index>
+        <unique name="UN_PAGE_SEC_CONSTRAINTS_DEF_1">
+            <unique-column name="PAGE_SECURITY_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
+    </table>
+
+    <table name="PAGE_SEC_CONSTRAINT_DEF">
+        <column name="CONSTRAINT_DEF_ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="CONSTRAINTS_DEF_ID" type="INTEGER" required="true"/>
         <column name="APPLY_ORDER" type="INTEGER" required="true"/>
         <column name="USER_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
         <column name="ROLE_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
         <column name="GROUP_PRINCIPALS_ACL" size="120" type="VARCHAR"/>
         <column name="PERMISSIONS_ACL" size="120" type="VARCHAR"/>
-        <foreign-key foreignTable="PAGE_SECURITY" onDelete="cascade">
-            <reference foreign="PAGE_SECURITY_ID" local="PAGE_SECURITY_ID"/>
+        <foreign-key foreignTable="PAGE_SEC_CONSTRAINTS_DEF" onDelete="cascade">
+            <reference foreign="CONSTRAINTS_DEF_ID" local="CONSTRAINTS_DEF_ID"/>
         </foreign-key>
-        <index name="IX_PAGE_SEC_CONSTRAINTS_DEF_1">
-            <index-column name="PAGE_SECURITY_ID"/>
+        <index name="IX_PAGE_SEC_CONSTRAINT_DEF_1">
+            <index-column name="CONSTRAINTS_DEF_ID"/>
         </index>
     </table>
 
@@ -307,6 +381,10 @@
         <index name="IX_PAGE_SEC_CONSTRAINTS_REF_1">
             <index-column name="PAGE_SECURITY_ID"/>
         </index>
+        <unique name="UN_PAGE_SEC_CONSTRAINTS_REF_1">
+            <unique-column name="PAGE_SECURITY_ID"/>
+            <unique-column name="NAME"/>
+        </unique>
     </table>
 
     <!--

Modified: portals/jetspeed-2/trunk/etc/sql/derby/schema/phase2-schema.sql
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/sql/derby/schema/phase2-schema.sql?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/sql/derby/schema/phase2-schema.sql (original)
+++ portals/jetspeed-2/trunk/etc/sql/derby/schema/phase2-schema.sql Wed Nov 30 14:53:22 2005
@@ -78,10 +78,28 @@
     PRIMARY KEY(CONSTRAINTS_REF_ID),
     FOREIGN KEY (FOLDER_ID) REFERENCES FOLDER (FOLDER_ID)
         ON DELETE CASCADE 
-);
+  ,
+    UNIQUE (FOLDER_ID, NAME));
 
 CREATE  INDEX IX_FOLDER_CONSTRAINTS_REF_1 ON FOLDER_CONSTRAINTS_REF (FOLDER_ID);
 -----------------------------------------------------------------------------
+-- FOLDER_ORDER
+-----------------------------------------------------------------------------
+
+CREATE TABLE FOLDER_ORDER
+(
+    ORDER_ID INTEGER NOT NULL,
+    FOLDER_ID INTEGER NOT NULL,
+    SORT_ORDER INTEGER NOT NULL,
+    NAME VARCHAR(80) NOT NULL,
+    PRIMARY KEY(ORDER_ID),
+    FOREIGN KEY (FOLDER_ID) REFERENCES FOLDER (FOLDER_ID)
+        ON DELETE CASCADE 
+  ,
+    UNIQUE (FOLDER_ID, NAME));
+
+CREATE  INDEX IX_FOLDER_ORDER_1 ON FOLDER_ORDER (FOLDER_ID);
+-----------------------------------------------------------------------------
 -- PAGE
 -----------------------------------------------------------------------------
 
@@ -164,7 +182,8 @@
     PRIMARY KEY(CONSTRAINTS_REF_ID),
     FOREIGN KEY (PAGE_ID) REFERENCES PAGE (PAGE_ID)
         ON DELETE CASCADE 
-);
+  ,
+    UNIQUE (PAGE_ID, NAME));
 
 CREATE  INDEX IX_PAGE_CONSTRAINTS_REF_1 ON PAGE_CONSTRAINTS_REF (PAGE_ID);
 -----------------------------------------------------------------------------
@@ -236,10 +255,44 @@
     PRIMARY KEY(CONSTRAINTS_REF_ID),
     FOREIGN KEY (FRAGMENT_ID) REFERENCES FRAGMENT (FRAGMENT_ID)
         ON DELETE CASCADE 
-);
+  ,
+    UNIQUE (FRAGMENT_ID, NAME));
 
 CREATE  INDEX IX_FRAGMENT_CONSTRAINTS_REF_1 ON FRAGMENT_CONSTRAINTS_REF (FRAGMENT_ID);
 -----------------------------------------------------------------------------
+-- FRAGMENT_PREF
+-----------------------------------------------------------------------------
+
+CREATE TABLE FRAGMENT_PREF
+(
+    PREF_ID INTEGER NOT NULL,
+    FRAGMENT_ID INTEGER NOT NULL,
+    NAME VARCHAR(40) NOT NULL,
+    IS_READ_ONLY INTEGER NOT NULL,
+    PRIMARY KEY(PREF_ID),
+    FOREIGN KEY (FRAGMENT_ID) REFERENCES FRAGMENT (FRAGMENT_ID)
+        ON DELETE CASCADE 
+  ,
+    UNIQUE (FRAGMENT_ID, NAME));
+
+CREATE  INDEX IX_FRAGMENT_PREF_1 ON FRAGMENT_PREF (FRAGMENT_ID);
+-----------------------------------------------------------------------------
+-- FRAGMENT_PREF_VALUE
+-----------------------------------------------------------------------------
+
+CREATE TABLE FRAGMENT_PREF_VALUE
+(
+    PREF_VALUE_ID INTEGER NOT NULL,
+    PREF_ID INTEGER NOT NULL,
+    VALUE_ORDER INTEGER NOT NULL,
+    VALUE VARCHAR(100) NOT NULL,
+    PRIMARY KEY(PREF_VALUE_ID),
+    FOREIGN KEY (PREF_ID) REFERENCES FRAGMENT_PREF (PREF_ID)
+        ON DELETE CASCADE 
+);
+
+CREATE  INDEX IX_FRAGMENT_PREF_VALUE_1 ON FRAGMENT_PREF_VALUE (PREF_ID);
+-----------------------------------------------------------------------------
 -- PAGE_SECURITY
 -----------------------------------------------------------------------------
 
@@ -274,17 +327,32 @@
     CONSTRAINTS_DEF_ID INTEGER NOT NULL,
     PAGE_SECURITY_ID INTEGER NOT NULL,
     NAME VARCHAR(40) NOT NULL,
+    PRIMARY KEY(CONSTRAINTS_DEF_ID),
+    FOREIGN KEY (PAGE_SECURITY_ID) REFERENCES PAGE_SECURITY (PAGE_SECURITY_ID)
+        ON DELETE CASCADE 
+  ,
+    UNIQUE (PAGE_SECURITY_ID, NAME));
+
+CREATE  INDEX IX_PAGE_SEC_CONSTRAINTS_DEF_1 ON PAGE_SEC_CONSTRAINTS_DEF (PAGE_SECURITY_ID);
+-----------------------------------------------------------------------------
+-- PAGE_SEC_CONSTRAINT_DEF
+-----------------------------------------------------------------------------
+
+CREATE TABLE PAGE_SEC_CONSTRAINT_DEF
+(
+    CONSTRAINT_DEF_ID INTEGER NOT NULL,
+    CONSTRAINTS_DEF_ID INTEGER NOT NULL,
     APPLY_ORDER INTEGER NOT NULL,
     USER_PRINCIPALS_ACL VARCHAR(120),
     ROLE_PRINCIPALS_ACL VARCHAR(120),
     GROUP_PRINCIPALS_ACL VARCHAR(120),
     PERMISSIONS_ACL VARCHAR(120),
-    PRIMARY KEY(CONSTRAINTS_DEF_ID),
-    FOREIGN KEY (PAGE_SECURITY_ID) REFERENCES PAGE_SECURITY (PAGE_SECURITY_ID)
+    PRIMARY KEY(CONSTRAINT_DEF_ID),
+    FOREIGN KEY (CONSTRAINTS_DEF_ID) REFERENCES PAGE_SEC_CONSTRAINTS_DEF (CONSTRAINTS_DEF_ID)
         ON DELETE CASCADE 
 );
 
-CREATE  INDEX IX_PAGE_SEC_CONSTRAINTS_DEF_1 ON PAGE_SEC_CONSTRAINTS_DEF (PAGE_SECURITY_ID);
+CREATE  INDEX IX_PAGE_SEC_CONSTRAINT_DEF_1 ON PAGE_SEC_CONSTRAINT_DEF (CONSTRAINTS_DEF_ID);
 -----------------------------------------------------------------------------
 -- PAGE_SEC_CONSTRAINTS_REF
 -----------------------------------------------------------------------------

Modified: portals/jetspeed-2/trunk/etc/sql/drop.sql
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/sql/drop.sql?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/sql/drop.sql (original)
+++ portals/jetspeed-2/trunk/etc/sql/drop.sql Wed Nov 30 14:53:22 2005
@@ -17,8 +17,11 @@
 DROP TABLE MEDIATYPE_TO_MIMETYPE;
 
 DROP TABLE PAGE_SEC_CONSTRAINTS_REF;
+DROP TABLE PAGE_SEC_CONSTRAINT_DEF;
 DROP TABLE PAGE_SEC_CONSTRAINTS_DEF;
 DROP TABLE PAGE_SECURITY;
+DROP TABLE FRAGMENT_PREF_VALUE;
+DROP TABLE FRAGMENT_PREF;
 DROP TABLE FRAGMENT_CONSTRAINTS_REF;
 DROP TABLE FRAGMENT_CONSTRAINT;
 DROP TABLE FRAGMENT;
@@ -26,6 +29,7 @@
 DROP TABLE PAGE_CONSTRAINT;
 DROP TABLE PAGE_METADATA;
 DROP TABLE PAGE;
+DROP TABLE FOLDER_ORDER;
 DROP TABLE FOLDER_CONSTRAINTS_REF;
 DROP TABLE FOLDER_CONSTRAINT;
 DROP TABLE FOLDER_METADATA;

Modified: portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql (original)
+++ portals/jetspeed-2/trunk/etc/sql/oracle/drop.sql Wed Nov 30 14:53:22 2005
@@ -22,8 +22,11 @@
 DROP TABLE MEDIATYPE_TO_MIMETYPE;
 
 DROP TABLE PAGE_SEC_CONSTRAINTS_REF;
+DROP TABLE PAGE_SEC_CONSTRAINT_DEF;
 DROP TABLE PAGE_SEC_CONSTRAINTS_DEF;
 DROP TABLE PAGE_SECURITY;
+DROP TABLE FRAGMENT_PREF_VALUE;
+DROP TABLE FRAGMENT_PREF;
 DROP TABLE FRAGMENT_CONSTRAINTS_REF;
 DROP TABLE FRAGMENT_CONSTRAINT;
 DROP TABLE FRAGMENT;
@@ -31,6 +34,7 @@
 DROP TABLE PAGE_CONSTRAINT;
 DROP TABLE PAGE_METADATA;
 DROP TABLE PAGE;
+DROP TABLE FOLDER_ORDER;
 DROP TABLE FOLDER_CONSTRAINTS_REF;
 DROP TABLE FOLDER_CONSTRAINT;
 DROP TABLE FOLDER_METADATA;

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/common/SecurityConstraint.java Wed Nov 30 14:53:22 2005
@@ -39,34 +39,16 @@
      * getUsers
      * </p>
      *
-     * @return constraint users in CSV string form
+     * @return constraint users list as List of String
      */
-    String getUsers();
+    List getUsers();
     
     /**
      * <p>
-     * getUsersList
-     * </p>
-     *
-     * @return constraint users as List
-     */
-    List getUsersList();
-    
-    /**
-     * <p>
-     * setUsers
-     * </p>
-     *
-     * @param users constraint list in CSV string form
-     */
-    void setUsers(String users);
-
-    /**
-     * <p>
      * setUsers
      * </p>
      *
-     * @param users constraint list as List
+     * @param users constraint users list as List of String
      */
     void setUsers(List users);
     
@@ -75,34 +57,16 @@
      * getRoles
      * </p>
      *
-     * @return constraint roles in CSV string form
+     * @return constraint roles list as List of String
      */
-    String getRoles();
+    List getRoles();
     
     /**
      * <p>
-     * getRolesList
-     * </p>
-     *
-     * @return constraint roles as List
-     */
-    List getRolesList();
-    
-    /**
-     * <p>
-     * setRoles
-     * </p>
-     *
-     * @param roles constraint list in CSV string form
-     */
-    void setRoles(String roles);
-
-    /**
-     * <p>
      * setRoles
      * </p>
      *
-     * @param roles constraint list as List
+     * @param roles constraint roles list as List of String
      */
     void setRoles(List roles);
     
@@ -111,34 +75,16 @@
      * getGroups
      * </p>
      *
-     * @return constraint groups in CSV string form
+     * @return constraint groups list as List of String
      */
-    String getGroups();
+    List getGroups();
     
     /**
      * <p>
-     * getGroupsList
-     * </p>
-     *
-     * @return constraint groups as List
-     */
-    List getGroupsList();
-    
-    /**
-     * <p>
-     * setGroups
-     * </p>
-     *
-     * @param groups constraint list in CSV string form
-     */
-    void setGroups(String groups);
-
-    /**
-     * <p>
      * setGroups
      * </p>
      *
-     * @param groups constraint list as List
+     * @param groups constraint groups list as List of String
      */
     void setGroups(List groups);
     
@@ -147,34 +93,16 @@
      * getPermissions
      * </p>
      *
-     * @return constraint permissions in CSV string form
+     * @return constraint permissions list as List of String
      */
-    String getPermissions();
+    List getPermissions();
     
     /**
      * <p>
-     * getPermissionsList
-     * </p>
-     *
-     * @return constraint permissions as List
-     */
-    List getPermissionsList();
-    
-    /**
-     * <p>
-     * setPermissions
-     * </p>
-     *
-     * @param permissions constraint permissions list in CSV string form
-     */
-    void setPermissions(String permissions);
-
-    /**
-     * <p>
      * setPermissions
      * </p>
      *
-     * @param permissions constraint permissions list as List
+     * @param permissions constraint permissions list as List of String
      */
     void setPermissions(List permissions);
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/folder/Folder.java Wed Nov 30 14:53:22 2005
@@ -66,7 +66,7 @@
     int RESERVED_FOLDER_LANGUAGE = 6;
     int RESERVED_FOLDER_COUNTRY = 7;
     int RESERVED_FOLDER_OTHER = 9999;
-    
+   
     /**
      * getDocumentOrder
      *

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/Fragment.java Wed Nov 30 14:53:22 2005
@@ -236,9 +236,17 @@
         throws java.lang.CloneNotSupportedException;
     
     /**
+     * Get collection of fragment preference objects used
+     * to initialize user preferences
      * 
-     * @return
+     * @return list of FragmentPreference objects
      */
-    List getPreferences();
-    
+    public List getPreferences();    
+
+    /**
+     * Set collection of fragment preference objects
+     * 
+     * @param preferences list of FragmentPreference objects
+     */
+    public void setPreferences(List preferences);    
 }

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/preference/FragmentPreference.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/preference/FragmentPreference.java?rev=350066&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/preference/FragmentPreference.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/preference/FragmentPreference.java Wed Nov 30 14:53:22 2005
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.om.preference;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * This interface represents a fragment preference used to populate
+ * portlet user preferences on initial access.
+ *
+ * @version $Id$
+ */
+public interface FragmentPreference
+{
+    /**
+     * getName
+     *
+     * @return preference name
+     */
+    String getName();
+    
+    /**
+     * setName
+     *
+     * @param name preference name
+     */
+    void setName(String name);
+    
+    /**
+     * isReadOnly
+     *
+     * @return read only preference flag
+     */
+    boolean isReadOnly();
+    
+    /**
+     * setReadOnly
+     *
+     * @param readOnly read only preference flag
+     */
+    void setReadOnly(boolean readOnly);
+    
+    /**
+     * getValueList
+     *
+     * @return list of String preference values
+     */
+    List getValueList();
+    
+    /**
+     * setValueList
+     *
+     * @param values list of String preference values
+     */
+    void setValueList(List values);
+}

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java?rev=350066&r1=350065&r2=350066&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java Wed Nov 30 14:53:22 2005
@@ -33,6 +33,7 @@
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.om.page.PageSecurity;
 import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.preference.FragmentPreference;
 import org.apache.jetspeed.page.document.DocumentException;
 import org.apache.jetspeed.page.document.DocumentNotFoundException;
 import org.apache.jetspeed.page.document.FailedToDeleteDocumentException;
@@ -166,6 +167,13 @@
      * @return a newly created SecurityConstraintsDef object
      */
     public SecurityConstraintsDef newSecurityConstraintsDef();
+
+    /**
+     * newFragmentPreference - creates a new fragment preference
+     *
+     * @return a newly created FragmentPreference
+     */
+    public FragmentPreference newFragmentPreference();
 
    /**
     * 



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


Mime
View raw message