001    /**
002     * Copyright (c) 2000-2012 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 parentGroupId the primary key of the parent group
062            * @param liveGroupId the primary key of the live group
063            * @param name the entity's name
064            * @param description the group's description (optionally
065            <code>null</code>)
066            * @param type the group's type. For more information see {@link
067            com.liferay.portal.model.GroupConstants}
068            * @param friendlyURL the group's friendlyURL (optionally
069            <code>null</code>)
070            * @param site whether the group is to be associated with a main site
071            * @param active whether the group is active
072            * @param serviceContext the service context to be applied (optionally
073            <code>null</code>). Can set the asset category IDs and asset tag
074            names for the group, and can set whether the group is for staging
075            * @return the group
076            * @throws PortalException if the user did not have permission to add the
077            group, if a creator could not be found, if the group's
078            information was invalid, if a layout could not be found, or if a
079            valid friendly URL could not be created for the group
080            * @throws SystemException if a system exception occurred
081            */
082            public static com.liferay.portal.model.Group addGroup(long parentGroupId,
083                    long liveGroupId, java.lang.String name, java.lang.String description,
084                    int type, java.lang.String friendlyURL, boolean site, boolean active,
085                    com.liferay.portal.service.ServiceContext serviceContext)
086                    throws com.liferay.portal.kernel.exception.PortalException,
087                            com.liferay.portal.kernel.exception.SystemException {
088                    return getService()
089                                       .addGroup(parentGroupId, liveGroupId, name, description,
090                            type, friendlyURL, site, active, serviceContext);
091            }
092    
093            /**
094            * Adds the group using the group default live group ID.
095            *
096            * @param parentGroupId the primary key of the parent group
097            * @param name the entity's name
098            * @param description the group's description (optionally
099            <code>null</code>)
100            * @param type the group's type. For more information see {@link
101            com.liferay.portal.model.GroupConstants}
102            * @param friendlyURL the group's friendlyURL
103            * @param site whether the group is to be associated with a main site
104            * @param active whether the group is active
105            * @param serviceContext the service context to be applied (optionally
106            <code>null</code>). Can set asset category IDs and asset tag
107            names for the group, and can set whether the group is for
108            staging
109            * @return the group
110            * @throws PortalException if the user did not have permission to add
111            the group, if a creator could not be found, if the group's
112            information was invalid, if a layout could not be found, or
113            if a valid friendly URL could not be created for the group
114            * @throws SystemException if a system exception occurred
115            * @deprecated {@link #addGroup(long, long, String, String, int, String,
116            boolean, boolean, ServiceContext)}
117            */
118            public static com.liferay.portal.model.Group addGroup(long parentGroupId,
119                    java.lang.String name, java.lang.String description, int type,
120                    java.lang.String friendlyURL, boolean site, boolean active,
121                    com.liferay.portal.service.ServiceContext serviceContext)
122                    throws com.liferay.portal.kernel.exception.PortalException,
123                            com.liferay.portal.kernel.exception.SystemException {
124                    return getService()
125                                       .addGroup(parentGroupId, name, description, type,
126                            friendlyURL, site, active, serviceContext);
127            }
128    
129            /**
130            * @deprecated {@link #addGroup(long, String, String, int, String, boolean,
131            boolean, ServiceContext)}
132            */
133            public static com.liferay.portal.model.Group addGroup(
134                    java.lang.String name, java.lang.String description, int type,
135                    java.lang.String friendlyURL, boolean site, boolean active,
136                    com.liferay.portal.service.ServiceContext serviceContext)
137                    throws com.liferay.portal.kernel.exception.PortalException,
138                            com.liferay.portal.kernel.exception.SystemException {
139                    return getService()
140                                       .addGroup(name, description, type, friendlyURL, site,
141                            active, serviceContext);
142            }
143    
144            /**
145            * Adds the groups to the role.
146            *
147            * @param roleId the primary key of the role
148            * @param groupIds the primary keys of the groups
149            * @throws PortalException if the user did not have permission to update the
150            role
151            * @throws SystemException if a system exception occurred
152            */
153            public static void addRoleGroups(long roleId, long[] groupIds)
154                    throws com.liferay.portal.kernel.exception.PortalException,
155                            com.liferay.portal.kernel.exception.SystemException {
156                    getService().addRoleGroups(roleId, groupIds);
157            }
158    
159            /**
160            * Deletes the group.
161            *
162            * <p>
163            * The group is unstaged and its assets and resources including layouts,
164            * membership requests, subscriptions, teams, blogs, bookmarks, calendar
165            * events, image gallery, journals, message boards, polls, shopping related
166            * entities, software catalog, and wikis are also deleted.
167            * </p>
168            *
169            * @param groupId the primary key of the group
170            * @throws PortalException if the user did not have permission to delete the
171            group or its assets or resources, if a group with the primary key
172            could not be found, or if the group was a system group
173            * @throws SystemException if a system exception occurred
174            */
175            public static void deleteGroup(long groupId)
176                    throws com.liferay.portal.kernel.exception.PortalException,
177                            com.liferay.portal.kernel.exception.SystemException {
178                    getService().deleteGroup(groupId);
179            }
180    
181            /**
182            * Returns the group with the primary key.
183            *
184            * @param groupId the primary key of the group
185            * @return the group with the primary key
186            * @throws PortalException if a group with the primary key could not be
187            found or if the current user did not have permission to view the
188            group
189            * @throws SystemException if a system exception occurred
190            */
191            public static com.liferay.portal.model.Group getGroup(long groupId)
192                    throws com.liferay.portal.kernel.exception.PortalException,
193                            com.liferay.portal.kernel.exception.SystemException {
194                    return getService().getGroup(groupId);
195            }
196    
197            /**
198            * Returns the group with the name.
199            *
200            * @param companyId the primary key of the company
201            * @param name the group's name
202            * @return the group with the name
203            * @throws PortalException if a matching group could not be found or if the
204            current user did not have permission to view the group
205            * @throws SystemException if a system exception occurred
206            */
207            public static com.liferay.portal.model.Group getGroup(long companyId,
208                    java.lang.String name)
209                    throws com.liferay.portal.kernel.exception.PortalException,
210                            com.liferay.portal.kernel.exception.SystemException {
211                    return getService().getGroup(companyId, name);
212            }
213    
214            /**
215            * Returns a range of all the site groups for which the user has control
216            * panel access.
217            *
218            * @param portlets the portlets to manage
219            * @param max the upper bound of the range of groups to consider (not
220            inclusive)
221            * @return the range of site groups for which the user has control panel
222            access
223            * @throws PortalException if a portal exception occurred
224            * @throws SystemException if a system exception occurred
225            */
226            public static java.util.List<com.liferay.portal.model.Group> getManageableSites(
227                    java.util.Collection<com.liferay.portal.model.Portlet> portlets, int max)
228                    throws com.liferay.portal.kernel.exception.PortalException,
229                            com.liferay.portal.kernel.exception.SystemException {
230                    return getService().getManageableSites(portlets, max);
231            }
232    
233            /**
234            * Returns the groups associated with the organizations.
235            *
236            * @param organizations the organizations
237            * @return the groups associated with the organizations
238            * @throws PortalException if a portal exception occurred
239            * @throws SystemException if a system exception occurred
240            */
241            public static java.util.List<com.liferay.portal.model.Group> getOrganizationsGroups(
242                    java.util.List<com.liferay.portal.model.Organization> organizations)
243                    throws com.liferay.portal.kernel.exception.PortalException,
244                            com.liferay.portal.kernel.exception.SystemException {
245                    return getService().getOrganizationsGroups(organizations);
246            }
247    
248            /**
249            * Returns the group associated with the user.
250            *
251            * @param companyId the primary key of the company
252            * @param userId the primary key of the user
253            * @return the group associated with the user
254            * @throws PortalException if a matching group could not be found or if the
255            current user did not have permission to view the group
256            * @throws SystemException if a system exception occurred
257            */
258            public static com.liferay.portal.model.Group getUserGroup(long companyId,
259                    long userId)
260                    throws com.liferay.portal.kernel.exception.PortalException,
261                            com.liferay.portal.kernel.exception.SystemException {
262                    return getService().getUserGroup(companyId, userId);
263            }
264    
265            /**
266            * Returns the groups associated with the user groups.
267            *
268            * @param userGroups the user groups
269            * @return the groups associated with the user groups
270            * @throws PortalException if any one of the user group's group could not be
271            found
272            * @throws SystemException if a system exception occurred
273            */
274            public static java.util.List<com.liferay.portal.model.Group> getUserGroupsGroups(
275                    java.util.List<com.liferay.portal.model.UserGroup> userGroups)
276                    throws com.liferay.portal.kernel.exception.PortalException,
277                            com.liferay.portal.kernel.exception.SystemException {
278                    return getService().getUserGroupsGroups(userGroups);
279            }
280    
281            /**
282            * Returns the range of all groups associated with the user's organization
283            * groups, including the ancestors of the organization groups, unless portal
284            * property <code>organizations.membership.strict</code> is set to
285            * <code>true</code>.
286            *
287            * <p>
288            * Useful when paginating results. Returns a maximum of <code>end -
289            * start</code> instances. <code>start</code> and <code>end</code> are not
290            * primary keys, they are indexes in the result set. Thus, <code>0</code>
291            * refers to the first result in the set. Setting both <code>start</code>
292            * and <code>end</code> to {@link
293            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
294            * result set.
295            * </p>
296            *
297            * @param userId the primary key of the user
298            * @param start the lower bound of the range of groups to consider
299            * @param end the upper bound of the range of groups to consider (not
300            inclusive)
301            * @return the range of groups associated with the user's organizations
302            * @throws PortalException if a user with the primary key could not be found
303            or if another portal exception occurred
304            * @throws SystemException if a system exception occurred
305            */
306            public static java.util.List<com.liferay.portal.model.Group> getUserOrganizationsGroups(
307                    long userId, int start, int end)
308                    throws com.liferay.portal.kernel.exception.PortalException,
309                            com.liferay.portal.kernel.exception.SystemException {
310                    return getService().getUserOrganizationsGroups(userId, start, end);
311            }
312    
313            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
314                    long userId, java.lang.String[] classNames,
315                    boolean includeControlPanel, int max)
316                    throws com.liferay.portal.kernel.exception.PortalException,
317                            com.liferay.portal.kernel.exception.SystemException {
318                    return getService()
319                                       .getUserPlaces(userId, classNames, includeControlPanel, 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 the guest or current user's group &quot;places&quot; associated
356            * with the group entity class names, including the control panel group if
357            * the user is permitted to view the control panel.
358            *
359            * <p>
360            * <ul> <li> Class name &quot;User&quot; includes the user's layout set
361            * group. </li> <li> Class name &quot;Organization&quot; includes the user's
362            * immediate organization groups and inherited organization groups. </li>
363            * <li> Class name &quot;Group&quot; includes the user's immediate
364            * organization groups and site groups. </li> <li> A <code>classNames</code>
365            * value of <code>null</code> includes the user's layout set group,
366            * organization groups, inherited organization groups, and site groups.
367            * </li> </ul>
368            * </p>
369            *
370            * @param classNames the group entity class names (optionally
371            <code>null</code>). For more information see {@link
372            #getUserPlaces(String[], int)}
373            * @param max the maximum number of groups to return
374            * @return the user's group &quot;places&quot;
375            * @throws PortalException if a portal exception occurred
376            * @throws SystemException if a system exception occurred
377            */
378            public static java.util.List<com.liferay.portal.model.Group> getUserPlaces(
379                    java.lang.String[] classNames, int max)
380                    throws com.liferay.portal.kernel.exception.PortalException,
381                            com.liferay.portal.kernel.exception.SystemException {
382                    return getService().getUserPlaces(classNames, max);
383            }
384    
385            /**
386            * Returns the guest or current user's layout set group, organization
387            * groups, inherited organization groups, and site groups.
388            *
389            * @return the user's layout set group, organization groups, and inherited
390            organization groups, and site groups
391            * @throws PortalException if a portal exception occurred
392            * @throws SystemException if a system exception occurred
393            */
394            public static java.util.List<com.liferay.portal.model.Group> getUserSites()
395                    throws com.liferay.portal.kernel.exception.PortalException,
396                            com.liferay.portal.kernel.exception.SystemException {
397                    return getService().getUserSites();
398            }
399    
400            /**
401            * Returns <code>true</code> if the user is associated with the group,
402            * including the user's inherited organizations and user groups. System and
403            * staged groups are not included.
404            *
405            * @param userId the primary key of the user
406            * @param groupId the primary key of the group
407            * @return <code>true</code> if the user is associated with the group;
408            <code>false</code> otherwise
409            * @throws PortalException if the current user did not have permission to
410            view the user or group members
411            * @throws SystemException if a system exception occurred
412            */
413            public static boolean hasUserGroup(long userId, long groupId)
414                    throws com.liferay.portal.kernel.exception.PortalException,
415                            com.liferay.portal.kernel.exception.SystemException {
416                    return getService().hasUserGroup(userId, groupId);
417            }
418    
419            /**
420            * Returns an ordered range of all the site groups and organization groups
421            * that match the name and description, optionally including the user's
422            * inherited organization groups and user groups. System and staged groups
423            * are not included.
424            *
425            * <p>
426            * Useful when paginating results. Returns a maximum of <code>end -
427            * start</code> instances. <code>start</code> and <code>end</code> are not
428            * primary keys, they are indexes in the result set. Thus, <code>0</code>
429            * refers to the first result in the set. Setting both <code>start</code>
430            * and <code>end</code> to {@link
431            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
432            * result set.
433            * </p>
434            *
435            * @param companyId the primary key of the company
436            * @param name the group's name (optionally <code>null</code>)
437            * @param description the group's description (optionally
438            <code>null</code>)
439            * @param params the finder params (optionally <code>null</code>). To
440            include the user's inherited organizations and user groups in the
441            search, add entries having &quot;usersGroups&quot; and
442            &quot;inherit&quot; as keys mapped to the the user's ID. For more
443            information see {@link
444            com.liferay.portal.service.persistence.GroupFinder}
445            * @param start the lower bound of the range of groups to return
446            * @param end the upper bound of the range of groups to return (not
447            inclusive)
448            * @return the matching groups ordered by name
449            * @throws PortalException if a portal exception occurred
450            * @throws SystemException if a system exception occurred
451            */
452            public static java.util.List<com.liferay.portal.model.Group> search(
453                    long companyId, java.lang.String name, java.lang.String description,
454                    java.lang.String[] params, int start, int end)
455                    throws com.liferay.portal.kernel.exception.PortalException,
456                            com.liferay.portal.kernel.exception.SystemException {
457                    return getService()
458                                       .search(companyId, name, description, params, start, end);
459            }
460    
461            /**
462            * Returns the number of groups and organization groups that match the name
463            * and description, optionally including the user's inherited organizations
464            * and user groups. System and staged groups are not included.
465            *
466            * @param companyId the primary key of the company
467            * @param name the group's name (optionally <code>null</code>)
468            * @param description the group's description (optionally
469            <code>null</code>)
470            * @param params the finder params (optionally <code>null</code>). To
471            include the user's inherited organizations and user groups in the
472            search, add entries having &quot;usersGroups&quot; and
473            &quot;inherit&quot; as keys mapped to the the user's ID. For more
474            information see {@link
475            com.liferay.portal.service.persistence.GroupFinder}
476            * @return the number of matching groups
477            * @throws SystemException if a system exception occurred
478            */
479            public static int searchCount(long companyId, java.lang.String name,
480                    java.lang.String description, java.lang.String[] params)
481                    throws com.liferay.portal.kernel.exception.SystemException {
482                    return getService().searchCount(companyId, name, description, params);
483            }
484    
485            /**
486            * Sets the groups associated with the role, removing and adding
487            * associations as necessary.
488            *
489            * @param roleId the primary key of the role
490            * @param groupIds the primary keys of the groups
491            * @throws PortalException if the user did not have permission to update
492            update the role
493            * @throws SystemException if a system exception occurred
494            */
495            public static void setRoleGroups(long roleId, long[] groupIds)
496                    throws com.liferay.portal.kernel.exception.PortalException,
497                            com.liferay.portal.kernel.exception.SystemException {
498                    getService().setRoleGroups(roleId, groupIds);
499            }
500    
501            /**
502            * Removes the groups from the role.
503            *
504            * @param roleId the primary key of the role
505            * @param groupIds the primary keys of the groups
506            * @throws PortalException if the user did not have permission to update the
507            role
508            * @throws SystemException if a system exception occurred
509            */
510            public static void unsetRoleGroups(long roleId, long[] groupIds)
511                    throws com.liferay.portal.kernel.exception.PortalException,
512                            com.liferay.portal.kernel.exception.SystemException {
513                    getService().unsetRoleGroups(roleId, groupIds);
514            }
515    
516            /**
517            * Updates the group's friendly URL.
518            *
519            * @param groupId the primary key of the group
520            * @param friendlyURL the group's new friendlyURL (optionally
521            <code>null</code>)
522            * @return the group
523            * @throws PortalException if the user did not have permission to update the
524            group, if a group with the primary key could not be found, or if
525            a valid friendly URL could not be created for the group
526            * @throws SystemException if a system exception occurred
527            */
528            public static com.liferay.portal.model.Group updateFriendlyURL(
529                    long groupId, java.lang.String friendlyURL)
530                    throws com.liferay.portal.kernel.exception.PortalException,
531                            com.liferay.portal.kernel.exception.SystemException {
532                    return getService().updateFriendlyURL(groupId, friendlyURL);
533            }
534    
535            /**
536            * Updates the group.
537            *
538            * @param groupId the primary key of the group
539            * @param parentGroupId the primary key of the parent group
540            * @param name the group's new name
541            * @param description the group's new description (optionally
542            <code>null</code>)
543            * @param type the group's new type. For more information see {@link
544            com.liferay.portal.model.GroupConstants}
545            * @param friendlyURL the group's new friendlyURL (optionally
546            <code>null</code>)
547            * @param active whether the group is active
548            * @param serviceContext the service context to be applied (optionally
549            <code>null</code>). Can set the asset category IDs and asset tag
550            names for the group.
551            * @return the group
552            * @throws PortalException if the user did not have permission to update the
553            group, if a group with the primary key could not be found, if the
554            friendly URL was invalid or could one not be created
555            * @throws SystemException if a system exception occurred
556            */
557            public static com.liferay.portal.model.Group updateGroup(long groupId,
558                    long parentGroupId, java.lang.String name,
559                    java.lang.String description, int type, java.lang.String friendlyURL,
560                    boolean active, com.liferay.portal.service.ServiceContext serviceContext)
561                    throws com.liferay.portal.kernel.exception.PortalException,
562                            com.liferay.portal.kernel.exception.SystemException {
563                    return getService()
564                                       .updateGroup(groupId, parentGroupId, name, description,
565                            type, friendlyURL, active, serviceContext);
566            }
567    
568            /**
569            * Updates the group's type settings.
570            *
571            * @param groupId the primary key of the group
572            * @param typeSettings the group's new type settings (optionally
573            <code>null</code>)
574            * @return the group
575            * @throws PortalException if the user did not have permission to update the
576            group or if a group with the primary key could not be found
577            * @throws SystemException if a system exception occurred
578            */
579            public static com.liferay.portal.model.Group updateGroup(long groupId,
580                    java.lang.String typeSettings)
581                    throws com.liferay.portal.kernel.exception.PortalException,
582                            com.liferay.portal.kernel.exception.SystemException {
583                    return getService().updateGroup(groupId, typeSettings);
584            }
585    
586            public static GroupService getService() {
587                    if (_service == null) {
588                            _service = (GroupService)PortalBeanLocatorUtil.locate(GroupService.class.getName());
589    
590                            ReferenceRegistry.registerReference(GroupServiceUtil.class,
591                                    "_service");
592                    }
593    
594                    return _service;
595            }
596    
597            /**
598             * @deprecated
599             */
600            public void setService(GroupService service) {
601            }
602    
603            private static GroupService _service;
604    }