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