Getting Groups which are Communities in Liferay
I am trying to get all the groups which are communities in Liferay 5.2.x version. Currently I am doing the following.
1) List<Group> groups = GroupLocalServiceUtil.getGroups(0, groupCount)
--> Get all the existing groups
2) Iterate over the groups list to check if the group is a community by using group.isCommunity()
.
Pleas开发者_StackOverflow中文版e suggest a way to get all the groups which are communities at one shot.
I would use:
GroupLocalServiceUtil.search(
long companyId, String name, String description,
LinkedHashMap<String, Object> params, int start, int end)
With name, description having a blank string passed. Params being null or an empty LinkedHashMap. Start and end being what every you desire (passing -1 to both will get the entire set).
Your final call would look something like:
GroupLocalServiceUtil.search(companyId, "", "", null, -1, -1)
精彩评论