You have imported the required interfaces and gotten the required factories.
More information: User Management Functions for Groups .
This procedure describes how to assign a user to a group programmatically. Use this procedure if you cannot use the existing user administration tools to perform group assignment and need to customize your tools to assign groups programmatically.
This example gets the user demo_user and the group demo_group. It then checks if demo_user is already directly assigned to demo_group. If not the method assigns the user to the group.
public static void modifyGroup_setAssignment(String groupUniqueName, String logonID){ try { // Get the user "demo_user" and the group "demo_group". // Check if the user is already assigned directly to the group. //Get a modifiable group object from the UME. // Make the user a direct member of the group. /* * Write the changes to the database. * Note: If the user was already added to this group on another cluster node * while between the check in the 'if' statement and now, an * AttributeValueAlreadyExistsException occurs. */ } } catch (NoSuchUserException nsuex) { // TODO: Handle NoSuchUserException. } catch (NoSuchUserAccountException nsuaex) { // TODO: Handle NoSuchUserAccountException. } catch (NoSuchGroupException nsgex) { // TODO: Handle NoSuchGroupException. } catch (AttributeValueAlreadyExistsException avaeex) { // TODO: Handle AttributeValueAlreadyExistsException. } catch (UMException umex) { // TODO: Handle UMException. } catch (UMRuntimeException umrex) { // TODO: Handle UMRuntimeException. } }