Example usage for com.liferay.portal.kernel.theme ThemeDisplay setScopeGroupId

List of usage examples for com.liferay.portal.kernel.theme ThemeDisplay setScopeGroupId

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.theme ThemeDisplay setScopeGroupId.

Prototype

public void setScopeGroupId(long scopeGroupId) 

Source Link

Usage

From source file:com.liferay.blogs.portlet.test.PortletLayoutFinderTest.java

License:Open Source License

protected ThemeDisplay getThemeDisplay() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    themeDisplay.setScopeGroupId(_group.getGroupId());

    PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(TestPropsValues.getUser());

    themeDisplay.setPermissionChecker(permissionChecker);

    themeDisplay.setPlid(_assetLayout.getPlid());

    return themeDisplay;
}

From source file:com.liferay.calendar.util.test.CalendarUtilTest.java

License:Open Source License

protected ThemeDisplay createThemeDisplay() throws PortalException {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Company company = CompanyLocalServiceUtil.getCompany(_group.getCompanyId());

    themeDisplay.setCompany(company);//ww w.j a  v a2 s.  c om

    themeDisplay.setLocale(LocaleUtil.getDefault());

    themeDisplay.setScopeGroupId(_group.getGroupId());

    themeDisplay.setPermissionChecker(PermissionThreadLocal.getPermissionChecker());

    themeDisplay.setUser(_user);

    return themeDisplay;
}

From source file:com.liferay.item.selector.web.internal.ItemSelectorImplTest.java

License:Open Source License

protected ItemSelectorRendering getItemSelectorRendering() {
    RequestBackedPortletURLFactory requestBackedPortletURLFactory = mock(RequestBackedPortletURLFactory.class);

    LiferayPortletURL mockLiferayPortletURL = mock(LiferayPortletURL.class);

    when(requestBackedPortletURLFactory.createControlPanelRenderURL(Mockito.anyString(),
            Mockito.any(Group.class), Mockito.anyLong(), Mockito.anyLong())).thenReturn(mockLiferayPortletURL);

    Map<String, String[]> parameters = _itemSelectorImpl.getItemSelectorParameters("itemSelectedEventName",
            _mediaItemSelectorCriterion, _flickrItemSelectorCriterion);

    ThemeDisplay themeDisplay = mock(ThemeDisplay.class);

    themeDisplay.setScopeGroupId(12345);

    when(themeDisplay.getScopeGroup()).thenReturn(new GroupImpl());

    return _itemSelectorImpl.getItemSelectorRendering(requestBackedPortletURLFactory, parameters, themeDisplay);
}

From source file:com.liferay.site.admin.web.internal.portlet.SiteAdminPortlet.java

License:Open Source License

protected void updateActive(ActionRequest actionRequest, boolean active) throws Exception {

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

    long groupId = ParamUtil.getLong(actionRequest, "groupId");

    if ((groupId == themeDisplay.getDoAsGroupId()) || (groupId == themeDisplay.getScopeGroupId())
            || (groupId == getRefererGroupId(themeDisplay))) {

        throw new RequiredGroupException.MustNotDeleteCurrentGroup(groupId);
    }/*  w w  w .  j  a v a 2s  .com*/

    Group group = groupService.getGroup(groupId);

    ServiceContext serviceContext = ServiceContextFactory.getInstance(Group.class.getName(), actionRequest);

    groupService.updateGroup(groupId, group.getParentGroupId(), group.getNameMap(), group.getDescriptionMap(),
            group.getType(), group.isManualMembership(), group.getMembershipRestriction(),
            group.getFriendlyURL(), group.isInheritContent(), active, serviceContext);

    themeDisplay.setScopeGroupId(groupId);
}

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

License:Open Source License

@Test
public void testGroupHasCurrentPageScopeDescriptiveName() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Group group = GroupTestUtil.addGroup();

    Group scopeGroup = addScopeGroup(group);

    themeDisplay.setPlid(scopeGroup.getClassPK());

    themeDisplay.setScopeGroupId(_group.getGroupId());

    String scopeDescriptiveName = scopeGroup.getScopeDescriptiveName(themeDisplay);

    Assert.assertTrue(scopeDescriptiveName, scopeDescriptiveName.contains("current-page"));

    GroupLocalServiceUtil.deleteGroup(scopeGroup);

    GroupLocalServiceUtil.deleteGroup(group);
}

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

License:Open Source License

@Test
public void testGroupHasCurrentSiteScopeDescriptiveName() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Group group = GroupTestUtil.addGroup();

    themeDisplay.setScopeGroupId(group.getGroupId());

    String scopeDescriptiveName = group.getScopeDescriptiveName(themeDisplay);

    Assert.assertTrue(scopeDescriptiveName, scopeDescriptiveName.contains("current-site"));

    GroupLocalServiceUtil.deleteGroup(group);
}

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

License:Open Source License

@Test
public void testGroupHasDefaultScopeDescriptiveName() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Group group = GroupTestUtil.addGroup();

    group.setClassName(LayoutPrototype.class.getName());

    themeDisplay.setScopeGroupId(_group.getGroupId());

    String scopeDescriptiveName = group.getScopeDescriptiveName(themeDisplay);

    Assert.assertTrue(scopeDescriptiveName, scopeDescriptiveName.contains("default"));

    GroupLocalServiceUtil.deleteGroup(group);
}

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

License:Open Source License

@Test
public void testGroupIsChildSiteScopeLabel() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Group group = GroupTestUtil.addGroup();

    themeDisplay.setScopeGroupId(group.getGroupId());

    Group subgroup = GroupTestUtil.addGroup(group.getGroupId());

    String scopeLabel = subgroup.getScopeLabel(themeDisplay);

    Assert.assertEquals("child-site", scopeLabel);

    GroupLocalServiceUtil.deleteGroup(subgroup);

    GroupLocalServiceUtil.deleteGroup(group);
}

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

License:Open Source License

@Test
public void testGroupIsCurrentSiteScopeLabel() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Group group = GroupTestUtil.addGroup();

    themeDisplay.setScopeGroupId(group.getGroupId());

    String scopeLabel = group.getScopeLabel(themeDisplay);

    Assert.assertEquals("current-site", scopeLabel);

    GroupLocalServiceUtil.deleteGroup(group);
}

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

License:Open Source License

@Test
public void testGroupIsPageScopeLabel() throws Exception {
    ThemeDisplay themeDisplay = new ThemeDisplay();

    Group group = GroupTestUtil.addGroup();

    Group scopeGroup = addScopeGroup(group);

    themeDisplay.setPlid(scopeGroup.getClassPK());

    themeDisplay.setScopeGroupId(_group.getGroupId());

    String scopeLabel = scopeGroup.getScopeLabel(themeDisplay);

    Assert.assertEquals("page", scopeLabel);

    GroupLocalServiceUtil.deleteGroup(scopeGroup);

    GroupLocalServiceUtil.deleteGroup(group);
}