Example usage for com.liferay.portal.kernel.service UserGroupLocalServiceUtil searchCount

List of usage examples for com.liferay.portal.kernel.service UserGroupLocalServiceUtil searchCount

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service UserGroupLocalServiceUtil searchCount.

Prototype

public static int searchCount(long companyId, String keywords, java.util.LinkedHashMap<String, Object> params) 

Source Link

Document

Returns the number of user groups that match the keywords

Usage

From source file:com.liferay.site.admin.web.internal.display.context.SiteAdminDisplayContext.java

License:Open Source License

public int getUserGroupsCount(Group group) {
    LinkedHashMap<String, Object> userGroupParams = new LinkedHashMap<>();

    ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    userGroupParams.put(UserGroupFinderConstants.PARAM_KEY_USER_GROUPS_GROUPS, group.getGroupId());

    return UserGroupLocalServiceUtil.searchCount(company.getCompanyId(), null, userGroupParams);
}

From source file:com.liferay.user.groups.admin.service.test.UserGroupLocalServiceTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    _role = RoleTestUtil.addRole(RoleConstants.TYPE_REGULAR);

    _companyId = _role.getCompanyId();/*ww w. java 2 s .co  m*/

    _count = UserGroupLocalServiceUtil.searchCount(_companyId, null, new LinkedHashMap<String, Object>());

    _userGroup1 = UserGroupTestUtil.addUserGroup();
    _userGroup2 = UserGroupTestUtil.addUserGroup();

    GroupLocalServiceUtil.addRoleGroup(_role.getRoleId(), _userGroup1.getGroupId());
}