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