001    /**
002     * Copyright (c) 2000-2012 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.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.
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.
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.
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            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
241            *
242            * @param userGroup the user group
243            * @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.
244            * @return the user group that was updated
245            * @throws SystemException if a system exception occurred
246            */
247            public static com.liferay.portal.model.UserGroup updateUserGroup(
248                    com.liferay.portal.model.UserGroup userGroup, boolean merge)
249                    throws com.liferay.portal.kernel.exception.SystemException {
250                    return getService().updateUserGroup(userGroup, merge);
251            }
252    
253            /**
254            * Returns the Spring bean ID for this bean.
255            *
256            * @return the Spring bean ID for this bean
257            */
258            public static java.lang.String getBeanIdentifier() {
259                    return getService().getBeanIdentifier();
260            }
261    
262            /**
263            * Sets the Spring bean ID for this bean.
264            *
265            * @param beanIdentifier the Spring bean ID for this bean
266            */
267            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
268                    getService().setBeanIdentifier(beanIdentifier);
269            }
270    
271            /**
272            * Adds the user groups to the group.
273            *
274            * @param groupId the primary key of the group
275            * @param userGroupIds the primary keys of the user groups
276            * @throws SystemException if a system exception occurred
277            */
278            public static void addGroupUserGroups(long groupId, long[] userGroupIds)
279                    throws com.liferay.portal.kernel.exception.SystemException {
280                    getService().addGroupUserGroups(groupId, userGroupIds);
281            }
282    
283            /**
284            * Adds the user groups to the team.
285            *
286            * @param teamId the primary key of the team
287            * @param userGroupIds the primary keys of the user groups
288            * @throws SystemException if a system exception occurred
289            */
290            public static void addTeamUserGroups(long teamId, long[] userGroupIds)
291                    throws com.liferay.portal.kernel.exception.SystemException {
292                    getService().addTeamUserGroups(teamId, userGroupIds);
293            }
294    
295            /**
296            * Adds a user group.
297            *
298            * <p>
299            * This method handles the creation and bookkeeping of the user group,
300            * including its resources, metadata, and internal data structures. It is
301            * not necessary to make subsequent calls to setup default groups and
302            * resources for the user group.
303            * </p>
304            *
305            * @param userId the primary key of the user
306            * @param companyId the primary key of the user group's company
307            * @param name the user group's name
308            * @param description the user group's description
309            * @return the user group
310            * @throws PortalException if the user group's information was invalid
311            * @throws SystemException if a system exception occurred
312            */
313            public static com.liferay.portal.model.UserGroup addUserGroup(long userId,
314                    long companyId, java.lang.String name, java.lang.String description)
315                    throws com.liferay.portal.kernel.exception.PortalException,
316                            com.liferay.portal.kernel.exception.SystemException {
317                    return getService().addUserGroup(userId, companyId, name, description);
318            }
319    
320            /**
321            * Clears all associations between the user and its user groups and clears
322            * the permissions cache.
323            *
324            * <p>
325            * This method is called from {@link #deleteUserGroup(UserGroup)}.
326            * </p>
327            *
328            * @param userId the primary key of the user
329            * @throws SystemException if a system exception occurred
330            */
331            public static void clearUserUserGroups(long userId)
332                    throws com.liferay.portal.kernel.exception.SystemException {
333                    getService().clearUserUserGroups(userId);
334            }
335    
336            /**
337            * Copies the user group's layouts to the users who are not already members
338            * of the user group.
339            *
340            * @param userGroupId the primary key of the user group
341            * @param userIds the primary keys of the users
342            * @throws PortalException if any one of the users could not be found or
343            if a portal exception occurred
344            * @throws SystemException if a system exception occurred
345            * @deprecated
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            * @deprecated
362            */
363            public static void copyUserGroupLayouts(long[] userGroupIds, long userId)
364                    throws com.liferay.portal.kernel.exception.PortalException,
365                            com.liferay.portal.kernel.exception.SystemException {
366                    getService().copyUserGroupLayouts(userGroupIds, userId);
367            }
368    
369            /**
370            * Copies the user group's layout to the user.
371            *
372            * @param userGroupId the primary key of the user group
373            * @param userId the primary key of the user
374            * @throws PortalException if a user with the primary key could not be
375            found or if a portal exception occurred
376            * @throws SystemException if a system exception occurred
377            * @deprecated
378            */
379            public static void copyUserGroupLayouts(long userGroupId, long userId)
380                    throws com.liferay.portal.kernel.exception.PortalException,
381                            com.liferay.portal.kernel.exception.SystemException {
382                    getService().copyUserGroupLayouts(userGroupId, userId);
383            }
384    
385            /**
386            * Returns the user group with the name.
387            *
388            * @param companyId the primary key of the user group's company
389            * @param name the user group's name
390            * @return Returns the user group with the name
391            * @throws PortalException if a user group with the name could not be found
392            * @throws SystemException if a system exception occurred
393            */
394            public static com.liferay.portal.model.UserGroup getUserGroup(
395                    long companyId, java.lang.String name)
396                    throws com.liferay.portal.kernel.exception.PortalException,
397                            com.liferay.portal.kernel.exception.SystemException {
398                    return getService().getUserGroup(companyId, name);
399            }
400    
401            /**
402            * Returns all the user groups belonging to the company.
403            *
404            * @param companyId the primary key of the user groups' company
405            * @return the user groups belonging to the company
406            * @throws SystemException if a system exception occurred
407            */
408            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
409                    long companyId)
410                    throws com.liferay.portal.kernel.exception.SystemException {
411                    return getService().getUserGroups(companyId);
412            }
413    
414            /**
415            * Returns all the user groups with the primary keys.
416            *
417            * @param userGroupIds the primary keys of the user groups
418            * @return the user groups with the primary keys
419            * @throws PortalException if any one of the user groups could not be found
420            * @throws SystemException if a system exception occurred
421            */
422            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
423                    long[] userGroupIds)
424                    throws com.liferay.portal.kernel.exception.PortalException,
425                            com.liferay.portal.kernel.exception.SystemException {
426                    return getService().getUserGroups(userGroupIds);
427            }
428    
429            /**
430            * Returns all the user groups to which the user belongs.
431            *
432            * @param userId the primary key of the user
433            * @return the user groups to which the user belongs
434            * @throws SystemException if a system exception occurred
435            */
436            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
437                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
438                    return getService().getUserUserGroups(userId);
439            }
440    
441            /**
442            * Returns <code>true</code> if the user group is associated with the group.
443            *
444            * @param groupId the primary key of the group
445            * @param userGroupId the primary key of the user group
446            * @return <code>true</code> if the user group belongs to the group;
447            <code>false</code> otherwise
448            * @throws SystemException if a system exception occurred
449            */
450            public static boolean hasGroupUserGroup(long groupId, long userGroupId)
451                    throws com.liferay.portal.kernel.exception.SystemException {
452                    return getService().hasGroupUserGroup(groupId, userGroupId);
453            }
454    
455            /**
456            * Returns <code>true</code> if the user group belongs to the team.
457            *
458            * @param teamId the primary key of the team
459            * @param userGroupId the primary key of the user group
460            * @return <code>true</code> if the user group belongs to the team;
461            <code>false</code> otherwise
462            * @throws SystemException if a system exception occurred
463            */
464            public static boolean hasTeamUserGroup(long teamId, long userGroupId)
465                    throws com.liferay.portal.kernel.exception.SystemException {
466                    return getService().hasTeamUserGroup(teamId, userGroupId);
467            }
468    
469            public static java.util.List<com.liferay.portal.model.UserGroup> search(
470                    long companyId, java.lang.String keywords,
471                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
472                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
473                    throws com.liferay.portal.kernel.exception.SystemException {
474                    return getService().search(companyId, keywords, params, start, end, obc);
475            }
476    
477            /**
478            * Returns an ordered range of all the user groups that match the name and
479            * description.
480            *
481            * <p>
482            * Useful when paginating results. Returns a maximum of <code>end -
483            * start</code> instances. <code>start</code> and <code>end</code> are not
484            * primary keys, they are indexes in the result set. Thus, <code>0</code>
485            * refers to the first result in the set. Setting both <code>start</code>
486            * and <code>end</code> to {@link
487            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
488            * result set.
489            * </p>
490            *
491            * @param companyId the primary key of the user group's company
492            * @param name the user group's name (optionally <code>null</code>)
493            * @param description the user group's description (optionally
494            <code>null</code>)
495            * @param params the finder params (optionally <code>null</code>). For more
496            information see {@link
497            com.liferay.portal.service.persistence.UserGroupFinder}
498            * @param start the lower bound of the range of user groups to return
499            * @param end the upper bound of the range of user groups to return (not
500            inclusive)
501            * @param obc the comparator to order the user groups (optionally
502            <code>null</code>)
503            * @return the matching user groups ordered by comparator <code>obc</code>
504            * @throws SystemException if a system exception occurred
505            * @see com.liferay.portal.service.persistence.UserGroupFinder
506            */
507            public static java.util.List<com.liferay.portal.model.UserGroup> search(
508                    long companyId, java.lang.String name, java.lang.String description,
509                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
510                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
511                    throws com.liferay.portal.kernel.exception.SystemException {
512                    return getService()
513                                       .search(companyId, name, description, params, start, end, obc);
514            }
515    
516            public static int searchCount(long companyId, java.lang.String keywords,
517                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
518                    throws com.liferay.portal.kernel.exception.SystemException {
519                    return getService().searchCount(companyId, keywords, params);
520            }
521    
522            /**
523            * Returns the number of user groups that match the name and description.
524            *
525            * @param companyId the primary key of the user group's company
526            * @param name the user group's name (optionally <code>null</code>)
527            * @param description the user group's description (optionally
528            <code>null</code>)
529            * @param params the finder params (optionally <code>null</code>). For more
530            information see {@link
531            com.liferay.portal.service.persistence.UserGroupFinder}
532            * @return the number of matching user groups
533            * @throws SystemException if a system exception occurred
534            * @see com.liferay.portal.service.persistence.UserGroupFinder
535            */
536            public static int searchCount(long companyId, java.lang.String name,
537                    java.lang.String description,
538                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
539                    throws com.liferay.portal.kernel.exception.SystemException {
540                    return getService().searchCount(companyId, name, description, params);
541            }
542    
543            /**
544            * Sets the user groups associated with the user copying the user group
545            * layouts and removing and adding user group associations for the user as
546            * necessary.
547            *
548            * @param userId the primary key of the user
549            * @param userGroupIds the primary keys of the user groups
550            * @throws PortalException if a portal exception occurred
551            * @throws SystemException if a system exception occurred
552            */
553            public static void setUserUserGroups(long userId, long[] userGroupIds)
554                    throws com.liferay.portal.kernel.exception.PortalException,
555                            com.liferay.portal.kernel.exception.SystemException {
556                    getService().setUserUserGroups(userId, userGroupIds);
557            }
558    
559            /**
560            * Removes the user groups from the group.
561            *
562            * @param groupId the primary key of the group
563            * @param userGroupIds the primary keys of the user groups
564            * @throws SystemException if a system exception occurred
565            */
566            public static void unsetGroupUserGroups(long groupId, long[] userGroupIds)
567                    throws com.liferay.portal.kernel.exception.SystemException {
568                    getService().unsetGroupUserGroups(groupId, userGroupIds);
569            }
570    
571            /**
572            * Removes the user groups from the team.
573            *
574            * @param teamId the primary key of the team
575            * @param userGroupIds the primary keys of the user groups
576            * @throws SystemException if a system exception occurred
577            */
578            public static void unsetTeamUserGroups(long teamId, long[] userGroupIds)
579                    throws com.liferay.portal.kernel.exception.SystemException {
580                    getService().unsetTeamUserGroups(teamId, userGroupIds);
581            }
582    
583            /**
584            * Updates the user group.
585            *
586            * @param companyId the primary key of the user group's company
587            * @param userGroupId the primary key of the user group
588            * @param name the user group's name
589            * @param description the user group's description
590            * @return the user group
591            * @throws PortalException if a user group with the primary key could not be
592            found or if the new information was invalid
593            * @throws SystemException if a system exception occurred
594            */
595            public static com.liferay.portal.model.UserGroup updateUserGroup(
596                    long companyId, long userGroupId, java.lang.String name,
597                    java.lang.String description)
598                    throws com.liferay.portal.kernel.exception.PortalException,
599                            com.liferay.portal.kernel.exception.SystemException {
600                    return getService()
601                                       .updateUserGroup(companyId, userGroupId, name, description);
602            }
603    
604            public static UserGroupLocalService getService() {
605                    if (_service == null) {
606                            _service = (UserGroupLocalService)PortalBeanLocatorUtil.locate(UserGroupLocalService.class.getName());
607    
608                            ReferenceRegistry.registerReference(UserGroupLocalServiceUtil.class,
609                                    "_service");
610                    }
611    
612                    return _service;
613            }
614    
615            /**
616             * @deprecated
617             */
618            public void setService(UserGroupLocalService service) {
619            }
620    
621            private static UserGroupLocalService _service;
622    }