Thursday, September 3, 2015

OIM 11G R2 Searching roleCategory


  1. package oimclient;

  2. import java.util.HashSet;
  3. import java.util.Hashtable;
  4. import java.util.List;
  5. import java.util.Set;

  6. import oracle.iam.identity.rolemgmt.api.RoleCategoryManager;
  7. import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
  8. import oracle.iam.identity.rolemgmt.vo.RoleCategory;
  9. import oracle.iam.platform.OIMClient;
  10. import oracle.iam.platform.entitymgr.vo.SearchCriteria;


  11. public class SearchRoleCategory {
  12.     public static void main(String[] args) throws Exception {
  13.         Hashtable env = new Hashtable();
  14.         env.put("java.naming.provider.url", "t3://localhost:14000");
  15.         env.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
  16.         System.setProperty("java.security.auth.login.config","G:/Oracle/Middleware/Oracle_IDM1/server/config/authwl.conf");
  17.         System.setProperty("APPSERVER_TYPE","wls");

  18.         OIMClient oimClient = new OIMClient(env);
  19.         oimClient.login("xelsysadm", "Welcome1".toCharArray());
  20.         RoleCategoryManager roleCategoryMgr = oimClient.getService(RoleCategoryManager.class);

  21.         SearchCriteria criteria = new SearchCriteria(RoleManagerConstants.ROLE_CATEGORY_NAME, "OIM",
  22.                                     SearchCriteria.Operator.BEGINS_WITH);
  23.         Set retSet = new HashSet();
  24.         retSet.add(RoleManagerConstants.ROLE_CATEGORY_DESCRIPTION);
  25.         retSet.add(RoleManagerConstants.ROLE_CATEGORY_NAME);                    

  26.                     List<RoleCategory> categories = roleCategoryMgr.search(criteria, retSet, null);

  27.                     for (RoleCategory roleCat : categories) {

  28.                     System.out.println( "The role name is "+roleCat.getName() + " & description is " + roleCat.getDescription());
  29.                     }
  30.     }
  31. }


No comments:

Post a Comment

Other Posts