portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r925160 - in /portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping: ./ impl/ ldap/ ldap/dao/ ldap/dao/impl/ ldap/filter/ ldap/util/ model/ model/impl/
Date Fri, 19 Mar 2010 10:20:11 GMT
Author: ate
Date: Fri Mar 19 10:20:10 2010
New Revision: 925160

URL: http://svn.apache.org/viewvc?rev=925160&view=rev
Log:
JS2-1136: Cleanup and strengthening the Security Entity/LDAP mapping
- code cleanup and formatting only: no code changes yet

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityRelationType.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/SecurityEntityRelationTypeImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/EntityFactoryImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityFilterFactory.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/LDAPEntityDAOConfiguration.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/SearchUtil.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AbstractRelationDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/filter/SimpleFilter.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/util/DnUtils.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Attribute.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/AttributeDef.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Entity.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityRelationDAO.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeDefImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/DefaultEntityRelationSearch.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/EntityImpl.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/EntityFactory.java Fri Mar 19 10:20:10 2010
@@ -21,17 +21,13 @@ import javax.naming.directory.DirContext
 import org.apache.jetspeed.security.JetspeedPrincipal;
 import org.apache.jetspeed.security.mapping.model.Entity;
 
-
 /**
  * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
  * @version $Id$
  */
-
 public interface EntityFactory
 {
-
     Entity createEntity(JetspeedPrincipal principal);
 
     Entity createEntity(DirContext ctx);
-    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java Fri Mar 19 10:20:10 2010
@@ -27,7 +27,6 @@ import org.apache.jetspeed.security.mapp
  */
 public interface SecurityEntityManager
 {
-
     Collection<String> getSupportedEntityTypes();
 
     Collection<SecurityEntityRelationType> getSupportedEntityRelationTypes();
@@ -43,17 +42,16 @@ public interface SecurityEntityManager
     void addEntity(Entity entity, Entity parentEntity) throws SecurityException;
 
     void removeEntity(Entity entity) throws SecurityException;
-    
+
     void updateEntity(Entity entity) throws SecurityException;
-    
+
     void addRelation(Entity fromEntity, Entity toEntity, SecurityEntityRelationType relationType) throws SecurityException;
-    
+
     void removeRelation(Entity fromEntity, Entity toEntity, SecurityEntityRelationType relationType) throws SecurityException;
 
     Collection<Entity> getRelatedEntitiesFrom(Entity fromEntity, SecurityEntityRelationType relationType);
 
-    Collection<Entity> getRelatedEntitiesTo(Entity toEntity, SecurityEntityRelationType relationType);    
+    Collection<Entity> getRelatedEntitiesTo(Entity toEntity, SecurityEntityRelationType relationType);
 
     EntityFactory getEntityFactory(String entityType);
-    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityRelationType.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityRelationType.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityRelationType.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityRelationType.java Fri Mar 19 10:20:10 2010
@@ -27,5 +27,4 @@ public interface SecurityEntityRelationT
     String getToEntityType();
 
     String getRelationType();
-    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/SecurityEntityRelationTypeImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/SecurityEntityRelationTypeImpl.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/SecurityEntityRelationTypeImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/impl/SecurityEntityRelationTypeImpl.java Fri Mar 19 10:20:10 2010
@@ -23,83 +23,104 @@ import org.apache.jetspeed.security.mapp
  * @version $Id$
  */
 public class SecurityEntityRelationTypeImpl implements SecurityEntityRelationType
+{
+    private String sourceEntityType, targetEntityType, relationType;
+
+    public SecurityEntityRelationTypeImpl(String relationType, String sourceEntityType, String targetEntityType)
     {
+        super();
+        this.relationType = relationType;
+        this.sourceEntityType = sourceEntityType;
+        this.targetEntityType = targetEntityType;
+    }
 
-        private String sourceEntityType, targetEntityType, relationType;
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((relationType == null) ? 0 : relationType.hashCode());
+        result = prime * result + ((sourceEntityType == null) ? 0 : sourceEntityType.hashCode());
+        result = prime * result + ((targetEntityType == null) ? 0 : targetEntityType.hashCode());
+        return result;
+    }
 
-        public SecurityEntityRelationTypeImpl(String relationType,
-                String sourceEntityType, String targetEntityType)
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
         {
-            super();
-            this.relationType = relationType;
-            this.sourceEntityType = sourceEntityType;
-            this.targetEntityType = targetEntityType;
-        }
-
-        @Override
-        public int hashCode()
-        {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result
-                    + ((relationType == null) ? 0 : relationType.hashCode());
-            result = prime
-                    * result
-                    + ((sourceEntityType == null) ? 0 : sourceEntityType
-                            .hashCode());
-            result = prime
-                    * result
-                    + ((targetEntityType == null) ? 0 : targetEntityType
-                            .hashCode());
-            return result;
-        }
-
-        @Override
-        public boolean equals(Object obj)
-        {
-            if (this == obj) return true;
-            if (obj == null) return false;
-            if (getClass() != obj.getClass()) return false;
-            SecurityEntityRelationType other = (SecurityEntityRelationType) obj;
-            if (relationType == null)
-            {
-                if (other.getRelationType() != null) return false;
-            } else if (!relationType.equals(other.getRelationType())) return false;
-            if (sourceEntityType == null)
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        SecurityEntityRelationType other = (SecurityEntityRelationType) obj;
+        if (relationType == null)
+        {
+            if (other.getRelationType() != null)
             {
-                if (other.getFromEntityType() != null) return false;
-            } else if (!sourceEntityType.equals(other.getFromEntityType()))
                 return false;
-            if (targetEntityType == null)
+            }
+        }
+        else if (!relationType.equals(other.getRelationType()))
+        {
+            return false;
+        }
+        if (sourceEntityType == null)
+        {
+            if (other.getFromEntityType() != null)
             {
-                if (other.getToEntityType() != null) return false;
-            } else if (!targetEntityType.equals(other.getToEntityType()))
                 return false;
-            return true;
+            }
         }
-
-        /* (non-Javadoc)
-         * @see org.apache.jetspeed.security.mapping.ldap.dao.Temp#getSourceEntityType()
-         */
-        public String getFromEntityType()
+        else if (!sourceEntityType.equals(other.getFromEntityType()))
         {
-            return sourceEntityType;
+            return false;
         }
-
-        /* (non-Javadoc)
-         * @see org.apache.jetspeed.security.mapping.ldap.dao.Temp#getTargetEntityType()
-         */
-        public String getToEntityType()
+        if (targetEntityType == null)
         {
-            return targetEntityType;
+            if (other.getToEntityType() != null)
+            {
+                return false;
+            }
         }
-
-        /* (non-Javadoc)
-         * @see org.apache.jetspeed.security.mapping.ldap.dao.Temp#getRelationType()
-         */
-        public String getRelationType()
+        else if (!targetEntityType.equals(other.getToEntityType()))
         {
-            return relationType;
+            return false;
         }
+        return true;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jetspeed.security.mapping.ldap.dao.Temp#getSourceEntityType()
+     */
+    public String getFromEntityType()
+    {
+        return sourceEntityType;
+    }
 
-    }
\ No newline at end of file
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jetspeed.security.mapping.ldap.dao.Temp#getTargetEntityType()
+     */
+    public String getToEntityType()
+    {
+        return targetEntityType;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.jetspeed.security.mapping.ldap.dao.Temp#getRelationType()
+     */
+    public String getRelationType()
+    {
+        return relationType;
+    }
+}
\ No newline at end of file

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/EntityFactoryImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/EntityFactoryImpl.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/EntityFactoryImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/EntityFactoryImpl.java Fri Mar 19 10:20:10 2010
@@ -25,21 +25,17 @@ import java.util.Set;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
-import javax.naming.ldap.LdapContext;
 
 import org.apache.jetspeed.security.JetspeedPrincipal;
 import org.apache.jetspeed.security.SecurityAttribute;
 import org.apache.jetspeed.security.SecurityAttributes;
 import org.apache.jetspeed.security.mapping.EntityFactory;
 import org.apache.jetspeed.security.mapping.ldap.dao.LDAPEntityDAOConfiguration;
-import org.apache.jetspeed.security.mapping.ldap.util.DnUtils;
 import org.apache.jetspeed.security.mapping.model.Attribute;
 import org.apache.jetspeed.security.mapping.model.AttributeDef;
 import org.apache.jetspeed.security.mapping.model.Entity;
 import org.apache.jetspeed.security.mapping.model.impl.AttributeImpl;
 import org.apache.jetspeed.security.mapping.model.impl.EntityImpl;
-import org.springframework.ldap.core.DirContextOperations;
-import org.springframework.ldap.core.DistinguishedName;
 import org.springframework.ldap.support.LdapUtils;
 
 /**
@@ -121,7 +117,6 @@ public class EntityFactoryImpl implement
             String[] values = null;
             try
             {
-                
                 values = getStringAttributes(ctx.getAttributes(""), attrDef.getName());
             }
             catch (NamingException e)
@@ -145,7 +140,9 @@ public class EntityFactoryImpl implement
                     {
                         a.setValues(attrValues);
                         attributes.add(a);
-                    }else{
+                    }
+                    else
+                    {
                         attributes.add(a);
                     }
                 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.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/DefaultEntityContextMapper.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultEntityContextMapper.java Fri Mar 19 10:20:10 2010
@@ -26,7 +26,6 @@ import org.springframework.ldap.core.sup
  */
 public class DefaultEntityContextMapper extends AbstractContextMapper
 {
-
     EntityFactory entityFactory;
 
     public DefaultEntityContextMapper(EntityFactory entityFactory)
@@ -34,9 +33,9 @@ public class DefaultEntityContextMapper 
         this.entityFactory = entityFactory;
     }
 
+    @Override
     public Object doMapFromContext(DirContextOperations ctx)
     {
         return entityFactory.createEntity(ctx);
     }
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.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/DefaultLDAPEntityManager.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java Fri Mar 19 10:20:10 2010
@@ -35,7 +35,7 @@ import org.apache.jetspeed.security.mapp
 public class DefaultLDAPEntityManager implements SecurityEntityManager
 {
     // entity type DAOs
-    protected Map<String, EntityDAO> entityDAOs;
+    protected Map<String, EntityDAO>                             entityDAOs;
     protected Map<SecurityEntityRelationType, EntityRelationDAO> entityRelationDAOs = new HashMap<SecurityEntityRelationType, EntityRelationDAO>();
 
     public Collection<SecurityEntityRelationType> getSupportedEntityRelationTypes()
@@ -183,20 +183,22 @@ public class DefaultLDAPEntityManager im
     {
         EntityDAO parentEntityDao = getDAOForEntity(parentEntity);
         Entity liveParentEntity = null;
-        if (parentEntityDao!=null){
-            // fetch "live" entity from LDAP to 
-            // 1) check whether entity exists and 
+        if (parentEntityDao != null)
+        {
+            // fetch "live" entity from LDAP to
+            // 1) check whether entity exists and
             // 2) fetch all LDAP attributes (mapped and not mapped) + fill the internal ID
-            liveParentEntity=parentEntityDao.getEntity(parentEntity.getId());
-            if (liveParentEntity == null){
+            liveParentEntity = parentEntityDao.getEntity(parentEntity.getId());
+            if (liveParentEntity == null)
+            {
                 throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(parentEntity.getType(), parentEntity.getId()));
             }
             EntityDAO dao = getDAOForEntity(entity);
             if (dao != null)
             {
-                dao.add(entity,liveParentEntity);
+                dao.add(entity, liveParentEntity);
             }
-        }         
+        }
     }
 
     public void setEntityDAOs(Map<String, EntityDAO> entityDAOs)

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.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/EntityDAO.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityDAO.java Fri Mar 19 10:20:10 2010
@@ -29,7 +29,6 @@ import org.springframework.ldap.filter.F
  */
 public interface EntityDAO
 {
-
     /**
      * Fetch entities by providing a list of specific entity IDs.
      * 
@@ -42,11 +41,11 @@ public interface EntityDAO
     /**
      * Fetch entity by providing an *internal* entity ID.
      * 
-     * @param internalId 
+     * @param internalId
      * @return found entity
      */
     Entity getEntityByInternalId(String internalId);
-    
+
     /**
      * Fetch entities by providing a list of specific *internal* entity IDs.
      * 
@@ -56,11 +55,9 @@ public interface EntityDAO
      */
     Collection<Entity> getEntitiesByInternalId(Collection<String> entityIds);
 
-    
     /**
-     * Method for applying a specific filter on the complete entity set returned
-     * by the DAO. The result would be the same as applying the specific filter
-     * to the result of getAllEntities().
+     * Method for applying a specific filter on the complete entity set returned by the DAO. The result would be the same as applying the specific filter to the
+     * result of getAllEntities().
      * 
      * @param filter
      *            a specific filter to narrow the returned entity set
@@ -69,14 +66,14 @@ public interface EntityDAO
     Collection<Entity> getEntities(Filter filter);
 
     /**
-     * Same as getEntities(Filter filter), except that this method only returns entities which are children of 
-     * the given parent entity.
+     * Same as getEntities(Filter filter), except that this method only returns entities which are children of the given parent entity.
+     * 
      * @param parentEntity
      * @param filter
      * @return
      */
     Collection<Entity> getEntities(Entity parentEntity, Filter filter);
-    
+
     /**
      * Fetch a single entity by ID.
      * 
@@ -88,12 +85,12 @@ public interface EntityDAO
     /**
      * Returns the parent entity of the given entity, if there is any.
      * 
-     * @param filter a specific filter to narrow the returned entity set
+     * @param filter
+     *            a specific filter to narrow the returned entity set
      * @return found entities
      */
     Entity getParentEntity(Entity childEntity);
 
-    
     /**
      * Fetch all entities
      * 
@@ -103,7 +100,7 @@ public interface EntityDAO
 
     void update(Entity entity) throws SecurityException;
 
-    void updateInternalAttributes(Entity entity) throws SecurityException ;
+    void updateInternalAttributes(Entity entity) throws SecurityException;
 
     void add(Entity entity) throws SecurityException;
 
@@ -112,5 +109,4 @@ public interface EntityDAO
     void add(Entity entity, Entity parentEntity) throws SecurityException;
 
     EntityFactory getEntityFactory();
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityFilterFactory.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/EntityFilterFactory.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityFilterFactory.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityFilterFactory.java Fri Mar 19 10:20:10 2010
@@ -16,9 +16,8 @@
  */
 package org.apache.jetspeed.security.mapping.ldap.dao;
 
-import org.springframework.ldap.filter.Filter;
-
 import org.apache.jetspeed.security.mapping.model.Entity;
+import org.springframework.ldap.filter.Filter;
 
 /**
  * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
@@ -26,7 +25,5 @@ import org.apache.jetspeed.security.mapp
  */
 public interface EntityFilterFactory
 {
-
     Filter createFilter(Entity entity);
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.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/EntityRelationDAO.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java Fri Mar 19 10:20:10 2010
@@ -28,18 +28,13 @@ import org.apache.jetspeed.security.mapp
  */
 public interface EntityRelationDAO
 {
-
     SecurityEntityRelationType getRelationType();
 
-    Collection<Entity> getRelatedEntitiesFrom(EntityDAO fromDao,
-            EntityDAO toDao, Entity fromEntity);
+    Collection<Entity> getRelatedEntitiesFrom(EntityDAO fromDao, EntityDAO toDao, Entity fromEntity);
 
-    Collection<Entity> getRelatedEntitiesTo(EntityDAO fromDao,
-            EntityDAO toDao, Entity toEntity);
+    Collection<Entity> getRelatedEntitiesTo(EntityDAO fromDao, EntityDAO toDao, Entity toEntity);
 
-    void addRelation(EntityDAO sourceDao, EntityDAO targetDao, Entity sourceEntity,
-            Entity targetEntity) throws SecurityException;
+    void addRelation(EntityDAO sourceDao, EntityDAO targetDao, Entity sourceEntity, Entity targetEntity) throws SecurityException;
 
-    void removeRelation(EntityDAO sourceDao, EntityDAO targetDao, Entity sourceEntity,
-                Entity targetEntity) throws SecurityException;
+    void removeRelation(EntityDAO sourceDao, EntityDAO targetDao, Entity sourceEntity, Entity targetEntity) throws SecurityException;
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/LDAPEntityDAOConfiguration.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/LDAPEntityDAOConfiguration.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/LDAPEntityDAOConfiguration.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/LDAPEntityDAOConfiguration.java Fri Mar 19 10:20:10 2010
@@ -28,34 +28,36 @@ import org.springframework.ldap.filter.F
  */
 public class LDAPEntityDAOConfiguration
 {
-
-    private String baseDN;
-    
-    private String searchDN;
-
-    private Filter baseFilter;
-
-    private String ldapIdAttribute;
-
+    private String            baseDN;
+    private String            searchDN;
+    private Filter            baseFilter;
+    private String            ldapIdAttribute;
     private Set<AttributeDef> attributeDefinitions;
+    private String            entityType;
+    private String[]          objectClassesArr;
 
-    private String entityType;
-    
-    private String[] objectClassesArr;
-
-    public void initialize() throws JetspeedException {
+    public void initialize() throws JetspeedException
+    {
         checkNotEmpty("entityType", entityType);
         checkNotNull("baseDN", baseDN);
         checkNotEmpty("ldapIdAttribute", ldapIdAttribute);
         checkNotNull("attributeDefinitions", attributeDefinitions);
     }
-    
-    private void checkNotNull(String fieldName, Object fieldValue ) throws JetspeedException {
-        if (fieldValue == null) throw new JetspeedException(getClass().getName()+": property '"+fieldName+"' cannot be null.");
+
+    private void checkNotNull(String fieldName, Object fieldValue) throws JetspeedException
+    {
+        if (fieldValue == null)
+        {
+            throw new JetspeedException(getClass().getName() + ": property '" + fieldName + "' cannot be null.");
+        }
     }
 
-    private void checkNotEmpty(String fieldName, String fieldValue ) throws JetspeedException {
-        if (fieldValue == null) throw new JetspeedException(getClass().getName()+": property '"+fieldName+"' cannot be null or empty.");
+    private void checkNotEmpty(String fieldName, String fieldValue) throws JetspeedException
+    {
+        if (fieldValue == null)
+        {
+            throw new JetspeedException(getClass().getName() + ": property '" + fieldName + "' cannot be null or empty.");
+        }
     }
 
     public String getBaseDN()
@@ -67,12 +69,12 @@ public class LDAPEntityDAOConfiguration
     {
         this.baseDN = baseDN;
     }
-    
+
     public String getSearchDN()
     {
         return searchDN;
     }
-    
+
     public void setSearchDN(String searchDN)
     {
         this.searchDN = searchDN;
@@ -122,12 +124,12 @@ public class LDAPEntityDAOConfiguration
     {
         return objectClassesArr;
     }
-    
+
     public void setObjectClasses(String objectClasses)
     {
-        if (objectClasses != null){
-            this.objectClassesArr=objectClasses.split(",");
+        if (objectClasses != null)
+        {
+            this.objectClassesArr = objectClasses.split(",");
         }
     }
-    
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/SearchUtil.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/SearchUtil.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/SearchUtil.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/SearchUtil.java Fri Mar 19 10:20:10 2010
@@ -16,20 +16,18 @@
  */
 package org.apache.jetspeed.security.mapping.ldap.dao;
 
+import org.apache.jetspeed.security.mapping.ldap.filter.SimpleFilter;
 import org.springframework.ldap.filter.AndFilter;
 import org.springframework.ldap.filter.EqualsFilter;
 import org.springframework.ldap.filter.Filter;
 import org.springframework.ldap.filter.OrFilter;
 
-import org.apache.jetspeed.security.mapping.ldap.filter.SimpleFilter;
-
 /**
  * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
  * @version $Id$
  */
 public class SearchUtil
 {
-
     public static Filter andFilters(Filter... filters)
     {
         AndFilter andFilter = new AndFilter();
@@ -40,8 +38,7 @@ public class SearchUtil
         return andFilter;
     }
 
-    public static Filter constructMatchingFieldsFilter(Filter baseFilter,
-            String[]... fieldNamesAndValues)
+    public static Filter constructMatchingFieldsFilter(Filter baseFilter, String[]... fieldNamesAndValues)
     {
         AndFilter filter = new AndFilter();
         for (String[] nameAndValues : fieldNamesAndValues)
@@ -57,14 +54,11 @@ public class SearchUtil
                 filter.and(fieldFilter);
             }
         }
-        return baseFilter != null ? andFilters(baseFilter, filter) : filter;
+        return baseFilter != null ? SearchUtil.andFilters(baseFilter, filter) : filter;
     }
 
-    public static Filter constructMatchingFieldsFilter(String baseFilter,
-            String[]... fieldNamesAndValues)
+    public static Filter constructMatchingFieldsFilter(String baseFilter, String[]... fieldNamesAndValues)
     {
-        return constructMatchingFieldsFilter(new SimpleFilter(baseFilter),
-                fieldNamesAndValues);
+        return SearchUtil.constructMatchingFieldsFilter(new SimpleFilter(baseFilter), fieldNamesAndValues);
     }
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AbstractRelationDAO.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/AbstractRelationDAO.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AbstractRelationDAO.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AbstractRelationDAO.java Fri Mar 19 10:20:10 2010
@@ -25,9 +25,8 @@ import org.apache.jetspeed.security.mapp
  */
 public abstract class AbstractRelationDAO implements EntityRelationDAO
 {
+    private SecurityEntityRelationType relationType;
 
-    private SecurityEntityRelationType relationType;    
-    
     public SecurityEntityRelationType getRelationType()
     {
         return relationType;
@@ -37,5 +36,4 @@ public abstract class AbstractRelationDA
     {
         this.relationType = relationType;
     }
-
 }

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=925160&r1=925159&r2=925160&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 Fri Mar 19 10:20:10 2010
@@ -41,7 +41,7 @@ import org.springframework.ldap.filter.F
  */
 public class AttributeBasedRelationDAO extends AbstractRelationDAO
 {
-    private String relationAttribute;
+    private String  relationAttribute;
     private boolean useFromEntityAttribute;
     private boolean attributeContainsInternalId; // if internal ID ( = DN) is
 
@@ -122,26 +122,27 @@ public class AttributeBasedRelationDAO e
         this.attributeContainsInternalId = attributeContainsInternalId;
     }
 
-    private Entity getLiveEntity(EntityDAO dao, Entity transientEntity) throws SecurityException {
+    private Entity getLiveEntity(EntityDAO dao, Entity transientEntity) throws SecurityException
+    {
         Entity liveEntity = dao.getEntity(transientEntity.getId());
-        if (liveEntity == null){
+        if (liveEntity == null)
+        {
             throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(transientEntity.getType(), transientEntity.getId()));
         }
-        if (liveEntity.getInternalId() == null){
-            throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(),"getLiveEntity","Internal ID not found"));
+        if (liveEntity.getInternalId() == null)
+        {
+            throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(), "getLiveEntity", "Internal ID not found"));
         }
         return liveEntity;
     }
-    
+
     private void internalAddRelation(EntityDAO fromEntityDAO, EntityDAO toEntityDAO, Entity fromEntity, Entity toEntity) throws SecurityException
     {
         fromEntity = getLiveEntity(fromEntityDAO, fromEntity);
-        
         toEntity = getLiveEntity(toEntityDAO, toEntity);
-        
         String attrValue = null;
         if (attributeContainsInternalId)
-        {            
+        {
             attrValue = toEntity.getInternalId();
         }
         else
@@ -149,19 +150,18 @@ public class AttributeBasedRelationDAO e
             attrValue = toEntity.getId();
         }
         Attribute relationAttribute = fromEntity.getAttribute(this.relationAttribute);
-        
-        if(relationAttribute == null)
+        if (relationAttribute == null)
         {
-            fromEntity.setAttribute(this.relationAttribute,new ArrayList<String>());    
+            fromEntity.setAttribute(this.relationAttribute, new ArrayList<String>());
         }
         else
         {
-            if(relationAttribute.getValues().contains(attrValue))
+            if (relationAttribute.getValues().contains(attrValue))
             {
-                throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_ALREADY_EXISTS.createScoped(fromEntity.getType(), fromEntity.getId(), relationAttribute, toEntity.getId()));
+                throw new SecurityException(SecurityException.PRINCIPAL_ASSOCIATION_ALREADY_EXISTS.createScoped(fromEntity.getType(), fromEntity.getId(),
+                                                                                                                relationAttribute, toEntity.getId()));
             }
         }
-        
         if (relationAttribute.getDefinition().isMultiValue())
         {
             relationAttribute.getValues().add(attrValue);
@@ -200,14 +200,14 @@ public class AttributeBasedRelationDAO e
                 boolean found = false;
                 String attribValue = null;
                 Iterator<String> iterator = relationAttribute.getValues().iterator();
-                while(iterator.hasNext() && !found)
+                while (iterator.hasNext() && !found)
                 {
                     attribValue = iterator.next();
                     DistinguishedName ldapAttr = new DistinguishedName(attribValue);
                     if (ldapAttr.equals(attrib))
                     {
                         relationAttribute.getValues().remove(attribValue);
-                        found = true; 
+                        found = true;
                     }
                 }
             }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.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/SpringLDAPEntityDAO.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/SpringLDAPEntityDAO.java Fri Mar 19 10:20:10 2010
@@ -54,21 +54,17 @@ import org.springframework.ldap.filter.O
  */
 public class SpringLDAPEntityDAO implements EntityDAO
 {
-
-    protected enum UpdateMode {
+    protected enum UpdateMode
+    {
         MAPPED, INTERNAL, ALL
     };
 
-    protected LdapTemplate ldapTemplate;
-
+    protected LdapTemplate                     ldapTemplate;
     protected final LDAPEntityDAOConfiguration configuration;
-    protected final DistinguishedName searchDN;
-
-    protected ContextMapper contextMapper;
+    protected final DistinguishedName          searchDN;
+    protected ContextMapper                    contextMapper;
+    protected EntityFactory                    entityFactory;
 
-    protected EntityFactory entityFactory;
-    
-    
     public SpringLDAPEntityDAO(LDAPEntityDAOConfiguration configuration)
     {
         super();
@@ -115,7 +111,8 @@ public class SpringLDAPEntityDAO impleme
         if (entities != null && entities.size() == 1)
         {
             return entities.iterator().next();
-        } else
+        }
+        else
         {
             return null;
         }
@@ -133,7 +130,8 @@ public class SpringLDAPEntityDAO impleme
         if (configuration.getSearchFilter() != null)
         {
             combinedFilter = SearchUtil.andFilters(idFilter, configuration.getSearchFilter());
-        } else
+        }
+        else
         {
             combinedFilter = idFilter;
         }
@@ -153,33 +151,32 @@ public class SpringLDAPEntityDAO impleme
         }
         return resultSet;
     }
-    
-    public Entity getEntityByInternalId(String internalId){
+
+    public Entity getEntityByInternalId(String internalId)
+    {
         Entity resultEntity = null;
         DistinguishedName principalDN = getRelativeDN(internalId);
         String relativeDN = principalDN.toCompactString();
         String searchDNStr = searchDN.toCompactString();
-        if (relativeDN.equals(searchDNStr) || relativeDN.endsWith(searchDNStr)){
+        if (relativeDN.equals(searchDNStr) || relativeDN.endsWith(searchDNStr))
+        {
             internalId = principalDN.toCompactString();
-            
             ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
             try
             {
                 Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-                
                 resultEntity = (Entity) ldapTemplate.lookup(internalId, getContextMapper());
-            } finally
+            }
+            finally
             {
                 Thread.currentThread().setContextClassLoader(currentClassLoader);
             }
-            
         }
         return resultEntity;
     }
 
     public Entity getParentEntity(Entity childEntity)
     {
-        
         DistinguishedName parentDN = new DistinguishedName(childEntity.getInternalId());
         parentDN.removeLast();
         return getEntityByInternalId(parentDN.encode());
@@ -202,7 +199,8 @@ public class SpringLDAPEntityDAO impleme
             if (filter == null)
             {
                 filter = configuration.getSearchFilter();
-            } else
+            }
+            else
             {
                 filter = SearchUtil.andFilters(configuration.getSearchFilter(), filter);
             }
@@ -224,14 +222,15 @@ public class SpringLDAPEntityDAO impleme
         try
         {
             Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-            results = (Collection<Entity>) ldapTemplate.search(configuration.getSearchDN(), filterStr, SearchControls.SUBTREE_SCOPE, getContextMapper());
-        } finally{
+            results = ldapTemplate.search(configuration.getSearchDN(), filterStr, SearchControls.SUBTREE_SCOPE, getContextMapper());
+        }
+        finally
+        {
             Thread.currentThread().setContextClassLoader(currentClassLoader);
         }
-
         return results;
     }
-    
+
     @SuppressWarnings("unchecked")
     public Collection<Entity> getEntities(Entity parent, Filter filter)
     {
@@ -243,11 +242,12 @@ public class SpringLDAPEntityDAO impleme
             Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
             String parentId = parent.getInternalId();
             DistinguishedName parentDN = getRelativeDN(parentId);
-            results = (Collection<Entity>) ldapTemplate.search(parentDN.encode(), filterStr, SearchControls.ONELEVEL_SCOPE, getContextMapper());
-        } finally{
+            results = ldapTemplate.search(parentDN.encode(), filterStr, SearchControls.ONELEVEL_SCOPE, getContextMapper());
+        }
+        finally
+        {
             Thread.currentThread().setContextClassLoader(currentClassLoader);
         }
-
         return results;
     }
 
@@ -260,44 +260,53 @@ public class SpringLDAPEntityDAO impleme
     private void internalUpdate(Entity entity, UpdateMode umode) throws SecurityException
     {
         String internalId = entity.getInternalId();
-        if (internalId == null){
+        if (internalId == null)
+        {
             Entity ldapEntity = getEntity(entity.getId());
-            if (ldapEntity == null || ldapEntity.getInternalId() == null) { throw new SecurityException(SecurityException.PRINCIPAL_UPDATE_FAILURE.createScoped(entity.getType(), entity.getId())); }
-            internalId=ldapEntity.getInternalId();
+            if (ldapEntity == null || ldapEntity.getInternalId() == null)
+            {
+                throw new SecurityException(SecurityException.PRINCIPAL_UPDATE_FAILURE.createScoped(entity.getType(), entity.getId()));
+            }
+            internalId = ldapEntity.getInternalId();
         }
-        
         Name dn = getRelativeDN(internalId);
         DirContextOperations dirCtxOps = null;
         ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
         try
         {
             Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
             dirCtxOps = ldapTemplate.lookupContext(dn);
-        } finally{
+        }
+        finally
+        {
             Thread.currentThread().setContextClassLoader(currentClassLoader);
         }
-        if (dirCtxOps == null) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(entity.getType(), entity.getId())); }
-
+        if (dirCtxOps == null)
+        {
+            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(entity.getType(), entity.getId()));
+        }
         Collection<ModificationItem> modItems = getModItems(entity, dirCtxOps, umode);
         try
         {
             Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
-            ldapTemplate.modifyAttributes(dn, modItems.toArray(new ModificationItem[]{}));
-        } finally{
+            ldapTemplate.modifyAttributes(dn, modItems.toArray(new ModificationItem[] {}));
+        }
+        finally
+        {
             Thread.currentThread().setContextClassLoader(currentClassLoader);
         }
     }
 
     public void add(Entity entity, Entity parentEntity) throws SecurityException
     {
-        if (parentEntity == null || parentEntity.getInternalId() == null){
-            throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(),"add(Entity entity, Entity parentEntity)","Provided parent entity is null or has no internal ID."));
-        }        
+        if (parentEntity == null || parentEntity.getInternalId() == null)
+        {
+            throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(), "add(Entity entity, Entity parentEntity)",
+                                                                            "Provided parent entity is null or has no internal ID."));
+        }
         DistinguishedName parentDn = new DistinguishedName(parentEntity.getInternalId());
         parentDn.removeFirst(new DistinguishedName(configuration.getBaseDN()));
-        internalAdd(entity,parentDn);        
+        internalAdd(entity, parentDn);
     }
 
     public void add(Entity entity) throws SecurityException
@@ -308,17 +317,21 @@ public class SpringLDAPEntityDAO impleme
             try
             {
                 dn.addAll(new DistinguishedName(configuration.getSearchDN()));
-            } catch (InvalidNameException inex)
+            }
+            catch (InvalidNameException inex)
             {
-                throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(),"add(Entity entity)",inex));
+                throw new SecurityException(SecurityException.UNEXPECTED.create(getClass().getName(), "add(Entity entity)", inex));
             }
         }
         internalAdd(entity, dn);
     }
-    
+
     public void internalAdd(Entity entity, DistinguishedName dn) throws SecurityException
     {
-        if (entityExists(entity)) { throw new SecurityException(SecurityException.PRINCIPAL_ALREADY_EXISTS.createScoped(entity.getType(), entity.getId())); }
+        if (entityExists(entity))
+        {
+            throw new SecurityException(SecurityException.PRINCIPAL_ALREADY_EXISTS.createScoped(entity.getType(), entity.getId()));
+        }
         DirContextAdapter context = new DirContextAdapter();
         if (dn != null)
         {
@@ -340,18 +353,21 @@ public class SpringLDAPEntityDAO impleme
                                 basicAttr.add(val);
                             }
                         }
-                    } else
+                    }
+                    else
                     {
                         basicAttr = new BasicAttribute(attrDef.getName());
                         basicAttr.add(entityAttr.getValue());
                     }
-                } else
+                }
+                else
                 {
                     if (attrDef.isIdAttribute())
                     {
                         basicAttr = new BasicAttribute(attrDef.getName());
                         basicAttr.add(entity.getId());
-                    } else if (attrDef.isRequired())
+                    }
+                    else if (attrDef.isRequired())
                     {
                         String requiredValue = attrDef.getRequiredDefaultValue();
                         if (requiredValue != null && requiredValue.length() > 0)
@@ -359,7 +375,8 @@ public class SpringLDAPEntityDAO impleme
                             basicAttr = new BasicAttribute(attrDef.getName());
                             basicAttr.add(attrDef.getRequiredDefaultValue());
                         }
-                    } else
+                    }
+                    else
                     {
                         // TODO missing required attribute value, throw
                         // exception
@@ -381,9 +398,10 @@ public class SpringLDAPEntityDAO impleme
             try
             {
                 Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
                 ldapTemplate.bind(dn, context, null);
-            } finally{
+            }
+            finally
+            {
                 Thread.currentThread().setContextClassLoader(currentClassLoader);
             }
         }
@@ -391,7 +409,10 @@ public class SpringLDAPEntityDAO impleme
 
     public void remove(Entity entity) throws SecurityException
     {
-        if (!entityExists(entity)) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(entity.getType(), entity.getId())); }
+        if (!entityExists(entity))
+        {
+            throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(entity.getType(), entity.getId()));
+        }
         String internalIdStr = entity.getInternalId();
         if (internalIdStr == null)
         {
@@ -400,7 +421,8 @@ public class SpringLDAPEntityDAO impleme
             {
                 // TODO throw exception
                 return;
-            } else
+            }
+            else
             {
                 internalIdStr = ldapEntity.getInternalId();
             }
@@ -409,13 +431,12 @@ public class SpringLDAPEntityDAO impleme
         try
         {
             Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
             ldapTemplate.unbind(getRelativeDN(internalIdStr));
-        } finally{
+        }
+        finally
+        {
             Thread.currentThread().setContextClassLoader(currentClassLoader);
         }
-
-        
     }
 
     public void update(Entity entity) throws SecurityException
@@ -447,7 +468,8 @@ public class SpringLDAPEntityDAO impleme
                     dirCtxOps.setAttributeValues(attrDef.getName(), values.toArray());
                     attrAdded = true;
                 }
-            } else
+            }
+            else
             {
                 String value = entityAttr.getValue();
                 if (value != null)
@@ -489,7 +511,8 @@ public class SpringLDAPEntityDAO impleme
                                     attrAdded = true;
                                 }
                             }
-                        } else
+                        }
+                        else
                         {
                             String value = entityAttr.getValue();
                             if (value != null)
@@ -514,12 +537,14 @@ public class SpringLDAPEntityDAO impleme
                                 {
                                     basicAttr.add(attrDef.getRequiredDefaultValue());
                                     modItems.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, basicAttr));
-                                } else
+                                }
+                                else
                                 {
                                     // TODO throw exception
                                     break;
                                 }
-                            } else
+                            }
+                            else
                             {
                                 modItems.add(new ModificationItem(DirContext.REMOVE_ATTRIBUTE, basicAttr));
                             }
@@ -533,8 +558,6 @@ public class SpringLDAPEntityDAO impleme
 
     protected Filter createFilterForIdSearch(String entityId)
     {
-        return SearchUtil.constructMatchingFieldsFilter(configuration.getSearchFilter(), new String[]
-        { configuration.getLdapIdAttribute(), entityId});
+        return SearchUtil.constructMatchingFieldsFilter(configuration.getSearchFilter(), new String[] { configuration.getLdapIdAttribute(), entityId });
     }
-    
 }
\ No newline at end of file

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/filter/SimpleFilter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/filter/SimpleFilter.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/filter/SimpleFilter.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/filter/SimpleFilter.java Fri Mar 19 10:20:10 2010
@@ -26,7 +26,6 @@ import org.springframework.ldap.filter.F
  */
 public class SimpleFilter implements Filter
 {
-
     private String ldapFilter;
 
     public SimpleFilter(String ldapFilter)
@@ -44,8 +43,9 @@ public class SimpleFilter implements Fil
         return sb.append(ldapFilter);
     }
 
-	public String toString() {
-		return ldapFilter;
-	}
-
+    @Override
+    public String toString()
+    {
+        return ldapFilter;
+    }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/util/DnUtils.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/util/DnUtils.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/util/DnUtils.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/util/DnUtils.java Fri Mar 19 10:20:10 2010
@@ -18,17 +18,16 @@ package org.apache.jetspeed.security.map
 
 import org.springframework.ldap.core.DistinguishedName;
 
-
 /**
  * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
  * @version $Id$
  */
-
 public class DnUtils
 {
-    public static final String DEFAULT_SEPARATOR =  ",";
-    
-    public static final String encodeDnUsingSeparator(String separator, String... dnParts){
+    public static final String DEFAULT_SEPARATOR = ",";
+
+    public static final String encodeDnUsingSeparator(String separator, String... dnParts)
+    {
         DistinguishedName dn = new DistinguishedName();
         for (String dnPart : dnParts)
         {
@@ -38,7 +37,8 @@ public class DnUtils
         return encodedDn.replace(", ", separator);
     }
 
-    public static final String encodeDn(String... dnParts){
-        return encodeDnUsingSeparator(DEFAULT_SEPARATOR, dnParts);
+    public static final String encodeDn(String... dnParts)
+    {
+        return DnUtils.encodeDnUsingSeparator(DnUtils.DEFAULT_SEPARATOR, dnParts);
     }
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Attribute.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Attribute.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Attribute.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Attribute.java Fri Mar 19 10:20:10 2010
@@ -24,9 +24,8 @@ import java.util.Collection;
  */
 public interface Attribute
 {
-
     String getName();
-    
+
     String getMappedName();
 
     String getValue();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/AttributeDef.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/AttributeDef.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/AttributeDef.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/AttributeDef.java Fri Mar 19 10:20:10 2010
@@ -22,19 +22,17 @@ package org.apache.jetspeed.security.map
  */
 public interface AttributeDef
 {
-
     String getName();
 
     boolean isMultiValue();
-    
+
     boolean isMapped();
-    
+
     String getMappedName();
-    
+
     boolean isRequired();
-    
+
     String getRequiredDefaultValue();
-    
-    boolean isIdAttribute();
 
+    boolean isIdAttribute();
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Entity.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Entity.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Entity.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/Entity.java Fri Mar 19 10:20:10 2010
@@ -26,7 +26,6 @@ import java.util.Set;
  */
 public interface Entity
 {
-
     String getType();
 
     String getId();
@@ -36,18 +35,19 @@ public interface Entity
     Attribute getAttribute(String name);
 
     /**
-     * Returns a read-only map of attributes (name to attribute). 
-     * To add attributes, call one of the setAttribute() methods
+     * Returns a read-only map of attributes (name to attribute). To add attributes, call one of the setAttribute() methods
+     * 
      * @return collection of all attributes of the entity
      */
-    Map<String,Attribute> getAttributes();
+    Map<String, Attribute> getAttributes();
 
     /**
-     * Returns a read-only map of attributes (mapped name to attribute). 
-     * Each attribute is mapped, i.e. is synchronized with a related Jetspeed principal attribute. 
+     * Returns a read-only map of attributes (mapped name to attribute). Each attribute is mapped, i.e. is synchronized with a related Jetspeed principal
+     * attribute.
+     * 
      * @return collection of all attributes of the entity
      */
-    Map<String,Attribute> getMappedAttributes();
+    Map<String, Attribute> getMappedAttributes();
 
     void setAttribute(String name, String value);
 
@@ -56,5 +56,4 @@ public interface Entity
     void setAttributes(Set<Attribute> attributes);
 
     Set<AttributeDef> getAllowedAttributes();
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityDAO.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityDAO.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityDAO.java Fri Mar 19 10:20:10 2010
@@ -24,7 +24,6 @@ import java.util.Collection;
  */
 public interface EntityDAO
 {
-
     Entity getEntity(String entityId);
 
     Collection<Entity> getEntities();
@@ -33,10 +32,7 @@ public interface EntityDAO
 
     void update(String entityId, Entity entity);
 
-    Collection<Entity> getRelatedEntities(Entity entity, String entityType,
-            String relationType);
-
-    void setRelatedEntities(String relationType, Entity entity,
-            Collection<Entity> entities);
+    Collection<Entity> getRelatedEntities(Entity entity, String entityType, String relationType);
 
+    void setRelatedEntities(String relationType, Entity entity, Collection<Entity> entities);
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityRelationDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityRelationDAO.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityRelationDAO.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/EntityRelationDAO.java Fri Mar 19 10:20:10 2010
@@ -24,9 +24,7 @@ import java.util.Collection;
  */
 public interface EntityRelationDAO
 {
-
     Collection<Entity> getRelatedEntities(Entity entity);
 
     Entity getRelatedEntity(Entity entity);
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeDefImpl.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/AttributeDefImpl.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeDefImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/AttributeDefImpl.java Fri Mar 19 10:20:10 2010
@@ -24,57 +24,49 @@ import org.apache.jetspeed.security.mapp
  */
 public class AttributeDefImpl implements AttributeDef
 {
-
-    private String name;
-
-    private String mappedName;
-
-    private boolean multiValue; // default is single-valued
-
-    private boolean mapped=true;
-    
-    private boolean required=false;
-
-    private String requiredDefaultValue;
-    
+    private String  name;
+    private String  mappedName;
+    private boolean multiValue;          // default is single-valued
+    private boolean mapped   = true;
+    private boolean required = false;
+    private String  requiredDefaultValue;
     private boolean idAttribute;
-    
+
     public AttributeDefImpl(String name)
     {
         super();
         this.name = name;
-        this.mappedName=name; // default mapping
+        this.mappedName = name; // default mapping
     }
 
     public AttributeDefImpl(String name, boolean multiValue)
     {
         this(name);
-        this.multiValue=multiValue;
+        this.multiValue = multiValue;
     }
 
     public AttributeDefImpl(String name, boolean multiValue, boolean isMapped)
     {
-        this(name,multiValue);
-        this.mapped=isMapped;
+        this(name, multiValue);
+        this.mapped = isMapped;
     }
 
-    public AttributeDefImpl(String name, boolean multiValue, boolean isMapped,String mappedName)
+    public AttributeDefImpl(String name, boolean multiValue, boolean isMapped, String mappedName)
     {
         this(name, multiValue, isMapped);
         this.mappedName = mappedName;
     }
 
-    
     public String getName()
     {
         return name;
     }
-    
+
     public String getMappedName()
     {
         return mappedName;
     }
-    
+
     public void setMappedName(String mappedName)
     {
         this.mappedName = mappedName;
@@ -84,12 +76,12 @@ public class AttributeDefImpl implements
     {
         return multiValue;
     }
-    
+
     public boolean isMapped()
     {
         return mapped;
     }
-    
+
     public void setMapped(boolean mapped)
     {
         this.mapped = mapped;
@@ -99,35 +91,33 @@ public class AttributeDefImpl implements
     {
         this.multiValue = multiValue;
     }
-    
+
     public boolean isRequired()
     {
         return required;
     }
-    
+
     public void setRequired(boolean required)
     {
         this.required = required;
     }
-    
+
     public String getRequiredDefaultValue()
     {
         return requiredDefaultValue;
     }
 
-    
     public void setRequiredDefaultValue(String requiredDefaultValue)
     {
         this.requiredDefaultValue = requiredDefaultValue;
     }
 
-    
-    public AttributeDefImpl cfgRequired(boolean required){
+    public AttributeDefImpl cfgRequired(boolean required)
+    {
         setRequired(required);
         return this;
     }
 
-    
     public boolean isIdAttribute()
     {
         return idAttribute;
@@ -138,16 +128,18 @@ public class AttributeDefImpl implements
         this.idAttribute = idAttribute;
     }
 
-    public AttributeDefImpl cfgRequiredDefaultValue(String requiredDefaultValue){
+    public AttributeDefImpl cfgRequiredDefaultValue(String requiredDefaultValue)
+    {
         setRequiredDefaultValue(requiredDefaultValue);
         return this;
     }
 
-    public AttributeDefImpl cfgIdAttribute(boolean isIdAttribute){
+    public AttributeDefImpl cfgIdAttribute(boolean isIdAttribute)
+    {
         setIdAttribute(isIdAttribute);
         return this;
     }
-    
+
     @Override
     public int hashCode()
     {
@@ -161,16 +153,34 @@ public class AttributeDefImpl implements
     @Override
     public boolean equals(Object obj)
     {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
         AttributeDefImpl other = (AttributeDefImpl) obj;
-        if (multiValue != other.multiValue) return false;
+        if (multiValue != other.multiValue)
+        {
+            return false;
+        }
         if (name == null)
         {
-            if (other.name != null) return false;
-        } else if (!name.equals(other.name)) return false;
+            if (other.name != null)
+            {
+                return false;
+            }
+        }
+        else if (!name.equals(other.name))
+        {
+            return false;
+        }
         return true;
     }
-
 }

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=925160&r1=925159&r2=925160&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 Fri Mar 19 10:20:10 2010
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.security.mapping.model.impl;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
@@ -24,20 +25,15 @@ 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$
  */
 public class AttributeImpl implements Attribute
 {
-
     private Collection<String> values = new ArrayList<String>();
-
-    private String value;
-
-    private AttributeDef definition;
+    private String             value;
+    private AttributeDef       definition;
 
     public AttributeImpl(AttributeDef definition)
     {
@@ -65,20 +61,24 @@ public class AttributeImpl implements At
     {
         return definition.getMappedName();
     }
-    
+
     public Collection<String> getValues()
     {
-        if(getDefinition().isMultiValue())
+        if (getDefinition().isMultiValue())
         {
-         return values;         
-        }else{
-            if(value==null)
+            return values;
+        }
+        else
+        {
+            if (value == null)
             {
                 return Collections.emptyList();
-            }else{
-                return Arrays.asList(new String[]{value});
             }
-        }        
+            else
+            {
+                return Arrays.asList(new String[] { value });
+            }
+        }
     }
 
     public void setValues(Collection<String> values)
@@ -94,8 +94,7 @@ public class AttributeImpl implements At
     {
         final int prime = 31;
         int result = 1;
-        result = prime * result
-                + ((definition == null) ? 0 : definition.hashCode());
+        result = prime * result + ((definition == null) ? 0 : definition.hashCode());
         result = prime * result + ((value == null) ? 0 : value.hashCode());
         result = prime * result + ((values == null) ? 0 : values.hashCode());
         return result;
@@ -104,22 +103,52 @@ public class AttributeImpl implements At
     @Override
     public boolean equals(Object obj)
     {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
         AttributeImpl other = (AttributeImpl) obj;
         if (definition == null)
         {
-            if (other.definition != null) return false;
-        } else if (!definition.equals(other.definition)) return false;
+            if (other.definition != null)
+            {
+                return false;
+            }
+        }
+        else if (!definition.equals(other.definition))
+        {
+            return false;
+        }
         if (value == null)
         {
-            if (other.value != null) return false;
-        } else if (!value.equals(other.value)) return false;
+            if (other.value != null)
+            {
+                return false;
+            }
+        }
+        else if (!value.equals(other.value))
+        {
+            return false;
+        }
         if (values == null)
         {
-            if (other.values != null) return false;
-        } else if (!values.equals(other.values)) return false;
+            if (other.values != null)
+            {
+                return false;
+            }
+        }
+        else if (!values.equals(other.values))
+        {
+            return false;
+        }
         return true;
     }
 
@@ -128,22 +157,30 @@ public class AttributeImpl implements At
         return definition;
     }
 
-    public String toString(){
+    @Override
+    public String toString()
+    {
         StringBuffer sb = new StringBuffer();
         sb.append(getName());
         sb.append("=");
-        if (getDefinition().isMultiValue()){
+        if (getDefinition().isMultiValue())
+        {
             Collection<String> values = getValues();
-            if (values != null){
+            if (values != null)
+            {
                 Iterator<String> valIter = values.iterator();
-                while (valIter.hasNext()){
+                while (valIter.hasNext())
+                {
                     sb.append(valIter.next());
-                    if (valIter.hasNext()){
+                    if (valIter.hasNext())
+                    {
                         sb.append(",");
                     }
                 }
             }
-        } else {
+        }
+        else
+        {
             sb.append(getValue());
         }
         return sb.toString();

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/DefaultEntityRelationSearch.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/DefaultEntityRelationSearch.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/DefaultEntityRelationSearch.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/DefaultEntityRelationSearch.java Fri Mar 19 10:20:10 2010
@@ -21,11 +21,10 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.commons.collections.CollectionUtils;
-
 import org.apache.jetspeed.security.mapping.model.Attribute;
 import org.apache.jetspeed.security.mapping.model.Entity;
-import org.apache.jetspeed.security.mapping.model.EntityRelationDAO;
 import org.apache.jetspeed.security.mapping.model.EntityDAO;
+import org.apache.jetspeed.security.mapping.model.EntityRelationDAO;
 
 /**
  * @author <a href="mailto:ddam@apache.org">Dennis Dam</a>
@@ -33,10 +32,8 @@ import org.apache.jetspeed.security.mapp
  */
 public class DefaultEntityRelationSearch implements EntityRelationDAO
 {
-
     private EntityDAO toEntitySearch;
-
-    private String relationAttribute;
+    private String    relationAttribute;
 
     @SuppressWarnings("unchecked")
     public Collection<Entity> getRelatedEntities(Entity entity)
@@ -45,7 +42,8 @@ public class DefaultEntityRelationSearch
         if (relatedEntityIds.size() > 0)
         {
             return toEntitySearch.getEntities(relatedEntityIds);
-        } else
+        }
+        else
         {
             return CollectionUtils.EMPTY_COLLECTION;
         }
@@ -57,7 +55,8 @@ public class DefaultEntityRelationSearch
         if (entities != null && entities.size() == 1)
         {
             return entities.iterator().next();
-        } else
+        }
+        else
         {
             return null;
         }
@@ -67,13 +66,13 @@ public class DefaultEntityRelationSearch
     {
         Attribute relatedAttr = entity.getAttribute(relationAttribute);
         Set<String> foundIds = new HashSet();
-
         if (relatedAttr != null)
         {
             if (relatedAttr.getDefinition().isMultiValue())
             {
                 foundIds.addAll(relatedAttr.getValues());
-            } else
+            }
+            else
             {
                 // TODO: if single value, parse value as CSV string
             }
@@ -100,5 +99,4 @@ public class DefaultEntityRelationSearch
     {
         this.relationAttribute = relationAttribute;
     }
-
 }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/EntityImpl.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/EntityImpl.java?rev=925160&r1=925159&r2=925160&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/EntityImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/model/impl/EntityImpl.java Fri Mar 19 10:20:10 2010
@@ -33,19 +33,13 @@ import org.apache.jetspeed.security.mapp
  */
 public class EntityImpl implements Entity
 {
-
-    private Map<String, Attribute> nameToAttributeMap = new HashMap<String, Attribute>();
-
+    private Map<String, Attribute>  nameToAttributeMap = new HashMap<String, Attribute>();
     private final Set<AttributeDef> allowedAttributes;
+    private String                  id;
+    private String                  internalId;
+    private String                  type;
 
-    private String id;
-
-    private String internalId;
-
-    private String type;
-    
-    public EntityImpl(String type, String id,
-            Set<AttributeDef> allowedAttributes)
+    public EntityImpl(String type, String id, Set<AttributeDef> allowedAttributes)
     {
         this.type = type;
         this.id = id;
@@ -67,18 +61,20 @@ public class EntityImpl implements Entit
         return nameToAttributeMap.get(name);
     }
 
-    public Map<String,Attribute> getAttributes()
+    public Map<String, Attribute> getAttributes()
     {
         return Collections.unmodifiableMap(nameToAttributeMap);
     }
 
-    public Map<String,Attribute> getMappedAttributes()
+    public Map<String, Attribute> getMappedAttributes()
     {
-        Map<String,Attribute> mappedAttrs = new HashMap<String,Attribute>();
-        for (Map.Entry<String,Attribute> mappedAttrEntry : nameToAttributeMap.entrySet()){
-            if (mappedAttrEntry.getValue().getDefinition().isMapped()){
+        Map<String, Attribute> mappedAttrs = new HashMap<String, Attribute>();
+        for (Map.Entry<String, Attribute> mappedAttrEntry : nameToAttributeMap.entrySet())
+        {
+            if (mappedAttrEntry.getValue().getDefinition().isMapped())
+            {
                 // it is assumed that mapped names are unique
-                mappedAttrs.put(mappedAttrEntry.getValue().getMappedName(),mappedAttrEntry.getValue());
+                mappedAttrs.put(mappedAttrEntry.getValue().getMappedName(), mappedAttrEntry.getValue());
             }
         }
         return Collections.unmodifiableMap(mappedAttrs);
@@ -103,7 +99,10 @@ public class EntityImpl implements Entit
     {
         for (AttributeDef def : allowedAttributes)
         {
-            if (def.getName().equals(name)) { return def; }
+            if (def.getName().equals(name))
+            {
+                return def;
+            }
         }
         return null;
     }
@@ -114,9 +113,13 @@ public class EntityImpl implements Entit
         if (attr == null)
         {
             AttributeDef def = getAttributeDefinition(name);
-            if (def == null) { return; // TODO: throw proper exception
+            if (def == null)
+            {
+                return; // TODO: throw proper exception
             }
-            if (def.isMultiValue()) { return; // TODO: throw proper exception
+            if (def.isMultiValue())
+            {
+                return; // TODO: throw proper exception
             }
             attr = new AttributeImpl(def);
             nameToAttributeMap.put(name, attr);
@@ -130,9 +133,13 @@ public class EntityImpl implements Entit
         if (attr == null)
         {
             AttributeDef def = getAttributeDefinition(name);
-            if (def == null) { return; // TODO: throw proper exception
+            if (def == null)
+            {
+                return; // TODO: throw proper exception
             }
-            if (!def.isMultiValue()) { return; // TODO: throw proper exception
+            if (!def.isMultiValue())
+            {
+                return; // TODO: throw proper exception
             }
             attr = new AttributeImpl(def);
             nameToAttributeMap.put(name, attr);
@@ -155,7 +162,8 @@ public class EntityImpl implements Entit
 
     public void setInternalId(String internalId)
     {
-        if (internalId != null){
+        if (internalId != null)
+        {
             internalId = DnUtils.encodeDn(internalId);
         }
         this.internalId = internalId;
@@ -167,12 +175,8 @@ public class EntityImpl implements Entit
         final int prime = 31;
         int result = 1;
         result = prime * result + ((id == null) ? 0 : id.hashCode());
-        result = prime * result
-                + ((internalId == null) ? 0 : internalId.hashCode());
-        result = prime
-                * result
-                + ((nameToAttributeMap == null) ? 0 : nameToAttributeMap
-                        .hashCode());
+        result = prime * result + ((internalId == null) ? 0 : internalId.hashCode());
+        result = prime * result + ((nameToAttributeMap == null) ? 0 : nameToAttributeMap.hashCode());
         result = prime * result + ((type == null) ? 0 : type.hashCode());
         return result;
     }
@@ -180,31 +184,69 @@ public class EntityImpl implements Entit
     @Override
     public boolean equals(Object obj)
     {
-        if (this == obj) return true;
-        if (obj == null) return false;
-        if (getClass() != obj.getClass()) return false;
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
         EntityImpl other = (EntityImpl) obj;
         if (id == null)
         {
-            if (other.id != null) return false;
-        } else if (!id.equals(other.id)) return false;
+            if (other.id != null)
+            {
+                return false;
+            }
+        }
+        else if (!id.equals(other.id))
+        {
+            return false;
+        }
         if (internalId == null)
         {
-            if (other.internalId != null) return false;
-        } else if (!internalId.equals(other.internalId)) return false;
+            if (other.internalId != null)
+            {
+                return false;
+            }
+        }
+        else if (!internalId.equals(other.internalId))
+        {
+            return false;
+        }
         if (nameToAttributeMap == null)
         {
-            if (other.nameToAttributeMap != null) return false;
-        } else if (!nameToAttributeMap.equals(other.nameToAttributeMap))
+            if (other.nameToAttributeMap != null)
+            {
+                return false;
+            }
+        }
+        else if (!nameToAttributeMap.equals(other.nameToAttributeMap))
+        {
             return false;
+        }
         if (type == null)
         {
-            if (other.type != null) return false;
-        } else if (!type.equals(other.type)) return false;
+            if (other.type != null)
+            {
+                return false;
+            }
+        }
+        else if (!type.equals(other.type))
+        {
+            return false;
+        }
         return true;
     }
-    
-    public String toString(){
+
+    @Override
+    public String toString()
+    {
         StringBuffer sb = new StringBuffer();
         sb.append("Entity of type '");
         sb.append(getType());
@@ -218,10 +260,9 @@ public class EntityImpl implements Entit
         for (Attribute attr : nameToAttributeMap.values())
         {
             sb.append("attribute: ");
-            sb.append(attr.toString());            
+            sb.append(attr.toString());
             sb.append("\n");
         }
         return sb.toString();
     }
-
 }



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