Sunday 25 December 2016

Search User Key based on User Login in OIM11gR2

Search User Key based on User Login in OIM11gR2-
========================================================================

public String searchUserKey(String _usrLogin)
{
String _methodName = "searchUserKey()-";
Thor.API.Operations.tcUserOperationsIntf userintf = Platform.getService(Thor.API.Operations.tcUserOperationsIntf.class);

 //String returnMsg = "userid not existing in OIM";
 String userKey="";
 java.util.HashMap<String, String> userMap = new java.util.HashMap<String, String>();
     
 userMap.put("Users.User ID", _usrLogin);
 Thor.API.tcResultSet moResultSet = null;
  try {
    moResultSet = userintf.findUsers(userMap);
    String[] CName=moResultSet.getColumnNames();
    userKey=moResultSet.getStringValue("Users.Key");
 }
catch (tcColumnNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (tcAPIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
       
return userKey;
}

No comments:

Post a Comment