001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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            * @param publicLayoutSetPrototypeId the primary key of the user group's
304            public layout set
305            * @param privateLayoutSetPrototypeId the primary key of the user group's
306            private layout set
307            * @return the user group
308            * @throws PortalException if the user group's information was invalid
309            * @throws SystemException if a system exception occurred
310            */
311            public static com.liferay.portal.model.UserGroup addUserGroup(long userId,
312                    long companyId, java.lang.String name, java.lang.String description,
313                    long publicLayoutSetPrototypeId, long privateLayoutSetPrototypeId)
314                    throws com.liferay.portal.kernel.exception.PortalException,
315                            com.liferay.portal.kernel.exception.SystemException {
316                    return getService()
317                                       .addUserGroup(userId, companyId, name, description,
318                            publicLayoutSetPrototypeId, privateLayoutSetPrototypeId);
319            }
320    
321            /**
322            * Clears all associations between the user and its user groups and clears
323            * the permissions cache.
324            *
325            * <p>
326            * This method is called from {@link #deleteUserGroup(UserGroup)}.
327            * </p>
328            *
329            * @param userId the primary key of the user
330            * @throws SystemException if a system exception occurred
331            */
332            public static void clearUserUserGroups(long userId)
333                    throws com.liferay.portal.kernel.exception.SystemException {
334                    getService().clearUserUserGroups(userId);
335            }
336    
337            /**
338            * Copies the user group's layouts to the users who are not already members
339            * of the user group.
340            *
341            * @param userGroupId the primary key of the user group
342            * @param userIds the primary keys of the users
343            * @throws PortalException if any one of the users could not be found or if
344            a portal exception occurred
345            * @throws SystemException if a system exception occurred
346            */
347            public static void copyUserGroupLayouts(long userGroupId, long[] userIds)
348                    throws com.liferay.portal.kernel.exception.PortalException,
349                            com.liferay.portal.kernel.exception.SystemException {
350                    getService().copyUserGroupLayouts(userGroupId, userIds);
351            }
352    
353            /**
354            * Copies the user groups' layouts to the user.
355            *
356            * @param userGroupIds the primary keys of the user groups
357            * @param userId the primary key of the user
358            * @throws PortalException if a user with the primary key could not be
359            found or if a portal exception occurred
360            * @throws SystemException if a system exception occurred
361            */
362            public static void copyUserGroupLayouts(long[] userGroupIds, long userId)
363                    throws com.liferay.portal.kernel.exception.PortalException,
364                            com.liferay.portal.kernel.exception.SystemException {
365                    getService().copyUserGroupLayouts(userGroupIds, userId);
366            }
367    
368            /**
369            * Copies the user group's layout to the user.
370            *
371            * @param userGroupId the primary key of the user group
372            * @param userId the primary key of the user
373            * @throws PortalException if a user with the primary key could not be
374            found or if a portal exception occurred
375            * @throws SystemException if a system exception occurred
376            */
377            public static void copyUserGroupLayouts(long userGroupId, long userId)
378                    throws com.liferay.portal.kernel.exception.PortalException,
379                            com.liferay.portal.kernel.exception.SystemException {
380                    getService().copyUserGroupLayouts(userGroupId, userId);
381            }
382    
383            /**
384            * Returns the user group with the name.
385            *
386            * @param companyId the primary key of the user group's company
387            * @param name the user group's name
388            * @return Returns the user group with the name
389            * @throws PortalException if a user group with the name could not be found
390            * @throws SystemException if a system exception occurred
391            */
392            public static com.liferay.portal.model.UserGroup getUserGroup(
393                    long companyId, java.lang.String name)
394                    throws com.liferay.portal.kernel.exception.PortalException,
395                            com.liferay.portal.kernel.exception.SystemException {
396                    return getService().getUserGroup(companyId, name);
397            }
398    
399            /**
400            * Returns all the user groups belonging to the company.
401            *
402            * @param companyId the primary key of the user groups' company
403            * @return the user groups belonging to the company
404            * @throws SystemException if a system exception occurred
405            */
406            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
407                    long companyId)
408                    throws com.liferay.portal.kernel.exception.SystemException {
409                    return getService().getUserGroups(companyId);
410            }
411    
412            /**
413            * Returns all the user groups with the primary keys.
414            *
415            * @param userGroupIds the primary keys of the user groups
416            * @return the user groups with the primary keys
417            * @throws PortalException if any one of the user groups could not be found
418            * @throws SystemException if a system exception occurred
419            */
420            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
421                    long[] userGroupIds)
422                    throws com.liferay.portal.kernel.exception.PortalException,
423                            com.liferay.portal.kernel.exception.SystemException {
424                    return getService().getUserGroups(userGroupIds);
425            }
426    
427            /**
428            * Returns all the user groups to which the user belongs.
429            *
430            * @param userId the primary key of the user
431            * @return the user groups to which the user belongs
432            * @throws SystemException if a system exception occurred
433            */
434            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
435                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
436                    return getService().getUserUserGroups(userId);
437            }
438    
439            /**
440            * Returns <code>true</code> if the user group is associated with the
441            * group.
442            *
443            * @param groupId the primary key of the group
444            * @param userGroupId the primary key of the user group
445            * @return <code>true</code> if the user group belongs to the group;
446            <code>false</code> otherwise
447            * @throws SystemException if a system exception occurred
448            */
449            public static boolean hasGroupUserGroup(long groupId, long userGroupId)
450                    throws com.liferay.portal.kernel.exception.SystemException {
451                    return getService().hasGroupUserGroup(groupId, userGroupId);
452            }
453    
454            /**
455            * Returns <code>true</code> if the user group belongs to the team.
456            *
457            * @param teamId the primary key of the team
458            * @param userGroupId the primary key of the user group
459            * @return <code>true</code> if the user group belongs to the team;
460            <code>false</code> otherwise
461            * @throws SystemException if a system exception occurred
462            */
463            public static boolean hasTeamUserGroup(long teamId, long userGroupId)
464                    throws com.liferay.portal.kernel.exception.SystemException {
465                    return getService().hasTeamUserGroup(teamId, userGroupId);
466            }
467    
468            /**
469            * Returns an ordered range of all the user groups that match the name and
470            * description.
471            *
472            * <p>
473            * Useful when paginating results. Returns a maximum of <code>end -
474            * start</code> instances. <code>start</code> and <code>end</code> are not
475            * primary keys, they are indexes in the result set. Thus, <code>0</code>
476            * refers to the first result in the set. Setting both <code>start</code>
477            * and <code>end</code> to {@link
478            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the
479            * full result set.
480            * </p>
481            *
482            * @param companyId the primary key of the user group's company
483            * @param name the user group's name (optionally <code>null</code>)
484            * @param description the user group's description (optionally
485            <code>null</code>)
486            * @param params the finder params (optionally <code>null</code>). For
487            more information see {@link
488            com.liferay.portal.service.persistence.UserGroupFinder}
489            * @param start the lower bound of the range of user groups to return
490            * @param end the upper bound of the range of user groups to return (not
491            inclusive)
492            * @param obc the comparator to order the user groups (optionally
493            <code>null</code>)
494            * @return the matching user groups ordered by comparator <code>obc</code>
495            * @throws SystemException if a system exception occurred
496            * @see com.liferay.portal.service.persistence.UserGroupFinder
497            */
498            public static java.util.List<com.liferay.portal.model.UserGroup> search(
499                    long companyId, java.lang.String name, java.lang.String description,
500                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
501                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
502                    throws com.liferay.portal.kernel.exception.SystemException {
503                    return getService()
504                                       .search(companyId, name, description, params, start, end, obc);
505            }
506    
507            /**
508            * Returns the number of user groups that match the name and description.
509            *
510            * @param companyId the primary key of the user group's company
511            * @param name the user group's name (optionally <code>null</code>)
512            * @param description the user group's description (optionally
513            <code>null</code>)
514            * @param params the finder params (optionally <code>null</code>). For
515            more information see {@link
516            com.liferay.portal.service.persistence.UserGroupFinder}
517            * @return the number of matching user groups
518            * @throws SystemException if a system exception occurred
519            * @see com.liferay.portal.service.persistence.UserGroupFinder
520            */
521            public static int searchCount(long companyId, java.lang.String name,
522                    java.lang.String description,
523                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
524                    throws com.liferay.portal.kernel.exception.SystemException {
525                    return getService().searchCount(companyId, name, description, params);
526            }
527    
528            /**
529            * Sets the user groups associated with the user copying the user group
530            * layouts and removing and adding user group associations for the user as
531            * necessary.
532            *
533            * @param userId the primary key of the user
534            * @param userGroupIds the primary keys of the user groups
535            * @throws PortalException if a portal exception occurred
536            * @throws SystemException if a system exception occurred
537            */
538            public static void setUserUserGroups(long userId, long[] userGroupIds)
539                    throws com.liferay.portal.kernel.exception.PortalException,
540                            com.liferay.portal.kernel.exception.SystemException {
541                    getService().setUserUserGroups(userId, userGroupIds);
542            }
543    
544            /**
545            * Removes the user groups from the group.
546            *
547            * @param groupId the primary key of the group
548            * @param userGroupIds the primary keys of the user groups
549            * @throws SystemException if a system exception occurred
550            */
551            public static void unsetGroupUserGroups(long groupId, long[] userGroupIds)
552                    throws com.liferay.portal.kernel.exception.SystemException {
553                    getService().unsetGroupUserGroups(groupId, userGroupIds);
554            }
555    
556            /**
557            * Removes the user groups from the team.
558            *
559            * @param teamId the primary key of the team
560            * @param userGroupIds the primary keys of the user groups
561            * @throws SystemException if a system exception occurred
562            */
563            public static void unsetTeamUserGroups(long teamId, long[] userGroupIds)
564                    throws com.liferay.portal.kernel.exception.SystemException {
565                    getService().unsetTeamUserGroups(teamId, userGroupIds);
566            }
567    
568            /**
569            * Updates the user group.
570            *
571            * @param companyId the primary key of the user group's company
572            * @param userGroupId the primary key of the user group
573            * @param name the user group's name
574            * @param description the user group's description
575            * @param publicLayoutSetPrototypeId the primary key of the user group's
576            public layout set
577            * @param privateLayoutSetPrototypeId the primary key of the user group's
578            private layout set
579            * @return the user group
580            * @throws PortalException if a user group with the primary key could not
581            be found or if the new information was invalid
582            * @throws SystemException if a system exception occurred
583            */
584            public static com.liferay.portal.model.UserGroup updateUserGroup(
585                    long companyId, long userGroupId, java.lang.String name,
586                    java.lang.String description, long publicLayoutSetPrototypeId,
587                    long privateLayoutSetPrototypeId)
588                    throws com.liferay.portal.kernel.exception.PortalException,
589                            com.liferay.portal.kernel.exception.SystemException {
590                    return getService()
591                                       .updateUserGroup(companyId, userGroupId, name, description,
592                            publicLayoutSetPrototypeId, privateLayoutSetPrototypeId);
593            }
594    
595            public static UserGroupLocalService getService() {
596                    if (_service == null) {
597                            _service = (UserGroupLocalService)PortalBeanLocatorUtil.locate(UserGroupLocalService.class.getName());
598    
599                            ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class,
600                                    "_service");
601                            MethodCache.remove(UserGroupLocalService.class);
602                    }
603    
604                    return _service;
605            }
606    
607            public void setService(UserGroupLocalService service) {
608                    MethodCache.remove(UserGroupLocalService.class);
609    
610                    _service = service;
611    
612                    ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class,
613                            "_service");
614                    MethodCache.remove(UserGroupLocalService.class);
615            }
616    
617            private static UserGroupLocalService _service;
618    }