You have imported the required interfaces and gotten the required factories.
More information: User Management Functions for Roles .
This procedure describes how you can get a role and read an attribute of that role. Use this procedure when you need to display role data and no existing application suits your needs. Once your custom application has read the data, you must decide how to display it.
With this procedure you have read the contents of the role attributes. You must determine the best way to display this data and modify your custom application to do so.
This example gets the role, "demo_role" , reads the description, then reads the value of the attribute "myAttributeName" in the namespace "com.example" .
public static void showRole(String roleUniqueName, String nameSpace, String attributeName) { try { // Get the role by unique name. // Show basic data. // Check the attribute type and read the attribute content with the // corresponding method. if (attributeType == IPrincipal.STRING_TYPE) { // Read the content of a multi-value string attribute. } else if (attributeType == IPrincipal.BYTE_TYPE) { // Read the content of a single-value binary attribute. } else { // TODO: Handle attribute not available or does not exist. } } catch (NoSuchRoleException nsrex) { // TODO: Handle NoSuchRoleException. } catch (UMException umex) { // TODO: Handle UMException. } catch (UMRuntimeException umrex) { // TODO: Handle UMRuntimeException. } }