You have imported the required interfaces and gotten the required factories.
More information: User Management Functions for Roles .
This procedure describes how to create a role programmatically in the user store. Use this procedure if you cannot use the existing user administration tools to create a role and need to customize your tools to create roles programmatically.
This example create a role with the name "demo_role" and sets the description attribute to "This role is for demo purposes." .
public static void createRole(String roleName, String roleDescription) { /* * Note: The unique name of a role cannot exceed 200 characters. * All other attributes have a maximum limit of 255 characters. */ try { // Set the description attribute of the role. // Write the changes to the user store. } catch (RoleAlreadyExistsException raeex) { // TODO: Handle RoleAlreadyExistsException. } catch (UMException umex) { // TODO: Handle UMException. } catch (UMRuntimeException umrex) { // TODO: Handle UMRuntimeException. } }