Error Got in Logs while provisioning
11/07/20 12:03:54 Running InitUtil
11/07/20 12:03:54 Running CreateUser
ERROR,20 Jul 2011 12:03:54,913,[OIMCP.EBSUM],================= Start Stack Trace =======================
ERROR,20 Jul 2011 12:03:54,913,[OIMCP.EBSUM],oracle.iam.connectors.ebs.usermgmt.integration.EBSUserManagementHelper : createEBSUser
ERROR,20 Jul 2011 12:03:54,913,[OIMCP.EBSUM],Exception Occured
ERROR,20 Jul 2011 12:03:54,913,[OIMCP.EBSUM],Description : ORA-20001: APP-FND-02600: Unable to create user 66696 due to the following reason(s):
Unabled to call fnd_ldap_wrapper.create_user due to the following reason:
ORA-20001: Unabled to call fnd_ldap_wrapper.create_user due to the following reason:
An unexpected error occurred. Please contact your System Administrator. (USER_NAME=66696). (USER_NAME=66696).
ORA-06512: at "APPS.APP_EXCEPTION", line 72
ORA-06512: at "APPS.FND_USER_PKG", line 780
ORA-06512: at "APPS.FND_USER_PKG", line 913
ORA-06512: at "APPS.FND_USER_PKG", line 1032
ORA-06512: at line 1
ERROR,20 Jul 2011 12:03:54,913,[OIMCP.EBSUM],java.sql.SQLException: ORA-20001: APP-FND-02600: Unable to create user 66696 due to the following reason(s):
Unabled to call fnd_ldap_wrapper.create_user due to the following reason:
ORA-20001: Unabled to call fnd_ldap_wrapper.create_user due to the following reason:
An unexpected error occurred. Please contact your System Administrator. (USER_NAME=66693236). (USER_NAME=66693236).
ORA-06512: at "APPS.APP_EXCEPTION", line 72
ORA-06512: at "APPS.FND_USER_PKG", line 780
ORA-06512: at "APPS.FND_USER_PKG", line 913
ORA-06512: at "APPS.FND_USER_PKG", line 1032
ORA-06512: at line 1
Solution:
1.Check for the user if it is already exists in OID(since it is doing some kind of authentication while creating the user in OF)
2.This error normally happens if the user is already available i the LDAP cn=OracleContext.
cn=ACCOUNTS,cn=subscription_data,cn=subscriptions,orclApplicationCommonName=IDMIDM,cn=EBusiness,cn=Products,cn=OracleContext,dc=test,dc=com,dc=in.
3.So deleted the entries related to the user and recreated the user again.
I am expertise in OIM-User Provisioning.I have experience in both 10G and 11G versions.This Blog helps you in understanding the concepts releated to OIM-UserProvisioning.I mainly tried covering the usage of OIM OOTB connectors,custom connectors,custom adaptors and also the customized usage of OIM API.
Wednesday, 20 July 2011
Tuesday, 12 July 2011
Code to Get the value of lookups by providing lookup name
public String getLookupVals(String lookupName)
{
HashMap lookup = new HashMap();
try {
tcResultSet tcresultSet = molookup.getLookupValues(lookupName);
for (int i=0; i < ((tcResultSet) tcresultSet).getRowCount(); i++){
((tcResultSet) tcresultSet).goToRow(i);
String code = tcresultSet.getStringValue("Lookup Definition.Lookup Code Information.Code Key");
tring decode = tcresultSet.getStringValue("Lookup Definition.Lookup Code Information.Decode");
System.out.println("Key : "+ decode+"\tValue :"+code); }
System.out.println("End of loop");
} catch (tcAPIException e) {
e.printStackTrace();
} catch (tcInvalidLookupException e) {
e.printStackTrace();
} catch (tcColumnNotFoundException e) {
e.printStackTrace();
}
return("Success");
}
{
HashMap
try {
tcResultSet tcresultSet = molookup.getLookupValues(lookupName);
for (int i=0; i < ((tcResultSet) tcresultSet).getRowCount(); i++){
((tcResultSet) tcresultSet).goToRow(i);
String code = tcresultSet.getStringValue("Lookup Definition.Lookup Code Information.Code Key");
tring decode = tcresultSet.getStringValue("Lookup Definition.Lookup Code Information.Decode");
System.out.println("Key : "+ decode+"\tValue :"+code); }
System.out.println("End of loop");
} catch (tcAPIException e) {
e.printStackTrace();
} catch (tcInvalidLookupException e) {
e.printStackTrace();
} catch (tcColumnNotFoundException e) {
e.printStackTrace();
}
return("Success");
}
Monday, 11 July 2011
General Utility factory in OIM for coding
private tcLookupOperationsIntf molookup;
public tcUtilityFactory ioUtilityFactory;
public tcUserOperationsIntf moUserUtility;
public tcGroupOperationsIntf moGroupUtility;
Utility
********
ioUtilityFactory = new tcUtilityFactory(env,usr,pass);
User utility
************
moUserUtility =(tcUserOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
Group Utility
**************
moGroupUtility = (tcGroupOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcGroupOperationsIntf");
Lookup Utility
**************
molookup=(tcLookupOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcLookupOperationsIntf");
public tcUtilityFactory ioUtilityFactory;
public tcUserOperationsIntf moUserUtility;
public tcGroupOperationsIntf moGroupUtility;
Utility
********
ioUtilityFactory = new tcUtilityFactory(env,usr,pass);
User utility
************
moUserUtility =(tcUserOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
Group Utility
**************
moGroupUtility = (tcGroupOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcGroupOperationsIntf");
Lookup Utility
**************
molookup=(tcLookupOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcLookupOperationsIntf");
Wednesday, 6 July 2011
code to Read an Excel sheet and updating in OIM(Bult data or bulk upload)
1.Code here below updates the password for the no of users in the excel sheet.
2.Inputs required are userid and password.
3.Code reads the attributes from the excel sheet and establishes connection with the oin and pass the values to the updatePassword method.
4.upadtes the password for all the OIM users as in the excel sheet
Code
*****
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import jxl.Cell;
import jxl.DateCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;
import com.thortech.xl.util.config.ConfigurationClient;
import Thor.API.tcResultSet;
import Thor.API.tcUtilityFactory;
import Thor.API.Exceptions.tcAPIException;
import Thor.API.Exceptions.tcChallengeNotSetException;
import Thor.API.Exceptions.tcLoginAttemptsExceededException;
import Thor.API.Exceptions.tcPasswordExpiredException;
import Thor.API.Exceptions.tcPasswordResetAttemptsExceededException;
import Thor.API.Exceptions.tcUserAccountDisabledException;
import Thor.API.Exceptions.tcUserAccountInvalidException;
import Thor.API.Exceptions.tcUserAlreadyLoggedInException;
import Thor.API.Operations.tcGroupOperationsIntf;
import Thor.API.Operations.tcUserOperationsIntf;
public class Blog {
static ReadProperty readProperty = new ReadProperty();
public long returnVal = -1;
public static String homeDir = readProperty.getProp("homeDir");
public static String policyDir = readProperty.getProp("policyDir");
public static String confDir = readProperty.getProp("confDir");
public static String username = readProperty.getProp("username");
public static String password = readProperty.getProp("password");
public static String providerUrl = readProperty.getProp("providerUrl");
public tcUtilityFactory ioUtilityFactory;
public tcUserOperationsIntf moUserUtility;
public tcGroupOperationsIntf moGroupUtility;
FileLogger fL;
public Blog(){
fL = new FileLogger();
fL.setLogFile("D:\\readerLog.txt");
}
public void writeFile(String text)
{
try{
// Create file
FileWriter fstream = new FileWriter("D:\\OfficeCode.txt",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(text);
out.newLine();
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
public String roleAuthenticate(String usr, String pass){
try {
System.setProperty("XL.HomeDir", homeDir);
System.setProperty("java.security.policy", policyDir);//server or client
System.setProperty("java.security.auth.login.config", confDir);//server or client
System.setProperty("java.naming.provider.url", providerUrl);
ConfigurationClient.ComplexSetting config =
ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
Hashtable env = config.getAllSettings();
System.out.println("test1");
System.out.println("Getting Information before login..");
this.writeFile("Getting Information before login..");
tcUtilityFactory ioUtilityFactory = new tcUtilityFactory(env,usr,pass);
System.out.println("Getting utility interfaces...");
System.out.println("Connection Established");
this.writeFile("Getting utility interfaces...\nConnection Established");
moUserUtility = (tcUserOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
moGroupUtility = (tcGroupOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcGroupOperationsIntf");
Logger logger = oracle.j2ee.rmi.RMIMessages.getLogger();
logger.setLevel(Level.OFF);
return "Valid";
} catch(Exception e){
e.printStackTrace();
return "Invalid";
}
}
public long getUserKey(String obj){
long key = 0;
HashMap userMap = new HashMap();
try {
//ConnectionEstablish cT = new ConnectionEstablish();
System.out.println("In getUserKey method, uid is :"+obj);
this.writeFile("In getUserKey method, uid is :"+obj);
userMap.put("Users.User ID", obj);
System.out.println("userMap contents: "+userMap.keySet()+userMap.values());
this.writeFile("userMap contents: "+userMap.keySet()+userMap.values());
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
System.out.println("MoResult set count is :"+moResultSet.getRowCount());
this.writeFile("MoResult set count is :"+moResultSet.getRowCount());
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Users.Key"); System.out.println("In getUserKey method, key is :"+key); } }catch(Exception e){ System.out.println("Error in getting user key" + e); e.printStackTrace(); } return key; } public long getGroupKey(String obj){ long key = 0; HashMap userMap = new HashMap();
try {
userMap.put("Groups.Group Name", obj);
tcResultSet moResultSet = moGroupUtility.findGroups(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Groups.Key"); } }catch(Exception e){ e.printStackTrace(); } return key; } public void UpdateUserPassword( String UID,String pwd) throws tcAPIException, tcChallengeNotSetException, tcLoginAttemptsExceededException, tcPasswordResetAttemptsExceededException, tcPasswordExpiredException, tcUserAccountDisabledException, tcUserAccountInvalidException, tcUserAlreadyLoggedInException { this.roleAuthenticate("xelsysadm","admin123"); HashMap userMap = new HashMap();
HashMap hmUser = new HashMap();
try {
userMap.put("Users.User ID", UID);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
hmUser.put("Users.User ID", UID);
hmUser.put("Users.Password", pwd);
moUserUtility.updateUser(moResultSet, hmUser);
System.out.println("Updated password");
} catch (Exception e) {
System.out.println("Exception in OIM server while updating password for user <===" + UID +"===>");
e.printStackTrace();
}
}
public void init(String filePath)
{
System.out.println("Opening file...........\n");
FileInputStream fs = null;
try
{
fs = new FileInputStream(new File(filePath));
readContent(fs);
}
catch (IOException e)
{
e.printStackTrace();
} catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
fs.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void updatePassword(Sheet sheet) throws tcAPIException, tcChallengeNotSetException, tcLoginAttemptsExceededException, tcPasswordResetAttemptsExceededException, tcUserAccountDisabledException, tcPasswordExpiredException, tcUserAlreadyLoggedInException, tcUserAccountInvalidException{
HashMap userMap = new HashMap();
//HashMap hmUser = new HashMap();
int columnCount = sheet.getColumns();
int rowCount = sheet.getRows();
String userID = null;
String password = null;
for(int j=1;j < rowCount; j++) { userID = sheet.getCell(0, j).getContents(); password = sheet.getCell(1, j).getContents(); System.out.println("For UserIDs User ID :"+userID); userMap.put("Users.User ID", userID); System.out.println("User Map values "+userMap.values()); this.roleAuthenticate("xelsysadm","admin123"); this.UpdateUserPassword(userID, password); System.out.println("\n\nupdated Password "+password+"for user: "+userID+"..............\n"); } } public void readContent(InputStream fileInputStream) throws tcAPIException, tcChallengeNotSetException, tcLoginAttemptsExceededException, tcPasswordResetAttemptsExceededException, tcUserAccountDisabledException, tcPasswordExpiredException, tcUserAlreadyLoggedInException, tcUserAccountInvalidException { WorkbookSettings ws = null; Workbook workbook = null; Sheet s = null; Cell rowData[] = null; int rowCount = '0'; int columnCount = '0'; DateCell dc = null; int totalSheet = 0; ArrayList al=new ArrayList(); ArrayList all=new ArrayList(); try { ws = new WorkbookSettings(); ws.setLocale(new Locale("en", "EN")); workbook = Workbook.getWorkbook(fileInputStream, ws); totalSheet = workbook.getNumberOfSheets(); if(totalSheet > 0)
{
System.out.println("Reading file contents............\n");
System.out.println("Total Sheet Found:" + totalSheet);
for(int j=0;j
{
System.out.println("Sheet Name:" + workbook.getSheet(j).getName());
}
}
//Getting Default Sheet i.e. 0
s = workbook.getSheet(0);
//Reading Individual Cell
// getHeadingFromXlsFile(s);
//Total Total No Of Rows in Sheet, will return you no of rows that are occupied with some data
System.out.println("Total Rows inside Sheet:" + s.getRows());
rowCount = s.getRows();
//Total Total No Of Columns in Sheet
System.out.println("Total Column inside Sheet:" + s.getColumns());
columnCount = s.getColumns();
updatePassword(s);
}
catch (IOException e)
{
e.printStackTrace();
} catch (BiffException e)
{
e.printStackTrace();
}
}
public static void main(String[] args){
try
{
Blog blog = new Blog();
blog.init("D:\\Book2.xls");
System.exit(0);
} catch (Exception e)
{
e.printStackTrace();
}
}
}
2.Inputs required are userid and password.
3.Code reads the attributes from the excel sheet and establishes connection with the oin and pass the values to the updatePassword method.
4.upadtes the password for all the OIM users as in the excel sheet
Code
*****
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import jxl.Cell;
import jxl.DateCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;
import com.thortech.xl.util.config.ConfigurationClient;
import Thor.API.tcResultSet;
import Thor.API.tcUtilityFactory;
import Thor.API.Exceptions.tcAPIException;
import Thor.API.Exceptions.tcChallengeNotSetException;
import Thor.API.Exceptions.tcLoginAttemptsExceededException;
import Thor.API.Exceptions.tcPasswordExpiredException;
import Thor.API.Exceptions.tcPasswordResetAttemptsExceededException;
import Thor.API.Exceptions.tcUserAccountDisabledException;
import Thor.API.Exceptions.tcUserAccountInvalidException;
import Thor.API.Exceptions.tcUserAlreadyLoggedInException;
import Thor.API.Operations.tcGroupOperationsIntf;
import Thor.API.Operations.tcUserOperationsIntf;
public class Blog {
static ReadProperty readProperty = new ReadProperty();
public long returnVal = -1;
public static String homeDir = readProperty.getProp("homeDir");
public static String policyDir = readProperty.getProp("policyDir");
public static String confDir = readProperty.getProp("confDir");
public static String username = readProperty.getProp("username");
public static String password = readProperty.getProp("password");
public static String providerUrl = readProperty.getProp("providerUrl");
public tcUtilityFactory ioUtilityFactory;
public tcUserOperationsIntf moUserUtility;
public tcGroupOperationsIntf moGroupUtility;
FileLogger fL;
public Blog(){
fL = new FileLogger();
fL.setLogFile("D:\\readerLog.txt");
}
public void writeFile(String text)
{
try{
// Create file
FileWriter fstream = new FileWriter("D:\\OfficeCode.txt",true);
BufferedWriter out = new BufferedWriter(fstream);
out.write(text);
out.newLine();
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}
}
public String roleAuthenticate(String usr, String pass){
try {
System.setProperty("XL.HomeDir", homeDir);
System.setProperty("java.security.policy", policyDir);//server or client
System.setProperty("java.security.auth.login.config", confDir);//server or client
System.setProperty("java.naming.provider.url", providerUrl);
ConfigurationClient.ComplexSetting config =
ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
Hashtable env = config.getAllSettings();
System.out.println("test1");
System.out.println("Getting Information before login..");
this.writeFile("Getting Information before login..");
tcUtilityFactory ioUtilityFactory = new tcUtilityFactory(env,usr,pass);
System.out.println("Getting utility interfaces...");
System.out.println("Connection Established");
this.writeFile("Getting utility interfaces...\nConnection Established");
moUserUtility = (tcUserOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
moGroupUtility = (tcGroupOperationsIntf)ioUtilityFactory.getUtility("Thor.API.Operations.tcGroupOperationsIntf");
Logger logger = oracle.j2ee.rmi.RMIMessages.getLogger();
logger.setLevel(Level.OFF);
return "Valid";
} catch(Exception e){
e.printStackTrace();
return "Invalid";
}
}
public long getUserKey(String obj){
long key = 0;
HashMap
try {
//ConnectionEstablish cT = new ConnectionEstablish();
System.out.println("In getUserKey method, uid is :"+obj);
this.writeFile("In getUserKey method, uid is :"+obj);
userMap.put("Users.User ID", obj);
System.out.println("userMap contents: "+userMap.keySet()+userMap.values());
this.writeFile("userMap contents: "+userMap.keySet()+userMap.values());
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
System.out.println("MoResult set count is :"+moResultSet.getRowCount());
this.writeFile("MoResult set count is :"+moResultSet.getRowCount());
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Users.Key"); System.out.println("In getUserKey method, key is :"+key); } }catch(Exception e){ System.out.println("Error in getting user key" + e); e.printStackTrace(); } return key; } public long getGroupKey(String obj){ long key = 0; HashMap
try {
userMap.put("Groups.Group Name", obj);
tcResultSet moResultSet = moGroupUtility.findGroups(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Groups.Key"); } }catch(Exception e){ e.printStackTrace(); } return key; } public void UpdateUserPassword( String UID,String pwd) throws tcAPIException, tcChallengeNotSetException, tcLoginAttemptsExceededException, tcPasswordResetAttemptsExceededException, tcPasswordExpiredException, tcUserAccountDisabledException, tcUserAccountInvalidException, tcUserAlreadyLoggedInException { this.roleAuthenticate("xelsysadm","admin123"); HashMap
HashMap
try {
userMap.put("Users.User ID", UID);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
hmUser.put("Users.User ID", UID);
hmUser.put("Users.Password", pwd);
moUserUtility.updateUser(moResultSet, hmUser);
System.out.println("Updated password");
} catch (Exception e) {
System.out.println("Exception in OIM server while updating password for user <===" + UID +"===>");
e.printStackTrace();
}
}
public void init(String filePath)
{
System.out.println("Opening file...........\n");
FileInputStream fs = null;
try
{
fs = new FileInputStream(new File(filePath));
readContent(fs);
}
catch (IOException e)
{
e.printStackTrace();
} catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
fs.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public void updatePassword(Sheet sheet) throws tcAPIException, tcChallengeNotSetException, tcLoginAttemptsExceededException, tcPasswordResetAttemptsExceededException, tcUserAccountDisabledException, tcPasswordExpiredException, tcUserAlreadyLoggedInException, tcUserAccountInvalidException{
HashMap
//HashMap
int columnCount = sheet.getColumns();
int rowCount = sheet.getRows();
String userID = null;
String password = null;
for(int j=1;j < rowCount; j++) { userID = sheet.getCell(0, j).getContents(); password = sheet.getCell(1, j).getContents(); System.out.println("For UserIDs User ID :"+userID); userMap.put("Users.User ID", userID); System.out.println("User Map values "+userMap.values()); this.roleAuthenticate("xelsysadm","admin123"); this.UpdateUserPassword(userID, password); System.out.println("\n\nupdated Password "+password+"for user: "+userID+"..............\n"); } } public void readContent(InputStream fileInputStream) throws tcAPIException, tcChallengeNotSetException, tcLoginAttemptsExceededException, tcPasswordResetAttemptsExceededException, tcUserAccountDisabledException, tcPasswordExpiredException, tcUserAlreadyLoggedInException, tcUserAccountInvalidException { WorkbookSettings ws = null; Workbook workbook = null; Sheet s = null; Cell rowData[] = null; int rowCount = '0'; int columnCount = '0'; DateCell dc = null; int totalSheet = 0; ArrayList al=new ArrayList(); ArrayList all=new ArrayList(); try { ws = new WorkbookSettings(); ws.setLocale(new Locale("en", "EN")); workbook = Workbook.getWorkbook(fileInputStream, ws); totalSheet = workbook.getNumberOfSheets(); if(totalSheet > 0)
{
System.out.println("Reading file contents............\n");
System.out.println("Total Sheet Found:" + totalSheet);
for(int j=0;j
System.out.println("Sheet Name:" + workbook.getSheet(j).getName());
}
}
//Getting Default Sheet i.e. 0
s = workbook.getSheet(0);
//Reading Individual Cell
// getHeadingFromXlsFile(s);
//Total Total No Of Rows in Sheet, will return you no of rows that are occupied with some data
System.out.println("Total Rows inside Sheet:" + s.getRows());
rowCount = s.getRows();
//Total Total No Of Columns in Sheet
System.out.println("Total Column inside Sheet:" + s.getColumns());
columnCount = s.getColumns();
updatePassword(s);
}
catch (IOException e)
{
e.printStackTrace();
} catch (BiffException e)
{
e.printStackTrace();
}
}
public static void main(String[] args){
try
{
Blog blog = new Blog();
blog.init("D:\\Book2.xls");
System.exit(0);
} catch (Exception e)
{
e.printStackTrace();
}
}
}
Code to get Get Userkey, groupkey and Objectkey
code to get userkey
public long getUserKey(String obj){
long key = 0;
HashMap userMap = new HashMap();
try {
userMap.put("Users.User ID", obj);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Users.Key"); } }catch(Exception e){ e.printStackTrace(); } return key;} Code to get groupkey
public long getGroupKey(String obj){
long key = 0;
HashMap userMap = new HashMap();
try {
userMap.put("Groups.Group Name", obj);
tcResultSet moResultSet = moGroupUtility.findGroups(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Groups.Key"); } }catch(Exception e){ e.printStackTrace(); } return key;} Getting Object key for resource
public long getObjectKey(String object) {
HashMap objectMap = new HashMap();
long key = 0;
try {
objectMap.put("Objects.Name", object);
tcResultSet moResultSet = moObjectUtility.findObjects(objectMap);
if (moResultSet.getRowCount()==0)
{
System.out.println("Cannot get key value");
}
else
{
moResultSet.goToRow(0);
key = moResultSet.getLongValue("Objects.Key");
System.out.println("Key value " +key);
}
}catch(Exception e){
e.printStackTrace();
}
return key;
}
public long getUserKey(String obj){
long key = 0;
HashMap
try {
userMap.put("Users.User ID", obj);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Users.Key"); } }catch(Exception e){ e.printStackTrace(); } return key;} Code to get groupkey
public long getGroupKey(String obj){
long key = 0;
HashMap
try {
userMap.put("Groups.Group Name", obj);
tcResultSet moResultSet = moGroupUtility.findGroups(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); key = moResultSet.getLongValue("Groups.Key"); } }catch(Exception e){ e.printStackTrace(); } return key;} Getting Object key for resource
public long getObjectKey(String object) {
HashMap
long key = 0;
try {
objectMap.put("Objects.Name", object);
tcResultSet moResultSet = moObjectUtility.findObjects(objectMap);
if (moResultSet.getRowCount()==0)
{
System.out.println("Cannot get key value");
}
else
{
moResultSet.goToRow(0);
key = moResultSet.getLongValue("Objects.Key");
System.out.println("Key value " +key);
}
}catch(Exception e){
e.printStackTrace();
}
return key;
}
Code to add groups to user in OIM
public void addgroups(String uid,String groupname){
try{
System.out.println("added groups"+groupname);
moGroupUtility.addMemberUser(getGroupKey(groupname), getUserKey(uid));
}catch(Exception e){
System.out.println(e);
}
}
try{
System.out.println("added groups"+groupname);
moGroupUtility.addMemberUser(getGroupKey(groupname), getUserKey(uid));
}catch(Exception e){
System.out.println(e);
}
}
Code to remove groups from a User in OIM
public void Removegroups(String uidToDeprovision){
try{
ArrayList alCurrentGroups = getGroups(uidToDeprovision);
for(int cntGroup = 0; cntGroup
String strGropuToBeRemoved = alCurrentGroups.get(cntGroup).toString();
System.out.println("Group to be removed is " + strGropuToBeRemoved);
moGroupUtility.removeMemberUser(getGroupKeystrGropuToBeRemoved),getUserKey(uidToDeprovision));
}
}catch(Exception e){
System.out.println(e);
}
}
try{
ArrayList
for(int cntGroup = 0; cntGroup
System.out.println("Group to be removed is " + strGropuToBeRemoved);
moGroupUtility.removeMemberUser(getGroupKeystrGropuToBeRemoved),getUserKey(uidToDeprovision));
}
}catch(Exception e){
System.out.println(e);
}
}
Code to check if users are already exists in OIM
public void userexists(String UserID){
HashMap userMap = new HashMap);
try{
userMap.put("Users.User ID",UserID);
tcResultSet resultSet=moUserUtility.findUsers(userMap);
if(resultSet.getRowCount()==0)
{
fL.writeToLog("User is not present");
System.out.println(UserID+ "is not present in OIM");
}
else
{
fL.writeToLog("User '"+UserID+"'is present");
System.out.println("User '"+UserID+"'is present in OIM");
}
}
catch(Exception e){
}
}
HashMap
try{
userMap.put("Users.User ID",UserID);
tcResultSet resultSet=moUserUtility.findUsers(userMap);
if(resultSet.getRowCount()==0)
{
fL.writeToLog("User is not present");
System.out.println(UserID+ "is not present in OIM");
}
else
{
fL.writeToLog("User '"+UserID+"'is present");
System.out.println("User '"+UserID+"'is present in OIM");
}
}
catch(Exception e){
}
}
Sunday, 3 July 2011
Creating Custom adaptors in the design console
1.1Deploying the Adaptor
After developing the Custom code, make it as jar(eg:customadaptor.jar) and deploy in $OIM_Home/JavaTasks
*Change the owner of the jarfile from root to oracle(User other than Superuser)
*Give rwx permissions to the jar file
*Add the dependent jar files to $ORACLE_HOME/jdk/jre/lib/ext
1.2.Create Adaptor
Open the Oracle Identity manager design console and proceed with the creation of adaptor.
a.Goto development tools-->Adaptor Factory
b.Enter the Adaptor name,adaptor type(select from the populated values) and description values.
c. Save.
d. Goto to Variable List Tab and Enter the Attributes
e. click Add
Add all the variable as above,after adding the attributes will be displayed like the below Screenshot
f.Now move to Adaptor tasks tab and click Add, Select Functional task and Java and click continue
g.Select New Object Instance and continue(A new Screen appears)
h.Enter a task Name
In the API Source select the jar file name(i.e Customadaptor.jar)
Select the Application API,Constructors,Methods and Save.The parameters will get autopopulated in the Application Methods Parameters
i.Mapping has to be done now
And click set
And click Set
j.Save after adding all the Parameters.
k.Compile the Adaptor(Click on the Built button).
The Compile status will change from Recompile to OK
With this the creation of Adaptor is complete.
1.3.Creating PrePopForm Adaptor
a.Enter
b. Goto to Variable List Tab and Enter the Attributes
c. click Add
d.Save
e.In the Adaptor Tasks Tab,Select Add
f.Click Continue
g.Save
The adaptor task tab will display like below.
h.Compile the Adaptor.
i.Click on the Built button
The Compile status will change from Recompile to OK
With this the creation of pre-pop Adaptor is complete.
1.4. Form Designer
a.Navigate through the development tools-Form Designer
b.Enter the table name:UD_(will be taken automatically).
Description:PeopleSoftRoleUpdate
c.Save
d.Goto Additional Columns tab and click Add
e.Save
f.GoTo Properties Tab,The parameters will be displayed,
g.Click Add Property
h.For lookup field(create the lookup before adding properties as in Point no 3)
i.Click add properties
j.Save
k.After adding properties,The form Designer properties tab will look like follows
l.In prepopulate tab,Enter the mappings as in screen shot
1.5 Creating Lookup
a.Goto->Administration -->LookUp definition
b.Enter lookup.PSCustpm.Role in the code column
c.Enter Group:PSCustom and save
The add button will get activated.
Enter the roles needed.
Doing prepopulate in lookup
a.Goto prepopulate Tab, Click add
b.Save
In the adaptor variables,Do the mapping
1.6.Resource Management
a.Goto Resource Mangement->Resource Objects
b.Enter Name:PSCustomRole
Type:Application
c.Save
d.Select Object Reconcilation Tab(Reconcilation Fields)and click Add
e.Move to reconciliation Action Rules Tab,Select Add
1.7.Process Definition
a.Goto Process mangement->Process Definition
b.Enter
c.Goto Reconcilation Field Mappings Select Add Field Map
d.Select Tasks Tab and click Add
e.Save it.
f.Goto Integration Tab ,In the Event handler/Adaptor,Select Add
g.In the Adaptor variable,the status in now N,
h.Map the variables to Y and save
i.In the responses Tab,Select Add and add the responses and save
j.In the Tasks tab,the newly mapped apaptor is added as shown in screenshot
After developing the Custom code, make it as jar(eg:customadaptor.jar) and deploy in $OIM_Home/JavaTasks
*Change the owner of the jarfile from root to oracle(User other than Superuser)
*Give rwx permissions to the jar file
*Add the dependent jar files to $ORACLE_HOME/jdk/jre/lib/ext
1.2.Create Adaptor
Open the Oracle Identity manager design console and proceed with the creation of adaptor.
a.Goto development tools-->Adaptor Factory
b.Enter the Adaptor name,adaptor type(select from the populated values) and description values.
c. Save.
d. Goto to Variable List Tab and Enter the Attributes
e. click Add
Add all the variable as above,after adding the attributes will be displayed like the below Screenshot
f.Now move to Adaptor tasks tab and click Add, Select Functional task and Java and click continue
g.Select New Object Instance and continue(A new Screen appears)
h.Enter a task Name
In the API Source select the jar file name(i.e Customadaptor.jar)
Select the Application API,Constructors,Methods and Save.The parameters will get autopopulated in the Application Methods Parameters
i.Mapping has to be done now
And click set
And click Set
j.Save after adding all the Parameters.
k.Compile the Adaptor(Click on the Built button).
The Compile status will change from Recompile to OK
With this the creation of Adaptor is complete.
1.3.Creating PrePopForm Adaptor
a.Enter
b. Goto to Variable List Tab and Enter the Attributes
c. click Add
d.Save
e.In the Adaptor Tasks Tab,Select Add
f.Click Continue
g.Save
The adaptor task tab will display like below.
h.Compile the Adaptor.
i.Click on the Built button
The Compile status will change from Recompile to OK
With this the creation of pre-pop Adaptor is complete.
1.4. Form Designer
a.Navigate through the development tools-Form Designer
b.Enter the table name:UD_(will be taken automatically).
Description:PeopleSoftRoleUpdate
c.Save
d.Goto Additional Columns tab and click Add
e.Save
f.GoTo Properties Tab,The parameters will be displayed,
g.Click Add Property
h.For lookup field(create the lookup before adding properties as in Point no 3)
i.Click add properties
j.Save
k.After adding properties,The form Designer properties tab will look like follows
l.In prepopulate tab,Enter the mappings as in screen shot
1.5 Creating Lookup
a.Goto->Administration -->LookUp definition
b.Enter lookup.PSCustpm.Role in the code column
c.Enter Group:PSCustom and save
The add button will get activated.
Enter the roles needed.
Doing prepopulate in lookup
a.Goto prepopulate Tab, Click add
b.Save
In the adaptor variables,Do the mapping
1.6.Resource Management
a.Goto Resource Mangement->Resource Objects
b.Enter Name:PSCustomRole
Type:Application
c.Save
d.Select Object Reconcilation Tab(Reconcilation Fields)and click Add
e.Move to reconciliation Action Rules Tab,Select Add
1.7.Process Definition
a.Goto Process mangement->Process Definition
b.Enter
c.Goto Reconcilation Field Mappings Select Add Field Map
d.Select Tasks Tab and click Add
e.Save it.
f.Goto Integration Tab ,In the Event handler/Adaptor,Select Add
g.In the Adaptor variable,the status in now N,
h.Map the variables to Y and save
i.In the responses Tab,Select Add and add the responses and save
j.In the Tasks tab,the newly mapped apaptor is added as shown in screenshot
Saturday, 2 July 2011
Code to Create a user using OIM
The below code is helpful to create a user in OIM .The code below has some custom attributes created by myself to create user.Modify the code as per your needs.:)
public String CreateUser(
final String UserID,
final String FirstName,
final String middleName,
final String LastName,
final String Status,
final String EmployeeType,
final String Location,
final String email,
{
String flag = "";
System.out.println("Value received from Method ");
System.out.println"-----------------------------------------------------------");
System.out.println("Value for UserID ===>"+ UserID );
System.out.println("Value for FirstName ===>"+FirstName);
System.out.println("Value for middleName ===>"+middleName);
System.out.println("Value for LastName ===>"+LastName);
System.out.println("Value for Status ===>"+Status);
System.out.println("Value for LocationType ===>"+LocationType);
System.out.println("Value for EmployeeType ===>"+EmployeeType);
System.out.println("Value for Location ===>"+Location);
System.out.println("Value for email ===>"+email);
System.out.println"-----------------------------------------------------------");
System.out.println("Value received );
HashMap userMap = new HashMap();
try {
userMap.put("Users.User ID", UserID);
userMap.put("Users.First Name", FirstName);
userMap.put("Users.Middle Name", middleName);
userMap.put("Users.Last Name", LastName);
userMap.put("Users.EmployeeType", "EMP");
userMap.put("Users.Password", "343245324");
userMap.put("Users.Confirm Password", "3432432");
userMap.put("Users.Location", Location);
userMap.put("Users.Division", LocationType);
userMap.put("Users.Email", email);
userMap.put("Users.User Type", "End-User");
userMap.put("Users.Status", "Active");
userMap.put("Users.AgentStatus", "");
userMap.put("Users.Xellerate Type", "End-User");
userMap.put("Users.Role", "Full-Time");
userMap.put("Users.Organization", "Xellerate Users");
userMap.put("Organizations.Key", "1");
userMap.put("RogueAcIdentifier","");
long test = moUserUtility.createUser(userMap);
//TODO write your implementation code here:
System.out.println("User created successfully with id <==="+ UserID +"===>");
flag = "User Created Successfully in OIM";
return flag;
} catch (Thor.API.Exceptions.tcAPIException exception) {
// e.printStackTrace();
System.out.println("Exception In OIM SERVER <===" + UserID + "===>" + exception.toString());
return exception.toString();
}
catch (Exception e) {
System.out.println("Exception In OIM SERVER while creating user <===" + e.toString());
return e.toString();
}
}
public String CreateUser(
final String UserID,
final String FirstName,
final String middleName,
final String LastName,
final String Status,
final String EmployeeType,
final String Location,
final String email,
{
String flag = "";
System.out.println("Value received from Method ");
System.out.println"-----------------------------------------------------------");
System.out.println("Value for UserID ===>"+ UserID );
System.out.println("Value for FirstName ===>"+FirstName);
System.out.println("Value for middleName ===>"+middleName);
System.out.println("Value for LastName ===>"+LastName);
System.out.println("Value for Status ===>"+Status);
System.out.println("Value for LocationType ===>"+LocationType);
System.out.println("Value for EmployeeType ===>"+EmployeeType);
System.out.println("Value for Location ===>"+Location);
System.out.println("Value for email ===>"+email);
System.out.println"-----------------------------------------------------------");
System.out.println("Value received );
HashMap
try {
userMap.put("Users.User ID", UserID);
userMap.put("Users.First Name", FirstName);
userMap.put("Users.Middle Name", middleName);
userMap.put("Users.Last Name", LastName);
userMap.put("Users.EmployeeType", "EMP");
userMap.put("Users.Password", "343245324");
userMap.put("Users.Confirm Password", "3432432");
userMap.put("Users.Location", Location);
userMap.put("Users.Division", LocationType);
userMap.put("Users.Email", email);
userMap.put("Users.User Type", "End-User");
userMap.put("Users.Status", "Active");
userMap.put("Users.AgentStatus", "");
userMap.put("Users.Xellerate Type", "End-User");
userMap.put("Users.Role", "Full-Time");
userMap.put("Users.Organization", "Xellerate Users");
userMap.put("Organizations.Key", "1");
userMap.put("RogueAcIdentifier","");
long test = moUserUtility.createUser(userMap);
//TODO write your implementation code here:
System.out.println("User created successfully with id <==="+ UserID +"===>");
flag = "User Created Successfully in OIM";
return flag;
} catch (Thor.API.Exceptions.tcAPIException exception) {
// e.printStackTrace();
System.out.println("Exception In OIM SERVER <===" + UserID + "===>" + exception.toString());
return exception.toString();
}
catch (Exception e) {
System.out.println("Exception In OIM SERVER while creating user <===" + e.toString());
return e.toString();
}
}
Friday, 1 July 2011
Code to update the Users Password in OIM
public void UpdateUserPassword( String UID,String pwd) {
HashMap userMap = new HashMap();
HashMap hmUser = new HashMap();
try {
userMap.put("Users.User ID", UID);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
hmUser.put("Users.User ID", UID);
hmUser.put("Users.Password", pwd);
moUserUtility.updateUser(moResultSet, hmUser);
System.out.println("Password Updated successfully for user <===" + UID +"===>");
} catch (Exception e) {
System.out.println("Exception in OIM server while updating password for user <===" + UID +"===>");
e.printStackTrace();
}
HashMap
HashMap
try {
userMap.put("Users.User ID", UID);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
hmUser.put("Users.User ID", UID);
hmUser.put("Users.Password", pwd);
moUserUtility.updateUser(moResultSet, hmUser);
System.out.println("Password Updated successfully for user <===" + UID +"===>");
} catch (Exception e) {
System.out.println("Exception in OIM server while updating password for user <===" + UID +"===>");
e.printStackTrace();
}
Code to get the Details of a user for an attribute in OIM
public void UserDetails(String UID) {
HashMap userMap = new HashMap();
try{
userMap.put("Users.User ID", UID);
System.out.println("UID==>"+UID);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); String FN = moResultSet.getStringValue("Users.First Name"); String Mail=moResultSet.getStringValue("Users.Email"); String LN = moResultSet.getStringValue("Users.Last Name"); String Dept= moResultSet.getStringValue("USR_UDF_DEPARMENT_ID"); System.out.println("First Name--> " + FN);
System.out.println("Mail--> " + Mail);
System.out.println("Last Name--> " +LN);
System.out.println("DeptID--> " +Dept);
}
}catch (Exception e){
e.printStackTrace();
}
}
HashMap
try{
userMap.put("Users.User ID", UID);
System.out.println("UID==>"+UID);
tcResultSet moResultSet = moUserUtility.findUsers(userMap);
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); String FN = moResultSet.getStringValue("Users.First Name"); String Mail=moResultSet.getStringValue("Users.Email"); String LN = moResultSet.getStringValue("Users.Last Name"); String Dept= moResultSet.getStringValue("USR_UDF_DEPARMENT_ID"); System.out.println("First Name--> " + FN);
System.out.println("Mail--> " + Mail);
System.out.println("Last Name--> " +LN);
System.out.println("DeptID--> " +Dept);
}
}catch (Exception e){
e.printStackTrace();
}
}
Getting the OIM Users list assigned to a particular group
public String usersingroup(String groupname){
HashMap userMap = new HashMap();
String uid="";
try {
userMap.put("Groups.Group Name", groupname);
System.out.println("Group Name==>" + groupname);
tcResultSet moResultSet = moGroupUtility.getAllMemberUsers(getGroupKey(groupname));
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); uid = moResultSet.getStringValueFromColumn(1); System.out.println("USerIDs==>"+uid);
}
}catch(Exception e){
System.out.println("No such groups Found");
}
return uid;
}
HashMap
String uid="";
try {
userMap.put("Groups.Group Name", groupname);
System.out.println("Group Name==>" + groupname);
tcResultSet moResultSet = moGroupUtility.getAllMemberUsers(getGroupKey(groupname));
for (int i=0; i < moResultSet.getRowCount(); i++){ moResultSet.goToRow(i); uid = moResultSet.getStringValueFromColumn(1); System.out.println("USerIDs==>"+uid);
}
}catch(Exception e){
System.out.println("No such groups Found");
}
return uid;
}
Subscribe to:
Posts (Atom)