OIM API To Search Users


package com.users;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.connection.Platform;

import oracle.iam.identity.usermgmt.api.UserManager;
import oracle.iam.identity.usermgmt.vo.User;
import oracle.iam.platform.entitymgr.vo.SearchCriteria;

public class UserSearch {
 public static void main(String[] args) throws Exception {
       
        UserManager usrMgr = Platform.getService(UserManager.class);

        SearchCriteria criteria = new SearchCriteria("User Login","*", SearchCriteria.Operator.EQUAL);
        Set retSet = new HashSet();
        retSet.add("usr_key");
        retSet.add("User Login");
        retSet.add("First Name");
        retSet.add("Last Name");

        List<User> users = usrMgr.search(criteria, retSet, null);
        
        for(User user : users) {
            System.out.println("********LIST********"+user.getAttributeNames());            
            Long usrKey = (Long)user.getAttribute("usr_key");
            String usrLogin = (String)user.getAttribute("User Login");
            String fn = (String)user.getAttribute("First Name");
            String ln = (String)user.getAttribute("Last Name");
            String test1 = (String)user.getAttribute("test1");
            String custom1 = (String)user.getAttribute("custom1");
            System.out.println(usrKey + " " + usrLogin + " " + fn + " " + ln + " " + test1 + " " + custom1);
        }

    }
}

No comments:

Post a Comment

About OIM

Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...

Popular Posts