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 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 SystemException if a system exception occurred
390            */
391            public static boolean hasUserGroup(long userId, long groupId)
392                    throws com.liferay.portal.kernel.exception.PortalException,
393                            com.liferay.portal.kernel.exception.SystemException {
394                    return getService().hasUserGroup(userId, groupId);
395            }
396    
397            /**
398            * Returns a name ordered range of all the site groups and organization
399            * groups that match the name and description, optionally including the
400            * user's inherited organization groups and user groups. System and staged
401            * groups are not included.
402            *
403            * <p>
404            * Useful when paginating results. Returns a maximum of <code>end -
405            * start</code> instances. <code>start</code> and <code>end</code> are not
406            * primary keys, they are indexes in the result set. Thus, <code>0</code>
407            * refers to the first result in the set. Setting both <code>start</code>
408            * and <code>end</code> to {@link
409            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
410            * result set.
411            * </p>
412            *
413            * @param companyId the primary key of the company
414            * @param name the group's name (optionally <code>null</code>)
415            * @param description the group's description (optionally
416            <code>null</code>)
417            * @param params the finder params (optionally <code>null</code>). To
418            include the user's inherited organizations and user groups in the
419            search, add entries having &quot;usersGroups&quot; and
420            &quot;inherit&quot; as keys mapped to the the user's ID. For more
421            information see {@link
422            com.liferay.portal.service.persistence.GroupFinder}
423            * @param start the lower bound of the range of groups to return
424            * @param end the upper bound of the range of groups to return (not
425            inclusive)
426            * @return the matching groups ordered by name
427            * @throws PortalException if a portal exception occurred
428            * @throws SystemException if a system exception occurred
429            */
430            public static java.util.List<com.liferay.portal.model.Group> search(
431                    long companyId, java.lang.String name, java.lang.String description,
432                    java.lang.String[] params, int start, int end)
433                    throws com.liferay.portal.kernel.exception.PortalException,
434                            com.liferay.portal.kernel.exception.SystemException {
435                    return getService()
436                                       .search(companyId, name, description, params, start, end);
437            }
438    
439            /**
440            * Returns the number of groups and organization groups that match the name
441            * and description, optionally including the user's inherited organizations
442            * and user groups. System and staged groups are not included.
443            *
444            * @param companyId the primary key of the company
445            * @param name the group's name (optionally <code>null</code>)
446            * @param description the group's description (optionally
447            <code>null</code>)
448            * @param params the finder params (optionally <code>null</code>). To
449            include the user's inherited organizations and user groups in the
450            search, add entries having &quot;usersGroups&quot; and
451            &quot;inherit&quot; as keys mapped to the the user's ID. For more
452            information see {@link
453            com.liferay.portal.service.persistence.GroupFinder}
454            * @return the number of matching groups
455            * @throws SystemException if a system exception occurred
456            */
457            public static int searchCount(long companyId, java.lang.String name,
458                    java.lang.String description, java.lang.String[] params)
459                    throws com.liferay.portal.kernel.exception.SystemException {
460                    return getService().searchCount(companyId, name, description, params);
461            }
462    
463            /**
464            * Sets the groups associated with the role, removing and adding
465            * associations as necessary.
466            *
467            * @param roleId the primary key of the role
468            * @param groupIds the primary keys of the groups
469            * @throws PortalException if the user did not have permission to update
470            update the role
471            * @throws SystemException if a system exception occurred
472            */
473            public static void setRoleGroups(long roleId, long[] groupIds)
474                    throws com.liferay.portal.kernel.exception.PortalException,
475                            com.liferay.portal.kernel.exception.SystemException {
476                    getService().setRoleGroups(roleId, groupIds);
477            }
478    
479            /**
480            * Removes the groups from the role.
481            *
482            * @param roleId the primary key of the role
483            * @param groupIds the primary keys of the groups
484            * @throws PortalException if the user did not have permission to update the
485            role
486            * @throws SystemException if a system exception occurred
487            */
488            public static void unsetRoleGroups(long roleId, long[] groupIds)
489                    throws com.liferay.portal.kernel.exception.PortalException,
490                            com.liferay.portal.kernel.exception.SystemException {
491                    getService().unsetRoleGroups(roleId, groupIds);
492            }
493    
494            /**
495            * Updates the group's friendly URL.
496            *
497            * @param groupId the primary key of the group
498            * @param friendlyURL the group's new friendlyURL (optionally
499            <code>null</code>)
500            * @return the group
501            * @throws PortalException if the user did not have permission to update the
502            group, if a group with the primary key could not be found, or if
503            a valid friendly URL could not be created for the group
504            * @throws SystemException if a system exception occurred
505            */
506            public static com.liferay.portal.model.Group updateFriendlyURL(
507                    long groupId, java.lang.String friendlyURL)
508                    throws com.liferay.portal.kernel.exception.PortalException,
509                            com.liferay.portal.kernel.exception.SystemException {
510                    return getService().updateFriendlyURL(groupId, friendlyURL);
511            }
512    
513            /**
514            * Updates the group's type settings.
515            *
516            * @param groupId the primary key of the group
517            * @param typeSettings the group's new type settings (optionally
518            <code>null</code>)
519            * @return the group
520            * @throws PortalException if the user did not have permission to update the
521            group or if a group with the primary key could not be found
522            * @throws SystemException if a system exception occurred
523            */
524            public static com.liferay.portal.model.Group updateGroup(long groupId,
525                    java.lang.String typeSettings)
526                    throws com.liferay.portal.kernel.exception.PortalException,
527                            com.liferay.portal.kernel.exception.SystemException {
528                    return getService().updateGroup(groupId, typeSettings);
529            }
530    
531            /**
532            * Updates the group.
533            *
534            * @param groupId the primary key of the group
535            * @param name the group's new name
536            * @param description the group's new description (optionally
537            <code>null</code>)
538            * @param type the group's new type. For more information see {@link
539            com.liferay.portal.model.GroupConstants}
540            * @param friendlyURL the group's new friendlyURL (optionally
541            <code>null</code>)
542            * @param active whether the group is active
543            * @param serviceContext the service context to be applied (optionally
544            <code>null</code>). Can set the asset category IDs and asset tag
545            names for the group.
546            * @return the group
547            * @throws PortalException if the user did not have permission to update the
548            group, if a group with the primary key could not be found, if the
549            friendly URL was invalid or could one not be created
550            * @throws SystemException if a system exception occurred
551            */
552            public static com.liferay.portal.model.Group updateGroup(long groupId,
553                    java.lang.String name, java.lang.String description, int type,
554                    java.lang.String friendlyURL, boolean active,
555                    com.liferay.portal.service.ServiceContext serviceContext)
556                    throws com.liferay.portal.kernel.exception.PortalException,
557                            com.liferay.portal.kernel.exception.SystemException {
558                    return getService()
559                                       .updateGroup(groupId, name, description, type, friendlyURL,
560                            active, serviceContext);
561            }
562    
563            public static GroupService getService() {
564                    if (_service == null) {
565                            _service = (GroupService)PortalBeanLocatorUtil.locate(GroupService.class.getName());
566    
567                            ReferenceRegistry.registerReference(GroupServiceUtil.class,
568                                    "_service");
569                    }
570    
571                    return _service;
572            }
573    
574            /**
575             * @deprecated
576             */
577            public void setService(GroupService service) {
578            }
579    
580            private static GroupService _service;
581    }