001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.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 SystemException if a system exception occurred
369            */
370            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
371            public boolean hasUserGroup(long userId, long groupId)
372                    throws com.liferay.portal.kernel.exception.PortalException,
373                            com.liferay.portal.kernel.exception.SystemException;
374    
375            /**
376            * Returns a name ordered range of all the site groups and organization
377            * groups that match the name and description, optionally including the
378            * user's inherited organization groups and user groups. System and staged
379            * groups are not included.
380            *
381            * <p>
382            * Useful when paginating results. Returns a maximum of <code>end -
383            * start</code> instances. <code>start</code> and <code>end</code> are not
384            * primary keys, they are indexes in the result set. Thus, <code>0</code>
385            * refers to the first result in the set. Setting both <code>start</code>
386            * and <code>end</code> to {@link
387            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
388            * result set.
389            * </p>
390            *
391            * @param companyId the primary key of the company
392            * @param name the group's name (optionally <code>null</code>)
393            * @param description the group's description (optionally
394            <code>null</code>)
395            * @param params the finder params (optionally <code>null</code>). To
396            include the user's inherited organizations and user groups in the
397            search, add entries having &quot;usersGroups&quot; and
398            &quot;inherit&quot; as keys mapped to the the user's ID. For more
399            information see {@link
400            com.liferay.portal.service.persistence.GroupFinder}
401            * @param start the lower bound of the range of groups to return
402            * @param end the upper bound of the range of groups to return (not
403            inclusive)
404            * @return the matching groups ordered by name
405            * @throws PortalException if a portal exception occurred
406            * @throws SystemException if a system exception occurred
407            */
408            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
409            public java.util.List<com.liferay.portal.model.Group> search(
410                    long companyId, java.lang.String name, java.lang.String description,
411                    java.lang.String[] params, int start, int end)
412                    throws com.liferay.portal.kernel.exception.PortalException,
413                            com.liferay.portal.kernel.exception.SystemException;
414    
415            /**
416            * Returns the number of groups and organization groups that match the name
417            * and description, optionally including the user's inherited organizations
418            * and user groups. System and staged groups are not included.
419            *
420            * @param companyId the primary key of the company
421            * @param name the group's name (optionally <code>null</code>)
422            * @param description the group's description (optionally
423            <code>null</code>)
424            * @param params the finder params (optionally <code>null</code>). To
425            include the user's inherited organizations and user groups in the
426            search, add entries having &quot;usersGroups&quot; and
427            &quot;inherit&quot; as keys mapped to the the user's ID. For more
428            information see {@link
429            com.liferay.portal.service.persistence.GroupFinder}
430            * @return the number of matching groups
431            * @throws SystemException if a system exception occurred
432            */
433            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
434            public int searchCount(long companyId, java.lang.String name,
435                    java.lang.String description, java.lang.String[] params)
436                    throws com.liferay.portal.kernel.exception.SystemException;
437    
438            /**
439            * Sets the groups associated with the role, removing and adding
440            * associations as necessary.
441            *
442            * @param roleId the primary key of the role
443            * @param groupIds the primary keys of the groups
444            * @throws PortalException if the user did not have permission to update
445            update the role
446            * @throws SystemException if a system exception occurred
447            */
448            public void setRoleGroups(long roleId, long[] groupIds)
449                    throws com.liferay.portal.kernel.exception.PortalException,
450                            com.liferay.portal.kernel.exception.SystemException;
451    
452            /**
453            * Removes the groups from the role.
454            *
455            * @param roleId the primary key of the role
456            * @param groupIds the primary keys of the groups
457            * @throws PortalException if the user did not have permission to update the
458            role
459            * @throws SystemException if a system exception occurred
460            */
461            public void unsetRoleGroups(long roleId, long[] groupIds)
462                    throws com.liferay.portal.kernel.exception.PortalException,
463                            com.liferay.portal.kernel.exception.SystemException;
464    
465            /**
466            * Updates the group's friendly URL.
467            *
468            * @param groupId the primary key of the group
469            * @param friendlyURL the group's new friendlyURL (optionally
470            <code>null</code>)
471            * @return the group
472            * @throws PortalException if the user did not have permission to update the
473            group, if a group with the primary key could not be found, or if
474            a valid friendly URL could not be created for the group
475            * @throws SystemException if a system exception occurred
476            */
477            public com.liferay.portal.model.Group updateFriendlyURL(long groupId,
478                    java.lang.String friendlyURL)
479                    throws com.liferay.portal.kernel.exception.PortalException,
480                            com.liferay.portal.kernel.exception.SystemException;
481    
482            /**
483            * Updates the group's type settings.
484            *
485            * @param groupId the primary key of the group
486            * @param typeSettings the group's new type settings (optionally
487            <code>null</code>)
488            * @return the group
489            * @throws PortalException if the user did not have permission to update the
490            group or if a group with the primary key could not be found
491            * @throws SystemException if a system exception occurred
492            */
493            public com.liferay.portal.model.Group updateGroup(long groupId,
494                    java.lang.String typeSettings)
495                    throws com.liferay.portal.kernel.exception.PortalException,
496                            com.liferay.portal.kernel.exception.SystemException;
497    
498            /**
499            * Updates the group.
500            *
501            * @param groupId the primary key of the group
502            * @param name the group's new name
503            * @param description the group's new description (optionally
504            <code>null</code>)
505            * @param type the group's new type. For more information see {@link
506            com.liferay.portal.model.GroupConstants}
507            * @param friendlyURL the group's new friendlyURL (optionally
508            <code>null</code>)
509            * @param active whether the group is active
510            * @param serviceContext the service context to be applied (optionally
511            <code>null</code>). Can set the asset category IDs and asset tag
512            names for the group.
513            * @return the group
514            * @throws PortalException if the user did not have permission to update the
515            group, if a group with the primary key could not be found, if the
516            friendly URL was invalid or could one not be created
517            * @throws SystemException if a system exception occurred
518            */
519            public com.liferay.portal.model.Group updateGroup(long groupId,
520                    java.lang.String name, java.lang.String description, int type,
521                    java.lang.String friendlyURL, boolean active,
522                    com.liferay.portal.service.ServiceContext serviceContext)
523                    throws com.liferay.portal.kernel.exception.PortalException,
524                            com.liferay.portal.kernel.exception.SystemException;
525    }