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