- package oimclient;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Hashtable;
- import java.util.List;
- import java.util.Set;
- import oracle.iam.identity.rolemgmt.api.RoleCategoryManager;
- import oracle.iam.identity.rolemgmt.api.RoleManager;
- import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
- import oracle.iam.identity.rolemgmt.vo.Role;
- import oracle.iam.identity.rolemgmt.vo.RoleCategory;
- import oracle.iam.identity.rolemgmt.vo.RoleManagerResult;
- import oracle.iam.platform.OIMClient;
- import oracle.iam.platform.entitymgr.vo.SearchCriteria;
- public class CreateRoleWithCategory {
- public CreateRoleWithCategory() {
- super();
- }
- public static void main(String[] args) throws Exception {
- Hashtable env = new Hashtable();
- env.put("java.naming.provider.url", "t3://localhost:14000");
- env.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
- System.setProperty("java.security.auth.login.config","G:/Oracle/Middleware/Oracle_IDM1/server/config/authwl.conf");
- System.setProperty("APPSERVER_TYPE","wls");
- OIMClient oimClient = new OIMClient(env);
- oimClient.login("xelsysadm", "Welcome1".toCharArray());
- String roleName = "Testrole";
- String categoryName = "TestroleCat";
- RoleManager roleMgr = oimClient.getService(RoleManager.class);
- RoleCategoryManager roleCategoryMgr = oimClient.getService(RoleCategoryManager.class);
- RoleManagerResult roleResult = null;
- HashMap<String, Object> createAttributes = new HashMap<String, Object>();
- createAttributes.put(RoleManagerConstants.ROLE_NAME, roleName);
- createAttributes.put(RoleManagerConstants.ROLE_DISPLAY_NAME, roleName);
- createAttributes.put(RoleManagerConstants.ROLE_DESCRIPTION, roleName);
- createAttributes.put(RoleManagerConstants.ROLE_CATEGORY_NAME, categoryName);
- createAttributes.put(RoleManagerConstants.ROLE_CATEGORY_DESCRIPTION, categoryName + " Description");
- RoleCategory roleCategory = new RoleCategory(createAttributes);
- roleResult = roleCategoryMgr.create(roleCategory);
- Role role = new Role(createAttributes);
- roleResult = roleMgr.create(role);
- String entityId = roleResult.getEntityId();
- System.out.println("Successfully Created role with key = " + entityId);
- }
- }
Thursday, September 3, 2015
OIM 11G R2 creating Roles with roleCategory
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment