1
22
23 package com.liferay.portal.service.http;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27 import com.liferay.portal.kernel.util.LongWrapper;
28 import com.liferay.portal.kernel.util.MethodWrapper;
29 import com.liferay.portal.kernel.util.NullWrapper;
30 import com.liferay.portal.security.auth.HttpPrincipal;
31 import com.liferay.portal.service.UserGroupServiceUtil;
32 import com.liferay.portal.service.http.TunnelUtil;
33
34
71 public class UserGroupServiceHttp {
72 public static void addGroupUserGroups(HttpPrincipal httpPrincipal,
73 long groupId, long[] userGroupIds)
74 throws com.liferay.portal.SystemException,
75 com.liferay.portal.PortalException {
76 try {
77 Object paramObj0 = new LongWrapper(groupId);
78 Object paramObj1 = userGroupIds;
79
80 if (userGroupIds == null) {
81 paramObj1 = new NullWrapper("[J");
82 }
83
84 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
85 "addGroupUserGroups", new Object[] { paramObj0, paramObj1 });
86
87 try {
88 TunnelUtil.invoke(httpPrincipal, methodWrapper);
89 }
90 catch (Exception e) {
91 if (e instanceof com.liferay.portal.SystemException) {
92 throw (com.liferay.portal.SystemException)e;
93 }
94
95 if (e instanceof com.liferay.portal.PortalException) {
96 throw (com.liferay.portal.PortalException)e;
97 }
98
99 throw new com.liferay.portal.SystemException(e);
100 }
101 }
102 catch (com.liferay.portal.SystemException se) {
103 _log.error(se, se);
104 throw se;
105 }
106 }
107
108 public static com.liferay.portal.model.UserGroup addUserGroup(
109 HttpPrincipal httpPrincipal, java.lang.String name,
110 java.lang.String description)
111 throws com.liferay.portal.SystemException,
112 com.liferay.portal.PortalException {
113 try {
114 Object paramObj0 = name;
115
116 if (name == null) {
117 paramObj0 = new NullWrapper("java.lang.String");
118 }
119
120 Object paramObj1 = description;
121
122 if (description == null) {
123 paramObj1 = new NullWrapper("java.lang.String");
124 }
125
126 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
127 "addUserGroup", new Object[] { paramObj0, paramObj1 });
128 Object returnObj = null;
129
130 try {
131 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
132 }
133 catch (Exception e) {
134 if (e instanceof com.liferay.portal.SystemException) {
135 throw (com.liferay.portal.SystemException)e;
136 }
137
138 if (e instanceof com.liferay.portal.PortalException) {
139 throw (com.liferay.portal.PortalException)e;
140 }
141
142 throw new com.liferay.portal.SystemException(e);
143 }
144
145 return (com.liferay.portal.model.UserGroup)returnObj;
146 }
147 catch (com.liferay.portal.SystemException se) {
148 _log.error(se, se);
149 throw se;
150 }
151 }
152
153 public static void deleteUserGroup(HttpPrincipal httpPrincipal,
154 long userGroupId)
155 throws com.liferay.portal.SystemException,
156 com.liferay.portal.PortalException {
157 try {
158 Object paramObj0 = new LongWrapper(userGroupId);
159 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
160 "deleteUserGroup", new Object[] { paramObj0 });
161
162 try {
163 TunnelUtil.invoke(httpPrincipal, methodWrapper);
164 }
165 catch (Exception e) {
166 if (e instanceof com.liferay.portal.SystemException) {
167 throw (com.liferay.portal.SystemException)e;
168 }
169
170 if (e instanceof com.liferay.portal.PortalException) {
171 throw (com.liferay.portal.PortalException)e;
172 }
173
174 throw new com.liferay.portal.SystemException(e);
175 }
176 }
177 catch (com.liferay.portal.SystemException se) {
178 _log.error(se, se);
179 throw se;
180 }
181 }
182
183 public static com.liferay.portal.model.UserGroup getUserGroup(
184 HttpPrincipal httpPrincipal, long userGroupId)
185 throws com.liferay.portal.SystemException,
186 com.liferay.portal.PortalException {
187 try {
188 Object paramObj0 = new LongWrapper(userGroupId);
189 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
190 "getUserGroup", new Object[] { paramObj0 });
191 Object returnObj = null;
192
193 try {
194 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
195 }
196 catch (Exception e) {
197 if (e instanceof com.liferay.portal.SystemException) {
198 throw (com.liferay.portal.SystemException)e;
199 }
200
201 if (e instanceof com.liferay.portal.PortalException) {
202 throw (com.liferay.portal.PortalException)e;
203 }
204
205 throw new com.liferay.portal.SystemException(e);
206 }
207
208 return (com.liferay.portal.model.UserGroup)returnObj;
209 }
210 catch (com.liferay.portal.SystemException se) {
211 _log.error(se, se);
212 throw se;
213 }
214 }
215
216 public static com.liferay.portal.model.UserGroup getUserGroup(
217 HttpPrincipal httpPrincipal, java.lang.String name)
218 throws com.liferay.portal.SystemException,
219 com.liferay.portal.PortalException {
220 try {
221 Object paramObj0 = name;
222
223 if (name == null) {
224 paramObj0 = new NullWrapper("java.lang.String");
225 }
226
227 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
228 "getUserGroup", new Object[] { paramObj0 });
229 Object returnObj = null;
230
231 try {
232 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
233 }
234 catch (Exception e) {
235 if (e instanceof com.liferay.portal.SystemException) {
236 throw (com.liferay.portal.SystemException)e;
237 }
238
239 if (e instanceof com.liferay.portal.PortalException) {
240 throw (com.liferay.portal.PortalException)e;
241 }
242
243 throw new com.liferay.portal.SystemException(e);
244 }
245
246 return (com.liferay.portal.model.UserGroup)returnObj;
247 }
248 catch (com.liferay.portal.SystemException se) {
249 _log.error(se, se);
250 throw se;
251 }
252 }
253
254 public static java.util.List getUserUserGroups(
255 HttpPrincipal httpPrincipal, long userId)
256 throws com.liferay.portal.SystemException,
257 com.liferay.portal.PortalException {
258 try {
259 Object paramObj0 = new LongWrapper(userId);
260 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
261 "getUserUserGroups", new Object[] { paramObj0 });
262 Object returnObj = null;
263
264 try {
265 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
266 }
267 catch (Exception e) {
268 if (e instanceof com.liferay.portal.SystemException) {
269 throw (com.liferay.portal.SystemException)e;
270 }
271
272 if (e instanceof com.liferay.portal.PortalException) {
273 throw (com.liferay.portal.PortalException)e;
274 }
275
276 throw new com.liferay.portal.SystemException(e);
277 }
278
279 return (java.util.List)returnObj;
280 }
281 catch (com.liferay.portal.SystemException se) {
282 _log.error(se, se);
283 throw se;
284 }
285 }
286
287 public static void unsetGroupUserGroups(HttpPrincipal httpPrincipal,
288 long groupId, long[] userGroupIds)
289 throws com.liferay.portal.SystemException,
290 com.liferay.portal.PortalException {
291 try {
292 Object paramObj0 = new LongWrapper(groupId);
293 Object paramObj1 = userGroupIds;
294
295 if (userGroupIds == null) {
296 paramObj1 = new NullWrapper("[J");
297 }
298
299 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
300 "unsetGroupUserGroups",
301 new Object[] { paramObj0, paramObj1 });
302
303 try {
304 TunnelUtil.invoke(httpPrincipal, methodWrapper);
305 }
306 catch (Exception e) {
307 if (e instanceof com.liferay.portal.SystemException) {
308 throw (com.liferay.portal.SystemException)e;
309 }
310
311 if (e instanceof com.liferay.portal.PortalException) {
312 throw (com.liferay.portal.PortalException)e;
313 }
314
315 throw new com.liferay.portal.SystemException(e);
316 }
317 }
318 catch (com.liferay.portal.SystemException se) {
319 _log.error(se, se);
320 throw se;
321 }
322 }
323
324 public static com.liferay.portal.model.UserGroup updateUserGroup(
325 HttpPrincipal httpPrincipal, long userGroupId, java.lang.String name,
326 java.lang.String description)
327 throws com.liferay.portal.SystemException,
328 com.liferay.portal.PortalException {
329 try {
330 Object paramObj0 = new LongWrapper(userGroupId);
331 Object paramObj1 = name;
332
333 if (name == null) {
334 paramObj1 = new NullWrapper("java.lang.String");
335 }
336
337 Object paramObj2 = description;
338
339 if (description == null) {
340 paramObj2 = new NullWrapper("java.lang.String");
341 }
342
343 MethodWrapper methodWrapper = new MethodWrapper(UserGroupServiceUtil.class.getName(),
344 "updateUserGroup",
345 new Object[] { paramObj0, paramObj1, paramObj2 });
346 Object returnObj = null;
347
348 try {
349 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
350 }
351 catch (Exception e) {
352 if (e instanceof com.liferay.portal.SystemException) {
353 throw (com.liferay.portal.SystemException)e;
354 }
355
356 if (e instanceof com.liferay.portal.PortalException) {
357 throw (com.liferay.portal.PortalException)e;
358 }
359
360 throw new com.liferay.portal.SystemException(e);
361 }
362
363 return (com.liferay.portal.model.UserGroup)returnObj;
364 }
365 catch (com.liferay.portal.SystemException se) {
366 _log.error(se, se);
367 throw se;
368 }
369 }
370
371 private static Log _log = LogFactoryUtil.getLog(UserGroupServiceHttp.class);
372 }