portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r371849 - in /portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page: impl/ psml/
Date Tue, 24 Jan 2006 07:06:47 GMT
Author: rwatler
Date: Mon Jan 23 23:06:44 2006
New Revision: 371849

URL: http://svn.apache.org/viewcvs?rev=371849&view=rev
Log:
ensure Fragment fragments lists always immutable: see JS2-473

Added:
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FilteredFragmentList.java
      - copied unchanged from r371848, portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FilteredFragmentList.java
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FilteredFragmentList.java
      - copied unchanged from r371848, portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FilteredFragmentList.java
Modified:
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java?rev=371849&r1=371848&r2=371849&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/FragmentImpl.java
Mon Jan 23 23:06:44 2006
@@ -556,16 +556,13 @@
      */
     public List getFragments()
     {
-        // mutable fragments collection must be defined... note
-        // that this collection is only mutable if user has full
-        // access rights to all fragments; otherwise, a copy of
-        // the list will be returned and any modifications to the
-        // set of fragments in the collection will not be preserved
+        // create and return mutable fragments collection
+        // filtered by view access
         if (fragmentsList == null)
         {
             fragmentsList = new FragmentList(this);
         }
-        return filterFragmentsByAccess(fragmentsList);
+        return filterFragmentsByAccess(fragmentsList, true);
     }
     
     /* (non-Javadoc)
@@ -726,10 +723,11 @@
      * Filter fragments list for view access.
      *
      * @param nodes list containing fragments to check
+     * @param mutable make returned list mutable
      * @return original list if all elements viewable, a filtered
      *         partial list, or null if all filtered for view access
      */
-    static List filterFragmentsByAccess(List fragments)
+    List filterFragmentsByAccess(List fragments, boolean mutable)
     {
         if ((fragments != null) && !fragments.isEmpty())
         {
@@ -781,7 +779,14 @@
             {
                 if (!filteredFragments.isEmpty())
                 {
-                    return filteredFragments;
+                    if (mutable)
+                    {
+                        return new FilteredFragmentList(this, filteredFragments);
+                    }
+                    else
+                    {
+                        return filteredFragments;
+                    }
                 }
                 else
                 {

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java?rev=371849&r1=371848&r2=371849&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/impl/PageImpl.java
Mon Jan 23 23:06:44 2006
@@ -306,7 +306,8 @@
         FragmentImpl rootFragment = (FragmentImpl)getRootFragment();
         if (rootFragment != null)
         {
-            return FragmentImpl.filterFragmentsByAccess(rootFragment.getFragmentsByName(name));
+            // return immutable filtered fragment list
+            return rootFragment.filterFragmentsByAccess(rootFragment.getFragmentsByName(name),
false);
         }
         return null;
     }

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java?rev=371849&r1=371848&r2=371849&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/components/page-manager/src/java/org/apache/jetspeed/om/page/psml/FragmentImpl.java
Mon Jan 23 23:06:44 2006
@@ -119,7 +119,8 @@
 
     public List getFragments()
     {
-        // return mutable fragments list if possible
+        // create and return mutable fragments collection
+        // filtered by view access
         if (fragmentsList == null)
         {
             fragmentsList = new FragmentList(this);
@@ -501,7 +502,7 @@
      * @return original list if all elements viewable, a filtered
      *         partial list, or null if all filtered for view access
      */
-    static List filterFragmentsByAccess(List fragments)
+    List filterFragmentsByAccess(List fragments)
     {
         if ((fragments != null) && !fragments.isEmpty())
         {
@@ -553,7 +554,7 @@
             {
                 if (!filteredFragments.isEmpty())
                 {
-                    return filteredFragments;
+                    return new FilteredFragmentList(this, filteredFragments);
                 }
                 else
                 {



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