001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.LongWrapper;
026: import com.liferay.portal.kernel.util.MethodWrapper;
027: import com.liferay.portal.kernel.util.NullWrapper;
028: import com.liferay.portal.security.auth.HttpPrincipal;
029: import com.liferay.portal.service.UserGroupServiceUtil;
030:
031: /**
032: * <a href="UserGroupServiceHttp.java.html"><b><i>View Source</i></b></a>
033: *
034: * <p>
035: * ServiceBuilder generated this class. Modifications in this class will be
036: * overwritten the next time is generated.
037: * </p>
038: *
039: * <p>
040: * This class provides a HTTP utility for the
041: * <code>com.liferay.portal.service.UserGroupServiceUtil</code> service
042: * utility. The static methods of this class calls the same methods of the
043: * service utility. However, the signatures are different because it requires an
044: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
045: * parameter.
046: * </p>
047: *
048: * <p>
049: * The benefits of using the HTTP utility is that it is fast and allows for
050: * tunneling without the cost of serializing to text. The drawback is that it
051: * only works with Java.
052: * </p>
053: *
054: * <p>
055: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
056: * portal.properties to configure security.
057: * </p>
058: *
059: * <p>
060: * The HTTP utility is only generated for remote services.
061: * </p>
062: *
063: * @author Brian Wing Shun Chan
064: *
065: * @see com.liferay.portal.security.auth.HttpPrincipal
066: * @see com.liferay.portal.service.UserGroupServiceUtil
067: * @see com.liferay.portal.service.http.UserGroupServiceSoap
068: *
069: */
070: public class UserGroupServiceHttp {
071: public static void addGroupUserGroups(HttpPrincipal httpPrincipal,
072: long groupId, long[] userGroupIds)
073: throws com.liferay.portal.SystemException,
074: com.liferay.portal.PortalException {
075: try {
076: Object paramObj0 = new LongWrapper(groupId);
077:
078: Object paramObj1 = userGroupIds;
079:
080: if (userGroupIds == null) {
081: paramObj1 = new NullWrapper("[J");
082: }
083:
084: MethodWrapper methodWrapper = new MethodWrapper(
085: UserGroupServiceUtil.class.getName(),
086: "addGroupUserGroups", new Object[] { paramObj0,
087: paramObj1 });
088:
089: try {
090: TunnelUtil.invoke(httpPrincipal, methodWrapper);
091: } catch (Exception e) {
092: if (e instanceof com.liferay.portal.SystemException) {
093: throw (com.liferay.portal.SystemException) e;
094: }
095:
096: if (e instanceof com.liferay.portal.PortalException) {
097: throw (com.liferay.portal.PortalException) e;
098: }
099:
100: throw new com.liferay.portal.SystemException(e);
101: }
102: } catch (com.liferay.portal.SystemException se) {
103: _log.error(se, se);
104:
105: throw se;
106: }
107: }
108:
109: public static com.liferay.portal.model.UserGroup addUserGroup(
110: HttpPrincipal httpPrincipal, java.lang.String name,
111: java.lang.String description)
112: throws com.liferay.portal.SystemException,
113: com.liferay.portal.PortalException {
114: try {
115: Object paramObj0 = name;
116:
117: if (name == null) {
118: paramObj0 = new NullWrapper("java.lang.String");
119: }
120:
121: Object paramObj1 = description;
122:
123: if (description == null) {
124: paramObj1 = new NullWrapper("java.lang.String");
125: }
126:
127: MethodWrapper methodWrapper = new MethodWrapper(
128: UserGroupServiceUtil.class.getName(),
129: "addUserGroup",
130: new Object[] { paramObj0, paramObj1 });
131:
132: Object returnObj = null;
133:
134: try {
135: returnObj = TunnelUtil.invoke(httpPrincipal,
136: methodWrapper);
137: } catch (Exception e) {
138: if (e instanceof com.liferay.portal.SystemException) {
139: throw (com.liferay.portal.SystemException) e;
140: }
141:
142: if (e instanceof com.liferay.portal.PortalException) {
143: throw (com.liferay.portal.PortalException) e;
144: }
145:
146: throw new com.liferay.portal.SystemException(e);
147: }
148:
149: return (com.liferay.portal.model.UserGroup) returnObj;
150: } catch (com.liferay.portal.SystemException se) {
151: _log.error(se, se);
152:
153: throw se;
154: }
155: }
156:
157: public static void deleteUserGroup(HttpPrincipal httpPrincipal,
158: long userGroupId)
159: throws com.liferay.portal.SystemException,
160: com.liferay.portal.PortalException {
161: try {
162: Object paramObj0 = new LongWrapper(userGroupId);
163:
164: MethodWrapper methodWrapper = new MethodWrapper(
165: UserGroupServiceUtil.class.getName(),
166: "deleteUserGroup", new Object[] { paramObj0 });
167:
168: try {
169: TunnelUtil.invoke(httpPrincipal, methodWrapper);
170: } catch (Exception e) {
171: if (e instanceof com.liferay.portal.SystemException) {
172: throw (com.liferay.portal.SystemException) e;
173: }
174:
175: if (e instanceof com.liferay.portal.PortalException) {
176: throw (com.liferay.portal.PortalException) e;
177: }
178:
179: throw new com.liferay.portal.SystemException(e);
180: }
181: } catch (com.liferay.portal.SystemException se) {
182: _log.error(se, se);
183:
184: throw se;
185: }
186: }
187:
188: public static com.liferay.portal.model.UserGroup getUserGroup(
189: HttpPrincipal httpPrincipal, long userGroupId)
190: throws com.liferay.portal.SystemException,
191: com.liferay.portal.PortalException {
192: try {
193: Object paramObj0 = new LongWrapper(userGroupId);
194:
195: MethodWrapper methodWrapper = new MethodWrapper(
196: UserGroupServiceUtil.class.getName(),
197: "getUserGroup", new Object[] { paramObj0 });
198:
199: Object returnObj = null;
200:
201: try {
202: returnObj = TunnelUtil.invoke(httpPrincipal,
203: methodWrapper);
204: } catch (Exception e) {
205: if (e instanceof com.liferay.portal.SystemException) {
206: throw (com.liferay.portal.SystemException) e;
207: }
208:
209: if (e instanceof com.liferay.portal.PortalException) {
210: throw (com.liferay.portal.PortalException) e;
211: }
212:
213: throw new com.liferay.portal.SystemException(e);
214: }
215:
216: return (com.liferay.portal.model.UserGroup) returnObj;
217: } catch (com.liferay.portal.SystemException se) {
218: _log.error(se, se);
219:
220: throw se;
221: }
222: }
223:
224: public static com.liferay.portal.model.UserGroup getUserGroup(
225: HttpPrincipal httpPrincipal, java.lang.String name)
226: throws com.liferay.portal.SystemException,
227: com.liferay.portal.PortalException {
228: try {
229: Object paramObj0 = name;
230:
231: if (name == null) {
232: paramObj0 = new NullWrapper("java.lang.String");
233: }
234:
235: MethodWrapper methodWrapper = new MethodWrapper(
236: UserGroupServiceUtil.class.getName(),
237: "getUserGroup", new Object[] { paramObj0 });
238:
239: Object returnObj = null;
240:
241: try {
242: returnObj = TunnelUtil.invoke(httpPrincipal,
243: methodWrapper);
244: } catch (Exception e) {
245: if (e instanceof com.liferay.portal.SystemException) {
246: throw (com.liferay.portal.SystemException) e;
247: }
248:
249: if (e instanceof com.liferay.portal.PortalException) {
250: throw (com.liferay.portal.PortalException) e;
251: }
252:
253: throw new com.liferay.portal.SystemException(e);
254: }
255:
256: return (com.liferay.portal.model.UserGroup) returnObj;
257: } catch (com.liferay.portal.SystemException se) {
258: _log.error(se, se);
259:
260: throw se;
261: }
262: }
263:
264: public static java.util.List getUserUserGroups(
265: HttpPrincipal httpPrincipal, long userId)
266: throws com.liferay.portal.SystemException,
267: com.liferay.portal.PortalException {
268: try {
269: Object paramObj0 = new LongWrapper(userId);
270:
271: MethodWrapper methodWrapper = new MethodWrapper(
272: UserGroupServiceUtil.class.getName(),
273: "getUserUserGroups", new Object[] { paramObj0 });
274:
275: Object returnObj = null;
276:
277: try {
278: returnObj = TunnelUtil.invoke(httpPrincipal,
279: methodWrapper);
280: } catch (Exception e) {
281: if (e instanceof com.liferay.portal.SystemException) {
282: throw (com.liferay.portal.SystemException) e;
283: }
284:
285: if (e instanceof com.liferay.portal.PortalException) {
286: throw (com.liferay.portal.PortalException) e;
287: }
288:
289: throw new com.liferay.portal.SystemException(e);
290: }
291:
292: return (java.util.List) returnObj;
293: } catch (com.liferay.portal.SystemException se) {
294: _log.error(se, se);
295:
296: throw se;
297: }
298: }
299:
300: public static void unsetGroupUserGroups(
301: HttpPrincipal httpPrincipal, long groupId,
302: long[] userGroupIds)
303: throws com.liferay.portal.SystemException,
304: com.liferay.portal.PortalException {
305: try {
306: Object paramObj0 = new LongWrapper(groupId);
307:
308: Object paramObj1 = userGroupIds;
309:
310: if (userGroupIds == null) {
311: paramObj1 = new NullWrapper("[J");
312: }
313:
314: MethodWrapper methodWrapper = new MethodWrapper(
315: UserGroupServiceUtil.class.getName(),
316: "unsetGroupUserGroups", new Object[] { paramObj0,
317: paramObj1 });
318:
319: try {
320: TunnelUtil.invoke(httpPrincipal, methodWrapper);
321: } catch (Exception e) {
322: if (e instanceof com.liferay.portal.SystemException) {
323: throw (com.liferay.portal.SystemException) e;
324: }
325:
326: if (e instanceof com.liferay.portal.PortalException) {
327: throw (com.liferay.portal.PortalException) e;
328: }
329:
330: throw new com.liferay.portal.SystemException(e);
331: }
332: } catch (com.liferay.portal.SystemException se) {
333: _log.error(se, se);
334:
335: throw se;
336: }
337: }
338:
339: public static com.liferay.portal.model.UserGroup updateUserGroup(
340: HttpPrincipal httpPrincipal, long userGroupId,
341: java.lang.String name, java.lang.String description)
342: throws com.liferay.portal.SystemException,
343: com.liferay.portal.PortalException {
344: try {
345: Object paramObj0 = new LongWrapper(userGroupId);
346:
347: Object paramObj1 = name;
348:
349: if (name == null) {
350: paramObj1 = new NullWrapper("java.lang.String");
351: }
352:
353: Object paramObj2 = description;
354:
355: if (description == null) {
356: paramObj2 = new NullWrapper("java.lang.String");
357: }
358:
359: MethodWrapper methodWrapper = new MethodWrapper(
360: UserGroupServiceUtil.class.getName(),
361: "updateUserGroup", new Object[] { paramObj0,
362: paramObj1, paramObj2 });
363:
364: Object returnObj = null;
365:
366: try {
367: returnObj = TunnelUtil.invoke(httpPrincipal,
368: methodWrapper);
369: } catch (Exception e) {
370: if (e instanceof com.liferay.portal.SystemException) {
371: throw (com.liferay.portal.SystemException) e;
372: }
373:
374: if (e instanceof com.liferay.portal.PortalException) {
375: throw (com.liferay.portal.PortalException) e;
376: }
377:
378: throw new com.liferay.portal.SystemException(e);
379: }
380:
381: return (com.liferay.portal.model.UserGroup) returnObj;
382: } catch (com.liferay.portal.SystemException se) {
383: _log.error(se, se);
384:
385: throw se;
386: }
387: }
388:
389: private static Log _log = LogFactoryUtil
390: .getLog(UserGroupServiceHttp.class);
391: }
|