portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r931819 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed: components/portletpreferences/ serializer/
Date Thu, 08 Apr 2010 07:39:27 GMT
Author: ate
Date: Thu Apr  8 07:39:27 2010
New Revision: 931819

URL: http://svn.apache.org/viewvc?rev=931819&view=rev
Log:
Ensuring JetspeedPreferenceImpl readOnly state is properly initialized by requiring it as
a constructor argument  

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferenceImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferenceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferenceImpl.java?rev=931819&r1=931818&r2=931819&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferenceImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/JetspeedPreferenceImpl.java
Thu Apr  8 07:39:27 2010
@@ -28,8 +28,8 @@ import org.apache.pluto.container.impl.P
  */
 public class JetspeedPreferenceImpl extends PortletPreferenceImpl
 {
-    public JetspeedPreferenceImpl(String name, String[] values)
+    public JetspeedPreferenceImpl(String name, String[] values, boolean readOnly)
     {
-        super(name, values);
+        super(name, values, readOnly);
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java?rev=931819&r1=931818&r2=931819&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletpreferences/PortletPreferencesServiceImpl.java
Thu Apr  8 07:39:27 2010
@@ -213,9 +213,7 @@ public class PortletPreferencesServiceIm
         while (preferences.hasNext())
         {
             DatabasePreference preference = preferences.next();            
-            JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(),
preference.getValues());
-            value.setReadOnly(preference.isReadOnly());
-            map.put(preference.getName(), value);
+            map.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues(), preference.isReadOnly()));
         }
         preferenceCache.put(preferenceCache.createElement(cacheKey, map));
         return map;                
@@ -405,9 +403,7 @@ public class PortletPreferencesServiceIm
                 preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map));
                 previousPortletName = preference.getPortletName();
             }
-            JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(),
preference.getValues());
-            value.setReadOnly(preference.isReadOnly());
-            map.put(preference.getName(), value);
+            map.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues(), preference.isReadOnly()));
         }
     }
     
@@ -437,9 +433,7 @@ public class PortletPreferencesServiceIm
                 preferenceCache.put(preferenceCache.createElement(cacheKey, map));
                 previousKey = cacheKey;
             }
-            JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(),
preference.getValues());
-            value.setReadOnly(preference.isReadOnly());
-            map.put(preference.getName(), value);
+            map.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues(), preference.isReadOnly()));
         }
     }
 
@@ -480,7 +474,7 @@ public class PortletPreferencesServiceIm
         JetspeedPreferencesMap map = new JetspeedPreferencesMap();
         for (Preference preference : preferences.getPortletPreferences())
         {
-            map.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues().toArray(new String[preference.getValues().size()])));
+            map.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues().toArray(new String[preference.getValues().size()]), preference.isReadOnly()));
         }
         this.storePortletPreference(pd, null, null, map);
     }
@@ -527,12 +521,10 @@ public class PortletPreferencesServiceIm
 
         getPersistenceBrokerTemplate().store(dbPref);
 
-        JetspeedPreferenceImpl cached = new JetspeedPreferenceImpl(preferenceName, dbPref.getValues());
-        cached.setReadOnly(dbPref.isReadOnly());
         String defaultsCacheKey = getPortletPreferenceKey(appName, portletName);
         CacheElement cacheElement = preferenceCache.get(defaultsCacheKey);
         JetspeedPreferencesMap map = (cacheElement != null ? (JetspeedPreferencesMap) cacheElement.getContent()
: new JetspeedPreferencesMap());
-        map.put(preferenceName, cached);
+        map.put(preferenceName, new JetspeedPreferenceImpl(preferenceName, dbPref.getValues(),
dbPref.isReadOnly()));
         preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map));
     }
     
@@ -555,9 +547,7 @@ public class PortletPreferencesServiceIm
                     entityValues[ix] = (String)value;
                     ix++;
                 }
-                JetspeedPreferenceImpl preference = new JetspeedPreferenceImpl(fragmentPref.getName(),
entityValues);
-                preference.setReadOnly(fragmentPref.isReadOnly());                    
-                entityMap.put(fragmentPref.getName(), preference);                    
+                entityMap.put(fragmentPref.getName(), new JetspeedPreferenceImpl(fragmentPref.getName(),
entityValues, fragmentPref.isReadOnly()));                    
             }
         }
         return entityMap;
@@ -666,9 +656,7 @@ public class PortletPreferencesServiceIm
             while (preferences.hasNext())
             {
                 DatabasePreference preference = preferences.next();
-                JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(),
preference.getValues());
-                value.setReadOnly(preference.isReadOnly());
-                map.put(preference.getName(), value);
+                map.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues(), preference.isReadOnly()));
             }
             preferenceCache.put(preferenceCache.createElement(defaultsCacheKey, map));
             defaultsMap = map;
@@ -722,9 +710,7 @@ public class PortletPreferencesServiceIm
             while (preferences.hasNext())
             {
                 DatabasePreference preference = preferences.next();
-                JetspeedPreferenceImpl value = new JetspeedPreferenceImpl(preference.getName(),
preference.getValues());
-                value.setReadOnly(preference.isReadOnly());
-                userPreferences.put(preference.getName(), value);
+                userPreferences.put(preference.getName(), new JetspeedPreferenceImpl(preference.getName(),
preference.getValues(), preference.isReadOnly()));
             }
             preferenceCache.put(preferenceCache.createElement(userCacheKey, userPreferences));
         }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java?rev=931819&r1=931818&r2=931819&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/serializer/JetspeedRegistrySerializer.java
Thu Apr  8 07:39:27 2010
@@ -212,15 +212,11 @@ public class JetspeedRegistrySerializer 
                 {
                     if (element.getValues() == null)
                     {
-                        JetspeedPreferenceImpl pref = new JetspeedPreferenceImpl(element.getKey(),
new String[] { element.getValue() });
-                        pref.setReadOnly(element.isReadOnly());
-                        portletPreference.put(element.getKey(), pref);
+                        portletPreference.put(element.getKey(), new JetspeedPreferenceImpl(element.getKey(),
new String[] { element.getValue() }, element.isReadOnly()));
                     }
                     else
                     {
-                        JetspeedPreferenceImpl pref = new JetspeedPreferenceImpl(element.getKey(),
element.getValues());
-                        pref.setReadOnly(element.isReadOnly());
-                        portletPreference.put(element.getKey(), pref);
+                        portletPreference.put(element.getKey(), new JetspeedPreferenceImpl(element.getKey(),
element.getValues(), element.isReadOnly()));
                     }
                 }
                 if (portletPreference.size() > 0)



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