Removed DOCUMENT ME comments that were generated and applied source code
[utils] / security / src / main / java / org / wamblee / usermgt / UserAdministrationImpl.java
index 55793da6256c04c0f2788035947d77c0b08dbd91..6e1c24937726574d621760dd533d74dd70153bb9 100644 (file)
@@ -1,19 +1,18 @@
 /*
  * Copyright 2005 the original author or authors.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.wamblee.usermgt;
 
 import static org.wamblee.usermgt.UserMgtException.Reason.DUPLICATE_GROUP;
@@ -27,11 +26,10 @@ import java.util.Set;
 
 /**
  * Administration of users and groups.
- *
+ * 
  * @author Erik Brakkee
  */
 public class UserAdministrationImpl implements UserAdministration {
-   
     /**
      * All known users.
      */
@@ -41,23 +39,23 @@ public class UserAdministrationImpl implements UserAdministration {
      * All known groups.
      */
     private GroupSet groups;
-    
+
     /**
-     * Validator for user names. 
+     * Validator for user names.
      */
     private NameValidator userValidator;
-    
+
     /**
-     * Validator for group names. 
+     * Validator for group names.
      */
     private NameValidator groupValidator;
-    
+
     /**
      * Constructs empty user administration.
      * 
      */
-    public UserAdministrationImpl(UserSet aUsers, GroupSet aGroups, NameValidator aUserValidator, 
-              NameValidator aGroupValidator) { 
+    public UserAdministrationImpl(UserSet aUsers, GroupSet aGroups,
+        NameValidator aUserValidator, NameValidator aGroupValidator) {
         users = aUsers;
         groups = aGroups;
         userValidator = aUserValidator;
@@ -68,16 +66,18 @@ public class UserAdministrationImpl implements UserAdministration {
      * (non-Javadoc)
      * 
      * @see org.wamblee.usermgt.UserAdministration#createUser(java.lang.String,
-     *      java.lang.String)
+     * java.lang.String)
      */
     public User createUser(String aUser, String aPassword, Group aGroup)
-            throws UserMgtException {
+        throws UserMgtException {
         userValidator.validate(aUser);
         checkGroup(aGroup);
+
         User user = users.createUser(aUser, aPassword, aGroup);
+
         return new User(user);
     }
-    
+
     /*
      * (non-Javadoc)
      * 
@@ -85,18 +85,24 @@ public class UserAdministrationImpl implements UserAdministration {
      */
     public Group createGroup(String aName) throws UserMgtException {
         groupValidator.validate(aName);
+
         Group group = new Group(aName);
+
         if (groups.contains(group)) {
             throw new UserMgtException(DUPLICATE_GROUP, group);
         }
+
         groups.add(group);
+
         return new Group(group);
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#userModified(org.wamblee.usermgt.User)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#userModified(org.wamblee.usermgt
+     * .User)
      */
     public void userModified(User aUser) {
         users.userModified(aUser);
@@ -105,7 +111,9 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#groupModified(org.wamblee.usermgt.Group)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#groupModified(org.wamblee.usermgt
+     * .Group)
      */
     public void groupModified(Group aGroup) {
         groups.groupModified(aGroup);
@@ -141,7 +149,9 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#getUsers(org.wamblee.usermgt.Group)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#getUsers(org.wamblee.usermgt.Group
+     * )
      */
     public Set<User> getUsers(Group aGroup) {
         return users.list(aGroup);
@@ -159,7 +169,9 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#removeUser(org.wamblee.usermgt.User)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#removeUser(org.wamblee.usermgt
+     * .User)
      */
     public void removeUser(User aUser) throws UserMgtException {
         checkUser(aUser);
@@ -169,31 +181,39 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#removeGroup(org.wamblee.usermgt.Group)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#removeGroup(org.wamblee.usermgt
+     * .Group)
      */
     public void removeGroup(Group aGroup) throws UserMgtException {
         checkGroup(aGroup);
+
         if (getUsers(aGroup).size() > 0) {
             throw new UserMgtException(GROUP_STILL_OCCUPIED, aGroup);
         }
+
         groups.remove(aGroup);
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#renameUser(org.wamblee.usermgt.User,
-     *      java.lang.String)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#renameUser(org.wamblee.usermgt
+     * .User, java.lang.String)
      */
     public void renameUser(User aUser, String aUserName)
-            throws UserMgtException {
+        throws UserMgtException {
         checkUser(aUser);
+
         if (aUser.getName().equals(aUserName)) {
             throw new UserMgtException(TRIVIAL_RENAME, aUser);
         }
+
         if (users.find(aUserName) != null) {
             throw new UserMgtException(DUPLICATE_USER, aUser);
         }
+
         userValidator.validate(aUserName);
         // we are modifying the user so we should re-insert it into the set
         // after renaming it.
@@ -205,18 +225,22 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#renameGroup(org.wamblee.usermgt.Group,
-     *      java.lang.String)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#renameGroup(org.wamblee.usermgt
+     * .Group, java.lang.String)
      */
     public void renameGroup(Group aGroup, String aGroupName)
-            throws UserMgtException {
+        throws UserMgtException {
         checkGroup(aGroup);
+
         if (aGroup.getName().equals(aGroupName)) {
             throw new UserMgtException(TRIVIAL_RENAME, aGroup);
         }
+
         if (groups.find(aGroupName) != null) {
             throw new UserMgtException(DUPLICATE_GROUP, aGroup);
         }
+
         groupValidator.validate(aGroupName);
         // we are renaming the group so we should re-insert it into the set
         // after renaming it.
@@ -228,11 +252,12 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#addUserToGroup(org.wamblee.usermgt.User,
-     *      org.wamblee.usermgt.Group)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#addUserToGroup(org.wamblee.usermgt
+     * .User, org.wamblee.usermgt.Group)
      */
     public void addUserToGroup(User aUser, Group aGroup)
-            throws UserMgtException {
+        throws UserMgtException {
         checkUser(aUser);
         checkGroup(aGroup);
         aUser.addGroup(aGroup);
@@ -242,11 +267,12 @@ public class UserAdministrationImpl implements UserAdministration {
     /*
      * (non-Javadoc)
      * 
-     * @see org.wamblee.usermgt.UserAdministration#removeUserFromGroup(org.wamblee.usermgt.User,
-     *      org.wamblee.usermgt.Group)
+     * @see
+     * org.wamblee.usermgt.UserAdministration#removeUserFromGroup(org.wamblee
+     * .usermgt.User, org.wamblee.usermgt.Group)
      */
     public void removeUserFromGroup(User aUser, Group aGroup)
-            throws UserMgtException {
+        throws UserMgtException {
         checkUser(aUser);
         checkGroup(aGroup);
         aUser.removeGroup(aGroup);
@@ -254,7 +280,9 @@ public class UserAdministrationImpl implements UserAdministration {
     }
 
     /**
+     * 
      * @param aUser
+     * 
      * @throws UserMgtException
      */
     private void checkUser(User aUser) throws UserMgtException {
@@ -264,7 +292,9 @@ public class UserAdministrationImpl implements UserAdministration {
     }
 
     /**
+     * 
      * @param aGroup
+     * 
      * @throws UserMgtException
      */
     private void checkGroup(Group aGroup) throws UserMgtException {
@@ -272,18 +302,22 @@ public class UserAdministrationImpl implements UserAdministration {
             throw new UserMgtException(UNKNOWN_GROUP, aGroup);
         }
     }
-    
-    /* (non-Javadoc)
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.wamblee.usermgt.UserAdministration#getUserCount()
      */
     public int getUserCount() {
-        return users.size(); 
+        return users.size();
     }
-    
-    /* (non-Javadoc)
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.wamblee.usermgt.UserAdministration#getGroupCount()
      */
     public int getGroupCount() {
-        return groups.size(); 
+        return groups.size();
     }
 }