Now that we have created users, we can try to search for users.
1) Code
2) Result
3) Complex SearchCriteria
If there is a need to create complex searchCriteria, there is a way to combine searchCriteria as below:
1) Code
public void searchUser(OIMClient oimclient){UserManager usrMgr = oimclient.getService(UserManager.class);Set retAttrs = new HashSet();retAttrs.add("First Name");retAttrs.add("Last Name");retAttrs.add("User Login");SearchCriteria sc = new SearchCriteria("First Name", "*",Operator.EQUAL); // Search can use wildcardsList<oracle.iam.identity.usermgmt.vo.User> userList;try {userList = usrMgr.search(sc, retAttrs, null);for(oracle.iam.identity.usermgmt.vo.User user: userList){System.out.println(user.getAttributes());}} catch (UserSearchException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (AccessDeniedException e) {// TODO Auto-generated catch blocke.printStackTrace();}}
2) Result
Connected{usr_key=1, User Login=XELSYSADM, Last Name=Administrator, First Name=System}{usr_key=3, User Login=WEBLOGIC, Last Name=WEBLOGIC, First Name=WEBLOGIC}{usr_key=4, User Login=OIMINTERNAL, Last Name=OIMINTERNAL, First Name=OIMINTERNAL}{usr_key=65, User Login=APIUSER1@MAIL.COM, Last Name=APIUser1, First Name=APIUser1}{usr_key=48, User Login=FNAME1_LNAME1@MAIL.COM, Last Name=LName123, First Name=FName123}{usr_key=66, User Login=APIUSER0.APIUSER0@ORACLE.COM, Last Name=APIUser0, First Name=APIUser0}{usr_key=67, User Login=APIUSER@MAIL.COM, Last Name=APIUser, First Name=APIUser}Disconnected
3) Complex SearchCriteria
If there is a need to create complex searchCriteria, there is a way to combine searchCriteria as below:
SearchCriteria sc1 = new SearchCriteria("First Name", "*",Operator.EQUAL);SearchCriteria sc2 = new SearchCriteria("Last Name", "*",Operator.EQUAL);SearchCriteria sc = new SearchCriteria(sc1, sc2, Operator.AND);
Hey hi i am getting error like
ReplyDeleteThe constructor SearchCriteria(String, String, CatalogSearchCriteria.Operator) is undefined