2017-11-17 18 views
0

을 사용하는 AS400 사용 가능 사용자 만 검색하는 방법 jt400의 UserList의 getUsers 메소드에 필터를 추가하기 위해 사용 가능 사용자 만 검색 할 수 있습니까?jt400 API

나는 다음과 같은 구현을했는데 성능이 좋지 않아 그래서 더 나은 방법을 찾고 사용자를 필터링하고 사용 가능 사용자 만 얻을 수있는 가능성이있는 경우.

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); 
      } 

     } 

답변

3

이 같은 USER_INFO 뷰를 쿼리 수 :

select * 
from qsys2.user_info 
where status = '*ENABLED' 

이것은 7.1에서 가능하게되었다. 이 권한은 사용자에게 권한이있는 사용자에게만 제공됩니다.

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(); 

    if (u.getStatus().equalsIgnoreCase("*ENABLED")) { 
     as400Users.add(u.getName()); 
    } 

} 

을 아니면 이제 막 가장 빠른 방법을 선택 getUsers(-1,0)

Set<String> as400Users = new HashSet(); 
AS400 as400 = new AS400(host, username, password); 

//Retrieving Users 
UserList users = new UserList(as400); 
for (com.ibm.as400.access.User u: users.getUser(-1,0)) { 
    if (u.getStatus().equalsIgnoreCase("*ENABLED")) { 
     as400Users.add(u.getName()); 
    } 
} 

와 함께 새로운 foreach 구문을 사용할 수 있습니다 또한 필터 내부의 getName() 전화를 이동 할 수 있습니다

.