portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r745128 - /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java
Date Tue, 17 Feb 2009 15:48:03 GMT
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:ddam@apache.org">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: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message