portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r695782 - in /portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src: main/java/org/apache/jetspeed/security/mapping/ main/java/org/apache/jetspeed/security/mapping/ldap/dao/ main/java/org/apache/jetspeed/s...
Date Tue, 16 Sep 2008 09:26:09 GMT
Author: ddam
Date: Tue Sep 16 02:26:07 2008
New Revision: 695782

URL: http://svn.apache.org/viewvc?rev=695782&view=rev
Log:
use "to" and "from" naming in relation methods which are consistent with association methods
in the security framework. 

Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/BasicTestCases.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/UserTests.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/UserTests.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/SecurityEntityManager.java
Tue Sep 16 02:26:07 2008
@@ -39,9 +39,9 @@
 
     void update(Entity entity);
 
-    Collection<Entity> getRelatedEntitiesFrom(Entity toEntity, SecurityEntityRelationType
relationType);
+    Collection<Entity> getRelatedEntitiesFrom(Entity fromEntity, SecurityEntityRelationType
relationType);
 
-    Collection<Entity> getRelatedEntitiesTo(Entity fromEntity, SecurityEntityRelationType
relationType);
+    Collection<Entity> getRelatedEntitiesTo(Entity toEntity, SecurityEntityRelationType
relationType);
 
     void addRelatedEntity(Entity entity, Entity relatedEntity, SecurityEntityRelationType
relationType);
 

Modified: portals/jetspeed-2/portal/branches/security-refactoring/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/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/DefaultLDAPEntityManager.java
Tue Sep 16 02:26:07 2008
@@ -111,7 +111,7 @@
         return dao != null ? dao.getEntity(entityId) : null;
     }
 
-    public Collection<Entity> getRelatedEntitiesTo(Entity fromEntity,
+    public Collection<Entity> getRelatedEntitiesTo(Entity toEntity,
             SecurityEntityRelationType relationType)
     {
         EntityDAO fromDAO=entityDAOs.get(relationType.getFromEntityType());
@@ -120,13 +120,13 @@
         if (fromDAO != null && toDAO != null && relationDAO != null)
         {
             return relationDAO.getRelatedEntitiesTo(
-                    fromDAO, toDAO, fromEntity); 
+                    fromDAO, toDAO, toEntity); 
         }
         return null; // todo : throw exception, since combination of entity
                      // types and relation type is not configured.
     }
 
-    public Collection<Entity> getRelatedEntitiesFrom(Entity toEntity,
+    public Collection<Entity> getRelatedEntitiesFrom(Entity fromEntity,
             SecurityEntityRelationType relationType)
     {
         EntityDAO fromDAO=entityDAOs.get(relationType.getFromEntityType());
@@ -135,7 +135,7 @@
         if (fromDAO != null && toDAO != null && relationDAO != null)
         {
             return relationDAO.getRelatedEntitiesFrom(
-                    fromDAO, toDAO, toEntity); 
+                    fromDAO, toDAO, fromEntity); 
         }
         return null; // todo : throw exception, since combination of entity
                      // types and relation type is not configured.

Modified: portals/jetspeed-2/portal/branches/security-refactoring/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/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/EntityRelationDAO.java
Tue Sep 16 02:26:07 2008
@@ -31,10 +31,10 @@
     SecurityEntityRelationType getRelationType();
 
     Collection<Entity> getRelatedEntitiesFrom(EntityDAO fromDao,
-            EntityDAO toDao, Entity toEntity);
+            EntityDAO toDao, Entity fromEntity);
 
     Collection<Entity> getRelatedEntitiesTo(EntityDAO fromDao,
-            EntityDAO toDao, Entity fromEntity);
+            EntityDAO toDao, Entity toEntity);
 
     void relate(EntityDAO sourceDao, EntityDAO targetDao, Entity sourceEntity,
             Entity targetEntity);

Modified: portals/jetspeed-2/portal/branches/security-refactoring/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/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/mapping/ldap/dao/impl/AttributeBasedRelationDAO.java
Tue Sep 16 02:26:07 2008
@@ -54,15 +54,15 @@
                                                  // contains the ID(s).
 
     public Collection<Entity> getRelatedEntitiesFrom(EntityDAO fromDAO,
-            EntityDAO toDAO, Entity toEntity)
+            EntityDAO toDAO, Entity fromEntity)
     {
-       return internalGetRelatedEntities( toDAO, fromDAO, !useFromEntityAttribute, toEntity);
              
+       return internalGetRelatedEntities( fromDAO, toDAO, useFromEntityAttribute, fromEntity);
              
     }
 
     public Collection<Entity> getRelatedEntitiesTo(EntityDAO fromDAO,
-            EntityDAO toDAO, Entity fromEntity)
+            EntityDAO toDAO, Entity toEntity)
     {
-       return internalGetRelatedEntities(fromDAO, toDAO, useFromEntityAttribute, fromEntity);
              
+       return internalGetRelatedEntities(toDAO, fromDAO, !useFromEntityAttribute, toEntity);
              
     }
     
     private Collection<Entity> internalGetRelatedEntities(EntityDAO fromDAO,

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/BasicTestCases.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/BasicTestCases.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/BasicTestCases.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/BasicTestCases.java
Tue Sep 16 02:26:07 2008
@@ -63,11 +63,10 @@
     }
 
     public void testFetchRelatedEntitiesTo(String fromEntityType,
-            String toEntityType, String relationType, String fromEntityId,
+            String toEntityType, String relationType, String toEntityId,
             Collection<Entity> expectedEntities) throws Exception
     {
-        Entity randomEntity = entityManager.getEntity(fromEntityType,
-                fromEntityId);
+        Entity randomEntity = entityManager.getEntity(toEntityType,toEntityId);
         TestCase.assertNotNull(randomEntity);
         Collection<Entity> resultEntities = entityManager.getRelatedEntitiesTo(
                 randomEntity, new SecurityEntityRelationTypeImpl(relationType,fromEntityType,toEntityType));
@@ -76,11 +75,10 @@
     }
     
     public void testFetchRelatedEntitiesFrom(String fromEntityType,
-            String toEntityType, String relationType, String toEntityId,
+            String toEntityType, String relationType, String fromEntityId,
             Collection<Entity> expectedEntities) throws Exception
     {
-        Entity randomEntity = entityManager.getEntity(toEntityType,
-                toEntityId);
+        Entity randomEntity = entityManager.getEntity(fromEntityType,fromEntityId);
         TestCase.assertNotNull(randomEntity);
         Collection<Entity> resultEntities = entityManager.getRelatedEntitiesFrom(
                 randomEntity, new SecurityEntityRelationTypeImpl(relationType,fromEntityType,toEntityType));

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/UserTests.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/UserTests.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/UserTests.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup1/UserTests.java
Tue Sep 16 02:26:07 2008
@@ -55,7 +55,7 @@
         Collection<Entity> resultSet = new ArrayList<Entity>();
         resultSet.add(role1);
         resultSet.add(role3);
-        basicTestCases.testFetchRelatedEntitiesTo("user", "role", "hasRole",
+        basicTestCases.testFetchRelatedEntitiesFrom("user", "role", "hasRole",
                 "jsmith", resultSet);
     }
 

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/UserTests.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/UserTests.java?rev=695782&r1=695781&r2=695782&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/UserTests.java
(original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/test/java/org/apache/jetspeed/security/mapping/ldap/setup2/UserTests.java
Tue Sep 16 02:26:07 2008
@@ -64,7 +64,7 @@
         resultSet.add(userRole);
         
         // test fetching roles for a user
-        basicTestCases.testFetchRelatedEntitiesTo("user", "role", "hasRole",
+        basicTestCases.testFetchRelatedEntitiesFrom("user", "role", "hasRole",
                 "someManager", resultSet);
 
         // .. next, test fetching users for a role using the same EntityRelationDAO
@@ -83,7 +83,7 @@
         resultSet.add(user);
         resultSet.add(jetspeed);
         resultSet.add(admin);
-        basicTestCases.testFetchRelatedEntitiesFrom("user", "role", "hasRole",
+        basicTestCases.testFetchRelatedEntitiesTo("user", "role", "hasRole",
                 "manager", resultSet);
 
     }



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