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

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

Introduction

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

Prototype

public static java.util.List<com.liferay.portal.kernel.model.Group> findByLayouts(long companyId,
            long parentGroupId, boolean site, Boolean active, 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 testFindByLayouts2() throws Exception {
    int initialGroupCount = GroupFinderUtil.countByLayouts(TestPropsValues.getCompanyId(),
            GroupConstants.DEFAULT_PARENT_GROUP_ID, true, true);

    GroupTestUtil.addGroup();//from  ww w.j  a  v a2 s  .co m

    Group parentGroup = GroupTestUtil.addGroup();

    LayoutTestUtil.addLayout(parentGroup, false);

    Group childGroup1 = GroupTestUtil.addGroup(parentGroup.getGroupId());

    LayoutTestUtil.addLayout(childGroup1, false);

    Group childGroup2 = GroupTestUtil.addGroup(parentGroup.getGroupId());

    LayoutTestUtil.addLayout(childGroup2, true);

    GroupLocalServiceUtil.updateGroup(parentGroup.getGroupId(), parentGroup.getParentGroupId(),
            parentGroup.getNameMap(), parentGroup.getDescriptionMap(), parentGroup.getType(),
            parentGroup.isManualMembership(), parentGroup.getMembershipRestriction(),
            parentGroup.getFriendlyURL(), parentGroup.isInheritContent(), false,
            ServiceContextTestUtil.getServiceContext());

    List<Group> groups = GroupFinderUtil.findByLayouts(TestPropsValues.getCompanyId(),
            GroupConstants.DEFAULT_PARENT_GROUP_ID, true, true, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
            new GroupNameComparator(true));

    Assert.assertEquals(groups.toString(), initialGroupCount, groups.size());

    groups = GroupFinderUtil.findByLayouts(TestPropsValues.getCompanyId(), parentGroup.getGroupId(), true, true,
            QueryUtil.ALL_POS, QueryUtil.ALL_POS, new GroupNameComparator(true));

    Assert.assertEquals(groups.toString(), 2, groups.size());
}