
You have imported the required interfaces and gotten the required factories.
More information: User Management Functions for Groups .
This procedure describes how to create a group programmatically in the user store. Use this procedure if you cannot use the existing user administration tools to create a group and need to customize your tools to create groups programmatically.
The following example creates a group with the name demo_group and sets the group description.
public static void createGroup(String groupName, String groupDescription) {
/*
* Note: The unique name of a group cannot exceed 200 characters.
* All other attributes have a maximum limit of 255 characters.
*/
try {
IGroup mutableGroup = groupFactory.newGroup(groupName);
// Set the description attribute of the group.
mutableGroup.setDescription(groupDescription);
// Write the changes to the user store.
mutableGroup.save();
mutableGroup.commit();
} catch (GroupAlreadyExistsException gaeex) {
// TODO: Handle GroupAlreadyExistsException.
} catch (UMException umex) {
// TODO: Handle UMException.
} catch (UMRuntimeException umrex) {
// TODO: Handle UMRuntimeException.
}
}