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.exportimport.kernel.lar.PortletDataContext;
020    
021    import com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery;
022    import com.liferay.portal.kernel.dao.orm.DynamicQuery;
023    import com.liferay.portal.kernel.dao.orm.ExportActionableDynamicQuery;
024    import com.liferay.portal.kernel.dao.orm.IndexableActionableDynamicQuery;
025    import com.liferay.portal.kernel.dao.orm.Projection;
026    import com.liferay.portal.kernel.exception.PortalException;
027    import com.liferay.portal.kernel.exception.SystemException;
028    import com.liferay.portal.kernel.model.PersistedModel;
029    import com.liferay.portal.kernel.model.SystemEventConstants;
030    import com.liferay.portal.kernel.model.UserGroup;
031    import com.liferay.portal.kernel.search.BaseModelSearchResult;
032    import com.liferay.portal.kernel.search.Hits;
033    import com.liferay.portal.kernel.search.Indexable;
034    import com.liferay.portal.kernel.search.IndexableType;
035    import com.liferay.portal.kernel.search.Sort;
036    import com.liferay.portal.kernel.systemevent.SystemEvent;
037    import com.liferay.portal.kernel.transaction.Isolation;
038    import com.liferay.portal.kernel.transaction.Propagation;
039    import com.liferay.portal.kernel.transaction.Transactional;
040    import com.liferay.portal.kernel.util.OrderByComparator;
041    
042    import java.io.Serializable;
043    
044    import java.util.LinkedHashMap;
045    import java.util.List;
046    
047    /**
048     * Provides the local service interface for UserGroup. Methods of this
049     * service will not have security checks based on the propagated JAAS
050     * credentials because this service can only be accessed from within the same
051     * VM.
052     *
053     * @author Brian Wing Shun Chan
054     * @see UserGroupLocalServiceUtil
055     * @see com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
056     * @see com.liferay.portal.service.impl.UserGroupLocalServiceImpl
057     * @generated
058     */
059    @ProviderType
060    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
061            PortalException.class, SystemException.class})
062    public interface UserGroupLocalService extends BaseLocalService,
063            PersistedModelLocalService {
064            /*
065             * NOTE FOR DEVELOPERS:
066             *
067             * Never modify or reference this interface directly. Always use {@link UserGroupLocalServiceUtil} to access the user group local service. Add custom service methods to {@link com.liferay.portal.service.impl.UserGroupLocalServiceImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
068             */
069            public void addGroupUserGroup(long groupId, UserGroup userGroup);
070    
071            public void addGroupUserGroup(long groupId, long userGroupId);
072    
073            public void addGroupUserGroups(long groupId, List<UserGroup> UserGroups);
074    
075            public void addGroupUserGroups(long groupId, long[] userGroupIds);
076    
077            public void addTeamUserGroup(long teamId, UserGroup userGroup);
078    
079            public void addTeamUserGroup(long teamId, long userGroupId);
080    
081            public void addTeamUserGroups(long teamId, List<UserGroup> UserGroups);
082    
083            public void addTeamUserGroups(long teamId, long[] userGroupIds);
084    
085            /**
086            * Adds the user group to the database. Also notifies the appropriate model listeners.
087            *
088            * @param userGroup the user group
089            * @return the user group that was added
090            */
091            @Indexable(type = IndexableType.REINDEX)
092            public UserGroup addUserGroup(UserGroup userGroup);
093    
094            /**
095            * Adds a user group.
096            *
097            * <p>
098            * This method handles the creation and bookkeeping of the user group,
099            * including its resources, metadata, and internal data structures. It is
100            * not necessary to make subsequent calls to setup default groups and
101            * resources for the user group.
102            * </p>
103            *
104            * @param userId the primary key of the user
105            * @param companyId the primary key of the user group's company
106            * @param name the user group's name
107            * @param description the user group's description
108            * @return the user group
109            * @deprecated As of 6.2.0, replaced by {@link #addUserGroup(long, long,
110            String, String, ServiceContext)}
111            */
112            @java.lang.Deprecated
113            public UserGroup addUserGroup(long userId, long companyId,
114                    java.lang.String name, java.lang.String description)
115                    throws PortalException;
116    
117            /**
118            * Adds a user group.
119            *
120            * <p>
121            * This method handles the creation and bookkeeping of the user group,
122            * including its resources, metadata, and internal data structures. It is
123            * not necessary to make subsequent calls to setup default groups and
124            * resources for the user group.
125            * </p>
126            *
127            * @param userId the primary key of the user
128            * @param companyId the primary key of the user group's company
129            * @param name the user group's name
130            * @param description the user group's description
131            * @param serviceContext the service context to be applied (optionally
132            <code>null</code>). Can set expando bridge attributes for the
133            user group.
134            * @return the user group
135            */
136            public UserGroup addUserGroup(long userId, long companyId,
137                    java.lang.String name, java.lang.String description,
138                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
139                    throws PortalException;
140    
141            public void addUserUserGroup(long userId, UserGroup userGroup);
142    
143            public void addUserUserGroup(long userId, long userGroupId);
144    
145            public void addUserUserGroups(long userId, List<UserGroup> UserGroups);
146    
147            public void addUserUserGroups(long userId, long[] userGroupIds);
148    
149            public void clearGroupUserGroups(long groupId);
150    
151            public void clearTeamUserGroups(long teamId);
152    
153            public void clearUserUserGroups(long userId);
154    
155            /**
156            * Copies the user group's layout to the user.
157            *
158            * @param userGroupId the primary key of the user group
159            * @param userId the primary key of the user
160            * @deprecated As of 6.2.0
161            */
162            @java.lang.Deprecated
163            public void copyUserGroupLayouts(long userGroupId, long userId)
164                    throws PortalException;
165    
166            /**
167            * Copies the user group's layouts to the users who are not already members
168            * of the user group.
169            *
170            * @param userGroupId the primary key of the user group
171            * @param userIds the primary keys of the users
172            * @deprecated As of 6.1.0
173            */
174            @java.lang.Deprecated
175            public void copyUserGroupLayouts(long userGroupId, long[] userIds)
176                    throws PortalException;
177    
178            /**
179            * Copies the user groups' layouts to the user.
180            *
181            * @param userGroupIds the primary keys of the user groups
182            * @param userId the primary key of the user
183            * @deprecated As of 6.1.0
184            */
185            @java.lang.Deprecated
186            public void copyUserGroupLayouts(long[] userGroupIds, long userId)
187                    throws PortalException;
188    
189            /**
190            * Creates a new user group with the primary key. Does not add the user group to the database.
191            *
192            * @param userGroupId the primary key for the new user group
193            * @return the new user group
194            */
195            public UserGroup createUserGroup(long userGroupId);
196    
197            public void deleteGroupUserGroup(long groupId, UserGroup userGroup);
198    
199            public void deleteGroupUserGroup(long groupId, long userGroupId);
200    
201            public void deleteGroupUserGroups(long groupId, List<UserGroup> UserGroups);
202    
203            public void deleteGroupUserGroups(long groupId, long[] userGroupIds);
204    
205            /**
206            * @throws PortalException
207            */
208            @Override
209            public PersistedModel deletePersistedModel(PersistedModel persistedModel)
210                    throws PortalException;
211    
212            public void deleteTeamUserGroup(long teamId, UserGroup userGroup);
213    
214            public void deleteTeamUserGroup(long teamId, long userGroupId);
215    
216            public void deleteTeamUserGroups(long teamId, List<UserGroup> UserGroups);
217    
218            public void deleteTeamUserGroups(long teamId, long[] userGroupIds);
219    
220            /**
221            * Deletes the user group from the database. Also notifies the appropriate model listeners.
222            *
223            * @param userGroup the user group
224            * @return the user group that was removed
225            * @throws PortalException
226            */
227            @Indexable(type = IndexableType.DELETE)
228            @SystemEvent(action = SystemEventConstants.ACTION_SKIP, type = SystemEventConstants.TYPE_DELETE)
229            public UserGroup deleteUserGroup(UserGroup userGroup)
230                    throws PortalException;
231    
232            /**
233            * Deletes the user group with the primary key from the database. Also notifies the appropriate model listeners.
234            *
235            * @param userGroupId the primary key of the user group
236            * @return the user group that was removed
237            * @throws PortalException if a user group with the primary key could not be found
238            */
239            @Indexable(type = IndexableType.DELETE)
240            public UserGroup deleteUserGroup(long userGroupId)
241                    throws PortalException;
242    
243            public void deleteUserGroups(long companyId) throws PortalException;
244    
245            public void deleteUserUserGroup(long userId, UserGroup userGroup);
246    
247            public void deleteUserUserGroup(long userId, long userGroupId);
248    
249            public void deleteUserUserGroups(long userId, List<UserGroup> UserGroups);
250    
251            public void deleteUserUserGroups(long userId, long[] userGroupIds);
252    
253            public DynamicQuery dynamicQuery();
254    
255            /**
256            * Performs a dynamic query on the database and returns the matching rows.
257            *
258            * @param dynamicQuery the dynamic query
259            * @return the matching rows
260            */
261            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery);
262    
263            /**
264            * Performs a dynamic query on the database and returns a range of the matching rows.
265            *
266            * <p>
267            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
268            * </p>
269            *
270            * @param dynamicQuery the dynamic query
271            * @param start the lower bound of the range of model instances
272            * @param end the upper bound of the range of model instances (not inclusive)
273            * @return the range of matching rows
274            */
275            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
276                    int end);
277    
278            /**
279            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
280            *
281            * <p>
282            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
283            * </p>
284            *
285            * @param dynamicQuery the dynamic query
286            * @param start the lower bound of the range of model instances
287            * @param end the upper bound of the range of model instances (not inclusive)
288            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
289            * @return the ordered range of matching rows
290            */
291            public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start,
292                    int end, OrderByComparator<T> orderByComparator);
293    
294            /**
295            * Returns the number of rows matching the dynamic query.
296            *
297            * @param dynamicQuery the dynamic query
298            * @return the number of rows matching the dynamic query
299            */
300            public long dynamicQueryCount(DynamicQuery dynamicQuery);
301    
302            /**
303            * Returns the number of rows matching the dynamic query.
304            *
305            * @param dynamicQuery the dynamic query
306            * @param projection the projection to apply to the query
307            * @return the number of rows matching the dynamic query
308            */
309            public long dynamicQueryCount(DynamicQuery dynamicQuery,
310                    Projection projection);
311    
312            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
313            public UserGroup fetchUserGroup(long companyId, java.lang.String name);
314    
315            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
316            public UserGroup fetchUserGroup(long userGroupId);
317    
318            /**
319            * Returns the user group with the matching UUID and company.
320            *
321            * @param uuid the user group's UUID
322            * @param companyId the primary key of the company
323            * @return the matching user group, or <code>null</code> if a matching user group could not be found
324            */
325            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
326            public UserGroup fetchUserGroupByUuidAndCompanyId(java.lang.String uuid,
327                    long companyId);
328    
329            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
330            public ActionableDynamicQuery getActionableDynamicQuery();
331    
332            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
333            public ExportActionableDynamicQuery getExportActionableDynamicQuery(
334                    PortletDataContext portletDataContext);
335    
336            /**
337            * Returns the groupIds of the groups associated with the user group.
338            *
339            * @param userGroupId the userGroupId of the user group
340            * @return long[] the groupIds of groups associated with the user group
341            */
342            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
343            public long[] getGroupPrimaryKeys(long userGroupId);
344    
345            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
346            public List<UserGroup> getGroupUserGroups(long groupId);
347    
348            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
349            public List<UserGroup> getGroupUserGroups(long groupId, int start, int end);
350    
351            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
352            public List<UserGroup> getGroupUserGroups(long groupId, int start, int end,
353                    OrderByComparator<UserGroup> orderByComparator);
354    
355            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
356            public int getGroupUserGroupsCount(long groupId);
357    
358            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
359            public List<UserGroup> getGroupUserUserGroups(long groupId, long userId)
360                    throws PortalException;
361    
362            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
363            public IndexableActionableDynamicQuery getIndexableActionableDynamicQuery();
364    
365            /**
366            * Returns the OSGi service identifier.
367            *
368            * @return the OSGi service identifier
369            */
370            public java.lang.String getOSGiServiceIdentifier();
371    
372            @Override
373            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
374            public PersistedModel getPersistedModel(Serializable primaryKeyObj)
375                    throws PortalException;
376    
377            /**
378            * Returns the teamIds of the teams associated with the user group.
379            *
380            * @param userGroupId the userGroupId of the user group
381            * @return long[] the teamIds of teams associated with the user group
382            */
383            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
384            public long[] getTeamPrimaryKeys(long userGroupId);
385    
386            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
387            public List<UserGroup> getTeamUserGroups(long teamId);
388    
389            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
390            public List<UserGroup> getTeamUserGroups(long teamId, int start, int end);
391    
392            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
393            public List<UserGroup> getTeamUserGroups(long teamId, int start, int end,
394                    OrderByComparator<UserGroup> orderByComparator);
395    
396            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
397            public int getTeamUserGroupsCount(long teamId);
398    
399            /**
400            * Returns the user group with the name.
401            *
402            * @param companyId the primary key of the user group's company
403            * @param name the user group's name
404            * @return Returns the user group with the name
405            */
406            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
407            public UserGroup getUserGroup(long companyId, java.lang.String name)
408                    throws PortalException;
409    
410            /**
411            * Returns the user group with the primary key.
412            *
413            * @param userGroupId the primary key of the user group
414            * @return the user group
415            * @throws PortalException if a user group with the primary key could not be found
416            */
417            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
418            public UserGroup getUserGroup(long userGroupId) throws PortalException;
419    
420            /**
421            * Returns the user group with the matching UUID and company.
422            *
423            * @param uuid the user group's UUID
424            * @param companyId the primary key of the company
425            * @return the matching user group
426            * @throws PortalException if a matching user group could not be found
427            */
428            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
429            public UserGroup getUserGroupByUuidAndCompanyId(java.lang.String uuid,
430                    long companyId) throws PortalException;
431    
432            /**
433            * Returns all the user groups belonging to the company.
434            *
435            * @param companyId the primary key of the user groups' company
436            * @return the user groups belonging to the company
437            */
438            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
439            public List<UserGroup> getUserGroups(long companyId);
440    
441            /**
442            * Returns a range of all the user groups.
443            *
444            * <p>
445            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.portal.model.impl.UserGroupModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
446            * </p>
447            *
448            * @param start the lower bound of the range of user groups
449            * @param end the upper bound of the range of user groups (not inclusive)
450            * @return the range of user groups
451            */
452            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
453            public List<UserGroup> getUserGroups(int start, int end);
454    
455            /**
456            * Returns all the user groups with the primary keys.
457            *
458            * @param userGroupIds the primary keys of the user groups
459            * @return the user groups with the primary keys
460            */
461            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
462            public List<UserGroup> getUserGroups(long[] userGroupIds)
463                    throws PortalException;
464    
465            /**
466            * Returns the number of user groups.
467            *
468            * @return the number of user groups
469            */
470            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
471            public int getUserGroupsCount();
472    
473            /**
474            * Returns the userIds of the users associated with the user group.
475            *
476            * @param userGroupId the userGroupId of the user group
477            * @return long[] the userIds of users associated with the user group
478            */
479            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
480            public long[] getUserPrimaryKeys(long userGroupId);
481    
482            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
483            public List<UserGroup> getUserUserGroups(long userId);
484    
485            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
486            public List<UserGroup> getUserUserGroups(long userId, int start, int end);
487    
488            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
489            public List<UserGroup> getUserUserGroups(long userId, int start, int end,
490                    OrderByComparator<UserGroup> orderByComparator);
491    
492            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
493            public int getUserUserGroupsCount(long userId);
494    
495            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
496            public boolean hasGroupUserGroup(long groupId, long userGroupId);
497    
498            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
499            public boolean hasGroupUserGroups(long groupId);
500    
501            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
502            public boolean hasTeamUserGroup(long teamId, long userGroupId);
503    
504            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
505            public boolean hasTeamUserGroups(long teamId);
506    
507            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
508            public boolean hasUserUserGroup(long userId, long userGroupId);
509    
510            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
511            public boolean hasUserUserGroups(long userId);
512    
513            /**
514            * Returns an ordered range of all the user groups that match the keywords.
515            *
516            * <p>
517            * Useful when paginating results. Returns a maximum of <code>end -
518            * start</code> instances. <code>start</code> and <code>end</code> are not
519            * primary keys, they are indexes in the result set. Thus, <code>0</code>
520            * refers to the first result in the set. Setting both <code>start</code>
521            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
522            * result set.
523            * </p>
524            *
525            * @param companyId the primary key of the user group's company
526            * @param keywords the keywords (space separated), which may occur in the
527            user group's name or description (optionally <code>null</code>)
528            * @param params the finder params (optionally <code>null</code>). For more
529            information see {@link
530            com.liferay.portal.kernel.service.persistence.UserGroupFinder}
531            * @param start the lower bound of the range of user groups to return
532            * @param end the upper bound of the range of user groups to return (not
533            inclusive)
534            * @param obc the comparator to order the user groups (optionally
535            <code>null</code>)
536            * @return the matching user groups ordered by comparator <code>obc</code>
537            * @see com.liferay.portal.kernel.service.persistence.UserGroupFinder
538            */
539            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
540            public List<UserGroup> search(long companyId, java.lang.String keywords,
541                    LinkedHashMap<java.lang.String, java.lang.Object> params, int start,
542                    int end, OrderByComparator<UserGroup> obc);
543    
544            /**
545            * Returns an ordered range of all the user groups that match the keywords,
546            * using the indexer. It is preferable to use this method instead of the
547            * non-indexed version whenever possible for performance reasons.
548            *
549            * <p>
550            * Useful when paginating results. Returns a maximum of <code>end -
551            * start</code> instances. <code>start</code> and <code>end</code> are not
552            * primary keys, they are indexes in the result set. Thus, <code>0</code>
553            * refers to the first result in the set. Setting both <code>start</code>
554            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
555            * result set.
556            * </p>
557            *
558            * @param companyId the primary key of the user group's company
559            * @param keywords the keywords (space separated), which may occur in the
560            user group's name or description (optionally <code>null</code>)
561            * @param params the finder params (optionally <code>null</code>). For more
562            information see {@link
563            com.liferay.user.groups.admin.web.search.UserGroupIndexer}
564            * @param start the lower bound of the range of user groups to return
565            * @param end the upper bound of the range of user groups to return (not
566            inclusive)
567            * @param sort the field and direction by which to sort (optionally
568            <code>null</code>)
569            * @return the matching user groups ordered by sort
570            * @see com.liferay.user.groups.admin.web.search.UserGroupIndexer
571            */
572            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
573            public Hits search(long companyId, java.lang.String keywords,
574                    LinkedHashMap<java.lang.String, java.lang.Object> params, int start,
575                    int end, Sort sort);
576    
577            /**
578            * Returns an ordered range of all the user groups that match the name and
579            * description.
580            *
581            * <p>
582            * Useful when paginating results. Returns a maximum of <code>end -
583            * start</code> instances. <code>start</code> and <code>end</code> are not
584            * primary keys, they are indexes in the result set. Thus, <code>0</code>
585            * refers to the first result in the set. Setting both <code>start</code>
586            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
587            * result set.
588            * </p>
589            *
590            * @param companyId the primary key of the user group's company
591            * @param name the user group's name (optionally <code>null</code>)
592            * @param description the user group's description (optionally
593            <code>null</code>)
594            * @param params the finder params (optionally <code>null</code>). For more
595            information see {@link
596            com.liferay.portal.kernel.service.persistence.UserGroupFinder}
597            * @param andOperator whether every field must match its keywords or just
598            one field
599            * @param start the lower bound of the range of user groups to return
600            * @param end the upper bound of the range of user groups to return (not
601            inclusive)
602            * @param obc the comparator to order the user groups (optionally
603            <code>null</code>)
604            * @return the matching user groups ordered by comparator <code>obc</code>
605            * @see com.liferay.portal.kernel.service.persistence.UserGroupFinder
606            */
607            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
608            public List<UserGroup> search(long companyId, java.lang.String name,
609                    java.lang.String description,
610                    LinkedHashMap<java.lang.String, java.lang.Object> params,
611                    boolean andOperator, int start, int end,
612                    OrderByComparator<UserGroup> obc);
613    
614            /**
615            * Returns an ordered range of all the user groups that match the name and
616            * description. It is preferable to use this method instead of the
617            * non-indexed version whenever possible for performance reasons.
618            *
619            * <p>
620            * Useful when paginating results. Returns a maximum of <code>end -
621            * start</code> instances. <code>start</code> and <code>end</code> are not
622            * primary keys, they are indexes in the result set. Thus, <code>0</code>
623            * refers to the first result in the set. Setting both <code>start</code>
624            * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
625            * result set.
626            * </p>
627            *
628            * @param companyId the primary key of the user group's company
629            * @param name the user group's name (optionally <code>null</code>)
630            * @param description the user group's description (optionally
631            <code>null</code>)
632            * @param params the finder params (optionally <code>null</code>). For more
633            information see {@link
634            com.liferay.user.groups.admin.web.search.UserGroupIndexer}
635            * @param andSearch whether every field must match its keywords or just one
636            field
637            * @param start the lower bound of the range of user groups to return
638            * @param end the upper bound of the range of user groups to return (not
639            inclusive)
640            * @param sort the field and direction by which to sort (optionally
641            <code>null</code>)
642            * @return the matching user groups ordered by sort
643            * @see com.liferay.portal.kernel.service.persistence.UserGroupFinder
644            */
645            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
646            public Hits search(long companyId, java.lang.String name,
647                    java.lang.String description,
648                    LinkedHashMap<java.lang.String, java.lang.Object> params,
649                    boolean andSearch, int start, int end, Sort sort);
650    
651            /**
652            * Returns the number of user groups that match the keywords
653            *
654            * @param companyId the primary key of the user group's company
655            * @param keywords the keywords (space separated), which may occur in the
656            user group's name or description (optionally <code>null</code>)
657            * @param params the finder params (optionally <code>null</code>). For more
658            information see {@link
659            com.liferay.portal.kernel.service.persistence.UserGroupFinder}
660            * @return the number of matching user groups
661            * @see com.liferay.portal.kernel.service.persistence.UserGroupFinder
662            */
663            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
664            public int searchCount(long companyId, java.lang.String keywords,
665                    LinkedHashMap<java.lang.String, java.lang.Object> params);
666    
667            /**
668            * Returns the number of user groups that match the name and description.
669            *
670            * @param companyId the primary key of the user group's company
671            * @param name the user group's name (optionally <code>null</code>)
672            * @param description the user group's description (optionally
673            <code>null</code>)
674            * @param params the finder params (optionally <code>null</code>). For more
675            information see {@link
676            com.liferay.portal.kernel.service.persistence.UserGroupFinder}
677            * @param andOperator whether every field must match its keywords or just
678            one field
679            * @return the number of matching user groups
680            * @see com.liferay.portal.kernel.service.persistence.UserGroupFinder
681            */
682            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
683            public int searchCount(long companyId, java.lang.String name,
684                    java.lang.String description,
685                    LinkedHashMap<java.lang.String, java.lang.Object> params,
686                    boolean andOperator);
687    
688            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
689            public BaseModelSearchResult<UserGroup> searchUserGroups(long companyId,
690                    java.lang.String keywords,
691                    LinkedHashMap<java.lang.String, java.lang.Object> params, int start,
692                    int end, Sort sort) throws PortalException;
693    
694            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
695            public BaseModelSearchResult<UserGroup> searchUserGroups(long companyId,
696                    java.lang.String name, java.lang.String description,
697                    LinkedHashMap<java.lang.String, java.lang.Object> params,
698                    boolean andSearch, int start, int end, Sort sort)
699                    throws PortalException;
700    
701            public void setGroupUserGroups(long groupId, long[] userGroupIds);
702    
703            public void setTeamUserGroups(long teamId, long[] userGroupIds);
704    
705            /**
706            * @throws PortalException
707            */
708            public void setUserUserGroups(long userId, long[] userGroupIds)
709                    throws PortalException;
710    
711            /**
712            * Removes the user groups from the group.
713            *
714            * @param groupId the primary key of the group
715            * @param userGroupIds the primary keys of the user groups
716            */
717            public void unsetGroupUserGroups(long groupId, long[] userGroupIds);
718    
719            /**
720            * Removes the user groups from the team.
721            *
722            * @param teamId the primary key of the team
723            * @param userGroupIds the primary keys of the user groups
724            */
725            public void unsetTeamUserGroups(long teamId, long[] userGroupIds);
726    
727            /**
728            * Updates the user group.
729            *
730            * @param companyId the primary key of the user group's company
731            * @param userGroupId the primary key of the user group
732            * @param name the user group's name
733            * @param description the user group's description
734            * @return the user group
735            * @deprecated As of 6.2.0, replaced by {@link #updateUserGroup(long, long,
736            String, String, ServiceContext)}
737            */
738            @java.lang.Deprecated
739            public UserGroup updateUserGroup(long companyId, long userGroupId,
740                    java.lang.String name, java.lang.String description)
741                    throws PortalException;
742    
743            /**
744            * Updates the user group.
745            *
746            * @param companyId the primary key of the user group's company
747            * @param userGroupId the primary key of the user group
748            * @param name the user group's name
749            * @param description the user group's description
750            * @param serviceContext the service context to be applied (optionally
751            <code>null</code>). Can set expando bridge attributes for the
752            user group.
753            * @return the user group
754            */
755            public UserGroup updateUserGroup(long companyId, long userGroupId,
756                    java.lang.String name, java.lang.String description,
757                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
758                    throws PortalException;
759    
760            /**
761            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
762            *
763            * @param userGroup the user group
764            * @return the user group that was updated
765            */
766            @Indexable(type = IndexableType.REINDEX)
767            public UserGroup updateUserGroup(UserGroup userGroup);
768    }