package com.users; import java.util.HashMap; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import com.connection.Platform; import oracle.iam.identity.exception.UserAlreadyExistsException; import oracle.iam.identity.exception.UserCreateException; import oracle.iam.identity.exception.ValidationFailedException; import oracle.iam.identity.usermgmt.api.UserManager; import oracle.iam.identity.usermgmt.vo.User; import oracle.iam.identity.usermgmt.vo.UserManagerResult; import oracle.iam.identity.utils.Constants; import oracle.iam.platform.authz.exception.AccessDeniedException; public class CreateUsersMultiThread { public static void main(String args[]){ BlockingQueue<Runnable> bQueue = new LinkedBlockingQueue<>(); ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 10, 0, TimeUnit.SECONDS, bQueue); for(int i=0;i<100;i++){ final String userLogin ="TUSER"+i; Runnable r = new CreateUsers(userLogin); executor.execute(r); } executor.shutdown(); } static class CreateUsers implements Runnable{ private String userLogin=""; public CreateUsers(String userLogin){ this.userLogin=userLogin; } public void run(){ UserManager userManager = Platform.getService(UserManager.class); HashMap<String, Object> createAttributes=null; createAttributes = new HashMap<String, Object>(); // create users //int i =16;//getRandomNumber(); createAttributes.put(Constants.USERID, userLogin); createAttributes.put(Constants.FIRSTNAME, "First_" + userLogin); createAttributes.put(Constants.LASTNAME, "Last_" + userLogin); //createAttributes.put(Constants.ORGKEY, Long.parseLong(createOrganizations.createorg())); createAttributes.put(Constants.ORGKEY, 1L); createAttributes.put(Constants.PASSWORD, "Welcome1"); createAttributes.put(Constants.EMAIL, "EMAIL_" + userLogin+ "@oracle.com"); createAttributes.put(Constants.EMPTYPE, "Full-Time"); createAttributes.put(Constants.USERTYPE,"End-User Administrator"); //createAttributes.put(Constants.AUTOMATICALLY_DELETED_ON,new Date(2014,6,11)); System.out.println(" ID -> "+userLogin); UserManagerResult result; try { result = userManager.create(new User(null,createAttributes)); System.out.println("getEntityId user."+result.getEntityId()); System.out.println("Status user."+result.getStatus()); } catch (ValidationFailedException | UserAlreadyExistsException | UserCreateException | AccessDeniedException e) { // TODO Auto-generated catch block e.printStackTrace(); } //System.out.println("getSucceededResults user."+result.getSucceededResults()); //ResetPasswordAsXelysyadmin.resetPassword(result.getEntityId()); } } }
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 Create Users in Multi Threaded Code
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