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