Example usage for com.liferay.portal.kernel.service GroupLocalServiceUtil getCompanyGroups

List of usage examples for com.liferay.portal.kernel.service GroupLocalServiceUtil getCompanyGroups

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service GroupLocalServiceUtil getCompanyGroups.

Prototype

public static java.util.List<com.liferay.portal.kernel.model.Group> getCompanyGroups(long companyId, int start,
        int end) 

Source Link

Document

Returns a range of all the groups associated with the company.

Usage

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularGroupServiceImpl.java

License:Open Source License

@Override
public List<Group> getInstanceGroups(long companyId) throws PortalException {

    _log.info("Getting all groups for company id: " + String.valueOf(companyId));

    _log.debug("    ... security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_USER_GROUPS);

    _log.debug("   ... getting information ...");

    int groupCount = GroupLocalServiceUtil.getCompanyGroupsCount(companyId);
    List<Group> instanceGroups = null;

    if (groupCount > 0) {
        instanceGroups = GroupLocalServiceUtil.getCompanyGroups(companyId, 0, groupCount - 1);
    }/*from  www  .j  a va  2 s  .co m*/

    return instanceGroups;
}

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularSiteServiceImpl.java

License:Open Source License

@Override
public List<Group> getInstanceSites(long companyId) throws PortalException {

    _log.info("Getting all groups for company id: " + String.valueOf(companyId));

    _log.debug("    ... security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.LIST_PAGES);

    _log.debug("   ... getting information ...");

    int groupCount = GroupLocalServiceUtil.getCompanyGroupsCount(companyId);
    List<Group> instanceGroups = null;
    List<Group> sites = null;

    if (groupCount > 0) {
        instanceGroups = GroupLocalServiceUtil.getCompanyGroups(companyId, 0, groupCount - 1);
        sites = this.filterSites(instanceGroups);
    }/*  ww w .  j a  v a  2s.co  m*/

    return sites;
}

From source file:jorgediazest.indexchecker.portlet.IndexCheckerPortlet.java

License:Open Source License

public List<Long> getGroupIds(Company company, String[] filterGroupIdArr) throws SystemException {

    List<Group> groups = GroupLocalServiceUtil.getCompanyGroups(company.getCompanyId(), QueryUtil.ALL_POS,
            QueryUtil.ALL_POS);//from  w  ww  . j av a2s  .  com

    List<Long> groupIds = new ArrayList<Long>();

    for (Group group : groups) {
        if (filterGroupIdArr == null) {
            groupIds.add(group.getGroupId());
            continue;
        }

        String groupIdStr = "" + group.getGroupId();

        for (int i = 0; i < filterGroupIdArr.length; i++) {
            if (groupIdStr.equals(filterGroupIdArr[i])) {
                groupIds.add(group.getGroupId());
                break;
            }
        }
    }

    return groupIds;
}

From source file:jorgediazest.stagingchecker.portlet.StagingCheckerPortlet.java

License:Open Source License

public List<Long> getGroupIds(Company company, String[] filterGroupIdArr) throws SystemException {

    if ((filterGroupIdArr != null) && (filterGroupIdArr.length == 1) && filterGroupIdArr[0].equals("-1000")) {

        filterGroupIdArr = null;// w  w w .  j a v  a  2 s  .  c  om
    }

    List<Group> groups = GroupLocalServiceUtil.getCompanyGroups(company.getCompanyId(), QueryUtil.ALL_POS,
            QueryUtil.ALL_POS);

    List<Long> groupIds = new ArrayList<Long>();

    for (Group group : groups) {
        if (!group.hasStagingGroup()) {
            continue;
        }

        if (filterGroupIdArr == null) {
            groupIds.add(group.getGroupId());
            continue;
        }

        String groupIdStr = "" + group.getGroupId();

        for (int i = 0; i < filterGroupIdArr.length; i++) {
            if (groupIdStr.equals(filterGroupIdArr[i])) {
                groupIds.add(group.getGroupId());
                break;
            }
        }
    }

    return groupIds;
}