List of usage examples for com.liferay.portal.kernel.model Group isRoot
public boolean isRoot();
From source file:com.liferay.asset.publisher.web.internal.ParentSitesItemSelectorView.java
License:Open Source License
@Override public boolean isVisible(ThemeDisplay themeDisplay) { Group siteGroup = themeDisplay.getSiteGroup(); if (siteGroup.isLayoutPrototype()) { return false; }/*from w ww .j av a 2s.c o m*/ if (siteGroup.isLayoutSetPrototype()) { return false; } if (siteGroup.isRoot()) { return false; } return true; }
From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java
License:Open Source License
@Test public void testScopes() throws Exception { Group group = GroupTestUtil.addGroup(); Layout layout = LayoutTestUtil.addLayout(group); Assert.assertFalse(layout.hasScopeGroup()); Map<Locale, String> nameMap = new HashMap<>(); nameMap.put(LocaleUtil.getDefault(), layout.getName(LocaleUtil.getDefault())); Group scope = GroupLocalServiceUtil.addGroup(TestPropsValues.getUserId(), GroupConstants.DEFAULT_PARENT_GROUP_ID, Layout.class.getName(), layout.getPlid(), GroupConstants.DEFAULT_LIVE_GROUP_ID, nameMap, (Map<Locale, String>) null, 0, true, GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null, false, true, null); Assert.assertFalse(scope.isRoot()); Assert.assertEquals(scope.getParentGroupId(), group.getGroupId()); GroupLocalServiceUtil.deleteGroup(scope); GroupLocalServiceUtil.deleteGroup(group); }
From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java
License:Open Source License
@Test public void testSubsites() throws Exception { Group group1 = GroupTestUtil.addGroup(); Group group11 = GroupTestUtil.addGroup(group1.getGroupId()); Group group111 = GroupTestUtil.addGroup(group11.getGroupId()); Assert.assertTrue(group1.isRoot()); Assert.assertFalse(group11.isRoot()); Assert.assertFalse(group111.isRoot()); Assert.assertEquals(group1.getGroupId(), group11.getParentGroupId()); Assert.assertEquals(group11.getGroupId(), group111.getParentGroupId()); GroupLocalServiceUtil.deleteGroup(group111); GroupLocalServiceUtil.deleteGroup(group11); GroupLocalServiceUtil.deleteGroup(group1); }
From source file:com.liferay.site.service.persistence.test.GroupServiceTest.java
License:Open Source License
protected void testSelectableParentSites(boolean staging) throws Exception { Group group = GroupTestUtil.addGroup(); Assert.assertTrue(group.isRoot()); LinkedHashMap<String, Object> params = new LinkedHashMap<>(); params.put("site", Boolean.TRUE); List<Long> excludedGroupIds = new ArrayList<>(); excludedGroupIds.add(group.getGroupId()); if (staging) { GroupTestUtil.enableLocalStaging(group); Assert.assertTrue(group.hasStagingGroup()); excludedGroupIds.add(group.getStagingGroup().getGroupId()); }//from w w w. j a va2 s. c o m params.put("excludedGroupIds", excludedGroupIds); List<Group> selectableGroups = GroupLocalServiceUtil.search(group.getCompanyId(), null, StringPool.BLANK, params, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); for (Group selectableGroup : selectableGroups) { long selectableGroupId = selectableGroup.getGroupId(); Assert.assertNotEquals("A group cannot be its own parent", group.getGroupId(), selectableGroupId); if (staging) { Assert.assertNotEquals("A group cannot have its live group as parent", group.getLiveGroupId(), selectableGroupId); } } GroupLocalServiceUtil.deleteGroup(group); }