001    /**
002     * Copyright (c) 2000-2012 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 com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.ReferenceRegistry;
019    
020    /**
021     * The utility for the user group local service. This utility wraps {@link com.liferay.portal.service.impl.UserGroupLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
022     *
023     * <p>
024     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
025     * </p>
026     *
027     * @author Brian Wing Shun Chan
028     * @see UserGroupLocalService
029     * @see com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
030     * @see com.liferay.portal.service.impl.UserGroupLocalServiceImpl
031     * @generated
032     */
033    public class UserGroupLocalServiceUtil {
034            /*
035             * NOTE FOR DEVELOPERS:
036             *
037             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.UserGroupLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
038             */
039    
040            /**
041            * Adds the user group to the database. Also notifies the appropriate model listeners.
042            *
043            * @param userGroup the user group
044            * @return the user group that was added
045            * @throws SystemException if a system exception occurred
046            */
047            public static com.liferay.portal.model.UserGroup addUserGroup(
048                    com.liferay.portal.model.UserGroup userGroup)
049                    throws com.liferay.portal.kernel.exception.SystemException {
050                    return getService().addUserGroup(userGroup);
051            }
052    
053            /**
054            * Creates a new user group with the primary key. Does not add the user group to the database.
055            *
056            * @param userGroupId the primary key for the new user group
057            * @return the new user group
058            */
059            public static com.liferay.portal.model.UserGroup createUserGroup(
060                    long userGroupId) {
061                    return getService().createUserGroup(userGroupId);
062            }
063    
064            /**
065            * Deletes the user group with the primary key from the database. Also notifies the appropriate model listeners.
066            *
067            * @param userGroupId the primary key of the user group
068            * @return the user group that was removed
069            * @throws PortalException if a user group with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static com.liferay.portal.model.UserGroup deleteUserGroup(
073                    long userGroupId)
074                    throws com.liferay.portal.kernel.exception.PortalException,
075                            com.liferay.portal.kernel.exception.SystemException {
076                    return getService().deleteUserGroup(userGroupId);
077            }
078    
079            /**
080            * Deletes the user group from the database. Also notifies the appropriate model listeners.
081            *
082            * @param userGroup the user group
083            * @return the user group that was removed
084            * @throws PortalException
085            * @throws SystemException if a system exception occurred
086            */
087            public static com.liferay.portal.model.UserGroup deleteUserGroup(
088                    com.liferay.portal.model.UserGroup userGroup)
089                    throws com.liferay.portal.kernel.exception.PortalException,
090                            com.liferay.portal.kernel.exception.SystemException {
091                    return getService().deleteUserGroup(userGroup);
092            }
093    
094            public static com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery() {
095                    return getService().dynamicQuery();
096            }
097    
098            /**
099            * Performs a dynamic query on the database and returns the matching rows.
100            *
101            * @param dynamicQuery the dynamic query
102            * @return the matching rows
103            * @throws SystemException if a system exception occurred
104            */
105            @SuppressWarnings("rawtypes")
106            public static java.util.List dynamicQuery(
107                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
108                    throws com.liferay.portal.kernel.exception.SystemException {
109                    return getService().dynamicQuery(dynamicQuery);
110            }
111    
112            /**
113            * Performs a dynamic query on the database and returns a range of the matching rows.
114            *
115            * <p>
116            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
117            * </p>
118            *
119            * @param dynamicQuery the dynamic query
120            * @param start the lower bound of the range of model instances
121            * @param end the upper bound of the range of model instances (not inclusive)
122            * @return the range of matching rows
123            * @throws SystemException if a system exception occurred
124            */
125            @SuppressWarnings("rawtypes")
126            public static java.util.List dynamicQuery(
127                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
128                    int end) throws com.liferay.portal.kernel.exception.SystemException {
129                    return getService().dynamicQuery(dynamicQuery, start, end);
130            }
131    
132            /**
133            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
134            *
135            * <p>
136            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
137            * </p>
138            *
139            * @param dynamicQuery the dynamic query
140            * @param start the lower bound of the range of model instances
141            * @param end the upper bound of the range of model instances (not inclusive)
142            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
143            * @return the ordered range of matching rows
144            * @throws SystemException if a system exception occurred
145            */
146            @SuppressWarnings("rawtypes")
147            public static java.util.List dynamicQuery(
148                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
149                    int end,
150                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
151                    throws com.liferay.portal.kernel.exception.SystemException {
152                    return getService()
153                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
154            }
155    
156            /**
157            * Returns the number of rows that match the dynamic query.
158            *
159            * @param dynamicQuery the dynamic query
160            * @return the number of rows that match the dynamic query
161            * @throws SystemException if a system exception occurred
162            */
163            public static long dynamicQueryCount(
164                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
165                    throws com.liferay.portal.kernel.exception.SystemException {
166                    return getService().dynamicQueryCount(dynamicQuery);
167            }
168    
169            public static com.liferay.portal.model.UserGroup fetchUserGroup(
170                    long userGroupId)
171                    throws com.liferay.portal.kernel.exception.SystemException {
172                    return getService().fetchUserGroup(userGroupId);
173            }
174    
175            /**
176            * Returns the user group with the primary key.
177            *
178            * @param userGroupId the primary key of the user group
179            * @return the user group
180            * @throws PortalException if a user group with the primary key could not be found
181            * @throws SystemException if a system exception occurred
182            */
183            public static com.liferay.portal.model.UserGroup getUserGroup(
184                    long userGroupId)
185                    throws com.liferay.portal.kernel.exception.PortalException,
186                            com.liferay.portal.kernel.exception.SystemException {
187                    return getService().getUserGroup(userGroupId);
188            }
189    
190            public static com.liferay.portal.model.PersistedModel getPersistedModel(
191                    java.io.Serializable primaryKeyObj)
192                    throws com.liferay.portal.kernel.exception.PortalException,
193                            com.liferay.portal.kernel.exception.SystemException {
194                    return getService().getPersistedModel(primaryKeyObj);
195            }
196    
197            /**
198            * Returns a range of all the user groups.
199            *
200            * <p>
201            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
202            * </p>
203            *
204            * @param start the lower bound of the range of user groups
205            * @param end the upper bound of the range of user groups (not inclusive)
206            * @return the range of user groups
207            * @throws SystemException if a system exception occurred
208            */
209            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
210                    int start, int end)
211                    throws com.liferay.portal.kernel.exception.SystemException {
212                    return getService().getUserGroups(start, end);
213            }
214    
215            /**
216            * Returns the number of user groups.
217            *
218            * @return the number of user groups
219            * @throws SystemException if a system exception occurred
220            */
221            public static int getUserGroupsCount()
222                    throws com.liferay.portal.kernel.exception.SystemException {
223                    return getService().getUserGroupsCount();
224            }
225    
226            /**
227            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
228            *
229            * @param userGroup the user group
230            * @return the user group that was updated
231            * @throws SystemException if a system exception occurred
232            */
233            public static com.liferay.portal.model.UserGroup updateUserGroup(
234                    com.liferay.portal.model.UserGroup userGroup)
235                    throws com.liferay.portal.kernel.exception.SystemException {
236                    return getService().updateUserGroup(userGroup);
237            }
238    
239            /**
240            * Returns the Spring bean ID for this bean.
241            *
242            * @return the Spring bean ID for this bean
243            */
244            public static java.lang.String getBeanIdentifier() {
245                    return getService().getBeanIdentifier();
246            }
247    
248            /**
249            * Sets the Spring bean ID for this bean.
250            *
251            * @param beanIdentifier the Spring bean ID for this bean
252            */
253            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
254                    getService().setBeanIdentifier(beanIdentifier);
255            }
256    
257            /**
258            * Adds the user groups to the group.
259            *
260            * @param groupId the primary key of the group
261            * @param userGroupIds the primary keys of the user groups
262            * @throws SystemException if a system exception occurred
263            */
264            public static void addGroupUserGroups(long groupId, long[] userGroupIds)
265                    throws com.liferay.portal.kernel.exception.SystemException {
266                    getService().addGroupUserGroups(groupId, userGroupIds);
267            }
268    
269            /**
270            * Adds the user groups to the team.
271            *
272            * @param teamId the primary key of the team
273            * @param userGroupIds the primary keys of the user groups
274            * @throws SystemException if a system exception occurred
275            */
276            public static void addTeamUserGroups(long teamId, long[] userGroupIds)
277                    throws com.liferay.portal.kernel.exception.SystemException {
278                    getService().addTeamUserGroups(teamId, userGroupIds);
279            }
280    
281            /**
282            * Adds a user group.
283            *
284            * <p>
285            * This method handles the creation and bookkeeping of the user group,
286            * including its resources, metadata, and internal data structures. It is
287            * not necessary to make subsequent calls to setup default groups and
288            * resources for the user group.
289            * </p>
290            *
291            * @param userId the primary key of the user
292            * @param companyId the primary key of the user group's company
293            * @param name the user group's name
294            * @param description the user group's description
295            * @return the user group
296            * @throws PortalException if the user group's information was invalid
297            * @throws SystemException if a system exception occurred
298            * @deprecated {@link #addUserGroup(long, long, String, String,
299            ServiceContext)}
300            */
301            public static com.liferay.portal.model.UserGroup addUserGroup(long userId,
302                    long companyId, java.lang.String name, java.lang.String description)
303                    throws com.liferay.portal.kernel.exception.PortalException,
304                            com.liferay.portal.kernel.exception.SystemException {
305                    return getService().addUserGroup(userId, companyId, name, description);
306            }
307    
308            /**
309            * Adds a user group.
310            *
311            * <p>
312            * This method handles the creation and bookkeeping of the user group,
313            * including its resources, metadata, and internal data structures. It is
314            * not necessary to make subsequent calls to setup default groups and
315            * resources for the user group.
316            * </p>
317            *
318            * @param userId the primary key of the user
319            * @param companyId the primary key of the user group's company
320            * @param name the user group's name
321            * @param description the user group's description
322            * @param serviceContext the user group's service context (optionally
323            <code>null</code>). Can set expando bridge attributes for the
324            user group.
325            * @return the user group
326            * @throws PortalException if the user group's information was invalid
327            * @throws SystemException if a system exception occurred
328            */
329            public static com.liferay.portal.model.UserGroup addUserGroup(long userId,
330                    long companyId, java.lang.String name, java.lang.String description,
331                    com.liferay.portal.service.ServiceContext serviceContext)
332                    throws com.liferay.portal.kernel.exception.PortalException,
333                            com.liferay.portal.kernel.exception.SystemException {
334                    return getService()
335                                       .addUserGroup(userId, companyId, name, description,
336                            serviceContext);
337            }
338    
339            /**
340            * Removes the user from any forbidden user groups and adds the user to all
341            * mandatory user groups, if the user does not belong to them.
342            *
343            * @param user the user
344            * @throws PortalException if the user cannot be added or removed from any
345            user groups.
346            * @throws SystemException if a system exception occurred
347            * @see com.liferay.portal.events.MembershipPolicyAction
348            */
349            public static void checkMembershipPolicy(com.liferay.portal.model.User user)
350                    throws com.liferay.portal.kernel.exception.PortalException,
351                            com.liferay.portal.kernel.exception.SystemException {
352                    getService().checkMembershipPolicy(user);
353            }
354    
355            /**
356            * Clears all associations between the user and its user groups and clears
357            * the permissions cache.
358            *
359            * <p>
360            * This method is called from {@link #deleteUserGroup(UserGroup)}.
361            * </p>
362            *
363            * @param userId the primary key of the user
364            * @throws SystemException if a system exception occurred
365            */
366            public static void clearUserUserGroups(long userId)
367                    throws com.liferay.portal.kernel.exception.SystemException {
368                    getService().clearUserUserGroups(userId);
369            }
370    
371            /**
372            * Copies the user group's layouts to the users who are not already members
373            * of the user group.
374            *
375            * @param userGroupId the primary key of the user group
376            * @param userIds the primary keys of the users
377            * @throws PortalException if any one of the users could not be found or
378            if a portal exception occurred
379            * @throws SystemException if a system exception occurred
380            * @deprecated
381            */
382            public static void copyUserGroupLayouts(long userGroupId, long[] userIds)
383                    throws com.liferay.portal.kernel.exception.PortalException,
384                            com.liferay.portal.kernel.exception.SystemException {
385                    getService().copyUserGroupLayouts(userGroupId, userIds);
386            }
387    
388            /**
389            * Copies the user groups' layouts to the user.
390            *
391            * @param userGroupIds the primary keys of the user groups
392            * @param userId the primary key of the user
393            * @throws PortalException if a user with the primary key could not be
394            found or if a portal exception occurred
395            * @throws SystemException if a system exception occurred
396            * @deprecated
397            */
398            public static void copyUserGroupLayouts(long[] userGroupIds, long userId)
399                    throws com.liferay.portal.kernel.exception.PortalException,
400                            com.liferay.portal.kernel.exception.SystemException {
401                    getService().copyUserGroupLayouts(userGroupIds, userId);
402            }
403    
404            /**
405            * Copies the user group's layout to the user.
406            *
407            * @param userGroupId the primary key of the user group
408            * @param userId the primary key of the user
409            * @throws PortalException if a user with the primary key could not be
410            found or if a portal exception occurred
411            * @throws SystemException if a system exception occurred
412            * @deprecated
413            */
414            public static void copyUserGroupLayouts(long userGroupId, long userId)
415                    throws com.liferay.portal.kernel.exception.PortalException,
416                            com.liferay.portal.kernel.exception.SystemException {
417                    getService().copyUserGroupLayouts(userGroupId, userId);
418            }
419    
420            /**
421            * Returns the user group with the name.
422            *
423            * @param companyId the primary key of the user group's company
424            * @param name the user group's name
425            * @return Returns the user group with the name
426            * @throws PortalException if a user group with the name could not be found
427            * @throws SystemException if a system exception occurred
428            */
429            public static com.liferay.portal.model.UserGroup getUserGroup(
430                    long companyId, java.lang.String name)
431                    throws com.liferay.portal.kernel.exception.PortalException,
432                            com.liferay.portal.kernel.exception.SystemException {
433                    return getService().getUserGroup(companyId, name);
434            }
435    
436            /**
437            * Returns all the user groups belonging to the company.
438            *
439            * @param companyId the primary key of the user groups' company
440            * @return the user groups belonging to the company
441            * @throws SystemException if a system exception occurred
442            */
443            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
444                    long companyId)
445                    throws com.liferay.portal.kernel.exception.SystemException {
446                    return getService().getUserGroups(companyId);
447            }
448    
449            /**
450            * Returns all the user groups with the primary keys.
451            *
452            * @param userGroupIds the primary keys of the user groups
453            * @return the user groups with the primary keys
454            * @throws PortalException if any one of the user groups could not be found
455            * @throws SystemException if a system exception occurred
456            */
457            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
458                    long[] userGroupIds)
459                    throws com.liferay.portal.kernel.exception.PortalException,
460                            com.liferay.portal.kernel.exception.SystemException {
461                    return getService().getUserGroups(userGroupIds);
462            }
463    
464            /**
465            * Returns all the user groups to which the user belongs.
466            *
467            * @param userId the primary key of the user
468            * @return the user groups to which the user belongs
469            * @throws SystemException if a system exception occurred
470            */
471            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
472                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
473                    return getService().getUserUserGroups(userId);
474            }
475    
476            /**
477            * Returns <code>true</code> if the user group is associated with the group.
478            *
479            * @param groupId the primary key of the group
480            * @param userGroupId the primary key of the user group
481            * @return <code>true</code> if the user group belongs to the group;
482            <code>false</code> otherwise
483            * @throws SystemException if a system exception occurred
484            */
485            public static boolean hasGroupUserGroup(long groupId, long userGroupId)
486                    throws com.liferay.portal.kernel.exception.SystemException {
487                    return getService().hasGroupUserGroup(groupId, userGroupId);
488            }
489    
490            /**
491            * Returns <code>true</code> if the user group belongs to the team.
492            *
493            * @param teamId the primary key of the team
494            * @param userGroupId the primary key of the user group
495            * @return <code>true</code> if the user group belongs to the team;
496            <code>false</code> otherwise
497            * @throws SystemException if a system exception occurred
498            */
499            public static boolean hasTeamUserGroup(long teamId, long userGroupId)
500                    throws com.liferay.portal.kernel.exception.SystemException {
501                    return getService().hasTeamUserGroup(teamId, userGroupId);
502            }
503    
504            /**
505            * Returns an ordered range of all the user groups that match the keywords.
506            *
507            * <p>
508            * Useful when paginating results. Returns a maximum of <code>end -
509            * start</code> instances. <code>start</code> and <code>end</code> are not
510            * primary keys, they are indexes in the result set. Thus, <code>0</code>
511            * refers to the first result in the set. Setting both <code>start</code>
512            * and <code>end</code> to {@link
513            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
514            * result set.
515            * </p>
516            *
517            * @param companyId the primary key of the user group's company
518            * @param keywords the keywords (space separated), which may occur in the
519            user group's name or description (optionally <code>null</code>)
520            * @param params the finder params (optionally <code>null</code>). For more
521            information see {@link
522            com.liferay.portal.service.persistence.UserGroupFinder}
523            * @param start the lower bound of the range of user groups to return
524            * @param end the upper bound of the range of user groups to return (not
525            inclusive)
526            * @param obc the comparator to order the user groups (optionally
527            <code>null</code>)
528            * @return the matching user groups ordered by comparator <code>obc</code>
529            * @throws SystemException if a system exception occurred
530            * @see com.liferay.portal.service.persistence.UserGroupFinder
531            */
532            public static java.util.List<com.liferay.portal.model.UserGroup> search(
533                    long companyId, java.lang.String keywords,
534                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
535                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
536                    throws com.liferay.portal.kernel.exception.SystemException {
537                    return getService().search(companyId, keywords, params, start, end, obc);
538            }
539    
540            /**
541            * Returns an ordered range of all the user groups that match the keywords,
542            * using the indexer. It is preferable to use this method instead of the
543            * non-indexed version whenever possible for performance reasons.
544            *
545            * <p>
546            * Useful when paginating results. Returns a maximum of <code>end -
547            * start</code> instances. <code>start</code> and <code>end</code> are not
548            * primary keys, they are indexes in the result set. Thus, <code>0</code>
549            * refers to the first result in the set. Setting both <code>start</code>
550            * and <code>end</code> to {@link
551            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
552            * result set.
553            * </p>
554            *
555            * @param companyId the primary key of the user group's company
556            * @param keywords the keywords (space separated), which may occur in the
557            user group's name or description (optionally <code>null</code>)
558            * @param params the finder params (optionally <code>null</code>). For more
559            information see {@link
560            com.liferay.portlet.usergroupsadmin.util.UserGroupIndexer}
561            * @param start the lower bound of the range of user groups to return
562            * @param end the upper bound of the range of user groups to return (not
563            inclusive)
564            * @param sort the field and direction by which to sort (optionally
565            <code>null</code>)
566            * @return the matching user groups ordered by sort
567            * @throws SystemException if a system exception occurred
568            * @see com.liferay.portlet.usergroupsadmin.util.UserGroupIndexer
569            */
570            public static com.liferay.portal.kernel.search.Hits search(long companyId,
571                    java.lang.String keywords,
572                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
573                    int start, int end, com.liferay.portal.kernel.search.Sort sort)
574                    throws com.liferay.portal.kernel.exception.SystemException {
575                    return getService().search(companyId, keywords, params, start, end, sort);
576            }
577    
578            /**
579            * Returns an ordered range of all the user groups that match the name and
580            * description. It is preferable to use this method instead of the
581            * non-indexed version whenever possible for performance reasons.
582            *
583            * <p>
584            * Useful when paginating results. Returns a maximum of <code>end -
585            * start</code> instances. <code>start</code> and <code>end</code> are not
586            * primary keys, they are indexes in the result set. Thus, <code>0</code>
587            * refers to the first result in the set. Setting both <code>start</code>
588            * and <code>end</code> to {@link
589            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
590            * result set.
591            * </p>
592            *
593            * @param companyId the primary key of the user group's company
594            * @param name the user group's name (optionally <code>null</code>)
595            * @param description the user group's description (optionally
596            <code>null</code>)
597            * @param params the finder params (optionally <code>null</code>). For more
598            information see {@link
599            com.liferay.portlet.usergroupsadmin.util.UserGroupIndexer}
600            * @param andSearch whether every field must match its keywords or just one
601            field
602            * @param start the lower bound of the range of user groups to return
603            * @param end the upper bound of the range of user groups to return (not
604            inclusive)
605            * @param sort the field and direction by which to sort (optionally
606            <code>null</code>)
607            * @return the matching user groups ordered by sort
608            * @throws SystemException if a system exception occurred
609            * @see com.liferay.portal.service.persistence.UserGroupFinder
610            */
611            public static com.liferay.portal.kernel.search.Hits search(long companyId,
612                    java.lang.String name, java.lang.String description,
613                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
614                    boolean andSearch, int start, int end,
615                    com.liferay.portal.kernel.search.Sort sort)
616                    throws com.liferay.portal.kernel.exception.SystemException {
617                    return getService()
618                                       .search(companyId, name, description, params, andSearch,
619                            start, end, sort);
620            }
621    
622            /**
623            * Returns the number of user groups that match the keywords
624            *
625            * @param companyId the primary key of the user group's company
626            * @param keywords the keywords (space separated), which may occur in the
627            user group's name or description (optionally <code>null</code>)
628            * @param params the finder params (optionally <code>null</code>). For more
629            information see {@link
630            com.liferay.portal.service.persistence.UserGroupFinder}
631            * @return the number of matching user groups
632            * @throws SystemException if a system exception occurred
633            * @see com.liferay.portal.service.persistence.UserGroupFinder
634            */
635            public static int searchCount(long companyId, java.lang.String keywords,
636                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
637                    throws com.liferay.portal.kernel.exception.SystemException {
638                    return getService().searchCount(companyId, keywords, params);
639            }
640    
641            /**
642            * Sets the user groups associated with the user copying the user group
643            * layouts and removing and adding user group associations for the user as
644            * necessary.
645            *
646            * @param userId the primary key of the user
647            * @param userGroupIds the primary keys of the user groups
648            * @throws PortalException if a portal exception occurred
649            * @throws SystemException if a system exception occurred
650            */
651            public static void setUserUserGroups(long userId, long[] userGroupIds)
652                    throws com.liferay.portal.kernel.exception.PortalException,
653                            com.liferay.portal.kernel.exception.SystemException {
654                    getService().setUserUserGroups(userId, userGroupIds);
655            }
656    
657            /**
658            * Removes the user groups from the group.
659            *
660            * @param groupId the primary key of the group
661            * @param userGroupIds the primary keys of the user groups
662            * @throws SystemException if a system exception occurred
663            */
664            public static void unsetGroupUserGroups(long groupId, long[] userGroupIds)
665                    throws com.liferay.portal.kernel.exception.SystemException {
666                    getService().unsetGroupUserGroups(groupId, userGroupIds);
667            }
668    
669            /**
670            * Removes the user groups from the team.
671            *
672            * @param teamId the primary key of the team
673            * @param userGroupIds the primary keys of the user groups
674            * @throws SystemException if a system exception occurred
675            */
676            public static void unsetTeamUserGroups(long teamId, long[] userGroupIds)
677                    throws com.liferay.portal.kernel.exception.SystemException {
678                    getService().unsetTeamUserGroups(teamId, userGroupIds);
679            }
680    
681            /**
682            * Updates the user group.
683            *
684            * @param companyId the primary key of the user group's company
685            * @param userGroupId the primary key of the user group
686            * @param name the user group's name
687            * @param description the user group's description
688            * @return the user group
689            * @throws PortalException if a user group with the primary key could
690            not be found or if the new information was invalid
691            * @throws SystemException if a system exception occurred
692            * @deprecated {@link #updateUserGroup(long, long, String, String,
693            ServiceContext)}
694            */
695            public static com.liferay.portal.model.UserGroup updateUserGroup(
696                    long companyId, long userGroupId, java.lang.String name,
697                    java.lang.String description)
698                    throws com.liferay.portal.kernel.exception.PortalException,
699                            com.liferay.portal.kernel.exception.SystemException {
700                    return getService()
701                                       .updateUserGroup(companyId, userGroupId, name, description);
702            }
703    
704            /**
705            * Updates the user group.
706            *
707            * @param companyId the primary key of the user group's company
708            * @param userGroupId the primary key of the user group
709            * @param name the user group's name
710            * @param description the user group's description
711            * @param serviceContext the user group's service context (optionally
712            <code>null</code>). Can set expando bridge attributes for the
713            user group.
714            * @return the user group
715            * @throws PortalException if a user group with the primary key could not be
716            found or if the new information was invalid
717            * @throws SystemException if a system exception occurred
718            */
719            public static com.liferay.portal.model.UserGroup updateUserGroup(
720                    long companyId, long userGroupId, java.lang.String name,
721                    java.lang.String description,
722                    com.liferay.portal.service.ServiceContext serviceContext)
723                    throws com.liferay.portal.kernel.exception.PortalException,
724                            com.liferay.portal.kernel.exception.SystemException {
725                    return getService()
726                                       .updateUserGroup(companyId, userGroupId, name, description,
727                            serviceContext);
728            }
729    
730            public static UserGroupLocalService getService() {
731                    if (_service == null) {
732                            _service = (UserGroupLocalService)PortalBeanLocatorUtil.locate(UserGroupLocalService.class.getName());
733    
734                            ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class,
735                                    "_service");
736                    }
737    
738                    return _service;
739            }
740    
741            /**
742             * @deprecated
743             */
744            public void setService(UserGroupLocalService service) {
745            }
746    
747            private static UserGroupLocalService _service;
748    }