Searching users based on custom attribute
import sailpoint.object.Identity;
import sailpoint.object.QueryOptions;
import sailpoint.object.Filter;
import java.util.*;
QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.eq("location",”Bangalore”));
// Search users based on two identity attributes
//QueryOptions qo = new QueryOptions();
//Filter f1=Filter.eq("firstname",firstName) ;
//Filter f2 = Filter.eq("lastname",lastName);
//Filter finalFilter = Filter.and(f1,f2);
//qo.addFilter(finalFilter);
Iterator users = context.search(Identity.class, qo);
while (users.hasNext()) {
Identity user = (Identity)users.next();
System.out.println("\nUserName: " + user.getName());
System.out.println("\nEmployee ID: " + user.getAttribute("empId"));
}
Comments
Post a Comment