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