001    /**
002     * Copyright (c) 2000-2011 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 com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.transaction.Isolation;
020    import com.liferay.portal.kernel.transaction.Propagation;
021    import com.liferay.portal.kernel.transaction.Transactional;
022    
023    /**
024     * The interface for the user group local service.
025     *
026     * <p>
027     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
028     * </p>
029     *
030     * @author Brian Wing Shun Chan
031     * @see UserGroupLocalServiceUtil
032     * @see com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
033     * @see com.liferay.portal.service.impl.UserGroupLocalServiceImpl
034     * @generated
035     */
036    @Transactional(isolation = Isolation.PORTAL, rollbackFor =  {
037            PortalException.class, SystemException.class})
038    public interface UserGroupLocalService extends PersistedModelLocalService {
039            /*
040             * NOTE FOR DEVELOPERS:
041             *
042             * 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.
043             */
044    
045            /**
046            * Adds the user group to the database. Also notifies the appropriate model listeners.
047            *
048            * @param userGroup the user group
049            * @return the user group that was added
050            * @throws SystemException if a system exception occurred
051            */
052            public com.liferay.portal.model.UserGroup addUserGroup(
053                    com.liferay.portal.model.UserGroup userGroup)
054                    throws com.liferay.portal.kernel.exception.SystemException;
055    
056            /**
057            * Creates a new user group with the primary key. Does not add the user group to the database.
058            *
059            * @param userGroupId the primary key for the new user group
060            * @return the new user group
061            */
062            public com.liferay.portal.model.UserGroup createUserGroup(long userGroupId);
063    
064            /**
065            * Deletes the user group with the primary key from the database. Also notifies the appropriate model listeners.
066            *
067            * @param userGroupId the primary key of the user group
068            * @throws PortalException if a user group with the primary key could not be found
069            * @throws SystemException if a system exception occurred
070            */
071            public void deleteUserGroup(long userGroupId)
072                    throws com.liferay.portal.kernel.exception.PortalException,
073                            com.liferay.portal.kernel.exception.SystemException;
074    
075            /**
076            * Deletes the user group from the database. Also notifies the appropriate model listeners.
077            *
078            * @param userGroup the user group
079            * @throws PortalException
080            * @throws SystemException if a system exception occurred
081            */
082            public void deleteUserGroup(com.liferay.portal.model.UserGroup userGroup)
083                    throws com.liferay.portal.kernel.exception.PortalException,
084                            com.liferay.portal.kernel.exception.SystemException;
085    
086            /**
087            * Performs a dynamic query on the database and returns the matching rows.
088            *
089            * @param dynamicQuery the dynamic query
090            * @return the matching rows
091            * @throws SystemException if a system exception occurred
092            */
093            @SuppressWarnings("rawtypes")
094            public java.util.List dynamicQuery(
095                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
096                    throws com.liferay.portal.kernel.exception.SystemException;
097    
098            /**
099            * Performs a dynamic query on the database and returns a range of the matching rows.
100            *
101            * <p>
102            * 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.
103            * </p>
104            *
105            * @param dynamicQuery the dynamic query
106            * @param start the lower bound of the range of model instances
107            * @param end the upper bound of the range of model instances (not inclusive)
108            * @return the range of matching rows
109            * @throws SystemException if a system exception occurred
110            */
111            @SuppressWarnings("rawtypes")
112            public java.util.List dynamicQuery(
113                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
114                    int end) throws com.liferay.portal.kernel.exception.SystemException;
115    
116            /**
117            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
118            *
119            * <p>
120            * 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.
121            * </p>
122            *
123            * @param dynamicQuery the dynamic query
124            * @param start the lower bound of the range of model instances
125            * @param end the upper bound of the range of model instances (not inclusive)
126            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
127            * @return the ordered range of matching rows
128            * @throws SystemException if a system exception occurred
129            */
130            @SuppressWarnings("rawtypes")
131            public java.util.List dynamicQuery(
132                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
133                    int end,
134                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
135                    throws com.liferay.portal.kernel.exception.SystemException;
136    
137            /**
138            * Returns the number of rows that match the dynamic query.
139            *
140            * @param dynamicQuery the dynamic query
141            * @return the number of rows that match the dynamic query
142            * @throws SystemException if a system exception occurred
143            */
144            public long dynamicQueryCount(
145                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
146                    throws com.liferay.portal.kernel.exception.SystemException;
147    
148            /**
149            * Returns the user group with the primary key.
150            *
151            * @param userGroupId the primary key of the user group
152            * @return the user group
153            * @throws PortalException if a user group with the primary key could not be found
154            * @throws SystemException if a system exception occurred
155            */
156            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
157            public com.liferay.portal.model.UserGroup getUserGroup(long userGroupId)
158                    throws com.liferay.portal.kernel.exception.PortalException,
159                            com.liferay.portal.kernel.exception.SystemException;
160    
161            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
162            public com.liferay.portal.model.PersistedModel getPersistedModel(
163                    java.io.Serializable primaryKeyObj)
164                    throws com.liferay.portal.kernel.exception.PortalException,
165                            com.liferay.portal.kernel.exception.SystemException;
166    
167            /**
168            * Returns a range of all the user groups.
169            *
170            * <p>
171            * 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.
172            * </p>
173            *
174            * @param start the lower bound of the range of user groups
175            * @param end the upper bound of the range of user groups (not inclusive)
176            * @return the range of user groups
177            * @throws SystemException if a system exception occurred
178            */
179            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
180            public java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
181                    int start, int end)
182                    throws com.liferay.portal.kernel.exception.SystemException;
183    
184            /**
185            * Returns the number of user groups.
186            *
187            * @return the number of user groups
188            * @throws SystemException if a system exception occurred
189            */
190            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
191            public int getUserGroupsCount()
192                    throws com.liferay.portal.kernel.exception.SystemException;
193    
194            /**
195            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
196            *
197            * @param userGroup the user group
198            * @return the user group that was updated
199            * @throws SystemException if a system exception occurred
200            */
201            public com.liferay.portal.model.UserGroup updateUserGroup(
202                    com.liferay.portal.model.UserGroup userGroup)
203                    throws com.liferay.portal.kernel.exception.SystemException;
204    
205            /**
206            * Updates the user group in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
207            *
208            * @param userGroup the user group
209            * @param merge whether to merge the user group with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
210            * @return the user group that was updated
211            * @throws SystemException if a system exception occurred
212            */
213            public com.liferay.portal.model.UserGroup updateUserGroup(
214                    com.liferay.portal.model.UserGroup userGroup, boolean merge)
215                    throws com.liferay.portal.kernel.exception.SystemException;
216    
217            /**
218            * Returns the Spring bean ID for this bean.
219            *
220            * @return the Spring bean ID for this bean
221            */
222            public java.lang.String getBeanIdentifier();
223    
224            /**
225            * Sets the Spring bean ID for this bean.
226            *
227            * @param beanIdentifier the Spring bean ID for this bean
228            */
229            public void setBeanIdentifier(java.lang.String beanIdentifier);
230    
231            /**
232            * Adds the user groups to the group.
233            *
234            * @param groupId the primary key of the group
235            * @param userGroupIds the primary keys of the user groups
236            * @throws SystemException if a system exception occurred
237            */
238            public void addGroupUserGroups(long groupId, long[] userGroupIds)
239                    throws com.liferay.portal.kernel.exception.SystemException;
240    
241            /**
242            * Adds the user groups to the team.
243            *
244            * @param teamId the primary key of the team
245            * @param userGroupIds the primary keys of the user groups
246            * @throws SystemException if a system exception occurred
247            */
248            public void addTeamUserGroups(long teamId, long[] userGroupIds)
249                    throws com.liferay.portal.kernel.exception.SystemException;
250    
251            /**
252            * Adds a user group.
253            *
254            * <p>
255            * This method handles the creation and bookkeeping of the user group,
256            * including its resources, metadata, and internal data structures. It is
257            * not necessary to make subsequent calls to setup default groups and
258            * resources for the user group.
259            * </p>
260            *
261            * @param userId the primary key of the user
262            * @param companyId the primary key of the user group's company
263            * @param name the user group's name
264            * @param description the user group's description
265            * @param publicLayoutSetPrototypeId the primary key of the user group's
266            public layout set
267            * @param privateLayoutSetPrototypeId the primary key of the user group's
268            private layout set
269            * @return the user group
270            * @throws PortalException if the user group's information was invalid
271            * @throws SystemException if a system exception occurred
272            */
273            public com.liferay.portal.model.UserGroup addUserGroup(long userId,
274                    long companyId, java.lang.String name, java.lang.String description,
275                    long publicLayoutSetPrototypeId, long privateLayoutSetPrototypeId)
276                    throws com.liferay.portal.kernel.exception.PortalException,
277                            com.liferay.portal.kernel.exception.SystemException;
278    
279            /**
280            * Clears all associations between the user and its user groups and clears
281            * the permissions cache.
282            *
283            * <p>
284            * This method is called from {@link #deleteUserGroup(UserGroup)}.
285            * </p>
286            *
287            * @param userId the primary key of the user
288            * @throws SystemException if a system exception occurred
289            */
290            public void clearUserUserGroups(long userId)
291                    throws com.liferay.portal.kernel.exception.SystemException;
292    
293            /**
294            * Copies the user group's layouts to the users who are not already members
295            * of the user group.
296            *
297            * @param userGroupId the primary key of the user group
298            * @param userIds the primary keys of the users
299            * @throws PortalException if any one of the users could not be found or if
300            a portal exception occurred
301            * @throws SystemException if a system exception occurred
302            */
303            public void copyUserGroupLayouts(long userGroupId, long[] userIds)
304                    throws com.liferay.portal.kernel.exception.PortalException,
305                            com.liferay.portal.kernel.exception.SystemException;
306    
307            /**
308            * Copies the user groups' layouts to the user.
309            *
310            * @param userGroupIds the primary keys of the user groups
311            * @param userId the primary key of the user
312            * @throws PortalException if a user with the primary key could not be
313            found or if a portal exception occurred
314            * @throws SystemException if a system exception occurred
315            */
316            public void copyUserGroupLayouts(long[] userGroupIds, long userId)
317                    throws com.liferay.portal.kernel.exception.PortalException,
318                            com.liferay.portal.kernel.exception.SystemException;
319    
320            /**
321            * Copies the user group's layout to the user.
322            *
323            * @param userGroupId the primary key of the user group
324            * @param userId the primary key of the user
325            * @throws PortalException if a user with the primary key could not be
326            found or if a portal exception occurred
327            * @throws SystemException if a system exception occurred
328            */
329            public void copyUserGroupLayouts(long userGroupId, long userId)
330                    throws com.liferay.portal.kernel.exception.PortalException,
331                            com.liferay.portal.kernel.exception.SystemException;
332    
333            /**
334            * Returns the user group with the name.
335            *
336            * @param companyId the primary key of the user group's company
337            * @param name the user group's name
338            * @return Returns the user group with the name
339            * @throws PortalException if a user group with the name could not be found
340            * @throws SystemException if a system exception occurred
341            */
342            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
343            public com.liferay.portal.model.UserGroup getUserGroup(long companyId,
344                    java.lang.String name)
345                    throws com.liferay.portal.kernel.exception.PortalException,
346                            com.liferay.portal.kernel.exception.SystemException;
347    
348            /**
349            * Returns all the user groups belonging to the company.
350            *
351            * @param companyId the primary key of the user groups' company
352            * @return the user groups belonging to the company
353            * @throws SystemException if a system exception occurred
354            */
355            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
356            public java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
357                    long companyId)
358                    throws com.liferay.portal.kernel.exception.SystemException;
359    
360            /**
361            * Returns all the user groups with the primary keys.
362            *
363            * @param userGroupIds the primary keys of the user groups
364            * @return the user groups with the primary keys
365            * @throws PortalException if any one of the user groups could not be found
366            * @throws SystemException if a system exception occurred
367            */
368            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
369            public java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
370                    long[] userGroupIds)
371                    throws com.liferay.portal.kernel.exception.PortalException,
372                            com.liferay.portal.kernel.exception.SystemException;
373    
374            /**
375            * Returns all the user groups to which the user belongs.
376            *
377            * @param userId the primary key of the user
378            * @return the user groups to which the user belongs
379            * @throws SystemException if a system exception occurred
380            */
381            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
382            public java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
383                    long userId) throws com.liferay.portal.kernel.exception.SystemException;
384    
385            /**
386            * Returns <code>true</code> if the user group is associated with the
387            * group.
388            *
389            * @param groupId the primary key of the group
390            * @param userGroupId the primary key of the user group
391            * @return <code>true</code> if the user group belongs to the group;
392            <code>false</code> otherwise
393            * @throws SystemException if a system exception occurred
394            */
395            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
396            public boolean hasGroupUserGroup(long groupId, long userGroupId)
397                    throws com.liferay.portal.kernel.exception.SystemException;
398    
399            /**
400            * Returns <code>true</code> if the user group belongs to the team.
401            *
402            * @param teamId the primary key of the team
403            * @param userGroupId the primary key of the user group
404            * @return <code>true</code> if the user group belongs to the team;
405            <code>false</code> otherwise
406            * @throws SystemException if a system exception occurred
407            */
408            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
409            public boolean hasTeamUserGroup(long teamId, long userGroupId)
410                    throws com.liferay.portal.kernel.exception.SystemException;
411    
412            /**
413            * Returns an ordered range of all the user groups that match the name and
414            * description.
415            *
416            * <p>
417            * Useful when paginating results. Returns a maximum of <code>end -
418            * start</code> instances. <code>start</code> and <code>end</code> are not
419            * primary keys, they are indexes in the result set. Thus, <code>0</code>
420            * refers to the first result in the set. Setting both <code>start</code>
421            * and <code>end</code> to {@link
422            * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the
423            * full result set.
424            * </p>
425            *
426            * @param companyId the primary key of the user group's company
427            * @param name the user group's name (optionally <code>null</code>)
428            * @param description the user group's description (optionally
429            <code>null</code>)
430            * @param params the finder params (optionally <code>null</code>). For
431            more information see {@link
432            com.liferay.portal.service.persistence.UserGroupFinder}
433            * @param start the lower bound of the range of user groups to return
434            * @param end the upper bound of the range of user groups to return (not
435            inclusive)
436            * @param obc the comparator to order the user groups (optionally
437            <code>null</code>)
438            * @return the matching user groups ordered by comparator <code>obc</code>
439            * @throws SystemException if a system exception occurred
440            * @see com.liferay.portal.service.persistence.UserGroupFinder
441            */
442            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
443            public java.util.List<com.liferay.portal.model.UserGroup> search(
444                    long companyId, java.lang.String name, java.lang.String description,
445                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params,
446                    int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc)
447                    throws com.liferay.portal.kernel.exception.SystemException;
448    
449            /**
450            * Returns the number of user groups that match the name and description.
451            *
452            * @param companyId the primary key of the user group's company
453            * @param name the user group's name (optionally <code>null</code>)
454            * @param description the user group's description (optionally
455            <code>null</code>)
456            * @param params the finder params (optionally <code>null</code>). For
457            more information see {@link
458            com.liferay.portal.service.persistence.UserGroupFinder}
459            * @return the number of matching user groups
460            * @throws SystemException if a system exception occurred
461            * @see com.liferay.portal.service.persistence.UserGroupFinder
462            */
463            @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
464            public int searchCount(long companyId, java.lang.String name,
465                    java.lang.String description,
466                    java.util.LinkedHashMap<java.lang.String, java.lang.Object> params)
467                    throws com.liferay.portal.kernel.exception.SystemException;
468    
469            /**
470            * Sets the user groups associated with the user copying the user group
471            * layouts and removing and adding user group associations for the user as
472            * necessary.
473            *
474            * @param userId the primary key of the user
475            * @param userGroupIds the primary keys of the user groups
476            * @throws PortalException if a portal exception occurred
477            * @throws SystemException if a system exception occurred
478            */
479            public void setUserUserGroups(long userId, long[] userGroupIds)
480                    throws com.liferay.portal.kernel.exception.PortalException,
481                            com.liferay.portal.kernel.exception.SystemException;
482    
483            /**
484            * Removes the user groups from the group.
485            *
486            * @param groupId the primary key of the group
487            * @param userGroupIds the primary keys of the user groups
488            * @throws SystemException if a system exception occurred
489            */
490            public void unsetGroupUserGroups(long groupId, long[] userGroupIds)
491                    throws com.liferay.portal.kernel.exception.SystemException;
492    
493            /**
494            * Removes the user groups from the team.
495            *
496            * @param teamId the primary key of the team
497            * @param userGroupIds the primary keys of the user groups
498            * @throws SystemException if a system exception occurred
499            */
500            public void unsetTeamUserGroups(long teamId, long[] userGroupIds)
501                    throws com.liferay.portal.kernel.exception.SystemException;
502    
503            /**
504            * Updates the user group.
505            *
506            * @param companyId the primary key of the user group's company
507            * @param userGroupId the primary key of the user group
508            * @param name the user group's name
509            * @param description the user group's description
510            * @param publicLayoutSetPrototypeId the primary key of the user group's
511            public layout set
512            * @param privateLayoutSetPrototypeId the primary key of the user group's
513            private layout set
514            * @return the user group
515            * @throws PortalException if a user group with the primary key could not
516            be found or if the new information was invalid
517            * @throws SystemException if a system exception occurred
518            */
519            public com.liferay.portal.model.UserGroup updateUserGroup(long companyId,
520                    long userGroupId, java.lang.String name, java.lang.String description,
521                    long publicLayoutSetPrototypeId, long privateLayoutSetPrototypeId)
522                    throws com.liferay.portal.kernel.exception.PortalException,
523                            com.liferay.portal.kernel.exception.SystemException;
524    }