001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.util.ReferenceRegistry;
021    
022    /**
023     * Provides the remote service utility for Group. This utility wraps
024     * {@link com.liferay.portal.service.impl.GroupServiceImpl} and is the
025     * primary access point for service operations in application layer code running
026     * on a remote server. Methods of this service are expected to have security
027     * checks based on the propagated JAAS credentials because this service can be
028     * accessed remotely.
029     *
030     * @author Brian Wing Shun Chan
031     * @see GroupService
032     * @see com.liferay.portal.service.base.GroupServiceBaseImpl
033     * @see com.liferay.portal.service.impl.GroupServiceImpl
034     * @generated
035     */
036    @ProviderType
037    public class GroupServiceUtil {
038            /*
039             * NOTE FOR DEVELOPERS:
040             *
041             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.GroupServiceImpl} and rerun ServiceBuilder to regenerate this class.
042             */
043    
044            /**
045            * Returns the Spring bean ID for this bean.
046            *
047            * @return the Spring bean ID for this bean
048            */
049            public static java.lang.String getBeanIdentifier() {
050                    return getService().getBeanIdentifier();
051            }
052    
053            /**
054            * Sets the Spring bean ID for this bean.
055            *
056            * @param beanIdentifier the Spring bean ID for this bean
057            */
058            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
059                    getService().setBeanIdentifier(beanIdentifier);
060            }
061    
062            /**
063            * Adds a group.
064            *
065            * @param parentGroupId the primary key of the parent group
066            * @param liveGroupId the primary key of the live group
067            * @param name the entity's name
068            * @param description the group's description (optionally
069            <code>null</code>)
070            * @param type the group's type. For more information see {@link
071            com.liferay.portal.model.GroupConstants}
072            * @param friendlyURL the group's friendlyURL (optionally
073            <code>null</code>)
074            * @param site whether the group is to be associated with a main site
075            * @param active whether the group is active
076            * @param serviceContext the service context to be applied (optionally
077            <code>null</code>). Can set the asset category IDs and asset tag
078            names for the group, and can set whether the group is for staging
079            * @return the group
080            * @throws PortalException if the user did not have permission to add the
081            group, if a creator could not be found, if the group's
082            information was invalid, if a layout could not be found, or if a
083            valid friendly URL could not be created for the group
084            * @throws SystemException if a system exception occurred
085            */
086            public static com.liferay.portal.model.Group addGroup(long parentGroupId,
087                    long liveGroupId, java.lang.String name, java.lang.String description,
088                    int type, boolean manualMembership, int membershipRestriction,
089                    java.lang.String friendlyURL, boolean site, boolean active,
090                    com.liferay.portal.service.ServiceContext serviceContext)
091                    throws com.liferay.portal.kernel.exception.PortalException,
092                            com.liferay.portal.kernel.exception.SystemException {
093                    return getService()
094                                       .addGroup(parentGroupId, liveGroupId, name, description,
095                            type, manualMembership, membershipRestriction, friendlyURL, site,
096                            active, serviceContext);
097            }
098    
099            /**
100            * Adds the group using the group default live group ID.
101            *
102            * @param parentGroupId the primary key of the parent group
103            * @param name the entity's name
104            * @param description the group's description (optionally
105            <code>null</code>)
106            * @param type the group's type. For more information see {@link
107            com.liferay.portal.model.GroupConstants}
108            * @param friendlyURL the group's friendlyURL
109            * @param site whether the group is to be associated with a main site
110            * @param active whether the group is active
111            * @param serviceContext the service context to be applied (optionally
112            <code>null</code>). Can set asset category IDs and asset tag
113            names for the group, and can set whether the group is for
114            staging
115            * @return the group
116            * @throws PortalException if the user did not have permission to add
117            the group, if a creator could not be found, if the group's
118            information was invalid, if a layout could not be found, or
119            if a valid friendly URL could not be created for the group
120            * @throws SystemException if a system exception occurred
121            * @deprecated As of 6.2.0, replaced by {@link #addGroup(long, long, String,
122            String, int, boolean, int, String, boolean, boolean,
123            ServiceContext)}
124            */
125            public static com.liferay.portal.model.Group addGroup(long parentGroupId,
126                    java.lang.String name, java.lang.String description, int type,
127                    java.lang.String friendlyURL, boolean site, boolean active,
128                    com.liferay.portal.service.ServiceContext serviceContext)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    return getService()
132                                       .addGroup(parentGroupId, name, description, type,
133                            friendlyURL, site, active, serviceContext);
134            }
135    
136            /**
137            * @deprecated As of 6.2.0, replaced by {@link #addGroup(long, String,
138            String, int, String, boolean, boolean, ServiceContext)}
139            */
140            public static com.liferay.portal.model.Group addGroup(
141                    java.lang.String name, java.lang.String description, int type,
142                    java.lang.String friendlyURL, boolean site, boolean active,
143                    com.liferay.portal.service.ServiceContext serviceContext)
144                    throws com.liferay.portal.kernel.exception.PortalException,
145                            com.liferay.portal.kernel.exception.SystemException {
146                    return getService()
147                                       .addGroup(name, description, type, friendlyURL, site,
148                            active, serviceContext);
149            }
150    
151            /**
152            * Adds the groups to the role.
153            *
154            * @param roleId the primary key of the role
155            * @param groupIds the primary keys of the groups
156            * @throws PortalException if the user did not have permission to update the
157            role
158            * @throws SystemException if a system exception occurred
159            */
160            public static void addRoleGroups(long roleId, long[] groupIds)
161                    throws com.liferay.portal.kernel.exception.PortalException,
162                            com.liferay.portal.kernel.exception.SystemException {
163                    getService().addRoleGroups(roleId, groupIds);
164            }
165    
166            /**
167            * Checks that the current user is permitted to use the group for Remote
168            * Staging.
169            *
170            * @param groupId the primary key of the group
171            * @throws PortalException if a group with the primary key could not be
172            found, if the current user did not have permission to view the
173            group, or if the group's company was different from the current
174            user's company
175            * @throws SystemException if a system exception occurred
176            */
177            public static void checkRemoteStagingGroup(long groupId)
178                    throws com.liferay.portal.kernel.exception.PortalException,
179                            com.liferay.portal.kernel.exception.SystemException {
180                    getService().checkRemoteStagingGroup(groupId);
181            }
182    
183            /**
184            * Deletes the group.
185            *
186            * <p>
187            * The group is unstaged and its assets and resources including layouts,
188            * membership requests, subscriptions, teams, blogs, bookmarks, calendar
189            * events, image gallery, journals, message boards, polls, shopping related
190            * entities, software catalog, and wikis are also deleted.
191            * </p>
192            *
193            * @param groupId the primary key of the group
194            * @throws PortalException if the user did not have permission to delete the
195            group or its assets or resources, if a group with the primary key
196            could not be found, or if the group was a system group
197            * @throws SystemException if a system exception occurred
198            */
199            public static void deleteGroup(long groupId)
200                    throws com.liferay.portal.kernel.exception.PortalException,
201                            com.liferay.portal.kernel.exception.SystemException {
202                    getService().deleteGroup(groupId);
203            }
204    
205            public static void disableStaging(long groupId)
206                    throws com.liferay.portal.kernel.exception.PortalException,
207                            com.liferay.portal.kernel.exception.SystemException {
208                    getService().disableStaging(groupId);
209            }
210    
211            public static void enableStaging(long groupId)
212                    throws com.liferay.portal.kernel.exception.PortalException,
213                            com.liferay.portal.kernel.exception.SystemException {
214                    getService().enableStaging(groupId);
215            }
216    
217            /**
218            * Returns the company group.
219            *
220            * @param companyId the primary key of the company
221            * @return the group associated with the company
222            * @throws PortalException if a matching group could not be found
223            * @throws SystemException if a system exception occurred
224            */
225            public static com.liferay.portal.model.Group getCompanyGroup(long companyId)
226                    throws com.liferay.portal.kernel.exception.PortalException,
227                            com.liferay.portal.kernel.exception.SystemException {
228                    return getService().getCompanyGroup(companyId);
229            }
230    
231            /**
232            * Returns the group with the primary key.
233            *
234            * @param groupId the primary key of the group
235            * @return the group with the primary key
236            * @throws PortalException if a group with the primary key could not be
237            found or if the current user did not have permission to view the
238            group
239            * @throws SystemException if a system exception occurred
240            */
241            public static com.liferay.portal.model.Group getGroup(long groupId)
242                    throws com.liferay.portal.kernel.exception.PortalException,
243                            com.liferay.portal.kernel.exception.SystemException {
244                    return getService().getGroup(groupId);
245            }
246    
247            /**
248            * Returns the group with the name.
249            *
250            * @param companyId the primary key of the company
251            * @param name the group's name
252            * @return the group with the name
253            * @throws PortalException if a matching group could not be found or if the
254            current user did not have permission to view the group
255            * @throws SystemException if a system exception occurred
256            */
257            public static com.liferay.portal.model.Group getGroup(long companyId,
258                    java.lang.String name)
259                    throws com.liferay.portal.kernel.exception.PortalException,
260                            com.liferay.portal.kernel.exception.SystemException {
261                    return getService().getGroup(companyId, name);
262            }
263    
264            /**
265            * Returns all the groups that are direct children of the parent group.
266            *
267            * @param companyId the primary key of the company
268            * @param parentGroupId the primary key of the parent group
269            * @param site whether the group is to be associated with a main site
270            * @return the matching groups, or <code>null</code> if no matches were
271            found
272            * @throws PortalException if the user did not have permission to view the
273            group or if a portal exception occurred
274            * @throws SystemException if a system exception occurred
275            */
276            public static java.util.List<com.liferay.portal.model.Group> getGroups(
277                    long companyId, long parentGroupId, boolean site)
278                    throws com.liferay.portal.kernel.exception.PortalException,
279                            com.liferay.portal.kernel.exception.SystemException {
280                    return getService().getGroups(companyId, parentGroupId, site);
281            }
282    
283            /**
284            * Returns a range of all the site groups for which the user has control
285            * panel access.
286            *
287            * @param portlets the portlets to manage
288            * @param max the upper bound of the range of groups to consider (not
289            inclusive)
290            * @return the range of site groups for which the user has Control Panel
291            access
292            * @throws PortalException if a portal exception occurred
293            * @throws SystemException if a system exception occurred
294            */
295            public static java.util.List<com.liferay.portal.model.Group> getManageableSiteGroups(
296                    java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max)
297                    throws com.liferay.portal.kernel.exception.PortalException,
298                            com.liferay.portal.kernel.exception.SystemException {
299                    return getService().getManageableSiteGroups(portlets, max);
300            }
301    
302            /**
303            * Returns a range of all the site groups for which the user has control
304            * panel access.
305            *
306            * @param portlets the portlets to manage
307            * @param max the upper bound of the range of groups to consider (not
308            inclusive)
309            * @return the range of site groups for which the user has Control Panel
310            access
311            * @throws PortalException if a portal exception occurred
312            * @throws SystemException if a system exception occurred
313            * @deprecated As of 6.2.0, replaced by {@link
314            #getManageableSiteGroups(Collection, int)}
315            */
316            public static java.util.List<com.liferay.portal.model.Group> getManageableSites(
317                    java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max)
318                    throws com.liferay.portal.kernel.exception.PortalException,
319                            com.liferay.portal.kernel.exception.SystemException {
320                    return getService().getManageableSites(portlets, max);
321            }
322    
323            /**
324            * Returns the groups associated with the organizations.
325            *
326            * @param organizations the organizations
327            * @return the groups associated with the organizations
328            * @throws PortalException if a portal exception occurred
329            * @throws SystemException if a system exception occurred
330            */
331            public static java.util.List<com.liferay.portal.model.Group> getOrganizationsGroups(
332                    java.util.List<com.liferay.portal.model.Organization> organizations)
333                    throws com.liferay.portal.kernel.exception.PortalException,
334                            com.liferay.portal.kernel.exception.SystemException {
335                    return getService().getOrganizationsGroups(organizations);
336            }
337    
338            /**
339            * Returns the group associated with the user.
340            *
341            * @param companyId the primary key of the company
342            * @param userId the primary key of the user
343            * @return the group associated with the user
344            * @throws PortalException if a matching group could not be found or if the
345            current user did not have permission to view the group
346            * @throws SystemException if a system exception occurred
347            */
348            public static com.liferay.portal.model.Group getUserGroup(long companyId,
349                    long userId)
350                    throws com.liferay.portal.kernel.exception.PortalException,
351                            com.liferay.portal.kernel.exception.SystemException {
352                    return getService().getUserGroup(companyId, userId);
353            }
354    
355            /**
356            * Returns the groups associated with the user groups.
357            *
358            * @param userGroups the user groups
359            * @return the groups associated with the user groups
360            * @throws PortalException if any one of the user group's group could not be
361            found
362            * @throws SystemException if a system exception occurred
363            */
364            public static java.util.List<com.liferay.portal.model.Group> getUserGroupsGroups(
365                    java.util.List<com.liferay.portal.model.UserGroup> userGroups)
366                    throws com.liferay.portal.kernel.exception.PortalException,
367                            com.liferay.portal.kernel.exception.SystemException {
368                    return getService().getUserGroupsGroups(userGroups);
369            }
370    
371            /**
372            * Returns the range of all groups associated with the user's organization
373            * groups, including the ancestors of the organization groups, unless portal
374            * property <code>organizations.membership.strict</code> is set to
375            * <code>true</code>.
376            *
377            * <p>
378            * Useful when paginating results. Returns a maximum of <code>end -
379            * start</code> instances. <code>start</code> and <code>end</code> are not
380            * primary keys, they are indexes in the result set. Thus, <code>0</code>
381            * refers to the first result in the set. Setting both <code>start</code>
382            * and <code>end</code> to {@link
383            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
384            * result set.
385            * </p>
386            *
387            * @param userId the primary key of the user
388            * @param start the lower bound of the range of groups to consider
389            * @param end the upper bound of the range of groups to consider (not
390            inclusive)
391            * @return the range of groups associated with the user's organizations
392            * @throws PortalException if a user with the primary key could not be found
393            or if another portal exception occurred
394            * @throws SystemException if a system exception occurred
395            */
396            public static java.util.List<com.liferay.portal.model.Group> getUserOrganizationsGroups(
397                    long userId, int start, int end)
398                    throws com.liferay.portal.kernel.exception.PortalException,
399                            com.liferay.portal.kernel.exception.SystemException {
400                    return getService().getUserOrganizationsGroups(userId, start, end);
401            }
402    
403            /**
404            * @deprecated As of 6.2.0, replaced by {@link #getUserSitesGroups(long,
405            String[], boolean, int)}
406            */
407            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
408                    long userId, java.lang.String[] classNames,
409                    boolean includeControlPanel, int max)
410                    throws com.liferay.portal.kernel.exception.PortalException,
411                            com.liferay.portal.kernel.exception.SystemException {
412                    return getService()
413                                       .getUserPlaces(userId, classNames, includeControlPanel, max);
414            }
415    
416            /**
417            * Returns the user's groups &quot;sites&quot; associated with the group
418            * entity class names, including the Control Panel group if the user is
419            * permitted to view the Control Panel.
420            *
421            * <ul>
422            * <li>
423            * Class name &quot;User&quot; includes the user's layout set
424            * group.
425            * </li>
426            * <li>
427            * Class name &quot;Organization&quot; includes the user's
428            * immediate organization groups and inherited organization groups.
429            * </li>
430            * <li>
431            * Class name &quot;Group&quot; includes the user's immediate
432            * organization groups and site groups.
433            * </li>
434            * <li>
435            * A <code>classNames</code>
436            * value of <code>null</code> includes the user's layout set group,
437            * organization groups, inherited organization groups, and site groups.
438            * </li>
439            * </ul>
440            *
441            * @param userId the primary key of the user
442            * @param classNames the group entity class names (optionally
443            <code>null</code>). For more information see {@link
444            #getUserSitesGroups(long, String[], int)}
445            * @param max the maximum number of groups to return
446            * @return the user's groups &quot;sites&quot;
447            * @throws PortalException if a portal exception occurred
448            * @throws SystemException if a system exception occurred
449            * @deprecated As of 6.2.0, replaced by {@link #getUserSitesGroups(long,
450            String[], int)}
451            */
452            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
453                    long userId, java.lang.String[] classNames, int max)
454                    throws com.liferay.portal.kernel.exception.PortalException,
455                            com.liferay.portal.kernel.exception.SystemException {
456                    return getService().getUserPlaces(userId, classNames, max);
457            }
458    
459            /**
460            * Returns the guest or current user's groups &quot;sites&quot; associated
461            * with the group entity class names, including the Control Panel group if
462            * the user is permitted to view the Control Panel.
463            *
464            * <ul>
465            * <li>
466            * Class name &quot;User&quot; includes the user's layout set
467            * group.
468            * </li>
469            * <li>
470            * Class name &quot;Organization&quot; includes the user's
471            * immediate organization groups and inherited organization groups.
472            * </li>
473            * <li>
474            * Class name &quot;Group&quot; includes the user's immediate
475            * organization groups and site groups.
476            * </li>
477            * <li>
478            * A <code>classNames</code>
479            * value of <code>null</code> includes the user's layout set group,
480            * organization groups, inherited organization groups, and site groups.
481            * </li>
482            * </ul>
483            *
484            * @param classNames the group entity class names (optionally
485            <code>null</code>). For more information see {@link
486            #getUserSitesGroups(String[], int)}
487            * @param max the maximum number of groups to return
488            * @return the user's groups &quot;sites&quot;
489            * @throws PortalException if a portal exception occurred
490            * @throws SystemException if a system exception occurred
491            * @deprecated As of 6.2.0, replaced by {@link #getUserSitesGroups(
492            String[], int)}
493            */
494            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
495                    java.lang.String[] classNames, int max)
496                    throws com.liferay.portal.kernel.exception.PortalException,
497                            com.liferay.portal.kernel.exception.SystemException {
498                    return getService().getUserPlaces(classNames, max);
499            }
500    
501            /**
502            * Returns the number of the guest or current user's groups
503            * &quot;sites&quot; associated with the group entity class names, including
504            * the Control Panel group if the user is permitted to view the Control
505            * Panel.
506            *
507            * @return the number of user's groups &quot;sites&quot;
508            * @throws PortalException if a portal exception occurred
509            * @throws SystemException if a system exception occurred
510            * @deprecated As of 6.2.0, replaced by {@link #getUserSitesGroupsCount()}
511            */
512            public static int getUserPlacesCount()
513                    throws com.liferay.portal.kernel.exception.PortalException,
514                            com.liferay.portal.kernel.exception.SystemException {
515                    return getService().getUserPlacesCount();
516            }
517    
518            /**
519            * Returns the guest or current user's layout set group, organization
520            * groups, inherited organization groups, and site groups.
521            *
522            * @return the user's layout set group, organization groups, and
523            inherited organization groups, and site groups
524            * @throws PortalException if a portal exception occurred
525            * @throws SystemException if a system exception occurred
526            * @deprecated As of 6.2.0, replaced by {@link #getUserSitesGroups}
527            */
528            public static java.util.List<com.liferay.portal.model.Group> getUserSites()
529                    throws com.liferay.portal.kernel.exception.PortalException,
530                            com.liferay.portal.kernel.exception.SystemException {
531                    return getService().getUserSites();
532            }
533    
534            public static java.util.List<com.liferay.portal.model.Group> getUserSitesGroups()
535                    throws com.liferay.portal.kernel.exception.PortalException,
536                            com.liferay.portal.kernel.exception.SystemException {
537                    return getService().getUserSitesGroups();
538            }
539    
540            public static java.util.List<com.liferay.portal.model.Group> getUserSitesGroups(
541                    long userId, java.lang.String[] classNames,
542                    boolean includeControlPanel, int max)
543                    throws com.liferay.portal.kernel.exception.PortalException,
544                            com.liferay.portal.kernel.exception.SystemException {
545                    return getService()
546                                       .getUserSitesGroups(userId, classNames, includeControlPanel,
547                            max);
548            }
549    
550            /**
551            * Returns the user's groups &quot;sites&quot; associated with the group
552            * entity class names, including the Control Panel group if the user is
553            * permitted to view the Control Panel.
554            *
555            * <ul>
556            * <li>
557            * Class name &quot;User&quot; includes the user's layout set
558            * group.
559            * </li>
560            * <li>
561            * Class name &quot;Organization&quot; includes the user's
562            * immediate organization groups and inherited organization groups.
563            * </li>
564            * <li>
565            * Class name &quot;Group&quot; includes the user's immediate
566            * organization groups and site groups.
567            * </li>
568            * <li>
569            * A <code>classNames</code>
570            * value of <code>null</code> includes the user's layout set group,
571            * organization groups, inherited organization groups, and site groups.
572            * </li>
573            * </ul>
574            *
575            * @param userId the primary key of the user
576            * @param classNames the group entity class names (optionally
577            <code>null</code>). For more information see {@link
578            #getUserSitesGroups(long, String[], boolean, int)}
579            * @param max the maximum number of groups to return
580            * @return the user's groups &quot;sites&quot;
581            * @throws PortalException if a portal exception occurred
582            * @throws SystemException if a system exception occurred
583            */
584            public static java.util.List<com.liferay.portal.model.Group> getUserSitesGroups(
585                    long userId, java.lang.String[] classNames, int max)
586                    throws com.liferay.portal.kernel.exception.PortalException,
587                            com.liferay.portal.kernel.exception.SystemException {
588                    return getService().getUserSitesGroups(userId, classNames, max);
589            }
590    
591            /**
592            * Returns the guest or current user's groups &quot;sites&quot; associated
593            * with the group entity class names, including the Control Panel group if
594            * the user is permitted to view the Control Panel.
595            *
596            * <ul>
597            * <li>
598            * Class name &quot;User&quot; includes the user's layout set
599            * group.
600            * </li>
601            * <li>
602            * Class name &quot;Organization&quot; includes the user's
603            * immediate organization groups and inherited organization groups.
604            * </li>
605            * <li>
606            * Class name &quot;Group&quot; includes the user's immediate
607            * organization groups and site groups.
608            * </li>
609            * <li>
610            * A <code>classNames</code>
611            * value of <code>null</code> includes the user's layout set group,
612            * organization groups, inherited organization groups, and site groups.
613            * </li>
614            * </ul>
615            *
616            * @param classNames the group entity class names (optionally
617            <code>null</code>). For more information see {@link
618            #getUserSitesGroups(long, String[], boolean, int)}
619            * @param max the maximum number of groups to return
620            * @return the user's groups &quot;sites&quot;
621            * @throws PortalException if a portal exception occurred
622            * @throws SystemException if a system exception occurred
623            */
624            public static java.util.List<com.liferay.portal.model.Group> getUserSitesGroups(
625                    java.lang.String[] classNames, int max)
626                    throws com.liferay.portal.kernel.exception.PortalException,
627                            com.liferay.portal.kernel.exception.SystemException {
628                    return getService().getUserSitesGroups(classNames, max);
629            }
630    
631            /**
632            * Returns the number of the guest or current user's groups
633            * &quot;sites&quot; associated with the group entity class names, including
634            * the Control Panel group if the user is permitted to view the Control
635            * Panel.
636            *
637            * @return the number of user's groups &quot;sites&quot;
638            * @throws PortalException if a portal exception occurred
639            * @throws SystemException if a system exception occurred
640            */
641            public static int getUserSitesGroupsCount()
642                    throws com.liferay.portal.kernel.exception.PortalException,
643                            com.liferay.portal.kernel.exception.SystemException {
644                    return getService().getUserSitesGroupsCount();
645            }
646    
647            /**
648            * Returns <code>true</code> if the user is associated with the group,
649            * including the user's inherited organizations and user groups. System and
650            * staged groups are not included.
651            *
652            * @param userId the primary key of the user
653            * @param groupId the primary key of the group
654            * @return <code>true</code> if the user is associated with the group;
655            <code>false</code> otherwise
656            * @throws PortalException if the current user did not have permission to
657            view the user or group members
658            * @throws SystemException if a system exception occurred
659            */
660            public static boolean hasUserGroup(long userId, long groupId)
661                    throws com.liferay.portal.kernel.exception.PortalException,
662                            com.liferay.portal.kernel.exception.SystemException {
663                    return getService().hasUserGroup(userId, groupId);
664            }
665    
666            /**
667            * Returns an ordered range of all the site groups and organization groups
668            * that match the name and description, optionally including the user's
669            * inherited organization groups and user groups. System and staged groups
670            * are not included.
671            *
672            * <p>
673            * Useful when paginating results. Returns a maximum of <code>end -
674            * start</code> instances. <code>start</code> and <code>end</code> are not
675            * primary keys, they are indexes in the result set. Thus, <code>0</code>
676            * refers to the first result in the set. Setting both <code>start</code>
677            * and <code>end</code> to {@link
678            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
679            * result set.
680            * </p>
681            *
682            * @param companyId the primary key of the company
683            * @param name the group's name (optionally <code>null</code>)
684            * @param description the group's description (optionally
685            <code>null</code>)
686            * @param params the finder params (optionally <code>null</code>). To
687            include the user's inherited organizations and user groups in the
688            search, add entries having &quot;usersGroups&quot; and
689            &quot;inherit&quot; as keys mapped to the the user's ID. For more
690            information see {@link
691            com.liferay.portal.service.persistence.GroupFinder}
692            * @param start the lower bound of the range of groups to return
693            * @param end the upper bound of the range of groups to return (not
694            inclusive)
695            * @return the matching groups ordered by name
696            * @throws PortalException if a portal exception occurred
697            * @throws SystemException if a system exception occurred
698            */
699            public static java.util.List<com.liferay.portal.model.Group> search(
700                    long companyId, java.lang.String name, java.lang.String description,
701                    java.lang.String[] params, int start, int end)
702                    throws com.liferay.portal.kernel.exception.PortalException,
703                            com.liferay.portal.kernel.exception.SystemException {
704                    return getService()
705                                       .search(companyId, name, description, params, start, end);
706            }
707    
708            /**
709            * Returns the number of groups and organization groups that match the name
710            * and description, optionally including the user's inherited organizations
711            * and user groups. System and staged groups are not included.
712            *
713            * @param companyId the primary key of the company
714            * @param name the group's name (optionally <code>null</code>)
715            * @param description the group's description (optionally
716            <code>null</code>)
717            * @param params the finder params (optionally <code>null</code>). To
718            include the user's inherited organizations and user groups in the
719            search, add entries having &quot;usersGroups&quot; and
720            &quot;inherit&quot; as keys mapped to the the user's ID. For more
721            information see {@link
722            com.liferay.portal.service.persistence.GroupFinder}
723            * @return the number of matching groups
724            * @throws SystemException if a system exception occurred
725            */
726            public static int searchCount(long companyId, java.lang.String name,
727                    java.lang.String description, java.lang.String[] params)
728                    throws com.liferay.portal.kernel.exception.SystemException {
729                    return getService().searchCount(companyId, name, description, params);
730            }
731    
732            /**
733            * Sets the groups associated with the role, removing and adding
734            * associations as necessary.
735            *
736            * @param roleId the primary key of the role
737            * @param groupIds the primary keys of the groups
738            * @throws PortalException if the user did not have permission to update
739            update the role
740            * @throws SystemException if a system exception occurred
741            */
742            public static void setRoleGroups(long roleId, long[] groupIds)
743                    throws com.liferay.portal.kernel.exception.PortalException,
744                            com.liferay.portal.kernel.exception.SystemException {
745                    getService().setRoleGroups(roleId, groupIds);
746            }
747    
748            /**
749            * Removes the groups from the role.
750            *
751            * @param roleId the primary key of the role
752            * @param groupIds the primary keys of the groups
753            * @throws PortalException if the user did not have permission to update the
754            role
755            * @throws SystemException if a system exception occurred
756            */
757            public static void unsetRoleGroups(long roleId, long[] groupIds)
758                    throws com.liferay.portal.kernel.exception.PortalException,
759                            com.liferay.portal.kernel.exception.SystemException {
760                    getService().unsetRoleGroups(roleId, groupIds);
761            }
762    
763            /**
764            * Updates the group's friendly URL.
765            *
766            * @param groupId the primary key of the group
767            * @param friendlyURL the group's new friendlyURL (optionally
768            <code>null</code>)
769            * @return the group
770            * @throws PortalException if the user did not have permission to update the
771            group, if a group with the primary key could not be found, or if
772            a valid friendly URL could not be created for the group
773            * @throws SystemException if a system exception occurred
774            */
775            public static com.liferay.portal.model.Group updateFriendlyURL(
776                    long groupId, java.lang.String friendlyURL)
777                    throws com.liferay.portal.kernel.exception.PortalException,
778                            com.liferay.portal.kernel.exception.SystemException {
779                    return getService().updateFriendlyURL(groupId, friendlyURL);
780            }
781    
782            /**
783            * Updates the group.
784            *
785            * @param groupId the primary key of the group
786            * @param parentGroupId the primary key of the parent group
787            * @param name the group's new name
788            * @param description the group's new description (optionally
789            <code>null</code>)
790            * @param type the group's new type. For more information see {@link
791            com.liferay.portal.model.GroupConstants}
792            * @param friendlyURL the group's new friendlyURL (optionally
793            <code>null</code>)
794            * @param active whether the group is active
795            * @param serviceContext the service context to be applied (optionally
796            <code>null</code>). Can set the asset category IDs and asset tag
797            names for the group.
798            * @return the group
799            * @throws PortalException if the user did not have permission to update the
800            group, if a group with the primary key could not be found, if the
801            friendly URL was invalid or could one not be created
802            * @throws SystemException if a system exception occurred
803            */
804            public static com.liferay.portal.model.Group updateGroup(long groupId,
805                    long parentGroupId, java.lang.String name,
806                    java.lang.String description, int type, boolean manualMembership,
807                    int membershipRestriction, java.lang.String friendlyURL,
808                    boolean active, com.liferay.portal.service.ServiceContext serviceContext)
809                    throws com.liferay.portal.kernel.exception.PortalException,
810                            com.liferay.portal.kernel.exception.SystemException {
811                    return getService()
812                                       .updateGroup(groupId, parentGroupId, name, description,
813                            type, manualMembership, membershipRestriction, friendlyURL, active,
814                            serviceContext);
815            }
816    
817            /**
818            * Updates the group's type settings.
819            *
820            * @param groupId the primary key of the group
821            * @param typeSettings the group's new type settings (optionally
822            <code>null</code>)
823            * @return the group
824            * @throws PortalException if the user did not have permission to update the
825            group or if a group with the primary key could not be found
826            * @throws SystemException if a system exception occurred
827            */
828            public static com.liferay.portal.model.Group updateGroup(long groupId,
829                    java.lang.String typeSettings)
830                    throws com.liferay.portal.kernel.exception.PortalException,
831                            com.liferay.portal.kernel.exception.SystemException {
832                    return getService().updateGroup(groupId, typeSettings);
833            }
834    
835            public static void updateStagedPortlets(long groupId,
836                    java.util.Map<java.lang.String, java.lang.String> stagedPortletIds)
837                    throws com.liferay.portal.kernel.exception.PortalException,
838                            com.liferay.portal.kernel.exception.SystemException {
839                    getService().updateStagedPortlets(groupId, stagedPortletIds);
840            }
841    
842            public static GroupService getService() {
843                    if (_service == null) {
844                            _service = (GroupService)PortalBeanLocatorUtil.locate(GroupService.class.getName());
845    
846                            ReferenceRegistry.registerReference(GroupServiceUtil.class,
847                                    "_service");
848                    }
849    
850                    return _service;
851            }
852    
853            /**
854             * @deprecated As of 6.2.0
855             */
856            public void setService(GroupService service) {
857            }
858    
859            private static GroupService _service;
860    }