* 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;
import static org.wamblee.usermgt.UserMgtException.Reason.UNKNOWN_GROUP;
import static org.wamblee.usermgt.UserMgtException.Reason.UNKNOWN_USER;
+import java.util.HashSet;
import java.util.Set;
/**
* @see org.wamblee.usermgt.UserAdministration#getUser(java.lang.String)
*/
public User getUser(String aName) {
- return users.find(aName);
+ User user = users.find(aName);
+ if (user == null) {
+ return user;
+ }
+ return new User(user);
}
/*
* @see org.wamblee.usermgt.UserAdministration#getGroup(java.lang.String)
*/
public Group getGroup(String aName) {
- return groups.find(aName);
+ Group group = groups.find(aName);
+ if ( group == null ) {
+ return group;
+ }
+ return new Group(group);
}
/*
* @see org.wamblee.usermgt.UserAdministration#getUsers()
*/
public Set<User> getUsers() {
- return users.list();
+ Set<User> res = new HashSet<User>();
+ for (User user: users.list()) {
+ res.add(new User(user));
+ }
+ return res;
}
/*
* )
*/
public Set<User> getUsers(Group aGroup) {
- return users.list(aGroup);
+ Set<User> res = new HashSet<User>();
+ for (User user: users.list(aGroup)) {
+ res.add(new User(user));
+ }
+ return res;
}
/*
* @see org.wamblee.usermgt.UserAdministration#getGroups()
*/
public Set<Group> getGroups() {
- return groups.list();
+ Set<Group> res = new HashSet<Group>();
+ for (Group group: groups.list()) {
+ res.add(new Group(group));
+ }
+ return res;
}
/*
}
userValidator.validate(aUserName);
-
+
aUser.setName(aUserName);
users.userModified(aUser);
}
}
groupValidator.validate(aGroupName);
-
+
aGroup.setName(aGroupName);
groups.groupModified(aGroup);
}