on 09-16-2014 2:46 PM
Hello,
I am trying to create a List with all customers. For as far as I can see, I can get one user at a time (be it the current user, or a userFromUid)
this is what I had been able to do: final CustomerModel cm = (CustomerModel) userService.getUserForUID();
Can anyone tell me how I can get all customers?
Thanks in advance!
I believe you can get the users from getUserService().getUserGroup().getMembers() ;
This will return all the users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Vinay
Please note that usergroup.getMembers()
will not give you all Users
directly, but a hierarchical Structure (Principals) instead. e.g. is willl give you something like this:
- John Doe (CustomerModel)
- Jane Doe (CustomerModel)
- Subusergroup 1 (UsergroupModel)
--SubSubUsergroup 1 (UsergroupModel)
--- Mr. X (CustomerModel)
--- Mr. Y (CustomerModel)
-- Mrs. Z (CustomerModel)
- Foo Bar (CustomerModel)
to get all CustomerModels, you'd have to write a function that collects all users from sub-groups as well. Or, as an alternative, you could work with Flexible Search/ Write a Dao.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're looking for a specific set of users, then try and use a flexible search query. This would be more efficient than returning all the users in a group and then iterating over them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.