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