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.bean.PortalBeanLocatorUtil;
020    import com.liferay.portal.kernel.util.ReferenceRegistry;
021    
022    /**
023     * Provides the remote service utility for UserGroup. This utility wraps
024     * {@link com.liferay.portal.service.impl.UserGroupServiceImpl} and is the
025     * primary access point for service operations in application layer code running
026     * on a remote server. Methods of this service are expected to have security
027     * checks based on the propagated JAAS credentials because this service can be
028     * accessed remotely.
029     *
030     * @author Brian Wing Shun Chan
031     * @see UserGroupService
032     * @see com.liferay.portal.service.base.UserGroupServiceBaseImpl
033     * @see com.liferay.portal.service.impl.UserGroupServiceImpl
034     * @generated
035     */
036    @ProviderType
037    public class UserGroupServiceUtil {
038            /*
039             * NOTE FOR DEVELOPERS:
040             *
041             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.UserGroupServiceImpl} and rerun ServiceBuilder to regenerate this class.
042             */
043    
044            /**
045            * Adds the user groups to the group.
046            *
047            * @param groupId the primary key of the group
048            * @param userGroupIds the primary keys of the user groups
049            * @throws PortalException if the user did not have permission to assign
050            group members
051            */
052            public static void addGroupUserGroups(long groupId, long[] userGroupIds)
053                    throws com.liferay.portal.kernel.exception.PortalException {
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 the user did not have permission to assign
063            team members
064            */
065            public static void addTeamUserGroups(long teamId, long[] userGroupIds)
066                    throws com.liferay.portal.kernel.exception.PortalException {
067                    getService().addTeamUserGroups(teamId, userGroupIds);
068            }
069    
070            /**
071            * Adds a user group.
072            *
073            * <p>
074            * This method handles the creation and bookkeeping of the user group,
075            * including its resources, metadata, and internal data structures.
076            * </p>
077            *
078            * @param name the user group's name
079            * @param description the user group's description
080            * @return the user group
081            * @throws PortalException if the user group's information was invalid
082            or if the user did not have permission to add the user group
083            * @deprecated As of 6.2.0, replaced by {@link #addUserGroup(String, String,
084            ServiceContext)}
085            */
086            @Deprecated
087            public static com.liferay.portal.model.UserGroup addUserGroup(
088                    java.lang.String name, java.lang.String description)
089                    throws com.liferay.portal.kernel.exception.PortalException {
090                    return getService().addUserGroup(name, description);
091            }
092    
093            /**
094            * Adds a user group.
095            *
096            * <p>
097            * This method handles the creation and bookkeeping of the user group,
098            * including its resources, metadata, and internal data structures.
099            * </p>
100            *
101            * @param name the user group's name
102            * @param description the user group's description
103            * @param serviceContext the service context to be applied (optionally
104            <code>null</code>). Can set expando bridge attributes for the
105            user group.
106            * @return the user group
107            * @throws PortalException if the user group's information was invalid or if
108            the user did not have permission to add the user group
109            */
110            public static com.liferay.portal.model.UserGroup addUserGroup(
111                    java.lang.String name, java.lang.String description,
112                    com.liferay.portal.service.ServiceContext serviceContext)
113                    throws com.liferay.portal.kernel.exception.PortalException {
114                    return getService().addUserGroup(name, description, serviceContext);
115            }
116    
117            /**
118            * Deletes the user group.
119            *
120            * @param userGroupId the primary key of the user group
121            * @throws PortalException if a user group with the primary key could not be
122            found, if the user did not have permission to delete the user
123            group, or if the user group had a workflow in approved status
124            */
125            public static void deleteUserGroup(long userGroupId)
126                    throws com.liferay.portal.kernel.exception.PortalException {
127                    getService().deleteUserGroup(userGroupId);
128            }
129    
130            /**
131            * Fetches the user group with the primary key.
132            *
133            * @param userGroupId the primary key of the user group
134            * @return the user group with the primary key
135            * @throws PortalException if the user did not have permission to view the
136            user group
137            */
138            public static com.liferay.portal.model.UserGroup fetchUserGroup(
139                    long userGroupId)
140                    throws com.liferay.portal.kernel.exception.PortalException {
141                    return getService().fetchUserGroup(userGroupId);
142            }
143    
144            /**
145            * Returns the Spring bean ID for this bean.
146            *
147            * @return the Spring bean ID for this bean
148            */
149            public static java.lang.String getBeanIdentifier() {
150                    return getService().getBeanIdentifier();
151            }
152    
153            /**
154            * Returns the user group with the name.
155            *
156            * @param name the user group's name
157            * @return the user group with the name
158            * @throws PortalException if a user group with the name could not be found
159            or if the user did not have permission to view the user group
160            */
161            public static com.liferay.portal.model.UserGroup getUserGroup(
162                    java.lang.String name)
163                    throws com.liferay.portal.kernel.exception.PortalException {
164                    return getService().getUserGroup(name);
165            }
166    
167            /**
168            * Returns the user group with the primary key.
169            *
170            * @param userGroupId the primary key of the user group
171            * @return the user group with the primary key
172            * @throws PortalException if a user group with the primary key could not be
173            found or if the user did not have permission to view the user
174            group
175            */
176            public static com.liferay.portal.model.UserGroup getUserGroup(
177                    long userGroupId)
178                    throws com.liferay.portal.kernel.exception.PortalException {
179                    return getService().getUserGroup(userGroupId);
180            }
181    
182            public static java.util.List<com.liferay.portal.model.UserGroup> getUserGroups(
183                    long companyId)
184                    throws com.liferay.portal.kernel.exception.PortalException {
185                    return getService().getUserGroups(companyId);
186            }
187    
188            /**
189            * Returns all the user groups to which the user belongs.
190            *
191            * @param userId the primary key of the user
192            * @return the user groups to which the user belongs
193            * @throws PortalException if the current user did not have permission to
194            view the user or any one of the user group members
195            */
196            public static java.util.List<com.liferay.portal.model.UserGroup> getUserUserGroups(
197                    long userId) throws com.liferay.portal.kernel.exception.PortalException {
198                    return getService().getUserUserGroups(userId);
199            }
200    
201            /**
202            * Sets the Spring bean ID for this bean.
203            *
204            * @param beanIdentifier the Spring bean ID for this bean
205            */
206            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
207                    getService().setBeanIdentifier(beanIdentifier);
208            }
209    
210            /**
211            * Removes the user groups from the group.
212            *
213            * @param groupId the primary key of the group
214            * @param userGroupIds the primary keys of the user groups
215            * @throws PortalException if the user did not have permission to assign
216            group members
217            */
218            public static void unsetGroupUserGroups(long groupId, long[] userGroupIds)
219                    throws com.liferay.portal.kernel.exception.PortalException {
220                    getService().unsetGroupUserGroups(groupId, userGroupIds);
221            }
222    
223            /**
224            * Removes the user groups from the team.
225            *
226            * @param teamId the primary key of the team
227            * @param userGroupIds the primary keys of the user groups
228            * @throws PortalException if the user did not have permission to assign
229            team members
230            */
231            public static void unsetTeamUserGroups(long teamId, long[] userGroupIds)
232                    throws com.liferay.portal.kernel.exception.PortalException {
233                    getService().unsetTeamUserGroups(teamId, userGroupIds);
234            }
235    
236            /**
237            * Updates the user group.
238            *
239            * @param userGroupId the primary key of the user group
240            * @param name the user group's name
241            * @param description the the user group's description
242            * @return the user group
243            * @throws PortalException if a user group with the primary key was not
244            found, if the new information was invalid, or if the user did
245            not have permission to update the user group information
246            * @deprecated As of 6.2.0, replaced by {@link #updateUserGroup(long,
247            String, String, ServiceContext)}
248            */
249            @Deprecated
250            public static com.liferay.portal.model.UserGroup updateUserGroup(
251                    long userGroupId, java.lang.String name, java.lang.String description)
252                    throws com.liferay.portal.kernel.exception.PortalException {
253                    return getService().updateUserGroup(userGroupId, name, description);
254            }
255    
256            /**
257            * Updates the user group.
258            *
259            * @param userGroupId the primary key of the user group
260            * @param name the user group's name
261            * @param description the the user group's description
262            * @param serviceContext the service context to be applied (optionally
263            <code>null</code>). Can set expando bridge attributes for the
264            user group.
265            * @return the user group
266            * @throws PortalException if a user group with the primary key was not
267            found, if the new information was invalid, or if the user did not
268            have permission to update the user group information
269            */
270            public static com.liferay.portal.model.UserGroup updateUserGroup(
271                    long userGroupId, java.lang.String name, java.lang.String description,
272                    com.liferay.portal.service.ServiceContext serviceContext)
273                    throws com.liferay.portal.kernel.exception.PortalException {
274                    return getService()
275                                       .updateUserGroup(userGroupId, name, description,
276                            serviceContext);
277            }
278    
279            public static UserGroupService getService() {
280                    if (_service == null) {
281                            _service = (UserGroupService)PortalBeanLocatorUtil.locate(UserGroupService.class.getName());
282    
283                            ReferenceRegistry.registerReference(UserGroupServiceUtil.class,
284                                    "_service");
285                    }
286    
287                    return _service;
288            }
289    
290            /**
291             * @deprecated As of 6.2.0
292             */
293            @Deprecated
294            public void setService(UserGroupService service) {
295            }
296    
297            private static UserGroupService _service;
298    }