package com.NeedEvaluate; import java.lang.annotation.AnnotationTypeMismatchException; import java.util.HashMap; import java.util.Hashtable; import java.util.List; import javax.faces.validator.ValidatorException; import javax.management.RuntimeErrorException; import javax.security.auth.login.LoginException; import oracle.iam.identity.exception.NoSuchUserException; import oracle.iam.identity.exception.UserLookupException; import oracle.iam.identity.exception.UserSearchException; import oracle.iam.platform.OIMClient; import oracle.iam.platform.entitymgr.vo.SearchCriteria; import oracle.iam.provisioning.api.ProvisioningConstants; import oracle.iam.provisioning.api.ProvisioningService; import oracle.iam.provisioning.exception.ApplicationInstanceNotFoundException; import oracle.iam.provisioning.exception.GenericAppInstanceServiceException; import oracle.iam.provisioning.exception.GenericProvisioningException; import oracle.iam.provisioning.exception.UserNotFoundException; import oracle.iam.provisioning.vo.Account; import Thor.API.tcResultSet; import Thor.API.Operations.tcLookupOperationsIntf; import Thor.API.Operations.tcUserOperationsIntf; import Thor.API.Security.XLClientSecurityAssociation; public class GetAccountListsFromLoggedInUser { public GetAccountListsFromLoggedInUser() { super(); } public static void main(String[] args) throws Exception, AnnotationTypeMismatchException { System.out.println("In Main Method ....!!!!!"); GetAccountList(); } public static boolean GetAccountList() throws GenericProvisioningException, UserSearchException, UserNotFoundException, RuntimeErrorException, NullPointerException, LoginException, GenericAppInstanceServiceException, ApplicationInstanceNotFoundException, ClassNotFoundException, NoSuchUserException, UserLookupException, ValidatorException { String ctxFactory = "weblogic.jndi.WLInitialContextFactory"; System.setProperty("APPSERVER_TYPE", "wls"); Hashtable env = new Hashtable(); env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, ctxFactory); env.put(OIMClient.APPSERVER_TYPE_WEBLOGIC,"wls"); //Establishing OIM Client OIMClient oimClient =new OIMClient(env); try{ XLClientSecurityAssociation.setClientHandle(oimClient); }catch(Exception e) { System.out.println(e); } String descriptionArray[] = new String[50]; Long accountIdArray[] = new Long[50]; int z3 =0; try { boolean isAccountExist = false; ProvisioningService proSer = oimClient.getService(ProvisioningService.class); tcUserOperationsIntf userOps = oimClient.getService(tcUserOperationsIntf.class); tcResultSet rs = userOps.getSelfProfile(); String usrKey = rs.getStringValue("Users.Key"); String userLogin = rs.getStringValue("Users.User ID"); SearchCriteria provisionedCriterion = new SearchCriteria(ProvisioningConstants.AccountSearchAttribute.ACCOUNT_STATUS.getId(), ProvisioningConstants.ObjectStatus.PROVISIONED.getId(), SearchCriteria.Operator.EQUAL); System.out.println("User Logged In::"+userLogin+"::usrKey::"+usrKey); List<Account> provInstList = proSer.getAccountsProvisionedToUser(usrKey, provisionedCriterion, new HashMap<String,Object>(), true); System.out.println("Prov List::"+provInstList.toString()); // used to print the Accounts provisioned list tcLookupOperationsIntf lookupIntf = oimClient.getService(tcLookupOperationsIntf.class); tcResultSet lookupVal = lookupIntf.getLookupValues("Lookup.OID.Accounts"); for(Account ac : provInstList){ String accountID = ac.getAccountID(); System.out.println("Account ID::"+accountID); long accountId = Long.parseLong(accountID); String description= ac.getAppInstance().getDescription(); System.out.println("Account ID::"+accountID); for(int i=0;i<lookupVal.getRowCount();i++){ lookupVal.goToRow(i); if(lookupVal.getStringValue("Lookup Definition.Lookup Code Information.Code Key").equalsIgnoreCase(description)){ descriptionArray[z3] = description; accountIdArray[z3] = accountId; isAccountExist = true; z3++; } } } for(int x1 =0; descriptionArray[x1]!=null| accountIdArray[x1]!=null; x1++){ System.out.println(descriptionArray[x1]); System.out.println(accountIdArray[x1]); } return isAccountExist; } catch (Exception e) { System.out.println(e); return false; } } }
Oracle Identity Manager (OIM R2PS2/PS3/12C) is a highly flexible and scalable enterprise identity administration system that provides operational and business efficiency by providing centralized administration & complete automation of identity and user provisioning events across enterprise as well as extranet applications.
OIM API To Get Accounts List From Logged In User
Subscribe to:
Posts (Atom)
About OIM
Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...
Popular Posts
-
OIM API's Sample Code : Videos: Massive Gaze Videos Connection Related API's : OIM DB Connection/ Data Source connection ...
-
Videos: Massive Gaze Videos 1. Basic OIM Information 2. MDS Export/Import 3. Steps For R2PS2 / R2PS3 Custom Pre-processor Ev...
-
Videos: Massive Gaze Videos 1. Query to get OIM Provsioned/provisioning Account details 2. Query to get usr keys For Rejected / ...
No comments:
Post a Comment