Users and groupsThe user and group classes allow a Java program to get lists of users and groups on the AS/400 system and information about each user. You use a UserList object to get a list of users and groups on the system. The only property of the UserList object that must be set is the AS400 object that represents the AS/400 system from which the list of users is to be retrieved. By default, all users are returned. Use a combination of setUserInfo() and setGroupInfo() to specify exactly which users should be returned. Use getUsers() to retrieve the list of users and groups from the system. The list is returned in an enumeration. The calling program can iterate through the list using the enumeration. All elements in the enumeration are User objects. For example: // Create an AS400 object. AS400 system = new AS400 ("mySystem.myCompany.com"); // Create the UserList object. UserList userList = new UserList (system); // Get the list of all users and groups. Enumeration enum = userList.getUsers (); // Iterate through the list. while (enum.hasMoreElements ()) { User u = (User) enum.nextElement (); System.out.println (u); } ExampleUse a UserList to list all of the users in a given group.
[ Legal | AS/400 Glossary ] |