is there a possibility to retrieve only the Enabled Users -to add a filter- to the getUsers method of UserList of jt400?
I did the following implementation but it does not have a good performance, so I am trying to find a better way and if there is a possibility to filter the users and to get only the Enabled users.
Set<String> as400Users = new HashSet();
AS400 as400 = new AS400(host, username, password);
//Retrieving Users
UserList users = new UserList(as400);
Enumeration io = users.getUsers();
while (io.hasMoreElements()) {
com.ibm.as400.access.User u = (com.ibm.as400.access.User)io.nextElement();
String userName = u.getName();
if (u.getStatus().equalsIgnoreCase("*ENABLED")) {
as400Users.add(userName);
}
}
You could query the USER_INFO view like this:
This became available at v7.1. Note that this only provides users that you have authority to.
You also might want to move the
getName()call inside the filter:Or you could use the newer
foreachsyntax withgetUsers(-1,0)Now just choose the fastest method.