public GroupVO createGroup() throws SecurityException,
UserException
{
GroupVO group = new GroupVO(); group.setName("UserGroupExample");
group.setDescription(getMessage("user.group.description"));
GroupUserVO groupUser = new GroupUserVO();
groupUser.setUserObject
(createSimpleUser("ssmith","Sam","Smith"));
group.addGroupUserOfGroup(groupUser);
groupUser = new GroupUserVO();
groupUser.setUserObject
(createSimpleUser("jdowning","Jane","Downing"));
group.addGroupUserOfGroup(groupUser);
groupUser = new GroupUserVO(); groupUser.setUserObject(createSimpleUser
("mjones","Mary","Jones"));
group.addGroupUserOfGroup(groupUser);
groupUser = new GroupUserVO();
groupUser.setUserObject(createSimpleUser
("tedwards","Tim","Edwards"));
group.addGroupUserOfGroup(groupUser);
return administrationFacade_.createGroup
(this.getSessionProfile(),group);
}
public UserVO createSimpleUser(String login, String firstName,
String lastName) throws SecurityException, UserException
{
// create a new user data value object
UserVO user = new UserVO();
user.setLogin(login);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setDescription(getMessage("user.group.description"));
// default password to login name
String password = login;
String encryptedPassword =
CryptoHelper.encryptString(password);
user.setPswd(encryptedPassword);
// call the API to create the user
UserVO createdUser = administrationFacade_.createUser
(this.getSessionProfile(), user, password);
// now update
return createdUser;
}