portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vku...@apache.org
Subject svn commit: r702915 - /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
Date Wed, 08 Oct 2008 15:54:15 GMT
Author: vkumar
Date: Wed Oct  8 08:54:15 2008
New Revision: 702915

URL: http://svn.apache.org/viewvc?rev=702915&view=rev
Log:
Adding pending changes in trunk

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java?rev=702915&r1=702914&r2=702915&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
Wed Oct  8 08:54:15 2008
@@ -16,6 +16,7 @@
  */
 package org.apache.jetspeed.security.mapping.ldap.dao.impl;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -148,6 +149,15 @@
             attrValue = toEntity.getId();
         }
         Attribute relationAttribute = fromEntity.getAttribute(this.relationAttribute);
+        
+        if(relationAttribute == null){
+            fromEntity.setAttribute(this.relationAttribute,new ArrayList<String>());
   
+        }else{
+            if(relationAttribute.getValues().contains(attrValue)){
+                throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_ALREADY_EXISTS.createScoped(fromEntity.getId(),toEntity.getId()));
+            }
+        }
+        
         if (relationAttribute.getDefinition().isMultiValue())
         {
             relationAttribute.getValues().add(attrValue);



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