001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.ReferenceRegistry;
019    
020    /**
021     * The utility for the group remote service. This utility wraps {@link com.liferay.portal.service.impl.GroupServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
022     *
023     * <p>
024     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
025     * </p>
026     *
027     * @author Brian Wing Shun Chan
028     * @see GroupService
029     * @see com.liferay.portal.service.base.GroupServiceBaseImpl
030     * @see com.liferay.portal.service.impl.GroupServiceImpl
031     * @generated
032     */
033    public class GroupServiceUtil {
034            /*
035             * NOTE FOR DEVELOPERS:
036             *
037             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.GroupServiceImpl} and rerun ServiceBuilder to regenerate this class.
038             */
039    
040            /**
041            * Returns the Spring bean ID for this bean.
042            *
043            * @return the Spring bean ID for this bean
044            */
045            public static java.lang.String getBeanIdentifier() {
046                    return getService().getBeanIdentifier();
047            }
048    
049            /**
050            * Sets the Spring bean ID for this bean.
051            *
052            * @param beanIdentifier the Spring bean ID for this bean
053            */
054            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
055                    getService().setBeanIdentifier(beanIdentifier);
056            }
057    
058            /**
059            * Adds a group.
060            *
061            * @param liveGroupId the primary key of the live group
062            * @param name the entity's name
063            * @param description the group's description (optionally
064            <code>null</code>)
065            * @param type the group's type. For more information see {@link
066            com.liferay.portal.model.GroupConstants}
067            * @param friendlyURL the group's friendlyURL (optionally
068            <code>null</code>)
069            * @param site whether the group is to be associated with a main site
070            * @param active whether the group is active
071            * @param serviceContext the service context to be applied (optionally
072            <code>null</code>). Can set the asset category IDs and asset tag
073            names for the group, and can set whether the group is for staging
074            * @return the group
075            * @throws PortalException if the user did not have permission to add the
076            group, if a creator could not be found, if the group's
077            information was invalid, if a layout could not be found, or if a
078            valid friendly URL could not be created for the group
079            * @throws SystemException if a system exception occurred
080            */
081            public static com.liferay.portal.model.Group addGroup(long liveGroupId,
082                    java.lang.String name, java.lang.String description, int type,
083                    java.lang.String friendlyURL, boolean site, boolean active,
084                    com.liferay.portal.service.ServiceContext serviceContext)
085                    throws com.liferay.portal.kernel.exception.PortalException,
086                            com.liferay.portal.kernel.exception.SystemException {
087                    return getService()
088                                       .addGroup(liveGroupId, name, description, type, friendlyURL,
089                            site, active, serviceContext);
090            }
091    
092            /**
093            * Adds the group using the group default live group ID.
094            *
095            * @param name the entity's name
096            * @param description the group's description (optionally
097            <code>null</code>)
098            * @param type the group's type. For more information see {@link
099            com.liferay.portal.model.GroupConstants}
100            * @param friendlyURL the group's friendlyURL
101            * @param site whether the group is to be associated with a main site
102            * @param active whether the group is active
103            * @param serviceContext the service context to be applied (optionally
104            <code>null</code>). Can set asset category IDs and asset tag
105            names for the group, and can set whether the group is for staging
106            * @return the group
107            * @throws PortalException if the user did not have permission to add the
108            group, if a creator could not be found, if the group's
109            information was invalid, if a layout could not be found, or if a
110            valid friendly URL could not be created for the group
111            * @throws SystemException if a system exception occurred
112            */
113            public static com.liferay.portal.model.Group addGroup(
114                    java.lang.String name, java.lang.String description, int type,
115                    java.lang.String friendlyURL, boolean site, boolean active,
116                    com.liferay.portal.service.ServiceContext serviceContext)
117                    throws com.liferay.portal.kernel.exception.PortalException,
118                            com.liferay.portal.kernel.exception.SystemException {
119                    return getService()
120                                       .addGroup(name, description, type, friendlyURL, site,
121                            active, serviceContext);
122            }
123    
124            /**
125            * Adds the groups to the role.
126            *
127            * @param roleId the primary key of the role
128            * @param groupIds the primary keys of the groups
129            * @throws PortalException if the user did not have permission to update the
130            role
131            * @throws SystemException if a system exception occurred
132            */
133            public static void addRoleGroups(long roleId, long[] groupIds)
134                    throws com.liferay.portal.kernel.exception.PortalException,
135                            com.liferay.portal.kernel.exception.SystemException {
136                    getService().addRoleGroups(roleId, groupIds);
137            }
138    
139            /**
140            * Deletes the group.
141            *
142            * <p>
143            * The group is unstaged and its assets and resources including layouts,
144            * membership requests, subscriptions, teams, blogs, bookmarks, calendar
145            * events, image gallery, journals, message boards, polls, shopping related
146            * entities, software catalog, and wikis are also deleted.
147            * </p>
148            *
149            * @param groupId the primary key of the group
150            * @throws PortalException if the user did not have permission to delete the
151            group or its assets or resources, if a group with the primary key
152            could not be found, or if the group was a system group
153            * @throws SystemException if a system exception occurred
154            */
155            public static void deleteGroup(long groupId)
156                    throws com.liferay.portal.kernel.exception.PortalException,
157                            com.liferay.portal.kernel.exception.SystemException {
158                    getService().deleteGroup(groupId);
159            }
160    
161            /**
162            * Returns the group with the primary key.
163            *
164            * @param groupId the primary key of the group
165            * @return the group with the primary key
166            * @throws PortalException if a group with the primary key could not be
167            found or if the current user did not have permission to view the
168            group
169            * @throws SystemException if a system exception occurred
170            */
171            public static com.liferay.portal.model.Group getGroup(long groupId)
172                    throws com.liferay.portal.kernel.exception.PortalException,
173                            com.liferay.portal.kernel.exception.SystemException {
174                    return getService().getGroup(groupId);
175            }
176    
177            /**
178            * Returns the group with the name.
179            *
180            * @param companyId the primary key of the company
181            * @param name the group's name
182            * @return the group with the name
183            * @throws PortalException if a matching group could not be found or if the
184            current user did not have permission to view the group
185            * @throws SystemException if a system exception occurred
186            */
187            public static com.liferay.portal.model.Group getGroup(long companyId,
188                    java.lang.String name)
189                    throws com.liferay.portal.kernel.exception.PortalException,
190                            com.liferay.portal.kernel.exception.SystemException {
191                    return getService().getGroup(companyId, name);
192            }
193    
194            /**
195            * Returns a range of all the site groups for which the user has control
196            * panel access.
197            *
198            * @param portlets the portlets to manage
199            * @param max the upper bound of the range of groups to consider (not
200            inclusive)
201            * @return the range of site groups for which the user has control panel
202            access
203            * @throws PortalException if a portal exception occurred
204            * @throws SystemException if a system exception occurred
205            */
206            public static java.util.List<com.liferay.portal.model.Group> getManageableSites(
207                    java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max)
208                    throws com.liferay.portal.kernel.exception.PortalException,
209                            com.liferay.portal.kernel.exception.SystemException {
210                    return getService().getManageableSites(portlets, max);
211            }
212    
213            /**
214            * Returns the groups associated with the organizations.
215            *
216            * @param organizations the organizations
217            * @return the groups associated with the organizations
218            * @throws PortalException if a portal exception occurred
219            * @throws SystemException if a system exception occurred
220            */
221            public static java.util.List<com.liferay.portal.model.Group> getOrganizationsGroups(
222                    java.util.List<com.liferay.portal.model.Organization> organizations)
223                    throws com.liferay.portal.kernel.exception.PortalException,
224                            com.liferay.portal.kernel.exception.SystemException {
225                    return getService().getOrganizationsGroups(organizations);
226            }
227    
228            /**
229            * Returns the group associated with the user.
230            *
231            * @param companyId the primary key of the company
232            * @param userId the primary key of the user
233            * @return the group associated with the user
234            * @throws PortalException if a matching group could not be found or if the
235            current user did not have permission to view the group
236            * @throws SystemException if a system exception occurred
237            */
238            public static com.liferay.portal.model.Group getUserGroup(long companyId,
239                    long userId)
240                    throws com.liferay.portal.kernel.exception.PortalException,
241                            com.liferay.portal.kernel.exception.SystemException {
242                    return getService().getUserGroup(companyId, userId);
243            }
244    
245            /**
246            * Returns the groups associated with the user groups.
247            *
248            * @param userGroups the user groups
249            * @return the groups associated with the user groups
250            * @throws PortalException if any one of the user group's group could not be
251            found
252            * @throws SystemException if a system exception occurred
253            */
254            public static java.util.List<com.liferay.portal.model.Group> getUserGroupsGroups(
255                    java.util.List<com.liferay.portal.model.UserGroup> userGroups)
256                    throws com.liferay.portal.kernel.exception.PortalException,
257                            com.liferay.portal.kernel.exception.SystemException {
258                    return getService().getUserGroupsGroups(userGroups);
259            }
260    
261            /**
262            * Returns the range of all groups associated with the user's organization
263            * groups, including the ancestors of the organization groups, unless portal
264            * property <code>organizations.membership.strict</code> is set to
265            * <code>true</code>.
266            *
267            * <p>
268            * Useful when paginating results. Returns a maximum of <code>end -
269            * start</code> instances. <code>start</code> and <code>end</code> are not
270            * primary keys, they are indexes in the result set. Thus, <code>0</code>
271            * refers to the first result in the set. Setting both <code>start</code>
272            * and <code>end</code> to {@link
273            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
274            * result set.
275            * </p>
276            *
277            * @param userId the primary key of the user
278            * @param start the lower bound of the range of groups to consider
279            * @param end the upper bound of the range of groups to consider (not
280            inclusive)
281            * @return the range of groups associated with the user's organizations
282            * @throws PortalException if a user with the primary key could not be found
283            or if another portal exception occurred
284            * @throws SystemException if a system exception occurred
285            */
286            public static java.util.List<com.liferay.portal.model.Group> getUserOrganizationsGroups(
287                    long userId, int start, int end)
288                    throws com.liferay.portal.kernel.exception.PortalException,
289                            com.liferay.portal.kernel.exception.SystemException {
290                    return getService().getUserOrganizationsGroups(userId, start, end);
291            }
292    
293            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
294                    long userId, java.lang.String[] classNames,
295                    boolean includeControlPanel, int max)
296                    throws com.liferay.portal.kernel.exception.PortalException,
297                            com.liferay.portal.kernel.exception.SystemException {
298                    return getService()
299                                       .getUserPlaces(userId, classNames, includeControlPanel, max);
300            }
301    
302            /**
303            * Returns the user's group &quot;places&quot; associated with the group
304            * entity class names, including the control panel group if the user is
305            * permitted to view the control panel.
306            *
307            * <p>
308            * <ul> <li> Class name &quot;User&quot; includes the user's layout set
309            * group. </li> <li> Class name &quot;Organization&quot; includes the user's
310            * immediate organization groups and inherited organization groups. </li>
311            * <li> Class name &quot;Group&quot; includes the user's immediate
312            * organization groups and site groups. </li> <li> A <code>classNames</code>
313            * value of <code>null</code> includes the user's layout set group,
314            * organization groups, inherited organization groups, and site groups.
315            * </li> </ul>
316            * </p>
317            *
318            * @param userId the primary key of the user
319            * @param classNames the group entity class names (optionally
320            <code>null</code>). For more information see {@link
321            #getUserPlaces(long, String[], int)}
322            * @param max the maximum number of groups to return
323            * @return the user's group &quot;places&quot;
324            * @throws PortalException if a portal exception occurred
325            * @throws SystemException if a system exception occurred
326            */
327            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
328                    long userId, java.lang.String[] classNames, int max)
329                    throws com.liferay.portal.kernel.exception.PortalException,
330                            com.liferay.portal.kernel.exception.SystemException {
331                    return getService().getUserPlaces(userId, classNames, max);
332            }
333    
334            /**
335            * Returns the guest or current user's group &quot;places&quot; associated
336            * with the group entity class names, including the control panel group if
337            * the user is permitted to view the control panel.
338            *
339            * <p>
340            * <ul> <li> Class name &quot;User&quot; includes the user's layout set
341            * group. </li> <li> Class name &quot;Organization&quot; includes the user's
342            * immediate organization groups and inherited organization groups. </li>
343            * <li> Class name &quot;Group&quot; includes the user's immediate
344            * organization groups and site groups. </li> <li> A <code>classNames</code>
345            * value of <code>null</code> includes the user's layout set group,
346            * organization groups, inherited organization groups, and site groups.
347            * </li> </ul>
348            * </p>
349            *
350            * @param classNames the group entity class names (optionally
351            <code>null</code>). For more information see {@link
352            #getUserPlaces(String[], int)}
353            * @param max the maximum number of groups to return
354            * @return the user's group &quot;places&quot;
355            * @throws PortalException if a portal exception occurred
356            * @throws SystemException if a system exception occurred
357            */
358            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
359                    java.lang.String[] classNames, int max)
360                    throws com.liferay.portal.kernel.exception.PortalException,
361                            com.liferay.portal.kernel.exception.SystemException {
362                    return getService().getUserPlaces(classNames, max);
363            }
364    
365            /**
366            * Returns the guest or current user's layout set group, organization
367            * groups, inherited organization groups, and site groups.
368            *
369            * @return the user's layout set group, organization groups, and inherited
370            organization groups, and site groups
371            * @throws PortalException if a portal exception occurred
372            * @throws SystemException if a system exception occurred
373            */
374            public static java.util.List<com.liferay.portal.model.Group> getUserSites()
375                    throws com.liferay.portal.kernel.exception.PortalException,
376                            com.liferay.portal.kernel.exception.SystemException {
377                    return getService().getUserSites();
378            }
379    
380            /**
381            * Returns <code>true</code> if the user is associated with the group,
382            * including the user's inherited organizations and user groups. System and
383            * staged groups are not included.
384            *
385            * @param userId the primary key of the user
386            * @param groupId the primary key of the group
387            * @return <code>true</code> if the user is associated with the group;
388            <code>false</code> otherwise
389            * @throws PortalException if the current user did not have permission to
390            view the user or group members
391            * @throws SystemException if a system exception occurred
392            */
393            public static boolean hasUserGroup(long userId, long groupId)
394                    throws com.liferay.portal.kernel.exception.PortalException,
395                            com.liferay.portal.kernel.exception.SystemException {
396                    return getService().hasUserGroup(userId, groupId);
397            }
398    
399            /**
400            * Returns a name ordered range of all the site groups and organization
401            * groups that match the name and description, optionally including the
402            * user's inherited organization groups and user groups. System and staged
403            * groups are not included.
404            *
405            * <p>
406            * Useful when paginating results. Returns a maximum of <code>end -
407            * start</code> instances. <code>start</code> and <code>end</code> are not
408            * primary keys, they are indexes in the result set. Thus, <code>0</code>
409            * refers to the first result in the set. Setting both <code>start</code>
410            * and <code>end</code> to {@link
411            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
412            * result set.
413            * </p>
414            *
415            * @param companyId the primary key of the company
416            * @param name the group's name (optionally <code>null</code>)
417            * @param description the group's description (optionally
418            <code>null</code>)
419            * @param params the finder params (optionally <code>null</code>). To
420            include the user's inherited organizations and user groups in the
421            search, add entries having &quot;usersGroups&quot; and
422            &quot;inherit&quot; as keys mapped to the the user's ID. For more
423            information see {@link
424            com.liferay.portal.service.persistence.GroupFinder}
425            * @param start the lower bound of the range of groups to return
426            * @param end the upper bound of the range of groups to return (not
427            inclusive)
428            * @return the matching groups ordered by name
429            * @throws PortalException if a portal exception occurred
430            * @throws SystemException if a system exception occurred
431            */
432            public static java.util.List<com.liferay.portal.model.Group> search(
433                    long companyId, java.lang.String name, java.lang.String description,
434                    java.lang.String[] params, int start, int end)
435                    throws com.liferay.portal.kernel.exception.PortalException,
436                            com.liferay.portal.kernel.exception.SystemException {
437                    return getService()
438                                       .search(companyId, name, description, params, start, end);
439            }
440    
441            /**
442            * Returns the number of groups and organization groups that match the name
443            * and description, optionally including the user's inherited organizations
444            * and user groups. System and staged groups are not included.
445            *
446            * @param companyId the primary key of the company
447            * @param name the group's name (optionally <code>null</code>)
448            * @param description the group's description (optionally
449            <code>null</code>)
450            * @param params the finder params (optionally <code>null</code>). To
451            include the user's inherited organizations and user groups in the
452            search, add entries having &quot;usersGroups&quot; and
453            &quot;inherit&quot; as keys mapped to the the user's ID. For more
454            information see {@link
455            com.liferay.portal.service.persistence.GroupFinder}
456            * @return the number of matching groups
457            * @throws SystemException if a system exception occurred
458            */
459            public static int searchCount(long companyId, java.lang.String name,
460                    java.lang.String description, java.lang.String[] params)
461                    throws com.liferay.portal.kernel.exception.SystemException {
462                    return getService().searchCount(companyId, name, description, params);
463            }
464    
465            /**
466            * Sets the groups associated with the role, removing and adding
467            * associations as necessary.
468            *
469            * @param roleId the primary key of the role
470            * @param groupIds the primary keys of the groups
471            * @throws PortalException if the user did not have permission to update
472            update the role
473            * @throws SystemException if a system exception occurred
474            */
475            public static void setRoleGroups(long roleId, long[] groupIds)
476                    throws com.liferay.portal.kernel.exception.PortalException,
477                            com.liferay.portal.kernel.exception.SystemException {
478                    getService().setRoleGroups(roleId, groupIds);
479            }
480    
481            /**
482            * Removes the groups from the role.
483            *
484            * @param roleId the primary key of the role
485            * @param groupIds the primary keys of the groups
486            * @throws PortalException if the user did not have permission to update the
487            role
488            * @throws SystemException if a system exception occurred
489            */
490            public static void unsetRoleGroups(long roleId, long[] groupIds)
491                    throws com.liferay.portal.kernel.exception.PortalException,
492                            com.liferay.portal.kernel.exception.SystemException {
493                    getService().unsetRoleGroups(roleId, groupIds);
494            }
495    
496            /**
497            * Updates the group's friendly URL.
498            *
499            * @param groupId the primary key of the group
500            * @param friendlyURL the group's new friendlyURL (optionally
501            <code>null</code>)
502            * @return the group
503            * @throws PortalException if the user did not have permission to update the
504            group, if a group with the primary key could not be found, or if
505            a valid friendly URL could not be created for the group
506            * @throws SystemException if a system exception occurred
507            */
508            public static com.liferay.portal.model.Group updateFriendlyURL(
509                    long groupId, java.lang.String friendlyURL)
510                    throws com.liferay.portal.kernel.exception.PortalException,
511                            com.liferay.portal.kernel.exception.SystemException {
512                    return getService().updateFriendlyURL(groupId, friendlyURL);
513            }
514    
515            /**
516            * Updates the group's type settings.
517            *
518            * @param groupId the primary key of the group
519            * @param typeSettings the group's new type settings (optionally
520            <code>null</code>)
521            * @return the group
522            * @throws PortalException if the user did not have permission to update the
523            group or if a group with the primary key could not be found
524            * @throws SystemException if a system exception occurred
525            */
526            public static com.liferay.portal.model.Group updateGroup(long groupId,
527                    java.lang.String typeSettings)
528                    throws com.liferay.portal.kernel.exception.PortalException,
529                            com.liferay.portal.kernel.exception.SystemException {
530                    return getService().updateGroup(groupId, typeSettings);
531            }
532    
533            /**
534            * Updates the group.
535            *
536            * @param groupId the primary key of the group
537            * @param name the group's new name
538            * @param description the group's new description (optionally
539            <code>null</code>)
540            * @param type the group's new type. For more information see {@link
541            com.liferay.portal.model.GroupConstants}
542            * @param friendlyURL the group's new friendlyURL (optionally
543            <code>null</code>)
544            * @param active whether the group is active
545            * @param serviceContext the service context to be applied (optionally
546            <code>null</code>). Can set the asset category IDs and asset tag
547            names for the group.
548            * @return the group
549            * @throws PortalException if the user did not have permission to update the
550            group, if a group with the primary key could not be found, if the
551            friendly URL was invalid or could one not be created
552            * @throws SystemException if a system exception occurred
553            */
554            public static com.liferay.portal.model.Group updateGroup(long groupId,
555                    java.lang.String name, java.lang.String description, int type,
556                    java.lang.String friendlyURL, boolean active,
557                    com.liferay.portal.service.ServiceContext serviceContext)
558                    throws com.liferay.portal.kernel.exception.PortalException,
559                            com.liferay.portal.kernel.exception.SystemException {
560                    return getService()
561                                       .updateGroup(groupId, name, description, type, friendlyURL,
562                            active, serviceContext);
563            }
564    
565            public static GroupService getService() {
566                    if (_service == null) {
567                            _service = (GroupService)PortalBeanLocatorUtil.locate(GroupService.class.getName());
568    
569                            ReferenceRegistry.registerReference(GroupServiceUtil.class,
570                                    "_service");
571                    }
572    
573                    return _service;
574            }
575    
576            /**
577             * @deprecated
578             */
579            public void setService(GroupService service) {
580            }
581    
582            private static GroupService _service;
583    }