Author: vkumar
Date: Tue Feb 17 15:48:02 2009
New Revision: 745128

URL: http://svn.apache.org/viewvc?rev=745128&view=rev
Log:
Adding to trunk
Improvement in getValues of Attribute.
In-case of single value attribute, code will return list with single value, if 
getValues get called on Attribute

Modified:
    
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java

Modified: 
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java?rev=745128&r1=745127&r2=745128&view=diff
==============================================================================
--- 
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java
 (original)
+++ 
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java
 Tue Feb 17 15:48:02 2009
@@ -18,11 +18,14 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 
 import org.apache.jetspeed.security.mapping.model.Attribute;
 import org.apache.jetspeed.security.mapping.model.AttributeDef;
 
+import java.util.Arrays;
+
 /**
  * @author <a href="mailto:[email protected]";>Dennis Dam</a>
  * @version $Id$
@@ -65,7 +68,17 @@
     
     public Collection<String> getValues()
     {
-        return getDefinition().isMultiValue() ? values : null;
+        if(getDefinition().isMultiValue())
+        {
+         return values;         
+        }else{
+            if(value==null)
+            {
+                return Collections.emptyList();
+            }else{
+                return Arrays.asList(new String[]{value});
+            }
+        }        
     }
 
     public void setValues(Collection<String> values)



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to