- import java.util.HashMap;
- import java.util.Hashtable;
- import java.util.List;
- import oracle.iam.platform.OIMClient;
- import oracle.iam.platform.authopss.vo.AdminRole;
- import oracle.iam.platform.entitymgr.vo.SearchCriteria;
- import oracle.iam.platformservice.api.AdminRoleService;
- import oracle.iam.reconciliation.api.ReconOperationsService;
- public class SearchCriteriaTest {
- private final static String serverURL = "t3://localshot:14000";
- private final static String username = "xelsysadm";
- private final static char[] password = "Welcome1".toCharArray();
- private static Hashtable<String, String> env;
- private static ReconOperationsService srv1;
- public static void main(String[] args) {
- String ctxFactory = "weblogic.jndi.WLInitialContextFactory";
- System.setProperty("OIM.AppServerType", "wls");
- System.setProperty("APPSERVER_TYPE", "wls");
- System.setProperty("java.security.auth.login.config", "conf/authwl.conf");
- env = new Hashtable<String, String>();
- env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, ctxFactory);
- env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, serverURL);
- try {
- OIMClient oimClient = new OIMClient(env);
- oimClient.login(username, password);
- AdminRoleService aRoleServ= oimClient.getService(AdminRoleService.class);
- SearchCriteria criteria1 =
- new SearchCriteria("role_display_name", "OrclOIMApplicationInstanceAdministratorRole", SearchCriteria.Operator.EQUAL);
- SearchCriteria criteria2 = new SearchCriteria("scoped", "0", SearchCriteria.Operator.EQUAL);
- SearchCriteria criteriaFinal1 = new SearchCriteria(criteria1, criteria2, SearchCriteria.Operator.OR);
- SearchCriteria criteriaFinal2 = new SearchCriteria(criteria2, criteria1, SearchCriteria.Operator.OR);
- try {
- System.out.println("========== First query ==========");
- searchRolesPerCriteria(aRoleServ, null, criteriaFinal1);
- System.out.println("========== Second query ==========");
- searchRolesPerCriteria(aRoleServ, null, criteriaFinal2);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- private static void searchRolesPerCriteria(AdminRoleService aRoleServ, HashMap<String, Object> configParams,
- SearchCriteria criteriaFinal1) throws Exception {
- List<AdminRole> adminRoleList = aRoleServ.search(criteriaFinal1, configParams);
- System.out.println("Using Search: List Size [" + adminRoleList.size() + "]");
- for (AdminRole ar : adminRoleList) {
- System.out.print("Role Id : [" + ar.getRoleId() + "]\t");
- System.out.println("Role Name : [" + ar.getRoleName() + "]");
- }
- }
- }
Oracle Identity Manager(OIM) is the Provisioning Solution from oracle. This page contains an index with references to all OIM related posts in the oracle identity manager Academy blog. The posts included herein are intended to provide oracle identity management customers and developers with technical information about best practices for implementing OIM based solutions.
Search Admin Roles Using Search Criteria
Subscribe to:
Post Comments (Atom)
-
Connection Related API's : OIM DB Connection/ Data Source connection OIMClient API / OIMConnection API OIM Platform API to getSer...
-
Error : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframewor...
-
In this post, we set the middle name as “MiddleName” if user does not provide middle name during user create operation. Below are high...
No comments:
Post a Comment