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