001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the user group remote service. This utility wraps {@link com.liferay.portal.service.impl.UserGroupServiceImpl} and is the primary access point for service operations in application layer code running on a remote server.
023     *
024     * <p>
025     * This is a remote service. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see UserGroupService
030     * @see com.liferay.portal.service.base.UserGroupServiceBaseImpl
031     * @see com.liferay.portal.service.impl.UserGroupServiceImpl
032     * @generated
033     */
034    public class UserGroupServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.UserGroupServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the user groups to the group.
043            *
044            * @param groupId the primary key of the group
045            * @param userGroupIds the primary keys of the user groups
046            * @throws PortalException if a group or user group with the primary key
047            could not be found, or if the user did not have permission to
048            assign group members
049            * @throws SystemException if a system exception occurred
050            */
051            public static void addGroupUserGroups(long groupId, long[] userGroupIds)
052                    throws com.liferay.portal.kernel.exception.PortalException,
053                            com.liferay.portal.kernel.exception.SystemException {
054                    getService().addGroupUserGroups(groupId, userGroupIds);
055            }
056    
057            /**
058            * Adds the user groups to the team
059            *
060            * @param teamId the primary key of the team
061            * @param userGroupIds the primary keys of the user groups
062            * @throws PortalException if a team or user group with the primary key
063            could not be found, or if the user did not have permission to
064            assign team members
065            * @throws SystemException if a system exception occurred
066            */
067            public static void addTeamUserGroups(long teamId, long[] userGroupIds)
068                    throws com.liferay.portal.kernel.exception.PortalException,
069                            com.liferay.portal.kernel.exception.SystemException {
070                    getService().addTeamUserGroups(teamId, userGroupIds);
071            }
072    
073            /**
074            * Adds a user group.
075            *
076            * <p>
077            * This method handles the creation and bookkeeping of the user group,
078            * including its resources, metadata, and internal data structures.
079            * </p>
080            *
081            * @param name the user group's name
082            * @param description the user group's description
083            * @param publicLayoutSetPrototypeId the primary key of the user group's
084            public layout set
085            * @param privateLayoutSetPrototypeId the primary key of the user group's
086            private layout set
087            * @return the user group
088            * @throws PortalException if the user group's information was invalid or
089            if the user did not have permission to add the user group
090            * @throws SystemException if a system exception occurred
091            */
092            public static com.liferay.portal.model.UserGroup addUserGroup(
093                    java.lang.String name, java.lang.String description,
094                    long publicLayoutSetPrototypeId, long privateLayoutSetPrototypeId)
095                    throws com.liferay.portal.kernel.exception.PortalException,
096                            com.liferay.portal.kernel.exception.SystemException {
097                    return getService()
098                                       .addUserGroup(name, description, publicLayoutSetPrototypeId,
099                            privateLayoutSetPrototypeId);
100            }
101    
102            /**
103            * Deletes the user group.
104            *
105            * @param userGroupId the primary key of the user group
106            * @throws PortalException if a user group with the primary key could not
107            be found, if the user did not have permission to delete the user
108            group, or if the user group had a workflow in approved status
109            * @throws SystemException if a system exception occurred
110            */
111            public static void deleteUserGroup(long userGroupId)
112                    throws com.liferay.portal.kernel.exception.PortalException,
113                            com.liferay.portal.kernel.exception.SystemException {
114                    getService().deleteUserGroup(userGroupId);
115            }
116    
117            /**
118            * Returns the user group with the primary key.
119            *
120            * @param userGroupId the primary key of the user group
121            * @return Returns the user group with the primary key
122            * @throws PortalException if a user group with the primary key could not
123            be found or if the user did not have permission to view the user
124            group
125            * @throws SystemException if a system exception occurred
126            */
127            public static com.liferay.portal.model.UserGroup getUserGroup(
128                    long userGroupId)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    return getService().getUserGroup(userGroupId);
132            }
133    
134            /**
135            * Returns the user group with the name.
136            *
137            * @param name the user group's name
138            * @return Returns the user group with the name
139            * @throws PortalException if a user group with the name could not be found
140            or if the user did not have permission to view the user group
141            * @throws SystemException if a system exception occurred
142            */
143            public static com.liferay.portal.model.UserGroup getUserGroup(
144                    java.lang.String name)
145                    throws com.liferay.portal.kernel.exception.PortalException,
146                            com.liferay.portal.kernel.exception.SystemException {
147                    return getService().getUserGroup(name);
148            }
149    
150            /**
151            * Returns all the user groups to which the user belongs.
152            *
153            * @param userId the primary key of the user
154            * @return the user groups to which the user belongs
155            * @throws SystemException if a system exception occurred
156            */
157            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
158                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
159                    return getService().getUserUserGroups(userId);
160            }
161    
162            /**
163            * Removes the user groups from the group.
164            *
165            * @param groupId the primary key of the group
166            * @param userGroupIds the primary keys of the user groups
167            * @throws PortalException if the user did not have permission to assign
168            group members
169            * @throws SystemException if a system exception occurred
170            */
171            public static void unsetGroupUserGroups(long groupId, long[] userGroupIds)
172                    throws com.liferay.portal.kernel.exception.PortalException,
173                            com.liferay.portal.kernel.exception.SystemException {
174                    getService().unsetGroupUserGroups(groupId, userGroupIds);
175            }
176    
177            /**
178            * Removes the user groups from the team.
179            *
180            * @param teamId the primary key of the team
181            * @param userGroupIds the primary keys of the user groups
182            * @throws PortalException if the user did not have permission to assign
183            team members
184            * @throws SystemException if a system exception occurred
185            */
186            public static void unsetTeamUserGroups(long teamId, long[] userGroupIds)
187                    throws com.liferay.portal.kernel.exception.PortalException,
188                            com.liferay.portal.kernel.exception.SystemException {
189                    getService().unsetTeamUserGroups(teamId, userGroupIds);
190            }
191    
192            /**
193            * Updates the user group.
194            *
195            * @param userGroupId the primary key of the user group
196            * @param name the user group's name
197            * @param description the the user group's description
198            * @param publicLayoutSetPrototypeId the primary key of the user group's
199            public layout set
200            * @param privateLayoutSetPrototypeId the primary key of the user group's
201            private layout set
202            * @return the user group
203            * @throws PortalException if a user group with the primary key was not
204            found, if the new information was invalid, or if the user did
205            not have permission to update the user group information
206            * @throws SystemException if a system exception occurred
207            */
208            public static com.liferay.portal.model.UserGroup updateUserGroup(
209                    long userGroupId, java.lang.String name, java.lang.String description,
210                    long publicLayoutSetPrototypeId, long privateLayoutSetPrototypeId)
211                    throws com.liferay.portal.kernel.exception.PortalException,
212                            com.liferay.portal.kernel.exception.SystemException {
213                    return getService()
214                                       .updateUserGroup(userGroupId, name, description,
215                            publicLayoutSetPrototypeId, privateLayoutSetPrototypeId);
216            }
217    
218            public static UserGroupService getService() {
219                    if (_service == null) {
220                            _service = (UserGroupService)PortalBeanLocatorUtil.locate(UserGroupService.class.getName());
221    
222                            ReferenceRegistry.registerReference(UserGroupServiceUtil.class,
223                                    "_service");
224                            MethodCache.remove(UserGroupService.class);
225                    }
226    
227                    return _service;
228            }
229    
230            public void setService(UserGroupService service) {
231                    MethodCache.remove(UserGroupService.class);
232    
233                    _service = service;
234    
235                    ReferenceRegistry.registerReference(UserGroupServiceUtil.class,
236                            "_service");
237                    MethodCache.remove(UserGroupService.class);
238            }
239    
240            private static UserGroupService _service;
241    }