portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r687482 - in /portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed: components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java om/preference/impl/PreferenceSetImpl.java
Date Wed, 20 Aug 2008 21:53:39 GMT
Author: ate
Date: Wed Aug 20 14:53:38 2008
New Revision: 687482

URL: http://svn.apache.org/viewvc?rev=687482&view=rev
Log:
Some fixes to new PortletPreferences implementation

Modified:
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java
    portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/preference/impl/PreferenceSetImpl.java

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java?rev=687482&r1=687481&r2=687482&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PersistenceBrokerPortletPreferencesProvider.java
Wed Aug 20 14:53:38 2008
@@ -19,6 +19,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.jetspeed.cache.CacheElement;
 import org.apache.jetspeed.cache.JetspeedCache;
@@ -159,14 +160,22 @@
                 if (prefId == null || prefId.longValue() != value.getPrefId())
                 {
                     prefId = new Long(value.getPrefId());
-                    preference = prefs.add(prefsMap.get(prefId), null);
+                    preference = prefs.add(value.getPrefId(), prefsMap.get(prefId), null);
                     preference.setReadOnly(Boolean.toString(value.isReadOnly()));
                 }
                 if (preference != null)
                 {
                     preference.addValue(value.getValue());
                 }
-            }        
+            }
+            for (Map.Entry<Long,String> entry : prefsMap.entrySet())
+            {
+                if (prefs.get(entry.getValue()) == null)
+                {
+                    // ensure preferences without *any* value are still loaded
+                    prefs.add(entry.getKey().longValue(), entry.getValue(),null);
+                }
+            }
             preferenceCache.put(preferenceCache.createElement(cacheKey, prefs));
         }
         return new PreferenceSetImpl(prefs);

Modified: portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/preference/impl/PreferenceSetImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/preference/impl/PreferenceSetImpl.java?rev=687482&r1=687481&r2=687482&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/preference/impl/PreferenceSetImpl.java
(original)
+++ portals/jetspeed-2/portal/branches/JS2-869/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/preference/impl/PreferenceSetImpl.java
Wed Aug 20 14:53:38 2008
@@ -163,7 +163,7 @@
         
         public boolean equals(PreferenceImpl other)
         {
-            if (other == null && name.equals(other.name) && readOnly == other.readOnly
&& values.size() == other.values.size() )
+            if (other != null && name.equals(other.name) && readOnly == other.readOnly
&& values.size() == other.values.size() )
             {
                 String a;
                 String b;
@@ -234,7 +234,7 @@
         return add(-1, name, values);
     }
 
-    PreferenceImpl add(long id, String name, List values)
+    public PreferenceImpl add(long id, String name, List values)
     {
         PreferenceImpl pref = new PreferenceImpl(id, name, values);
         prefs.put(name, pref);



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