Fórum
User List Based On Roles
mohammad azaruddin, modificado 11 Anos atrás.
User List Based On Roles
Expert Postagens: 492 Data de Entrada: 17/09/12 Postagens Recentes
HI All
I need to get list of users based on roles( for example i need get single USER list contains Manager and developer )
I need to get list of users based on roles( for example i need get single USER list contains Manager and developer )
here i can get two seperate List of manager/developer by passing role id of manager/developer
List<User> manager =UserLocalServiceUtil.getRoleUsers(roleId of manager);
List<User> developer =UserLocalServiceUtil.getRoleUsers(roleId of developer);
and in this case i'm unable to combine these two list another list.
i am getting this error when i try to combine the list
Stacktrace:
07:17:11,089 ERROR [IncludeTag:154] java.lang.UnsupportedOperationException: Please make a copy of this read-only list before modifying it.
Gnaniyar Zubair, modificado 11 Anos atrás.
RE: User List Based On Roles
Liferay Master Postagens: 722 Data de Entrada: 19/12/07 Postagens Recentes
You can create new List where you can inject two lists into that.
BTW, You have created 2 different threads in the same name. As per the Forum Poilcy, it is not a best practice. so continue your queries in that same loop itself if it relates to that.
BTW, You have created 2 different threads in the same name. As per the Forum Poilcy, it is not a best practice. so continue your queries in that same loop itself if it relates to that.
mohammad azaruddin, modificado 11 Anos atrás.
RE: User List Based On Roles
Expert Postagens: 492 Data de Entrada: 17/09/12 Postagens Recentes
Hi
And i tried this
But it is throwing exception
unknowingly i post previous thread and i'm not able post comment on it.it is already marked as spam
And i tried this
List<User> newList=null;
List<User> manager= UserLocalServiceUtil.getRoleUsers(manager roleID);
List<User> developer=UserLocalServiceUtil.getRoleUsers(developer roleID);
newList.addAll(manager);
newList.addAll(developer);
But it is throwing exception
Chirag Patadia, modificado 11 Anos atrás.
RE: User List Based On Roles
Junior Member Postagens: 29 Data de Entrada: 03/02/12 Postagens Recentes
First problem is that you have not declared newList object.
Try with below code snippet, it may resolve your problem.
Best Regards,
Chirag Patadia.
Try with below code snippet, it may resolve your problem.
List<user> newList=new ArrayList<user>();
List<user> manager= new ArrayList<user>(UserLocalServiceUtil.getRoleUsers(manager roleID));
List<user> developer=new ArrayList<user>(UserLocalServiceUtil.getRoleUsers(developer roleID));
newList.addAll(manager);
newList.addAll(developer);</user></user></user></user></user></user>
Best Regards,
Chirag Patadia.
mohammad azaruddin, modificado 11 Anos atrás.
RE: User List Based On Roles
Expert Postagens: 492 Data de Entrada: 17/09/12 Postagens Recentes
HI
Thank you..It is working
Thank you..It is working