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.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * 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.
023     *
024     * <p>
025     * 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.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see UserGroupLocalService
030     * @see com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
031     * @see com.liferay.portal.service.impl.UserGroupLocalServiceImpl
032     * @generated
033     */
034    public class UserGroupLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.UserGroupLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the user group to the database. Also notifies the appropriate model listeners.
043            *
044            * @param userGroup the user group
045            * @return the user group that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portal.model.UserGroup addUserGroup(
049                    com.liferay.portal.model.UserGroup userGroup)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addUserGroup(userGroup);
052            }
053    
054            /**
055            * Creates a new user group with the primary key. Does not add the user group to the database.
056            *
057            * @param userGroupId the primary key for the new user group
058            * @return the new user group
059            */
060            public static com.liferay.portal.model.UserGroup createUserGroup(
061                    long userGroupId) {
062                    return getService().createUserGroup(userGroupId);
063            }
064    
065            /**
066            * Deletes the user group with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param userGroupId the primary key of the user group
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 void deleteUserGroup(long userGroupId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteUserGroup(userGroupId);
076            }
077    
078            /**
079            * Deletes the user group from the database. Also notifies the appropriate model listeners.
080            *
081            * @param userGroup the user group
082            * @throws PortalException
083            * @throws SystemException if a system exception occurred
084            */
085            public static void deleteUserGroup(
086                    com.liferay.portal.model.UserGroup userGroup)
087                    throws com.liferay.portal.kernel.exception.PortalException,
088                            com.liferay.portal.kernel.exception.SystemException {
089                    getService().deleteUserGroup(userGroup);
090            }
091    
092            /**
093            * Performs a dynamic query on the database and returns the matching rows.
094            *
095            * @param dynamicQuery the dynamic query
096            * @return the matching rows
097            * @throws SystemException if a system exception occurred
098            */
099            @SuppressWarnings("rawtypes")
100            public static java.util.List dynamicQuery(
101                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
102                    throws com.liferay.portal.kernel.exception.SystemException {
103                    return getService().dynamicQuery(dynamicQuery);
104            }
105    
106            /**
107            * Performs a dynamic query on the database and returns a range of the matching rows.
108            *
109            * <p>
110            * 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.
111            * </p>
112            *
113            * @param dynamicQuery the dynamic query
114            * @param start the lower bound of the range of model instances
115            * @param end the upper bound of the range of model instances (not inclusive)
116            * @return the range of matching rows
117            * @throws SystemException if a system exception occurred
118            */
119            @SuppressWarnings("rawtypes")
120            public static java.util.List dynamicQuery(
121                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
122                    int end) throws com.liferay.portal.kernel.exception.SystemException {
123                    return getService().dynamicQuery(dynamicQuery, start, end);
124            }
125    
126            /**
127            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
128            *
129            * <p>
130            * 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.
131            * </p>
132            *
133            * @param dynamicQuery the dynamic query
134            * @param start the lower bound of the range of model instances
135            * @param end the upper bound of the range of model instances (not inclusive)
136            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
137            * @return the ordered range of matching rows
138            * @throws SystemException if a system exception occurred
139            */
140            @SuppressWarnings("rawtypes")
141            public static java.util.List dynamicQuery(
142                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
143                    int end,
144                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
145                    throws com.liferay.portal.kernel.exception.SystemException {
146                    return getService()
147                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
148            }
149    
150            /**
151            * Returns the number of rows that match the dynamic query.
152            *
153            * @param dynamicQuery the dynamic query
154            * @return the number of rows that match the dynamic query
155            * @throws SystemException if a system exception occurred
156            */
157            public static long dynamicQueryCount(
158                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
159                    throws com.liferay.portal.kernel.exception.SystemException {
160                    return getService().dynamicQueryCount(dynamicQuery);
161            }
162    
163            public static com.liferay.portal.model.UserGroup fetchUserGroup(
164                    long userGroupId)
165                    throws com.liferay.portal.kernel.exception.SystemException {
166                    return getService().fetchUserGroup(userGroupId);
167            }
168    
169            /**
170            * Returns the user group with the primary key.
171            *
172            * @param userGroupId the primary key of the user group
173            * @return the user group
174            * @throws PortalException if a user group with the primary key could not be found
175            * @throws SystemException if a system exception occurred
176            */
177            public static com.liferay.portal.model.UserGroup getUserGroup(
178                    long userGroupId)
179                    throws com.liferay.portal.kernel.exception.PortalException,
180                            com.liferay.portal.kernel.exception.SystemException {
181                    return getService().getUserGroup(userGroupId);
182            }
183    
184            public static com.liferay.portal.model.PersistedModel getPersistedModel(
185                    java.io.Serializable primaryKeyObj)
186                    throws com.liferay.portal.kernel.exception.PortalException,
187                            com.liferay.portal.kernel.exception.SystemException {
188                    return getService().getPersistedModel(primaryKeyObj);
189            }
190    
191            /**
192            * Returns a range of all the user groups.
193            *
194            * <p>
195            * 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.
196            * </p>
197            *
198            * @param start the lower bound of the range of user groups
199            * @param end the upper bound of the range of user groups (not inclusive)
200            * @return the range of user groups
201            * @throws SystemException if a system exception occurred
202            */
203            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
204                    int start, int end)
205                    throws com.liferay.portal.kernel.exception.SystemException {
206                    return getService().getUserGroups(start, end);
207            }
208    
209            /**
210            * Returns the number of user groups.
211            *
212            * @return the number of user groups
213            * @throws SystemException if a system exception occurred
214            */
215            public static int getUserGroupsCount()
216                    throws com.liferay.portal.kernel.exception.SystemException {
217                    return getService().getUserGroupsCount();
218            }
219    
220            /**
221            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
222            *
223            * @param userGroup the user group
224            * @return the user group that was updated
225            * @throws SystemException if a system exception occurred
226            */
227            public static com.liferay.portal.model.UserGroup updateUserGroup(
228                    com.liferay.portal.model.UserGroup userGroup)
229                    throws com.liferay.portal.kernel.exception.SystemException {
230                    return getService().updateUserGroup(userGroup);
231            }
232    
233            /**
234            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
235            *
236            * @param userGroup the user group
237            * @param merge whether to merge the user group with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
238            * @return the user group that was updated
239            * @throws SystemException if a system exception occurred
240            */
241            public static com.liferay.portal.model.UserGroup updateUserGroup(
242                    com.liferay.portal.model.UserGroup userGroup, boolean merge)
243                    throws com.liferay.portal.kernel.exception.SystemException {
244                    return getService().updateUserGroup(userGroup, merge);
245            }
246    
247            /**
248            * Returns the Spring bean ID for this bean.
249            *
250            * @return the Spring bean ID for this bean
251            */
252            public static java.lang.String getBeanIdentifier() {
253                    return getService().getBeanIdentifier();
254            }
255    
256            /**
257            * Sets the Spring bean ID for this bean.
258            *
259            * @param beanIdentifier the Spring bean ID for this bean
260            */
261            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
262                    getService().setBeanIdentifier(beanIdentifier);
263            }
264    
265            /**
266            * Adds the user groups to the group.
267            *
268            * @param groupId the primary key of the group
269            * @param userGroupIds the primary keys of the user groups
270            * @throws SystemException if a system exception occurred
271            */
272            public static void addGroupUserGroups(long groupId, long[] userGroupIds)
273                    throws com.liferay.portal.kernel.exception.SystemException {
274                    getService().addGroupUserGroups(groupId, userGroupIds);
275            }
276    
277            /**
278            * Adds the user groups to the team.
279            *
280            * @param teamId the primary key of the team
281            * @param userGroupIds the primary keys of the user groups
282            * @throws SystemException if a system exception occurred
283            */
284            public static void addTeamUserGroups(long teamId, long[] userGroupIds)
285                    throws com.liferay.portal.kernel.exception.SystemException {
286                    getService().addTeamUserGroups(teamId, userGroupIds);
287            }
288    
289            /**
290            * Adds a user group.
291            *
292            * <p>
293            * This method handles the creation and bookkeeping of the user group,
294            * including its resources, metadata, and internal data structures. It is
295            * not necessary to make subsequent calls to setup default groups and
296            * resources for the user group.
297            * </p>
298            *
299            * @param userId the primary key of the user
300            * @param companyId the primary key of the user group's company
301            * @param name the user group's name
302            * @param description the user group's description
303            * @return the user group
304            * @throws PortalException if the user group's information was invalid
305            * @throws SystemException if a system exception occurred
306            */
307            public static com.liferay.portal.model.UserGroup addUserGroup(long userId,
308                    long companyId, java.lang.String name, java.lang.String description)
309                    throws com.liferay.portal.kernel.exception.PortalException,
310                            com.liferay.portal.kernel.exception.SystemException {
311                    return getService().addUserGroup(userId, companyId, name, description);
312            }
313    
314            /**
315            * Clears all associations between the user and its user groups and clears
316            * the permissions cache.
317            *
318            * <p>
319            * This method is called from {@link #deleteUserGroup(UserGroup)}.
320            * </p>
321            *
322            * @param userId the primary key of the user
323            * @throws SystemException if a system exception occurred
324            */
325            public static void clearUserUserGroups(long userId)
326                    throws com.liferay.portal.kernel.exception.SystemException {
327                    getService().clearUserUserGroups(userId);
328            }
329    
330            /**
331            * Copies the user group's layouts to the users who are not already members
332            * of the user group.
333            *
334            * @param userGroupId the primary key of the user group
335            * @param userIds the primary keys of the users
336            * @throws PortalException if any one of the users could not be found or
337            if a portal exception occurred
338            * @throws SystemException if a system exception occurred
339            * @deprecated
340            */
341            public static void copyUserGroupLayouts(long userGroupId, long[] userIds)
342                    throws com.liferay.portal.kernel.exception.PortalException,
343                            com.liferay.portal.kernel.exception.SystemException {
344                    getService().copyUserGroupLayouts(userGroupId, userIds);
345            }
346    
347            /**
348            * Copies the user groups' layouts to the user.
349            *
350            * @param userGroupIds the primary keys of the user groups
351            * @param userId the primary key of the user
352            * @throws PortalException if a user with the primary key could not be
353            found or if a portal exception occurred
354            * @throws SystemException if a system exception occurred
355            * @deprecated
356            */
357            public static void copyUserGroupLayouts(long[] userGroupIds, long userId)
358                    throws com.liferay.portal.kernel.exception.PortalException,
359                            com.liferay.portal.kernel.exception.SystemException {
360                    getService().copyUserGroupLayouts(userGroupIds, userId);
361            }
362    
363            /**
364            * Copies the user group's layout to the user.
365            *
366            * @param userGroupId the primary key of the user group
367            * @param userId the primary key of the user
368            * @throws PortalException if a user with the primary key could not be
369            found or if a portal exception occurred
370            * @throws SystemException if a system exception occurred
371            * @deprecated
372            */
373            public static void copyUserGroupLayouts(long userGroupId, long userId)
374                    throws com.liferay.portal.kernel.exception.PortalException,
375                            com.liferay.portal.kernel.exception.SystemException {
376                    getService().copyUserGroupLayouts(userGroupId, userId);
377            }
378    
379            /**
380            * Returns the user group with the name.
381            *
382            * @param companyId the primary key of the user group's company
383            * @param name the user group's name
384            * @return Returns the user group with the name
385            * @throws PortalException if a user group with the name could not be found
386            * @throws SystemException if a system exception occurred
387            */
388            public static com.liferay.portal.model.UserGroup getUserGroup(
389                    long companyId, java.lang.String name)
390                    throws com.liferay.portal.kernel.exception.PortalException,
391                            com.liferay.portal.kernel.exception.SystemException {
392                    return getService().getUserGroup(companyId, name);
393            }
394    
395            /**
396            * Returns all the user groups belonging to the company.
397            *
398            * @param companyId the primary key of the user groups' company
399            * @return the user groups belonging to the company
400            * @throws SystemException if a system exception occurred
401            */
402            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
403                    long companyId)
404                    throws com.liferay.portal.kernel.exception.SystemException {
405                    return getService().getUserGroups(companyId);
406            }
407    
408            /**
409            * Returns all the user groups with the primary keys.
410            *
411            * @param userGroupIds the primary keys of the user groups
412            * @return the user groups with the primary keys
413            * @throws PortalException if any one of the user groups could not be found
414            * @throws SystemException if a system exception occurred
415            */
416            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
417                    long[] userGroupIds)
418                    throws com.liferay.portal.kernel.exception.PortalException,
419                            com.liferay.portal.kernel.exception.SystemException {
420                    return getService().getUserGroups(userGroupIds);
421            }
422    
423            /**
424            * Returns all the user groups to which the user belongs.
425            *
426            * @param userId the primary key of the user
427            * @return the user groups to which the user belongs
428            * @throws SystemException if a system exception occurred
429            */
430            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
431                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
432                    return getService().getUserUserGroups(userId);
433            }
434    
435            /**
436            * Returns <code>true</code> if the user group is associated with the group.
437            *
438            * @param groupId the primary key of the group
439            * @param userGroupId the primary key of the user group
440            * @return <code>true</code> if the user group belongs to the group;
441            <code>false</code> otherwise
442            * @throws SystemException if a system exception occurred
443            */
444            public static boolean hasGroupUserGroup(long groupId, long userGroupId)
445                    throws com.liferay.portal.kernel.exception.SystemException {
446                    return getService().hasGroupUserGroup(groupId, userGroupId);
447            }
448    
449            /**
450            * Returns <code>true</code> if the user group belongs to the team.
451            *
452            * @param teamId the primary key of the team
453            * @param userGroupId the primary key of the user group
454            * @return <code>true</code> if the user group belongs to the team;
455            <code>false</code> otherwise
456            * @throws SystemException if a system exception occurred
457            */
458            public static boolean hasTeamUserGroup(long teamId, long userGroupId)
459                    throws com.liferay.portal.kernel.exception.SystemException {
460                    return getService().hasTeamUserGroup(teamId, userGroupId);
461            }
462    
463            public static java.util.List<com.liferay.portal.model.UserGroup> search(
464                    long companyId, java.lang.String keywords,
465                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
466                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
467                    throws com.liferay.portal.kernel.exception.SystemException {
468                    return getService().search(companyId, keywords, params, start, end, obc);
469            }
470    
471            /**
472            * Returns an ordered range of all the user groups that match the name and
473            * description.
474            *
475            * <p>
476            * Useful when paginating results. Returns a maximum of <code>end -
477            * start</code> instances. <code>start</code> and <code>end</code> are not
478            * primary keys, they are indexes in the result set. Thus, <code>0</code>
479            * refers to the first result in the set. Setting both <code>start</code>
480            * and <code>end</code> to {@link
481            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
482            * result set.
483            * </p>
484            *
485            * @param companyId the primary key of the user group's company
486            * @param name the user group's name (optionally <code>null</code>)
487            * @param description the user group's description (optionally
488            <code>null</code>)
489            * @param params the finder params (optionally <code>null</code>). For more
490            information see {@link
491            com.liferay.portal.service.persistence.UserGroupFinder}
492            * @param start the lower bound of the range of user groups to return
493            * @param end the upper bound of the range of user groups to return (not
494            inclusive)
495            * @param obc the comparator to order the user groups (optionally
496            <code>null</code>)
497            * @return the matching user groups ordered by comparator <code>obc</code>
498            * @throws SystemException if a system exception occurred
499            * @see com.liferay.portal.service.persistence.UserGroupFinder
500            */
501            public static java.util.List<com.liferay.portal.model.UserGroup> search(
502                    long companyId, java.lang.String name, java.lang.String description,
503                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
504                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
505                    throws com.liferay.portal.kernel.exception.SystemException {
506                    return getService()
507                                       .search(companyId, name, description, params, start, end, obc);
508            }
509    
510            public static int searchCount(long companyId, java.lang.String keywords,
511                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
512                    throws com.liferay.portal.kernel.exception.SystemException {
513                    return getService().searchCount(companyId, keywords, params);
514            }
515    
516            /**
517            * Returns the number of user groups that match the name and description.
518            *
519            * @param companyId the primary key of the user group's company
520            * @param name the user group's name (optionally <code>null</code>)
521            * @param description the user group's description (optionally
522            <code>null</code>)
523            * @param params the finder params (optionally <code>null</code>). For more
524            information see {@link
525            com.liferay.portal.service.persistence.UserGroupFinder}
526            * @return the number of matching user groups
527            * @throws SystemException if a system exception occurred
528            * @see com.liferay.portal.service.persistence.UserGroupFinder
529            */
530            public static int searchCount(long companyId, java.lang.String name,
531                    java.lang.String description,
532                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
533                    throws com.liferay.portal.kernel.exception.SystemException {
534                    return getService().searchCount(companyId, name, description, params);
535            }
536    
537            /**
538            * Sets the user groups associated with the user copying the user group
539            * layouts and removing and adding user group associations for the user as
540            * necessary.
541            *
542            * @param userId the primary key of the user
543            * @param userGroupIds the primary keys of the user groups
544            * @throws PortalException if a portal exception occurred
545            * @throws SystemException if a system exception occurred
546            */
547            public static void setUserUserGroups(long userId, long[] userGroupIds)
548                    throws com.liferay.portal.kernel.exception.PortalException,
549                            com.liferay.portal.kernel.exception.SystemException {
550                    getService().setUserUserGroups(userId, userGroupIds);
551            }
552    
553            /**
554            * Removes the user groups from the group.
555            *
556            * @param groupId the primary key of the group
557            * @param userGroupIds the primary keys of the user groups
558            * @throws SystemException if a system exception occurred
559            */
560            public static void unsetGroupUserGroups(long groupId, long[] userGroupIds)
561                    throws com.liferay.portal.kernel.exception.SystemException {
562                    getService().unsetGroupUserGroups(groupId, userGroupIds);
563            }
564    
565            /**
566            * Removes the user groups from the team.
567            *
568            * @param teamId the primary key of the team
569            * @param userGroupIds the primary keys of the user groups
570            * @throws SystemException if a system exception occurred
571            */
572            public static void unsetTeamUserGroups(long teamId, long[] userGroupIds)
573                    throws com.liferay.portal.kernel.exception.SystemException {
574                    getService().unsetTeamUserGroups(teamId, userGroupIds);
575            }
576    
577            /**
578            * Updates the user group.
579            *
580            * @param companyId the primary key of the user group's company
581            * @param userGroupId the primary key of the user group
582            * @param name the user group's name
583            * @param description the user group's description
584            * @return the user group
585            * @throws PortalException if a user group with the primary key could not be
586            found or if the new information was invalid
587            * @throws SystemException if a system exception occurred
588            */
589            public static com.liferay.portal.model.UserGroup updateUserGroup(
590                    long companyId, long userGroupId, java.lang.String name,
591                    java.lang.String description)
592                    throws com.liferay.portal.kernel.exception.PortalException,
593                            com.liferay.portal.kernel.exception.SystemException {
594                    return getService()
595                                       .updateUserGroup(companyId, userGroupId, name, description);
596            }
597    
598            public static UserGroupLocalService getService() {
599                    if (_service == null) {
600                            _service = (UserGroupLocalService)PortalBeanLocatorUtil.locate(UserGroupLocalService.class.getName());
601    
602                            ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class,
603                                    "_service");
604                            MethodCache.remove(UserGroupLocalService.class);
605                    }
606    
607                    return _service;
608            }
609    
610            public void setService(UserGroupLocalService service) {
611                    MethodCache.remove(UserGroupLocalService.class);
612    
613                    _service = service;
614    
615                    ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class,
616                            "_service");
617                    MethodCache.remove(UserGroupLocalService.class);
618            }
619    
620            private static UserGroupLocalService _service;
621    }