cancel
Showing results for 
Search instead for 
Did you mean: 

inaccurate users number retuned by getUserFactory mathod

Wei-min
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi, all,

when using getUserFactory mathod,my customer gets smaller number of users then from User Management UI.

Is there any control field in database which effect the return of the getUserFactory function?

any suggestion?

Attached the code from my customer:

public List<Map<String, String>> getBpmUsers(String userName){

    List<Map<String, String>> users = new ArrayList<Map<String, String>>();

       try {

        IUserFactory userFactory = UMFactory.getUserFactory();

        IUserSearchFilter userSearchFilter = userFactory.getUserSearchFilter();

        userSearchFilter.setUniqueName(userName, ISearchAttribute.LIKE_OPERATOR, false);

        ISearchResult searchUsers = userFactory.searchUsers(userSearchFilter);

        while(searchUsers.hasNext()){

            IUser user = userFactory.getUser(searchUsers.next().toString());

            Map<String, String> userMap = new HashMap<String, String>();

            userMap.put("userId", user.getUniqueName());

            userMap.put("userName", user.getDisplayName());

            users.add(userMap);

        }

       } catch (UMException e) {

           e.printStackTrace();

       }

    return users;

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Wei-min Shan,

What are u passing in userName in below code?

userSearchFilter.setUniqueName(userName,ISearchAttribute.LIKE_OPERATOR, false);

if you are using setUniqueName(), then you've to pass userID (getUniqueName) not userName (getDisplayName).
I may be wrong, as I don't know what are passing in userName. So please check your code and give another try!


Hope it helps,

MS

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

1. why you expect the same number? how do you know the code for user management UI is the same as yours?

2. you have to check the state of search result, they have different state, like SIZE_LIMIT_EXCEEDED

Wei-min
Product and Topic Expert
Product and Topic Expert
0 Kudos

Thanks Jun, the only thing ct want to do is to test the function whether it can get all users back, so he just call the getUserFactory without any parameter and then, he check the resultset by the User management on portal, but get two different number.

Any advice?

junwu
Active Contributor
0 Kudos

buddy, did you read the two points......

Wei-min
Product and Topic Expert
Product and Topic Expert
0 Kudos

Ct find one user can't be retrieved by getUserFactory with userId and userSearchFilter *, but can be found in portal. Then he delete this user and create it again but still not work.

I ask him to compare the columns in database and waiting his feedback.