Example usage for com.liferay.portal.kernel.service.persistence GroupFinderUtil findByC_C_PG_N_D

List of usage examples for com.liferay.portal.kernel.service.persistence GroupFinderUtil findByC_C_PG_N_D

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service.persistence GroupFinderUtil findByC_C_PG_N_D.

Prototype

public static java.util.List<com.liferay.portal.kernel.model.Group> findByC_C_PG_N_D(long companyId,
            long[] classNameIds, long parentGroupId, String[] names, String[] descriptions,
            java.util.LinkedHashMap<String, Object> params, boolean andOperator, int start, int end,
            com.liferay.portal.kernel.util.OrderByComparator<com.liferay.portal.kernel.model.Group> obc) 

Source Link

Usage

From source file:com.liferay.site.service.persistence.test.GroupFinderTest.java

License:Open Source License

@Test
public void testFindByC_C_PG_N_D() throws Exception {
    _userGroup = UserGroupTestUtil.addUserGroup();
    _userGroupUser = UserTestUtil.addUser();

    UserGroupLocalServiceUtil.addUserUserGroup(_userGroupUser.getUserId(), _userGroup);

    Group group = _organization.getGroup();

    GroupLocalServiceUtil.addUserGroupGroup(_userGroup.getUserGroupId(), group.getGroupId());

    LinkedHashMap<String, Object> params = new LinkedHashMap<>();

    params.put("inherit", true);
    params.put("usersGroups", _userGroupUser.getUserId());

    List<Group> groups = GroupFinderUtil.findByC_C_PG_N_D(_organization.getCompanyId(), null,
            GroupConstants.DEFAULT_PARENT_GROUP_ID, null, null, params, true, QueryUtil.ALL_POS,
            QueryUtil.ALL_POS, null);//from   w  w  w . j  av a 2  s . co m

    Assert.assertTrue(groups.toString(), groups.contains(group));
}

From source file:com.liferay.site.service.persistence.test.GroupFinderTest.java

License:Open Source License

protected List<Group> findByC_C_N_D(String actionId, String name, long roleId) throws Exception {

    LinkedHashMap<String, Object> groupParams = new LinkedHashMap<>();

    RolePermissions rolePermissions = new RolePermissions(name, ResourceConstants.SCOPE_GROUP, actionId,
            roleId);// w  w w.j  a  v a2  s  .  co  m

    groupParams.put("rolePermissions", rolePermissions);

    long[] classNameIds = { PortalUtil.getClassNameId(Group.class) };

    return GroupFinderUtil.findByC_C_PG_N_D(TestPropsValues.getCompanyId(), classNameIds,
            GroupConstants.ANY_PARENT_GROUP_ID, new String[] { null }, new String[] { null }, groupParams, true,
            QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}