Example usage for com.liferay.portal.kernel.model User getMySiteGroups

List of usage examples for com.liferay.portal.kernel.model User getMySiteGroups

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model User getMySiteGroups.

Prototype

public java.util.List<Group> getMySiteGroups(String[] classNames, int max)
            throws com.liferay.portal.kernel.exception.PortalException;

Source Link

Usage

From source file:com.liferay.product.navigation.site.administration.internal.display.context.SiteAdministrationPanelCategoryDisplayContext.java

License:Open Source License

public List<Group> getMySites() throws PortalException {
    if (_mySites != null) {
        return _mySites;
    }//w  w w.  ja v a2s  .c  om

    User user = _themeDisplay.getUser();

    _mySites = user.getMySiteGroups(
            new String[] { Company.class.getName(), Group.class.getName(), Organization.class.getName() },
            PropsValues.MY_SITES_MAX_ELEMENTS);

    return _mySites;
}

From source file:com.liferay.product.navigation.user.internal.display.context.MyAccountPanelCategoryDisplayContext.java

License:Open Source License

public Group getMySiteGroup() throws PortalException {
    if (_mySiteGroup != null) {
        return _mySiteGroup;
    }/*  w  w w  .  j  av  a2  s .c  om*/

    User user = _themeDisplay.getUser();

    List<Group> mySiteGroups = user.getMySiteGroups(new String[] { User.class.getName() }, 1);

    if (mySiteGroups.isEmpty()) {
        return null;
    }

    _mySiteGroup = mySiteGroups.get(0);

    return _mySiteGroup;
}

From source file:com.liferay.site.util.GroupSearchProvider.java

License:Open Source License

protected List<Group> getAllGroups(PortletRequest portletRequest) throws PortalException {

    List<Group> groups = new ArrayList<>();

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

    User user = themeDisplay.getUser();

    groups = user.getMySiteGroups(
            new String[] { Company.class.getName(), Group.class.getName(), Organization.class.getName() },
            QueryUtil.ALL_POS);//w  w w  . j  a va  2s .  co m

    long groupId = ParamUtil.getLong(portletRequest, "groupId", GroupConstants.DEFAULT_PARENT_GROUP_ID);

    if (groupId != GroupConstants.DEFAULT_PARENT_GROUP_ID) {
        groups.clear();

        groups.add(_groupLocalService.getGroup(groupId));
    }

    return groups;
}