Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/TorqueAbstractUserManager.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/TorqueAbstractUserManager.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/TorqueAbstractUserManager.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/TorqueAbstractUserManager.java
 Mon Nov  5 22:43:28 2018
@@ -1,4 +1,5 @@
 package org.apache.fulcrum.security.torque;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -26,356 +27,292 @@ import org.apache.fulcrum.security.entit
 import org.apache.fulcrum.security.spi.AbstractUserManager;
 import 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity;
 import org.apache.fulcrum.security.util.DataBackendException;
-import org.apache.fulcrum.security.util.EntityExistsException;
 import org.apache.fulcrum.security.util.UnknownEntityException;
 import org.apache.fulcrum.security.util.UserSet;
 import org.apache.torque.NoRowsException;
 import org.apache.torque.TooManyRowsException;
 import org.apache.torque.TorqueException;
 import org.apache.torque.util.Transaction;
+
 /**
  * This implementation persists to a database via Torque.
  *
  * @author <a href="mailto:[email protected]";>Thomas Vandahl</a>
  * @version $Id:$
  */
-public abstract class TorqueAbstractUserManager extends AbstractUserManager
-{
-    
+public abstract class TorqueAbstractUserManager extends AbstractUserManager {
+
        /** Serial version */
        private static final long serialVersionUID = 2050218990148719292L;
-    
-    /**
-     * Avalon Service lifecycle method
-     */
-    @Override
-    public void configure(Configuration conf) throws ConfigurationException
-    {
-       super.configure( conf );
-    }
-    
-
-    /**
-     * Get all specialized Users
-     *
-     * @param con a database connection
-     *
-     * @return a List of User instances
-     *
-     * @throws TorqueException if any database error occurs
-     */
-    protected abstract <T extends User> List<T> doSelectAllUsers(Connection 
con)
-        throws TorqueException;
-
-    /**
-     * Get a specialized User by name
-     *
-     * @param name the name of the group
-     * @param con a database connection
-     *
-     * @return a User instance
-     *
-     * @throws NoRowsException if no such group exists
-     * @throws TooManyRowsException if multiple groups with the given name 
exist
-     * @throws TorqueException if any other database error occurs
-     */
-    protected abstract <T extends User> T doSelectByName(String name, 
Connection con)
-        throws NoRowsException, TooManyRowsException, TorqueException;
-
-    /**
-     * Get a specialized User by id
-     *
-     * @param id the id of the group
-     * @param con a database connection
-     *
-     * @return a User instance
-     *
-     * @throws NoRowsException if no such group exists
-     * @throws TooManyRowsException if multiple groups with the given id exist
-     * @throws TorqueException if any other database error occurs
-     */
-    protected abstract <T extends User> T doSelectById(Integer id, Connection 
con)
-        throws NoRowsException, TooManyRowsException, TorqueException;
-
-    /**
-    * Removes an user account from the system.
-    *
-    * @param user the object describing the account to be removed.
-    * @throws DataBackendException if there was an error accessing the data
-    *         backend.
-    * @throws UnknownEntityException if the user account is not present.
-    */
-    @Override
-       public synchronized void removeUser(User user) throws 
DataBackendException, UnknownEntityException
-    {
-        try
-        {
-            ((TorqueAbstractSecurityEntity)user).delete();
-        }
-        catch (TorqueException e)
-        {
-            throw new DataBackendException("Removing User '" + user.getName() 
+ "' failed", e);
-        }
-    }
-
-    /**
-       * Creates new user account with specified attributes.
-       *
-       * @param user the object describing account to be created.
-       *
-       * @throws DataBackendException if there was an error accessing the
-       *         data backend.
-       * @throws EntityExistsException if the user account already exists.
-       */
-    @Override
-       protected synchronized <T extends User> T persistNewUser(T user) throws 
DataBackendException
-    {
-        try
-        {
-               TorqueAbstractSecurityEntity u = 
(TorqueAbstractSecurityEntity)user;
-            u.save();
-        }
-        catch (Exception e)
-        {
-            throw new DataBackendException("Adding User '" + user.getName() + 
"' failed", e);
-        }
-
-        return user;
-    }
-
-    /**
-       * Stores User attributes. The User is required to exist in the system.
-       *
-       * @param user The User to be stored.
-       * @throws DataBackendException if there was an error accessing the data
-       *         backend.
-       * @throws UnknownEntityException if the role does not exist.
-       */
-    @Override
-       public synchronized void saveUser(User user) throws 
DataBackendException, UnknownEntityException
-    {
-        if (checkExists(user))
-        {
-            try
-            {
-                TorqueAbstractSecurityEntity u = 
(TorqueAbstractSecurityEntity)user;
-                u.setNew(false);
-                u.save();
-            }
-            catch (Exception e)
-            {
-                throw new DataBackendException("Saving User '" + 
user.getName() + "' failed", e);
-            }
-        }
-        else
-        {
-            throw new UnknownEntityException("Unknown user '" + user + "'");
-        }
-    }
-
-    /**
-     * Check whether a specified user's account exists.
-     *
-     * The login name is used for looking up the account.
-     *
-     * @param userName The name of the user to be checked.
-     * @return true if the specified account exists
-     * @throws DataBackendException if there was an error accessing
-     *         the data backend.
-     */
-    @Override
-       public boolean checkExists(String userName) throws DataBackendException
-    {
-        boolean exists = false;
-
-        Connection con = null;
-
-        try
-        {
-            con = Transaction.begin();
-
-            doSelectByName(userName, con);
-
-            Transaction.commit(con);
-            con = null;
-
-            exists = true;
-        }
-        catch (NoRowsException e)
-        {
-            exists = false;
-        }
-        catch (TooManyRowsException e)
-        {
-            throw new DataBackendException("Multiple Users with same username 
'" + userName + "'");
-        }
-        catch (TorqueException e)
-        {
-            throw new DataBackendException("Error retrieving user 
information", e);
-        }
-        finally
-        {
-            if (con != null)
-            {
-                Transaction.safeRollback(con);
-            }
-        }
-
-        return exists;
-    }
-
-    /**
-     * Retrieve a user from persistent storage using username as the
-     * key.
-     *
-     * @param userName the name of the user.
-     * @return an User object.
-     * @exception UnknownEntityException if the user's account does not
-     *            exist in the database.
-     * @exception DataBackendException if there is a problem accessing the
-     *            storage.
-     */
-    @Override
-       public <T extends User> T getUser(String userName) throws 
UnknownEntityException, DataBackendException
-    {
-        T user = null;
-        Connection con = null;
-
-        try
-        {
-            con = Transaction.begin();
-
-            user = doSelectByName(userName.toLowerCase(), con);
-
-            // Add attached objects if they exist
-            ((TorqueAbstractSecurityEntity)user).retrieveAttachedObjects(con, 
false );
-
-            Transaction.commit(con);
-            con = null;
-        }
-        catch (NoRowsException e)
-        {
-            throw new UnknownEntityException("Unknown user '" + userName + 
"'");
-        }
-        catch (TooManyRowsException e)
-        {
-            throw new DataBackendException("Multiple Users with same username 
'" + userName + "'");
-        }
-        catch (TorqueException e)
-        {
-            throw new DataBackendException("Error retrieving user 
information", e);
-        }
-        finally
-        {
-            if (con != null)
-            {
-                Transaction.safeRollback(con);
-            }
-        }
-
-        return user;
-    }
-
-    /**
-       * Retrieves all users defined in the system.
-       *
-       * @return the names of all users defined in the system.
-       * @throws DataBackendException if there was an error accessing the data
-       *         backend.
-       */
-    @Override
-       public <T extends User> UserSet<T> getAllUsers() throws 
DataBackendException
-    {
-        UserSet userSet = new UserSet();
-        Connection con = null;
-
-        try
-        {
-            con = Transaction.begin();
-
-            List<User> users = doSelectAllUsers(con);
-
-            for (User user : users)
-            {
-                // Add attached objects if they exist
-                
((TorqueAbstractSecurityEntity)user).retrieveAttachedObjects(con, false);
-
-                userSet.add(user);
-            }
-
-            Transaction.commit(con);
-            con = null;
-        }
-        catch (TorqueException e)
-        {
-            throw new DataBackendException("Error retrieving all users", e);
-        }
-        finally
-        {
-            if (con != null)
-            {
-                Transaction.safeRollback(con);
-            }
-        }
-
-        return userSet;
-    }
-
-    /**
-     * Retrieve a User object with specified id.
-     *
-     * @param id
-     *            the id of the User.
-     * @return an object representing the User with specified id.
-     * @throws DataBackendException
-     *             if there was an error accessing the data backend.
-     * @throws UnknownEntityException
-     *             if the user does not exist.
-     */
-    @Override
-       public <T extends User> T getUserById(Object id) throws 
DataBackendException, UnknownEntityException
-    {
-        T user;
-
-        if (id != null && id instanceof Integer)
-        {
-            Connection con = null;
-
-            try
-            {
-                con = Transaction.begin();
-
-                user = doSelectById((Integer)id, con);
-
-                // Add attached objects if they exist
-                
((TorqueAbstractSecurityEntity)user).retrieveAttachedObjects(con, false); // 
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (NoRowsException e)
-            {
-                throw new UnknownEntityException("User with id '" + id + "' 
does not exist.", e);
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("Error retrieving user 
information", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-        }
-        else
-        {
-            throw new UnknownEntityException("Invalid user id '" + id + "'");
-        }
 
-        return user;
-    }
+       /**
+        * Avalon Service lifecycle method
+        */
+       @Override
+       public void configure(Configuration conf) throws ConfigurationException 
{
+               super.configure(conf);
+       }
+
+       /**
+        * Get all specialized Users
+        *
+        * @param con a database connection
+        *
+        * @return a List of User instances
+        *
+        * @throws TorqueException if any database error occurs
+        */
+       protected abstract <T extends User> List<T> doSelectAllUsers(Connection 
con) throws TorqueException;
+
+       /**
+        * Get a specialized User by name
+        *
+        * @param name the name of the group
+        * @param con  a database connection
+        *
+        * @return a User instance
+        *
+        * @throws NoRowsException      if no such group exists
+        * @throws TooManyRowsException if multiple groups with the given name 
exist
+        * @throws TorqueException      if any database error occurs if any 
other
+        *                              database error occurs
+        */
+       protected abstract <T extends User> T doSelectByName(String name, 
Connection con)
+                       throws NoRowsException, TooManyRowsException, 
TorqueException;
+
+       /**
+        * Get a specialized User by id
+        *
+        * @param id  the id of the group
+        * @param con a database connection
+        *
+        * @return a User instance
+        *
+        * @throws NoRowsException      if no such group exists
+        * @throws TooManyRowsException if multiple groups with the given id 
exist
+        * @throws TorqueException      if any database error occurs if any 
other
+        *                              database error occurs
+        */
+       protected abstract <T extends User> T doSelectById(Integer id, 
Connection con)
+                       throws NoRowsException, TooManyRowsException, 
TorqueException;
+
+       /**
+        * Removes an user account from the system.
+        *
+        * @param user the object describing the account to be removed.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if the user account is not present.
+        */
+       @Override
+       public synchronized void removeUser(User user) throws 
DataBackendException, UnknownEntityException {
+               try {
+                       ((TorqueAbstractSecurityEntity) user).delete();
+               } catch (TorqueException e) {
+                       throw new DataBackendException("Removing User '" + 
user.getName() + "' failed", e);
+               }
+       }
+
+       /**
+        * Creates new user account with specified attributes.
+        *
+        * @param user the object describing account to be created.
+        *
+        * @throws DataBackendException if there was an error accessing the data
+        *                              backend.
+        */
+       @Override
+       protected synchronized <T extends User> T persistNewUser(T user) throws 
DataBackendException {
+               try {
+                       TorqueAbstractSecurityEntity u = 
(TorqueAbstractSecurityEntity) user;
+                       u.save();
+               } catch (Exception e) {
+                       throw new DataBackendException("Adding User '" + 
user.getName() + "' failed", e);
+               }
+
+               return user;
+       }
+
+       /**
+        * Stores User attributes. The User is required to exist in the system.
+        *
+        * @param user The User to be stored.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if the role does not exist.
+        */
+       @Override
+       public synchronized void saveUser(User user) throws 
DataBackendException, UnknownEntityException {
+               if (checkExists(user)) {
+                       try {
+                               TorqueAbstractSecurityEntity u = 
(TorqueAbstractSecurityEntity) user;
+                               u.setNew(false);
+                               u.save();
+                       } catch (Exception e) {
+                               throw new DataBackendException("Saving User '" 
+ user.getName() + "' failed", e);
+                       }
+               } else {
+                       throw new UnknownEntityException("Unknown user '" + 
user + "'");
+               }
+       }
+
+       /**
+        * Check whether a specified user's account exists.
+        *
+        * The login name is used for looking up the account.
+        *
+        * @param userName The name of the user to be checked.
+        * @return true if the specified account exists
+        * @throws DataBackendException if there was an error accessing the data
+        *                              backend.
+        */
+       @Override
+       public boolean checkExists(String userName) throws DataBackendException 
{
+               boolean exists = false;
+
+               Connection con = null;
+
+               try {
+                       con = Transaction.begin();
+
+                       doSelectByName(userName, con);
+
+                       Transaction.commit(con);
+                       con = null;
+
+                       exists = true;
+               } catch (NoRowsException e) {
+                       exists = false;
+               } catch (TooManyRowsException e) {
+                       throw new DataBackendException("Multiple Users with 
same username '" + userName + "'");
+               } catch (TorqueException e) {
+                       throw new DataBackendException("Error retrieving user 
information", e);
+               } finally {
+                       if (con != null) {
+                               Transaction.safeRollback(con);
+                       }
+               }
+
+               return exists;
+       }
+
+       /**
+        * Retrieve a user from persistent storage using username as the key.
+        *
+        * @param userName the name of the user.
+        * @return an User object.
+        * @exception UnknownEntityException if the user's account does not 
exist in the
+        *                                   database.
+        * @exception DataBackendException   if there is a problem accessing the
+        *                                   storage.
+        */
+       @Override
+       public <T extends User> T getUser(String userName) throws 
UnknownEntityException, DataBackendException {
+               T user = null;
+               Connection con = null;
+
+               try {
+                       con = Transaction.begin();
+
+                       user = doSelectByName(userName.toLowerCase(), con);
+
+                       // Add attached objects if they exist
+                       ((TorqueAbstractSecurityEntity) 
user).retrieveAttachedObjects(con, false);
+
+                       Transaction.commit(con);
+                       con = null;
+               } catch (NoRowsException e) {
+                       throw new UnknownEntityException("Unknown user '" + 
userName + "'");
+               } catch (TooManyRowsException e) {
+                       throw new DataBackendException("Multiple Users with 
same username '" + userName + "'");
+               } catch (TorqueException e) {
+                       throw new DataBackendException("Error retrieving user 
information", e);
+               } finally {
+                       if (con != null) {
+                               Transaction.safeRollback(con);
+                       }
+               }
+
+               return user;
+       }
+
+       /**
+        * Retrieves all users defined in the system.
+        *
+        * @return the names of all users defined in the system.
+        * @throws DataBackendException if there was an error accessing the data
+        *                              backend.
+        */
+       @Override
+       public <T extends User> UserSet<T> getAllUsers() throws 
DataBackendException {
+               UserSet<T> userSet = new UserSet<T>();
+               Connection con = null;
+
+               try {
+                       con = Transaction.begin();
+
+                       List<User> users = doSelectAllUsers(con);
+
+                       for (User user : users) {
+                               // Add attached objects if they exist
+                               ((TorqueAbstractSecurityEntity) 
user).retrieveAttachedObjects(con, false);
+
+                               userSet.add(user);
+                       }
+
+                       Transaction.commit(con);
+                       con = null;
+               } catch (TorqueException e) {
+                       throw new DataBackendException("Error retrieving all 
users", e);
+               } finally {
+                       if (con != null) {
+                               Transaction.safeRollback(con);
+                       }
+               }
+
+               return userSet;
+       }
+
+       /**
+        * Retrieve a User object with specified id.
+        *
+        * @param id the id of the User.
+        * @return an object representing the User with specified id.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if the user does not exist.
+        */
+       @Override
+       public <T extends User> T getUserById(Object id) throws 
DataBackendException, UnknownEntityException {
+               T user;
+
+               if (id != null && id instanceof Integer) {
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               user = doSelectById((Integer) id, con);
+
+                               // Add attached objects if they exist
+                               ((TorqueAbstractSecurityEntity) 
user).retrieveAttachedObjects(con, false); //
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (NoRowsException e) {
+                               throw new UnknownEntityException("User with id 
'" + id + "' does not exist.", e);
+                       } catch (TorqueException e) {
+                               throw new DataBackendException("Error 
retrieving user information", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+               } else {
+                       throw new UnknownEntityException("Invalid user id '" + 
id + "'");
+               }
+
+               return user;
+       }
 
-    
 }

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicGroup.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicGroup.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicGroup.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicGroup.java
 Mon Nov  5 22:43:28 2018
@@ -55,7 +55,7 @@ public abstract class TorqueAbstractBasi
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of User/Group relations
      */

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicUser.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicUser.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicUser.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/basic/TorqueAbstractBasicUser.java
 Mon Nov  5 22:43:28 2018
@@ -54,7 +54,7 @@ public abstract class TorqueAbstractBasi
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of User/Group relations
      */

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicGroup.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicGroup.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicGroup.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicGroup.java
 Mon Nov  5 22:43:28 2018
@@ -61,7 +61,7 @@ public abstract class TorqueAbstractDyna
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of User/Group relations
      */
@@ -80,7 +80,7 @@ public abstract class TorqueAbstractDyna
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of Role/Group relations
      */
@@ -91,7 +91,7 @@ public abstract class TorqueAbstractDyna
         return 
TorqueDynamicGroupRolePeer.doSelectJoinTorqueDynamicRole(criteria, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.basic.entity.BasicGroup#addUser(org.apache.fulcrum.security.entity.User)
      */
     public void addUser(User user)
@@ -99,7 +99,7 @@ public abstract class TorqueAbstractDyna
         getUsers().add(user);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.basic.entity.BasicGroup#getUsers()
      */
     public UserSet getUsers()
@@ -116,7 +116,7 @@ public abstract class TorqueAbstractDyna
         return (UserSet)userSet;
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.basic.entity.BasicGroup#getUsersAsSet()
      */
     @SuppressWarnings("unchecked")
@@ -125,7 +125,7 @@ public abstract class TorqueAbstractDyna
         return (Set<T>)userSet;
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.basic.entity.BasicGroup#removeUser(org.apache.fulcrum.security.entity.User)
      */
     public void removeUser(User user)
@@ -133,7 +133,7 @@ public abstract class TorqueAbstractDyna
         getUsers().remove(user);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.basic.entity.BasicGroup#setUsers(org.apache.fulcrum.security.util.UserSet)
      */
     public void setUsers(UserSet userSet)
@@ -148,7 +148,7 @@ public abstract class TorqueAbstractDyna
         }
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.basic.entity.BasicGroup#setUsersAsSet(java.util.Set)
      */
     public <T extends User> void setUsersAsSet(Set<T> users)
@@ -156,7 +156,7 @@ public abstract class TorqueAbstractDyna
         setUsers(new UserSet<User>(users));
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup#addRole(org.apache.fulcrum.security.entity.Role)
      */
     public void addRole(Role role)
@@ -164,7 +164,7 @@ public abstract class TorqueAbstractDyna
         getRoles().add(role);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup#getRoles()
      */
     public RoleSet getRoles()
@@ -181,7 +181,7 @@ public abstract class TorqueAbstractDyna
         return (RoleSet)roleSet;
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup#getRolesAsSet()
      */
     @SuppressWarnings("unchecked")
@@ -190,7 +190,7 @@ public abstract class TorqueAbstractDyna
         return (Set<T>)roleSet;
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup#removeRole(org.apache.fulcrum.security.entity.Role)
      */
     public void removeRole(Role role)
@@ -198,7 +198,7 @@ public abstract class TorqueAbstractDyna
         getRoles().remove(role);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup#setRoles(org.apache.fulcrum.security.util.RoleSet)
      */
     public void setRoles(RoleSet roleSet)
@@ -213,7 +213,7 @@ public abstract class TorqueAbstractDyna
         }
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup#setRolesAsSet(java.util.Set)
      */
     public <T extends Role> void setRolesAsSet(Set<T> roles)
@@ -222,13 +222,16 @@ public abstract class TorqueAbstractDyna
     }
 
     /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#getDatabaseName()
+     * @return the database name
      */
     public String getDatabaseName()
     {
         return TorqueDynamicGroupPeer.DATABASE_NAME;
     }
     
+    /* (non-Javadoc)
+     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection)
+     */
     @Override
     public void retrieveAttachedObjects( Connection con )
         throws TorqueException
@@ -236,8 +239,8 @@ public abstract class TorqueAbstractDyna
         retrieveAttachedObjects( con, false );
     }
 
-    /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#retrieveAttachedObjects(Connection,
 Boolean)
+    /* (non-Javadoc)
+     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#retrieveAttachedObjects(java.sql.Connection,
 java.lang.Boolean)
      */
     @Override
     public void retrieveAttachedObjects( Connection con, Boolean lazy )
@@ -262,7 +265,7 @@ public abstract class TorqueAbstractDyna
         }
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#update(java.sql.Connection)
      */
     public void update(Connection con) throws TorqueException
@@ -311,7 +314,7 @@ public abstract class TorqueAbstractDyna
         }
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#delete()
      */
     public void delete() throws TorqueException

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicPermission.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicPermission.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicPermission.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicPermission.java
 Mon Nov  5 22:43:28 2018
@@ -53,7 +53,7 @@ public abstract class TorqueAbstractDyna
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of Role/Permission relations
      */
@@ -130,7 +130,7 @@ public abstract class TorqueAbstractDyna
     }
 
     /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#getDatabaseName()
+     * @return the database name
      */
     public String getDatabaseName()
     {

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicRole.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicRole.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicRole.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicRole.java
 Mon Nov  5 22:43:28 2018
@@ -62,7 +62,7 @@ public abstract class TorqueAbstractDyna
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of Role/Permission relations
      */
@@ -81,7 +81,7 @@ public abstract class TorqueAbstractDyna
      *
      * @param criteria Criteria to define the selection of records
      * @param con a database connection
-     * @throws TorqueException
+     * @throws TorqueException  if any database error occurs
      *
      * @return a list of Group/Role relations
      */
@@ -223,7 +223,7 @@ public abstract class TorqueAbstractDyna
     }
 
     /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#getDatabaseName()
+     * @return the database name
      */
     public String getDatabaseName()
     {

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicUser.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicUser.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicUser.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueAbstractDynamicUser.java
 Mon Nov  5 22:43:28 2018
@@ -1,4 +1,5 @@
 package org.apache.fulcrum.security.torque.dynamic;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -35,328 +36,326 @@ import org.apache.fulcrum.security.util.
 import org.apache.torque.TorqueException;
 import org.apache.torque.criteria.Criteria;
 import org.apache.torque.om.SimpleKey;
+
 /**
  * This abstract class provides the SecurityInterface to the managers.
  *
  * @author <a href="mailto:[email protected]";>Thomas Vandahl</a>
  * @version $Id:$
  */
-public abstract class TorqueAbstractDynamicUser extends 
TorqueAbstractSecurityEntity
-    implements DynamicUser
-{
-    /** Serial version */
+public abstract class TorqueAbstractDynamicUser extends 
TorqueAbstractSecurityEntity implements DynamicUser {
+       /** Serial version */
        private static final long serialVersionUID = -7307211992287876455L;
 
        /** a cache of group objects */
-    private Set<Group> groupSet = null;
+       private Set<Group> groupSet = null;
 
-    /** a cache of delegator (user) objects */
-    private Set<User> delegators = null;
+       /** a cache of delegator (user) objects */
+       private Set<User> delegators = null;
 
-    /** a cache of delegatee(user) objects */
-    private Set<User> delegatees = null;
+       /** a cache of delegatee(user) objects */
+       private Set<User> delegatees = null;
 
-    /**
-     * Forward reference to generated code
-     *
-     * Get a list of association objects, pre-populated with their 
TorqueDynamicGroup
-     * objects.
-     *
-     * @param criteria Criteria to define the selection of records
-     * @param con a database connection
-     * @throws TorqueException
-     *
-     * @return a list of User/Group relations
-     */
-    protected List<TorqueDynamicUserGroup> 
getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(Criteria criteria, Connection 
con)
-        throws TorqueException
-    {
-        criteria.and(TorqueDynamicUserGroupPeer.USER_ID, getEntityId() );
-        return 
TorqueDynamicUserGroupPeer.doSelectJoinTorqueDynamicGroup(criteria, con);
-    }
-
-    /**
-     * Forward reference to generated code
-     *
-     * Get a list of delegator association objects, pre-populated with their
-     * TorqueDynamicUserDelegates objects.
-     *
-     * @param criteria Criteria to define the selection of records
-     * @param con a database connection
-     * @throws TorqueException
-     *
-     * @return a list of User/Delegator relations
-     */
-    protected List<TorqueDynamicUserDelegates> 
getTorqueDynamicUserDelegatessRelatedByDelegateeUserIdJoinTorqueDynamicUserRelatedByDelegatorUserId(Criteria
 criteria, Connection con)
-        throws TorqueException
-    {
-        criteria.and(TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, 
getEntityId() );
-        return 
TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegatorUserId(criteria,
 con);
-    }
-
-    /**
-     * Forward reference to generated code
-     *
-     * Get a list of delegatee association objects, pre-populated with their
-     * TorqueDynamicUserDelegates objects.
-     *
-     * @param criteria Criteria to define the selection of records
-     * @param con a database connection
-     * @throws TorqueException
-     *
-     * @return a list of User/Delegator relations
-     */
-    protected List<TorqueDynamicUserDelegates> 
getTorqueDynamicUserDelegatessRelatedByDelegatorUserIdJoinTorqueDynamicUserRelatedByDelegateeUserId(Criteria
 criteria, Connection con)
-        throws TorqueException
-    {
-        criteria.and(TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, 
getEntityId() );
-        return 
TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegateeUserId(criteria,
 con);
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#addGroup(org.apache.fulcrum.security.entity.Group)
-     */
-    public void addGroup(Group group)
-    {
-        getGroups().add(group);
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#getGroups()
-     */
-    public GroupSet getGroups()
-    {
-        if (groupSet == null)
-        {
-            groupSet = new GroupSet();
-        }
-        else if(!(groupSet instanceof GroupSet))
-        {
-            groupSet = new GroupSet(groupSet);
-        }
-
-        return (GroupSet)groupSet;
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#getGroupsAsSet()
-     */
-    @SuppressWarnings("unchecked")
-       public <T extends Group> Set<T> getGroupsAsSet()
-    {
-        return (Set<T>)groupSet;
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#removeGroup(org.apache.fulcrum.security.entity.Group)
-     */
-    public void removeGroup(Group group)
-    {
-        getGroups().remove(group);
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#setGroups(org.apache.fulcrum.security.util.GroupSet)
-     */
-    public void setGroups(GroupSet groups)
-    {
-        if (groups != null)
-        {
-            this.groupSet = groups;
-        }
-        else
-        {
-            this.groupSet = new GroupSet();
-        }
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#setGroupsAsSet(java.util.Set)
-     */
-    public <T extends Group> void setGroupsAsSet(Set<T> groups)
-    {
-        setGroups(new GroupSet(groups));
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#getDelegatees()
-     */
-    @SuppressWarnings("unchecked")
-       public <T extends User> Set<T> getDelegatees()
-    {
-        if (delegatees == null)
-        {
-            delegatees = new UserSet<T>();
-        }
-
-        return (Set<T>)delegatees;
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#getDelegators()
-     */
-    @SuppressWarnings("unchecked")
-       public <T extends User> Set<T> getDelegators()
-    {
-        if (delegators == null)
-        {
-            delegators = new UserSet<T>();
-        }
-
-        return (Set<T>)delegators;
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#setDelegatees(java.util.Set)
-     */
-    public <T extends User> void setDelegatees(Set<T> delegatees)
-    {
-        if (delegatees != null)
-        {
-            this.delegatees = new UserSet<T>(delegatees);
-        }
-        else
-        {
-            this.delegatees = new UserSet<T>();
-        }
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#setDelegators(java.util.Set)
-     */
-    public <T extends User> void setDelegators(Set<T> delegates)
-    {
-        if (delegators != null)
-        {
-            this.delegators = new UserSet<T>(delegates);
-        }
-        else
-        {
-            this.delegators = new UserSet<T>();
-        }
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#getDatabaseName()
-     */
-    public String getDatabaseName()
-    {
-        return TorqueDynamicUserPeer.DATABASE_NAME;
-    }
-    
-    @Override
-    public void retrieveAttachedObjects( Connection con )
-        throws TorqueException
-    {
-        retrieveAttachedObjects( con, false );
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#retrieveAttachedObjects(Connection,
 Boolean)
-     */
-    @Override
-    public void retrieveAttachedObjects( Connection con, Boolean lazy )
-        throws TorqueException
-    {
-        this.groupSet = new GroupSet();
-
-        List<TorqueDynamicUserGroup> usergroups = 
getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(new Criteria(), con);
-
-        for (TorqueDynamicUserGroup tdug : usergroups)
-        {
-            groupSet.add(tdug.getTorqueDynamicGroup());
-        }
-
-        this.delegators = new UserSet<User>();
-
-        List<TorqueDynamicUserDelegates> delegatorlist = 
getTorqueDynamicUserDelegatessRelatedByDelegateeUserIdJoinTorqueDynamicUserRelatedByDelegatorUserId(new
 Criteria(), con);
-
-        for (TorqueDynamicUserDelegates tdud : delegatorlist)
-        {
-            
delegators.add(tdud.getTorqueDynamicUserRelatedByDelegatorUserId());
-        }
-
-        this.delegatees = new UserSet<User>();
-
-        List<TorqueDynamicUserDelegates> delegateelist = 
getTorqueDynamicUserDelegatessRelatedByDelegatorUserIdJoinTorqueDynamicUserRelatedByDelegateeUserId(new
 Criteria(), con);
-
-        for (TorqueDynamicUserDelegates tdud : delegateelist)
-        {
-            
delegatees.add(tdud.getTorqueDynamicUserRelatedByDelegateeUserId());
-        }
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#update(java.sql.Connection)
-     */
-    public void update(Connection con) throws TorqueException
-    {
-        if (groupSet != null)
-        {
-            Criteria criteria = new Criteria();
-
-            /* remove old entries */
-            criteria.where(TorqueDynamicUserGroupPeer.USER_ID, getEntityId());
-            TorqueDynamicUserGroupPeer.doDelete(criteria, con);
-
-            for (Group g : groupSet)
-            {
-                TorqueDynamicUserGroup ug = new TorqueDynamicUserGroup();
-                ug.setUserId(getEntityId());
-                ug.setGroupId((Integer)g.getId());
-                ug.save(con);
-            }
-        }
-
-        if (delegators != null)
-        {
-            Criteria criteria = new Criteria();
-
-            /* remove old entries */
-            criteria.where(TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, 
getEntityId());
-            TorqueDynamicUserDelegatesPeer.doDelete(criteria, con);
-
-            for (User u : delegators)
-            {
-                TorqueDynamicUserDelegates ud = new 
TorqueDynamicUserDelegates();
-                ud.setDelegateeUserId(getEntityId());
-                ud.setDelegatorUserId((Integer)u.getId());
-                ud.save(con);
-            }
-        }
-
-        if (delegatees != null)
-        {
-            Criteria criteria = new Criteria();
-
-            /* remove old entries */
-            criteria.where(TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, 
getEntityId());
-            TorqueDynamicUserDelegatesPeer.doDelete(criteria, con);
-
-            for (User u : delegatees)
-            {
-                TorqueDynamicUserDelegates ud = new 
TorqueDynamicUserDelegates();
-                ud.setDelegatorUserId(getEntityId());
-                ud.setDelegateeUserId((Integer)u.getId());
-                ud.save(con);
-            }
-        }
-
-        try
-        {
-            save(con);
-        }
-        catch (Exception e)
-        {
-            throw new TorqueException(e);
-        }
-    }
-
-    /**
-     * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#delete()
-     */
-    public void delete() throws TorqueException
-    {
-        TorqueDynamicUserPeer.doDelete(SimpleKey.keyFor(getEntityId()));
-    }
+       /**
+        * Forward reference to generated code
+        *
+        * Get a list of association objects, pre-populated with their
+        * TorqueDynamicGroup objects.
+        *
+        * @param criteria Criteria to define the selection of records
+        * @param con      a database connection
+        * @throws TorqueException if any database error occurs
+        *
+        * @return a list of User/Group relations
+        */
+       protected List<TorqueDynamicUserGroup> 
getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(Criteria criteria,
+                       Connection con) throws TorqueException {
+               criteria.and(TorqueDynamicUserGroupPeer.USER_ID, getEntityId());
+               return 
TorqueDynamicUserGroupPeer.doSelectJoinTorqueDynamicGroup(criteria, con);
+       }
+
+       /**
+        * Forward reference to generated code
+        *
+        * Get a list of delegator association objects, pre-populated with their
+        * TorqueDynamicUserDelegates objects.
+        *
+        * @param criteria Criteria to define the selection of records
+        * @param con      a database connection
+        * @throws TorqueException if any database error occurs
+        *
+        * @return a list of User/Delegator relations
+        */
+       protected List<TorqueDynamicUserDelegates> 
getTorqueDynamicUserDelegatessRelatedByDelegateeUserIdJoinTorqueDynamicUserRelatedByDelegatorUserId(
+                       Criteria criteria, Connection con) throws 
TorqueException {
+               criteria.and(TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, 
getEntityId());
+               return 
TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegatorUserId(criteria,
 con);
+       }
+
+       /**
+        * Forward reference to generated code
+        *
+        * Get a list of delegatee association objects, pre-populated with their
+        * TorqueDynamicUserDelegates objects.
+        *
+        * @param criteria Criteria to define the selection of records
+        * @param con      a database connection
+        * @throws TorqueException if any database error occurs
+        *
+        * @return a list of User/Delegator relations
+        */
+       protected List<TorqueDynamicUserDelegates> 
getTorqueDynamicUserDelegatessRelatedByDelegatorUserIdJoinTorqueDynamicUserRelatedByDelegateeUserId(
+                       Criteria criteria, Connection con) throws 
TorqueException {
+               criteria.and(TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, 
getEntityId());
+               return 
TorqueDynamicUserDelegatesPeer.doSelectJoinTorqueDynamicUserRelatedByDelegateeUserId(criteria,
 con);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.basic.entity.BasicUser#addGroup(org.apache.
+        * fulcrum.security.entity.Group)
+        */
+       public void addGroup(Group group) {
+               getGroups().add(group);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see 
org.apache.fulcrum.security.model.basic.entity.BasicUser#getGroups()
+        */
+       public GroupSet getGroups() {
+               if (groupSet == null) {
+                       groupSet = new GroupSet();
+               } else if (!(groupSet instanceof GroupSet)) {
+                       groupSet = new GroupSet(groupSet);
+               }
+
+               return (GroupSet) groupSet;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.basic.entity.BasicUser#getGroupsAsSet()
+        */
+       @SuppressWarnings("unchecked")
+       public <T extends Group> Set<T> getGroupsAsSet() {
+               return (Set<T>) groupSet;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.basic.entity.BasicUser#removeGroup(org.
+        * apache.fulcrum.security.entity.Group)
+        */
+       public void removeGroup(Group group) {
+               getGroups().remove(group);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.basic.entity.BasicUser#setGroups(org.apache
+        * .fulcrum.security.util.GroupSet)
+        */
+       public void setGroups(GroupSet groups) {
+               if (groups != null) {
+                       this.groupSet = groups;
+               } else {
+                       this.groupSet = new GroupSet();
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.basic.entity.BasicUser#setGroupsAsSet(java.
+        * util.Set)
+        */
+       public <T extends Group> void setGroupsAsSet(Set<T> groups) {
+               setGroups(new GroupSet(groups));
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#getDelegatees()
+        */
+       @SuppressWarnings("unchecked")
+       public <T extends User> Set<T> getDelegatees() {
+               if (delegatees == null) {
+                       delegatees = new UserSet<T>();
+               }
+
+               return (Set<T>) delegatees;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#getDelegators()
+        */
+       @SuppressWarnings("unchecked")
+       public <T extends User> Set<T> getDelegators() {
+               if (delegators == null) {
+                       delegators = new UserSet<T>();
+               }
+
+               return (Set<T>) delegators;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#setDelegatees(
+        * java.util.Set)
+        */
+       public <T extends User> void setDelegatees(Set<T> delegatees) {
+               if (delegatees != null) {
+                       this.delegatees = new UserSet<T>(delegatees);
+               } else {
+                       this.delegatees = new UserSet<T>();
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.model.dynamic.entity.DynamicUser#setDelegators(
+        * java.util.Set)
+        */
+       public <T extends User> void setDelegators(Set<T> delegates) {
+               if (delegators != null) {
+                       this.delegators = new UserSet<T>(delegates);
+               } else {
+                       this.delegators = new UserSet<T>();
+               }
+       }
+
+       /**
+        * @return the database name
+        */
+       public String getDatabaseName() {
+               return TorqueDynamicUserPeer.DATABASE_NAME;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#
+        * retrieveAttachedObjects(java.sql.Connection)
+        */
+       @Override
+       public void retrieveAttachedObjects(Connection con) throws 
TorqueException {
+               retrieveAttachedObjects(con, false);
+       }
+
+       /**
+        * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#retrieveAttachedObjects(Connection,
+        *      Boolean)
+        */
+       @Override
+       public void retrieveAttachedObjects(Connection con, Boolean lazy) 
throws TorqueException {
+               this.groupSet = new GroupSet();
+
+               List<TorqueDynamicUserGroup> usergroups = 
getTorqueDynamicUserGroupsJoinTorqueDynamicGroup(new Criteria(), con);
+
+               for (TorqueDynamicUserGroup tdug : usergroups) {
+                       groupSet.add(tdug.getTorqueDynamicGroup());
+               }
+
+               this.delegators = new UserSet<User>();
+
+               List<TorqueDynamicUserDelegates> delegatorlist = 
getTorqueDynamicUserDelegatessRelatedByDelegateeUserIdJoinTorqueDynamicUserRelatedByDelegatorUserId(
+                               new Criteria(), con);
+
+               for (TorqueDynamicUserDelegates tdud : delegatorlist) {
+                       
delegators.add(tdud.getTorqueDynamicUserRelatedByDelegatorUserId());
+               }
+
+               this.delegatees = new UserSet<User>();
+
+               List<TorqueDynamicUserDelegates> delegateelist = 
getTorqueDynamicUserDelegatessRelatedByDelegatorUserIdJoinTorqueDynamicUserRelatedByDelegateeUserId(
+                               new Criteria(), con);
+
+               for (TorqueDynamicUserDelegates tdud : delegateelist) {
+                       
delegatees.add(tdud.getTorqueDynamicUserRelatedByDelegateeUserId());
+               }
+       }
+
+       /**
+        * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#update(java.sql.Connection)
+        */
+       public void update(Connection con) throws TorqueException {
+               if (groupSet != null) {
+                       Criteria criteria = new Criteria();
+
+                       /* remove old entries */
+                       criteria.where(TorqueDynamicUserGroupPeer.USER_ID, 
getEntityId());
+                       TorqueDynamicUserGroupPeer.doDelete(criteria, con);
+
+                       for (Group g : groupSet) {
+                               TorqueDynamicUserGroup ug = new 
TorqueDynamicUserGroup();
+                               ug.setUserId(getEntityId());
+                               ug.setGroupId((Integer) g.getId());
+                               ug.save(con);
+                       }
+               }
+
+               if (delegators != null) {
+                       Criteria criteria = new Criteria();
+
+                       /* remove old entries */
+                       
criteria.where(TorqueDynamicUserDelegatesPeer.DELEGATEE_USER_ID, getEntityId());
+                       TorqueDynamicUserDelegatesPeer.doDelete(criteria, con);
+
+                       for (User u : delegators) {
+                               TorqueDynamicUserDelegates ud = new 
TorqueDynamicUserDelegates();
+                               ud.setDelegateeUserId(getEntityId());
+                               ud.setDelegatorUserId((Integer) u.getId());
+                               ud.save(con);
+                       }
+               }
+
+               if (delegatees != null) {
+                       Criteria criteria = new Criteria();
+
+                       /* remove old entries */
+                       
criteria.where(TorqueDynamicUserDelegatesPeer.DELEGATOR_USER_ID, getEntityId());
+                       TorqueDynamicUserDelegatesPeer.doDelete(criteria, con);
+
+                       for (User u : delegatees) {
+                               TorqueDynamicUserDelegates ud = new 
TorqueDynamicUserDelegates();
+                               ud.setDelegatorUserId(getEntityId());
+                               ud.setDelegateeUserId((Integer) u.getId());
+                               ud.save(con);
+                       }
+               }
+
+               try {
+                       save(con);
+               } catch (Exception e) {
+                       throw new TorqueException(e);
+               }
+       }
+
+       /**
+        * @see 
org.apache.fulcrum.security.torque.security.TorqueAbstractSecurityEntity#delete()
+        */
+       public void delete() throws TorqueException {
+               TorqueDynamicUserPeer.doDelete(SimpleKey.keyFor(getEntityId()));
+       }
 }

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicGroupManagerImpl.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicGroupManagerImpl.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicGroupManagerImpl.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicGroupManagerImpl.java
 Mon Nov  5 22:43:28 2018
@@ -36,7 +36,7 @@ import org.apache.torque.criteria.Criter
  */
 public class TorqueDynamicGroupManagerImpl extends TorqueAbstractGroupManager
 {
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractGroupManager#doSelectAllGroups(java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -47,7 +47,7 @@ public class TorqueDynamicGroupManagerIm
         return (List<T>)TorqueDynamicGroupPeer.doSelect(criteria, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractGroupManager#doSelectById(java.lang.Integer,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -56,7 +56,7 @@ public class TorqueDynamicGroupManagerIm
         return (T) TorqueDynamicGroupPeer.retrieveByPK(id, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractGroupManager#doSelectByName(java.lang.String,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicModelManagerImpl.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicModelManagerImpl.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicModelManagerImpl.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicModelManagerImpl.java
 Mon Nov  5 22:43:28 2018
@@ -1,4 +1,5 @@
 package org.apache.fulcrum.security.torque.dynamic;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -34,471 +35,413 @@ import org.apache.fulcrum.security.util.
 import org.apache.fulcrum.security.util.UnknownEntityException;
 import org.apache.torque.TorqueException;
 import org.apache.torque.util.Transaction;
+
 /**
  * This implementation persists to a database via Torque.
  *
  * @author <a href="mailto:[email protected]";>Thomas Vandahl</a>
  * @version $Id:$
  */
-public class TorqueDynamicModelManagerImpl extends AbstractDynamicModelManager 
implements DynamicModelManager
-{
-    /**
-     * Revokes a Role from a Group.
-     *
-     * @param group the Group.
-     * @param role the Role.
-     * @throws DataBackendException if there was an error accessing the data 
backend.
-     * @throws UnknownEntityException if group or role is not present.
-     */
-    @Override
-       public synchronized void revoke(Group group, Role role)
-        throws DataBackendException, UnknownEntityException
-    {
-        boolean groupExists = getGroupManager().checkExists(group);
-        boolean roleExists = getRoleManager().checkExists(role);
-
-        if (groupExists && roleExists)
-        {
-            ((DynamicGroup) group).removeRole(role);
-            ((DynamicRole) role).removeGroup(group);
-
-            Connection con = null;
-
-            try
-            {
-                con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)role).update(con);
-                ((TorqueAbstractSecurityEntity)group).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("revoke('" + group.getName() + 
"', '" + role.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!groupExists)
-        {
-            throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
-        }
-
-        if (!roleExists)
-        {
-            throw new UnknownEntityException("Unknown role '" + role.getName() 
+ "'");
-        }
-    }
-
-    /**
-     * Grants a Role a Permission
-     *
-     * @param role the Role.
-     * @param permission the Permission.
-     * @throws DataBackendException if there was an error accessing the data 
backend.
-     * @throws UnknownEntityException if role or permission is not present.
-     */
-    @Override
+public class TorqueDynamicModelManagerImpl extends AbstractDynamicModelManager 
implements DynamicModelManager {
+       
+       /**
+        * Serial ID
+        */
+       private static final long serialVersionUID = -4102444603078107928L;
+
+       /**
+        * Revokes a Role from a Group.
+        *
+        * @param group the Group.
+        * @param role  the Role.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if group or role is not present.
+        */
+       @Override
+       public synchronized void revoke(Group group, Role role) throws 
DataBackendException, UnknownEntityException {
+               boolean groupExists = getGroupManager().checkExists(group);
+               boolean roleExists = getRoleManager().checkExists(role);
+
+               if (groupExists && roleExists) {
+                       ((DynamicGroup) group).removeRole(role);
+                       ((DynamicRole) role).removeGroup(group);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
role).update(con);
+                               ((TorqueAbstractSecurityEntity) 
group).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException("revoke('" + 
group.getName() + "', '" + role.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!groupExists) {
+                       throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
+               }
+
+               if (!roleExists) {
+                       throw new UnknownEntityException("Unknown role '" + 
role.getName() + "'");
+               }
+       }
+
+       /**
+        * Grants a Role a Permission
+        *
+        * @param role       the Role.
+        * @param permission the Permission.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if role or permission is not present.
+        */
+       @Override
        public synchronized void grant(Role role, Permission permission)
-        throws DataBackendException, UnknownEntityException
-    {
-        boolean roleExists = getRoleManager().checkExists(role);
-        boolean permissionExists = 
getPermissionManager().checkExists(permission);
-
-        if (roleExists && permissionExists)
-        {
-            ((DynamicRole) role).addPermission(permission);
-            ((DynamicPermission) permission).addRole(role);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)role).update(con);
-                ((TorqueAbstractSecurityEntity)permission).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("grant('" + role.getName() + 
"', '" + permission.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!roleExists)
-        {
-            throw new UnknownEntityException("Unknown role '" + role.getName() 
+ "'");
-        }
-
-        if (!permissionExists)
-        {
-            throw new UnknownEntityException("Unknown permission '" + 
permission.getName() + "'");
-        }
-    }
-
-    /**
-     * Revokes a Permission from a Role.
-     *
-     * @param role the Role.
-     * @param permission the Permission.
-     * @throws DataBackendException if there was an error accessing the data 
backend.
-     * @throws UnknownEntityException if role or permission is not present.
-     */
-    @Override
+                       throws DataBackendException, UnknownEntityException {
+               boolean roleExists = getRoleManager().checkExists(role);
+               boolean permissionExists = 
getPermissionManager().checkExists(permission);
+
+               if (roleExists && permissionExists) {
+                       ((DynamicRole) role).addPermission(permission);
+                       ((DynamicPermission) permission).addRole(role);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
role).update(con);
+                               ((TorqueAbstractSecurityEntity) 
permission).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException("grant('" + 
role.getName() + "', '" + permission.getName() + "') failed",
+                                               e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!roleExists) {
+                       throw new UnknownEntityException("Unknown role '" + 
role.getName() + "'");
+               }
+
+               if (!permissionExists) {
+                       throw new UnknownEntityException("Unknown permission '" 
+ permission.getName() + "'");
+               }
+       }
+
+       /**
+        * Revokes a Permission from a Role.
+        *
+        * @param role       the Role.
+        * @param permission the Permission.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if role or permission is not present.
+        */
+       @Override
        public synchronized void revoke(Role role, Permission permission)
-        throws DataBackendException, UnknownEntityException
-    {
-        boolean roleExists = getRoleManager().checkExists(role);
-        boolean permissionExists = 
getPermissionManager().checkExists(permission);
-
-        if (roleExists && permissionExists)
-        {
-            ((DynamicRole) role).removePermission(permission);
-            ((DynamicPermission) permission).removeRole(role);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();;
-
-                ((TorqueAbstractSecurityEntity)role).update(con);
-                ((TorqueAbstractSecurityEntity)permission).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("revoke('" + role.getName() + 
"', '" + permission.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!roleExists)
-        {
-            throw new UnknownEntityException("Unknown role '" + role.getName() 
+ "'");
-        }
-
-        if (!permissionExists)
-        {
-            throw new UnknownEntityException("Unknown permission '" + 
permission.getName() + "'");
-        }
-    }
-
-    /**
-     * Puts a user in a group.
-     *
-     * This method is used when adding a user to a group
-     *
-     * @param user the User.
-     * @throws DataBackendException if there was an error accessing the data 
backend.
-     * @throws UnknownEntityException if the account is not present.
-     */
-    @Override
-       public synchronized void grant(User user, Group group) throws 
DataBackendException, UnknownEntityException
-    {
-        boolean groupExists = getGroupManager().checkExists(group);
-        boolean userExists = getUserManager().checkExists(user);
-
-        if (groupExists && userExists)
-        {
-            ((DynamicUser) user).addGroup(group);
-            ((DynamicGroup) group).addUser(user);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)user).update(con);
-                ((TorqueAbstractSecurityEntity)group).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("grant('" + user.getName() + 
"', '" + group.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!groupExists)
-        {
-            throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
-        }
-
-        if (!userExists)
-        {
-            throw new UnknownEntityException("Unknown user '" + user.getName() 
+ "'");
-        }
-    }
-
-    /**
-     * Removes a user in a group.
-     *
-     * This method is used when removing a user to a group
-     *
-     * @param user the User.
-     * @throws DataBackendException if there was an error accessing the data 
backend.
-     * @throws UnknownEntityException if the user or group is not present.
-     */
-    @Override
-       public synchronized void revoke(User user, Group group) throws 
DataBackendException, UnknownEntityException
-    {
-        boolean groupExists = getGroupManager().checkExists(group);
-        boolean userExists = getUserManager().checkExists(user);
-
-        if (groupExists && userExists)
-        {
-            ((DynamicUser) user).removeGroup(group);
-            ((DynamicGroup) group).removeUser(user);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)user).update(con);
-                ((TorqueAbstractSecurityEntity)group).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("revoke('" + user.getName() + 
"', '" + group.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!groupExists)
-        {
-            throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
-        }
-
-        if (!userExists)
-        {
-            throw new UnknownEntityException("Unknown user '" + user.getName() 
+ "'");
-        }
-    }
-
-    /**
-     * Grants a Group a Role
-     *
-     * @param group the Group.
-     * @param role the Role.
-     * @throws DataBackendException if there was an error accessing the data 
backend.
-     * @throws UnknownEntityException if group or role is not present.
-     */
-    @Override
-       public synchronized void grant(Group group, Role role)
-        throws DataBackendException, UnknownEntityException
-    {
-        boolean groupExists = getGroupManager().checkExists(group);
-        boolean roleExists = getRoleManager().checkExists(role);
-
-        if (groupExists && roleExists)
-        {
-            ((DynamicGroup) group).addRole(role);
-            ((DynamicRole) role).addGroup(group);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)role).update(con);
-                ((TorqueAbstractSecurityEntity)group).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("grant('" + group.getName() + 
"', '" + role.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!groupExists)
-        {
-            throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
-        }
-
-        if (!roleExists)
-        {
-            throw new UnknownEntityException("Unknown role '" + role.getName() 
+ "'");
-        }
-    }
-
-    /**
-     * Allow B to assumes A's roles, groups and permissions
-     * @param delegator A
-     * @param delegatee B
-     */
-    @Override
+                       throws DataBackendException, UnknownEntityException {
+               boolean roleExists = getRoleManager().checkExists(role);
+               boolean permissionExists = 
getPermissionManager().checkExists(permission);
+
+               if (roleExists && permissionExists) {
+                       ((DynamicRole) role).removePermission(permission);
+                       ((DynamicPermission) permission).removeRole(role);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+                               ;
+
+                               ((TorqueAbstractSecurityEntity) 
role).update(con);
+                               ((TorqueAbstractSecurityEntity) 
permission).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException(
+                                               "revoke('" + role.getName() + 
"', '" + permission.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!roleExists) {
+                       throw new UnknownEntityException("Unknown role '" + 
role.getName() + "'");
+               }
+
+               if (!permissionExists) {
+                       throw new UnknownEntityException("Unknown permission '" 
+ permission.getName() + "'");
+               }
+       }
+
+       /**
+        * Puts a user in a group.
+        *
+        * This method is used when adding a user to a group
+        *
+        * @param user  the User.
+        * @param group the Group
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if the account is not present.
+        */
+       @Override
+       public synchronized void grant(User user, Group group) throws 
DataBackendException, UnknownEntityException {
+               boolean groupExists = getGroupManager().checkExists(group);
+               boolean userExists = getUserManager().checkExists(user);
+
+               if (groupExists && userExists) {
+                       ((DynamicUser) user).addGroup(group);
+                       ((DynamicGroup) group).addUser(user);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
user).update(con);
+                               ((TorqueAbstractSecurityEntity) 
group).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException("grant('" + 
user.getName() + "', '" + group.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!groupExists) {
+                       throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
+               }
+
+               if (!userExists) {
+                       throw new UnknownEntityException("Unknown user '" + 
user.getName() + "'");
+               }
+       }
+
+       /**
+        * Removes a user in a group.
+        *
+        * This method is used when removing a user to a group
+        *
+        * @param user  the User.
+        * @param group the Group
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if the user or group is not present.
+        */
+       @Override
+       public synchronized void revoke(User user, Group group) throws 
DataBackendException, UnknownEntityException {
+               boolean groupExists = getGroupManager().checkExists(group);
+               boolean userExists = getUserManager().checkExists(user);
+
+               if (groupExists && userExists) {
+                       ((DynamicUser) user).removeGroup(group);
+                       ((DynamicGroup) group).removeUser(user);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
user).update(con);
+                               ((TorqueAbstractSecurityEntity) 
group).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException("revoke('" + 
user.getName() + "', '" + group.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!groupExists) {
+                       throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
+               }
+
+               if (!userExists) {
+                       throw new UnknownEntityException("Unknown user '" + 
user.getName() + "'");
+               }
+       }
+
+       /**
+        * Grants a Group a Role
+        *
+        * @param group the Group.
+        * @param role  the Role.
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if group or role is not present.
+        */
+       @Override
+       public synchronized void grant(Group group, Role role) throws 
DataBackendException, UnknownEntityException {
+               boolean groupExists = getGroupManager().checkExists(group);
+               boolean roleExists = getRoleManager().checkExists(role);
+
+               if (groupExists && roleExists) {
+                       ((DynamicGroup) group).addRole(role);
+                       ((DynamicRole) role).addGroup(group);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
role).update(con);
+                               ((TorqueAbstractSecurityEntity) 
group).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException("grant('" + 
group.getName() + "', '" + role.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!groupExists) {
+                       throw new UnknownEntityException("Unknown group '" + 
group.getName() + "'");
+               }
+
+               if (!roleExists) {
+                       throw new UnknownEntityException("Unknown role '" + 
role.getName() + "'");
+               }
+       }
+
+       /**
+        * Allow B to assumes A's roles, groups and permissions
+        * 
+        * @param delegator A
+        * @param delegatee B
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if delegator or delagatee is not 
present.
+        */
+       @Override
        public synchronized void addDelegate(User delegator, User delegatee)
-            throws DataBackendException, UnknownEntityException
-    {
-        boolean delegatorExists = getUserManager().checkExists(delegator);
-        boolean delegateeExists = getUserManager().checkExists(delegatee);
-
-        if (delegatorExists && delegateeExists)
-        {
-            super.addDelegate(delegator, delegatee);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)delegator).update(con);
-                ((TorqueAbstractSecurityEntity)delegatee).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("addDelegate('"
-                        + delegator.getName() + "', '"
-                        + delegatee.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!delegatorExists)
-        {
-            throw new UnknownEntityException("Unknown user '" + 
delegator.getName() + "'");
-        }
-
-        if (!delegateeExists)
-        {
-            throw new UnknownEntityException("Unknown user '" + 
delegatee.getName() + "'");
-        }
-    }
-
-    /**
-     * Stop A having B's roles, groups and permissions
-     * @param delegate A
-     * @param delegatee B
-     */
-    @Override
+                       throws DataBackendException, UnknownEntityException {
+               boolean delegatorExists = 
getUserManager().checkExists(delegator);
+               boolean delegateeExists = 
getUserManager().checkExists(delegatee);
+
+               if (delegatorExists && delegateeExists) {
+                       super.addDelegate(delegator, delegatee);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
delegator).update(con);
+                               ((TorqueAbstractSecurityEntity) 
delegatee).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException(
+                                               "addDelegate('" + 
delegator.getName() + "', '" + delegatee.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!delegatorExists) {
+                       throw new UnknownEntityException("Unknown user '" + 
delegator.getName() + "'");
+               }
+
+               if (!delegateeExists) {
+                       throw new UnknownEntityException("Unknown user '" + 
delegatee.getName() + "'");
+               }
+       }
+
+       /**
+        * Stop A having B's roles, groups and permissions
+        * 
+        * @param delegator  A
+        * @param delegatee  B
+        * 
+        * @throws DataBackendException   if there was an error accessing the 
data
+        *                                backend.
+        * @throws UnknownEntityException if delegator or delagatee is not 
present.
+        */
+       @Override
        public synchronized void removeDelegate(User delegator, User delegatee)
-            throws DataBackendException, UnknownEntityException
-    {
-        boolean delegatorExists = getUserManager().checkExists(delegator);
-        boolean delegateeExists = getUserManager().checkExists(delegatee);
-
-        if (delegatorExists && delegateeExists)
-        {
-            super.removeDelegate(delegator, delegatee);
-
-            Connection con = null;
-
-            try
-            {
-               con = Transaction.begin();
-
-                ((TorqueAbstractSecurityEntity)delegator).update(con);
-                ((TorqueAbstractSecurityEntity)delegatee).update(con);
-
-                Transaction.commit(con);
-                con = null;
-            }
-            catch (TorqueException e)
-            {
-                throw new DataBackendException("removeDelegate('"
-                        + delegator.getName() + "', '"
-                        + delegatee.getName() + "') failed", e);
-            }
-            finally
-            {
-                if (con != null)
-                {
-                    Transaction.safeRollback(con);
-                }
-            }
-
-            return;
-        }
-
-        if (!delegatorExists)
-        {
-            throw new UnknownEntityException("Unknown user '" + 
delegator.getName() + "'");
-        }
-
-        if (!delegateeExists)
-        {
-            throw new UnknownEntityException("Unknown user '" + 
delegatee.getName() + "'");
-        }
-    }
+                       throws DataBackendException, UnknownEntityException {
+               boolean delegatorExists = 
getUserManager().checkExists(delegator);
+               boolean delegateeExists = 
getUserManager().checkExists(delegatee);
+
+               if (delegatorExists && delegateeExists) {
+                       super.removeDelegate(delegator, delegatee);
+
+                       Connection con = null;
+
+                       try {
+                               con = Transaction.begin();
+
+                               ((TorqueAbstractSecurityEntity) 
delegator).update(con);
+                               ((TorqueAbstractSecurityEntity) 
delegatee).update(con);
+
+                               Transaction.commit(con);
+                               con = null;
+                       } catch (TorqueException e) {
+                               throw new DataBackendException(
+                                               "removeDelegate('" + 
delegator.getName() + "', '" + delegatee.getName() + "') failed", e);
+                       } finally {
+                               if (con != null) {
+                                       Transaction.safeRollback(con);
+                               }
+                       }
+
+                       return;
+               }
+
+               if (!delegatorExists) {
+                       throw new UnknownEntityException("Unknown user '" + 
delegator.getName() + "'");
+               }
+
+               if (!delegateeExists) {
+                       throw new UnknownEntityException("Unknown user '" + 
delegatee.getName() + "'");
+               }
+       }
 }

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicPermissionManagerImpl.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicPermissionManagerImpl.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicPermissionManagerImpl.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicPermissionManagerImpl.java
 Mon Nov  5 22:43:28 2018
@@ -37,6 +37,11 @@ import org.apache.torque.criteria.Criter
 public class TorqueDynamicPermissionManagerImpl extends 
TorqueAbstractPermissionManager
 {
     /**
+        * Serial ID
+        */
+       private static final long serialVersionUID = -4831283855331325456L;
+
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractPermissionManager#doSelectAllPermissions(java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -47,7 +52,7 @@ public class TorqueDynamicPermissionMana
         return (List<T>)TorqueDynamicPermissionPeer.doSelect(criteria, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractPermissionManager#doSelectById(java.lang.Integer,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -56,7 +61,7 @@ public class TorqueDynamicPermissionMana
         return (T) TorqueDynamicPermissionPeer.retrieveByPK(id, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractPermissionManager#doSelectByName(java.lang.String,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicRoleManagerImpl.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicRoleManagerImpl.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicRoleManagerImpl.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicRoleManagerImpl.java
 Mon Nov  5 22:43:28 2018
@@ -37,6 +37,11 @@ import org.apache.torque.criteria.Criter
 public class TorqueDynamicRoleManagerImpl extends TorqueAbstractRoleManager
 {
     /**
+        * Serial
+        */
+       private static final long serialVersionUID = 907083674412091946L;
+
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractRoleManager#doSelectAllRoles(java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -47,7 +52,7 @@ public class TorqueDynamicRoleManagerImp
         return (List<T>)TorqueDynamicRolePeer.doSelect(criteria, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractRoleManager#doSelectById(java.lang.Integer,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -56,7 +61,7 @@ public class TorqueDynamicRoleManagerImp
         return (T) TorqueDynamicRolePeer.retrieveByPK(id, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractRoleManager#doSelectByName(java.lang.String,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicUserManagerImpl.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicUserManagerImpl.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicUserManagerImpl.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/dynamic/TorqueDynamicUserManagerImpl.java
 Mon Nov  5 22:43:28 2018
@@ -41,7 +41,7 @@ public class TorqueDynamicUserManagerImp
      */
     private static final long serialVersionUID = 1L;
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractUserManager#doSelectAllUsers(java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -52,7 +52,7 @@ public class TorqueDynamicUserManagerImp
         return (List<T>)TorqueDynamicUserPeer.doSelect(criteria, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractUserManager#doSelectById(java.lang.Integer,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")
@@ -61,7 +61,7 @@ public class TorqueDynamicUserManagerImp
         return (T) TorqueDynamicUserPeer.retrieveByPK(id, con);
     }
 
-    /**
+    /* (non-Javadoc)
      * @see 
org.apache.fulcrum.security.torque.TorqueAbstractUserManager#doSelectByName(java.lang.String,
 java.sql.Connection)
      */
     @SuppressWarnings("unchecked")

Modified: 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/peer/PeerManager.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/peer/PeerManager.java?rev=1845861&r1=1845860&r2=1845861&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/peer/PeerManager.java
 (original)
+++ 
turbine/fulcrum/trunk/security/torque/src/java/org/apache/fulcrum/security/torque/peer/PeerManager.java
 Mon Nov  5 22:43:28 2018
@@ -42,12 +42,12 @@ public interface PeerManager extends Ser
     String ROLE = PeerManager.class.getName(); 
 
     /**
-     *  Expects the class name of a Torque Peer class, which could be 
instantiated. 
-     *  @see AbstractEntityManager#getPeerClassName()
+     * Expects the class name of a Torque Peer class, which could be 
instantiated. 
+     * {@link 
org.apache.fulcrum.security.spi.AbstractEntityManager#getClassName()}
      *  
      * @param peerClassName the peerClassName
-     * 
-     * @return a (cashed) peer class instance
+     * @return a cached peer class instance
+     * @throws DataBackendException data backend exception
      */
     public abstract <P extends Peer> P getPeerInstance(String peerClassName)
         throws DataBackendException;
@@ -55,11 +55,11 @@ public interface PeerManager extends Ser
     /**
      * This method is provided to get more helpful exception messages.
      * 
-     * @param peerClassName
+     * @param peerClassName the peerClassName
      * @param class1 expected class the peers should implement 
      * @param className target class, i.e. the data object class type of the 
Peer object. The data object for which the peer is provided. 
-     * @return
-     * @throws DataBackendException
+     * @return peer instance
+     * @throws DataBackendException data backend exception
      */
     public abstract <P extends Peer> P getPeerInstance( String peerClassName, 
Class<? extends Peer> class1, String className ) throws DataBackendException;
 


Reply via email to