User Login Search from user key in OIM using UserManager API
@SuppressWarnings({ "unchecked", "rawtypes" })
public String getUserLogin(String userKey) {
String methodName = "getUserLogin";
logger.setMethodStartLog(className, methodName);
logger.debug(className, methodName, "userKey: "+userKey);
String userLogin = null;
SearchCriteria sc = new SearchCriteria("usr_key", userKey,Operator.EQUAL);
try {
Set retAttrs = new HashSet();
retAttrs.add("User Login");// add whatever fields you want get
UserManager usrMgr = Platform.getService(UserManager.class);
//UserManager usrMgr = OIMClientFactory.getUserManager(); in ADF
List<oracle.iam.identity.usermgmt.vo.User> userList;
userList = usrMgr.search(sc, retAttrs, null);
for(oracle.iam.identity.usermgmt.vo.User user: userList){
userLogin = user.getLogin();//get user fields
logger.debug(className, methodName, "userLogin: "+userLogin);
}
} catch (Exception e) {
e.printStackTrace();
}
logger.debug(className, methodName, "userLogin: "+userLogin);
logger.setMethodFinishLog(className, methodName);
return userLogin;
}
public String getUserLogin(String userKey) {
String methodName = "getUserLogin";
logger.setMethodStartLog(className, methodName);
logger.debug(className, methodName, "userKey: "+userKey);
String userLogin = null;
SearchCriteria sc = new SearchCriteria("usr_key", userKey,Operator.EQUAL);
try {
Set retAttrs = new HashSet();
retAttrs.add("User Login");// add whatever fields you want get
UserManager usrMgr = Platform.getService(UserManager.class);
//UserManager usrMgr = OIMClientFactory.getUserManager(); in ADF
List<oracle.iam.identity.usermgmt.vo.User> userList;
userList = usrMgr.search(sc, retAttrs, null);
for(oracle.iam.identity.usermgmt.vo.User user: userList){
userLogin = user.getLogin();//get user fields
logger.debug(className, methodName, "userLogin: "+userLogin);
}
} catch (Exception e) {
e.printStackTrace();
}
logger.debug(className, methodName, "userLogin: "+userLogin);
logger.setMethodFinishLog(className, methodName);
return userLogin;
}
Can we get reverse? Is there a api to get the user key from the account uid from target?
ReplyDelete