You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/09/12 15:11:30 UTC

svn commit: r280338 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common: PreferenceImpl.java PreferenceSetImpl.java

Author: cziegeler
Date: Mon Sep 12 06:11:25 2005
New Revision: 280338

URL: http://svn.apache.org/viewcvs?rev=280338&view=rev
Log:
Cleanup

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java?rev=280338&r1=280337&r2=280338&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceImpl.java Mon Sep 12 06:11:25 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-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.
@@ -45,12 +45,16 @@
         // nothing to do 
     }
 
-    // Preference implementation.
-
+    /**
+     * @see org.apache.pluto.om.common.Preference#getName()
+     */
     public String getName() {
         return name;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.Preference#getValues()
+     */
     public Iterator getValues() {
         // replace the NULL_VALUE String by NULL
         if (value.contains(NULL_VALUE)) {
@@ -70,6 +74,9 @@
         return returnValue.iterator();
     }
 
+    /**
+     * @see org.apache.pluto.om.common.Preference#isReadOnly()
+     */
     public boolean isReadOnly() {
         if (readOnly == null) {
             return false;
@@ -77,16 +84,25 @@
         return readOnly.booleanValue();
     }
 
+    /**
+     * @see org.apache.pluto.om.common.Preference#isValueSet()
+     */
     public boolean isValueSet() {
         return value != null;
     }
 
     // PreferenceCtrl implementation.
     
+    /**
+     * @see org.apache.pluto.om.common.PreferenceCtrl#setName(java.lang.String)
+     */
     public void setName(String name) {
         this.name = name;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceCtrl#setValues(java.util.List)
+     */
     public void setValues(java.util.List _value) {
         if (this.value == null) {
             this.value = new ArrayList();
@@ -114,6 +130,9 @@
         this.value.addAll(addValue);
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceCtrl#setReadOnly(java.lang.String)
+     */
     public void setReadOnly(String readOnly) {
         this.readOnly = BooleanUtils.toBooleanObject(readOnly);
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java?rev=280338&r1=280337&r2=280338&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/pluto/om/common/PreferenceSetImpl.java Mon Sep 12 06:11:25 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004,2004 The Apache Software Foundation.
+ * Copyright 2004-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.
@@ -42,8 +42,9 @@
     private ClassLoader classLoader;
     private Set preferences = new HashSet();
 
-    // PreferenceSet implementation.
-
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSet#get(java.lang.String)
+     */
     public Preference get(String name) {
         Iterator iterator = this.preferences.iterator();
         while (iterator.hasNext()) {
@@ -55,10 +56,16 @@
         return null;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSet#iterator()
+     */
     public Iterator iterator() {
         return this.preferences.iterator();
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSet#getPreferencesValidator()
+     */
     public PreferencesValidator getPreferencesValidator() {
         if (this.classLoader == null)
             throw new IllegalStateException("Portlet class loader not yet available to load preferences validator.");
@@ -68,8 +75,9 @@
 
         try {
             Object validator = classLoader.loadClass(castorPreferencesValidator).newInstance();
-            if (validator instanceof PreferencesValidator)
+            if (validator instanceof PreferencesValidator) {
                 return(PreferencesValidator)validator;
+            }
         } catch (Exception ignore) {
             // ignore it
         }
@@ -77,8 +85,9 @@
         return null;
     }
 
-    // PreferenceSetCtrl implementation.
-
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSetCtrl#add(java.lang.String, java.util.List)
+     */
     public Preference add(String name, List values) {
         PreferenceImpl preference = new PreferenceImpl();
         preference.setName(name);
@@ -93,7 +102,9 @@
         return this.preferences.add(preference);
     }
 
-
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSetCtrl#remove(java.lang.String)
+     */
     public Preference remove(String name) {
         Iterator iterator = this.iterator();
         while (iterator.hasNext()) {
@@ -106,24 +117,24 @@
         return null;
     }
 
+    /**
+     * @see org.apache.pluto.om.common.PreferenceSetCtrl#remove(org.apache.pluto.om.common.Preference)
+     */
     public void remove(Preference preference) {
         this.preferences.remove(preference);
     }
 
-    // additional methods.
-    
+    /**
+     * @see java.lang.Object#toString()
+     */
     public String toString() {
-        return toString(0);
-    }
-
-    public String toString(int indent) {
         StringBuffer buffer = new StringBuffer(50);
-        StringUtils.newLine(buffer,indent);
+        buffer.append(StringUtils.lineSeparator);
         buffer.append(getClass().toString());
         buffer.append(": ");
         Iterator iterator = this.iterator();
         while (iterator.hasNext()) {
-            buffer.append(((PreferenceImpl)iterator.next()).toString(indent+2));
+            buffer.append(((PreferenceImpl)iterator.next()).toString(2));
         }
         return buffer.toString();
     }
@@ -148,17 +159,19 @@
     }
 
     /**
+     * Makes a deep copy.
      * @see java.util.Collection#addAll(Collection)
-     * makes a deep copy
      */
     public boolean addAll(Collection c) {
+        boolean changed = false;
         Iterator it = c.iterator();
         while (it.hasNext()) {
+            changed = true;
             PreferenceImpl pref = (PreferenceImpl) it.next();
             this.add(pref.getName(), pref.getClonedCastorValuesAsList());
         }
 
-        return true;  //always assume something changed
+        return changed;
     }
 
 }