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.BooleanWrapper;
026: import com.liferay.portal.kernel.util.IntegerWrapper;
027: import com.liferay.portal.kernel.util.LongWrapper;
028: import com.liferay.portal.kernel.util.MethodWrapper;
029: import com.liferay.portal.kernel.util.NullWrapper;
030: import com.liferay.portal.security.auth.HttpPrincipal;
031: import com.liferay.portal.service.GroupServiceUtil;
032:
033: /**
034: * <a href="GroupServiceHttp.java.html"><b><i>View Source</i></b></a>
035: *
036: * <p>
037: * ServiceBuilder generated this class. Modifications in this class will be
038: * overwritten the next time is generated.
039: * </p>
040: *
041: * <p>
042: * This class provides a HTTP utility for the
043: * <code>com.liferay.portal.service.GroupServiceUtil</code> service
044: * utility. The static methods of this class calls the same methods of the
045: * service utility. However, the signatures are different because it requires an
046: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
047: * parameter.
048: * </p>
049: *
050: * <p>
051: * The benefits of using the HTTP utility is that it is fast and allows for
052: * tunneling without the cost of serializing to text. The drawback is that it
053: * only works with Java.
054: * </p>
055: *
056: * <p>
057: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
058: * portal.properties to configure security.
059: * </p>
060: *
061: * <p>
062: * The HTTP utility is only generated for remote services.
063: * </p>
064: *
065: * @author Brian Wing Shun Chan
066: *
067: * @see com.liferay.portal.security.auth.HttpPrincipal
068: * @see com.liferay.portal.service.GroupServiceUtil
069: * @see com.liferay.portal.service.http.GroupServiceSoap
070: *
071: */
072: public class GroupServiceHttp {
073: public static com.liferay.portal.model.Group addGroup(
074: HttpPrincipal httpPrincipal, java.lang.String name,
075: java.lang.String description, int type,
076: java.lang.String friendlyURL, boolean active)
077: throws com.liferay.portal.SystemException,
078: com.liferay.portal.PortalException {
079: try {
080: Object paramObj0 = name;
081:
082: if (name == null) {
083: paramObj0 = new NullWrapper("java.lang.String");
084: }
085:
086: Object paramObj1 = description;
087:
088: if (description == null) {
089: paramObj1 = new NullWrapper("java.lang.String");
090: }
091:
092: Object paramObj2 = new IntegerWrapper(type);
093:
094: Object paramObj3 = friendlyURL;
095:
096: if (friendlyURL == null) {
097: paramObj3 = new NullWrapper("java.lang.String");
098: }
099:
100: Object paramObj4 = new BooleanWrapper(active);
101:
102: MethodWrapper methodWrapper = new MethodWrapper(
103: GroupServiceUtil.class.getName(), "addGroup",
104: new Object[] { paramObj0, paramObj1, paramObj2,
105: paramObj3, paramObj4 });
106:
107: Object returnObj = null;
108:
109: try {
110: returnObj = TunnelUtil.invoke(httpPrincipal,
111: methodWrapper);
112: } catch (Exception e) {
113: if (e instanceof com.liferay.portal.SystemException) {
114: throw (com.liferay.portal.SystemException) e;
115: }
116:
117: if (e instanceof com.liferay.portal.PortalException) {
118: throw (com.liferay.portal.PortalException) e;
119: }
120:
121: throw new com.liferay.portal.SystemException(e);
122: }
123:
124: return (com.liferay.portal.model.Group) returnObj;
125: } catch (com.liferay.portal.SystemException se) {
126: _log.error(se, se);
127:
128: throw se;
129: }
130: }
131:
132: public static com.liferay.portal.model.Group addGroup(
133: HttpPrincipal httpPrincipal, long liveGroupId,
134: java.lang.String name, java.lang.String description,
135: int type, java.lang.String friendlyURL, boolean active)
136: throws com.liferay.portal.SystemException,
137: com.liferay.portal.PortalException {
138: try {
139: Object paramObj0 = new LongWrapper(liveGroupId);
140:
141: Object paramObj1 = name;
142:
143: if (name == null) {
144: paramObj1 = new NullWrapper("java.lang.String");
145: }
146:
147: Object paramObj2 = description;
148:
149: if (description == null) {
150: paramObj2 = new NullWrapper("java.lang.String");
151: }
152:
153: Object paramObj3 = new IntegerWrapper(type);
154:
155: Object paramObj4 = friendlyURL;
156:
157: if (friendlyURL == null) {
158: paramObj4 = new NullWrapper("java.lang.String");
159: }
160:
161: Object paramObj5 = new BooleanWrapper(active);
162:
163: MethodWrapper methodWrapper = new MethodWrapper(
164: GroupServiceUtil.class.getName(), "addGroup",
165: new Object[] { paramObj0, paramObj1, paramObj2,
166: paramObj3, paramObj4, paramObj5 });
167:
168: Object returnObj = null;
169:
170: try {
171: returnObj = TunnelUtil.invoke(httpPrincipal,
172: methodWrapper);
173: } catch (Exception e) {
174: if (e instanceof com.liferay.portal.SystemException) {
175: throw (com.liferay.portal.SystemException) e;
176: }
177:
178: if (e instanceof com.liferay.portal.PortalException) {
179: throw (com.liferay.portal.PortalException) e;
180: }
181:
182: throw new com.liferay.portal.SystemException(e);
183: }
184:
185: return (com.liferay.portal.model.Group) returnObj;
186: } catch (com.liferay.portal.SystemException se) {
187: _log.error(se, se);
188:
189: throw se;
190: }
191: }
192:
193: public static void addRoleGroups(HttpPrincipal httpPrincipal,
194: long roleId, long[] groupIds)
195: throws com.liferay.portal.SystemException,
196: com.liferay.portal.PortalException {
197: try {
198: Object paramObj0 = new LongWrapper(roleId);
199:
200: Object paramObj1 = groupIds;
201:
202: if (groupIds == null) {
203: paramObj1 = new NullWrapper("[J");
204: }
205:
206: MethodWrapper methodWrapper = new MethodWrapper(
207: GroupServiceUtil.class.getName(), "addRoleGroups",
208: new Object[] { paramObj0, paramObj1 });
209:
210: try {
211: TunnelUtil.invoke(httpPrincipal, methodWrapper);
212: } catch (Exception e) {
213: if (e instanceof com.liferay.portal.SystemException) {
214: throw (com.liferay.portal.SystemException) e;
215: }
216:
217: if (e instanceof com.liferay.portal.PortalException) {
218: throw (com.liferay.portal.PortalException) e;
219: }
220:
221: throw new com.liferay.portal.SystemException(e);
222: }
223: } catch (com.liferay.portal.SystemException se) {
224: _log.error(se, se);
225:
226: throw se;
227: }
228: }
229:
230: public static void deleteGroup(HttpPrincipal httpPrincipal,
231: long groupId) throws com.liferay.portal.SystemException,
232: com.liferay.portal.PortalException {
233: try {
234: Object paramObj0 = new LongWrapper(groupId);
235:
236: MethodWrapper methodWrapper = new MethodWrapper(
237: GroupServiceUtil.class.getName(), "deleteGroup",
238: new Object[] { paramObj0 });
239:
240: try {
241: TunnelUtil.invoke(httpPrincipal, methodWrapper);
242: } catch (Exception e) {
243: if (e instanceof com.liferay.portal.SystemException) {
244: throw (com.liferay.portal.SystemException) e;
245: }
246:
247: if (e instanceof com.liferay.portal.PortalException) {
248: throw (com.liferay.portal.PortalException) e;
249: }
250:
251: throw new com.liferay.portal.SystemException(e);
252: }
253: } catch (com.liferay.portal.SystemException se) {
254: _log.error(se, se);
255:
256: throw se;
257: }
258: }
259:
260: public static com.liferay.portal.model.Group getGroup(
261: HttpPrincipal httpPrincipal, long groupId)
262: throws com.liferay.portal.SystemException,
263: com.liferay.portal.PortalException {
264: try {
265: Object paramObj0 = new LongWrapper(groupId);
266:
267: MethodWrapper methodWrapper = new MethodWrapper(
268: GroupServiceUtil.class.getName(), "getGroup",
269: new Object[] { paramObj0 });
270:
271: Object returnObj = null;
272:
273: try {
274: returnObj = TunnelUtil.invoke(httpPrincipal,
275: methodWrapper);
276: } catch (Exception e) {
277: if (e instanceof com.liferay.portal.SystemException) {
278: throw (com.liferay.portal.SystemException) e;
279: }
280:
281: if (e instanceof com.liferay.portal.PortalException) {
282: throw (com.liferay.portal.PortalException) e;
283: }
284:
285: throw new com.liferay.portal.SystemException(e);
286: }
287:
288: return (com.liferay.portal.model.Group) returnObj;
289: } catch (com.liferay.portal.SystemException se) {
290: _log.error(se, se);
291:
292: throw se;
293: }
294: }
295:
296: public static com.liferay.portal.model.Group getGroup(
297: HttpPrincipal httpPrincipal, long companyId,
298: java.lang.String name)
299: throws com.liferay.portal.SystemException,
300: com.liferay.portal.PortalException {
301: try {
302: Object paramObj0 = new LongWrapper(companyId);
303:
304: Object paramObj1 = name;
305:
306: if (name == null) {
307: paramObj1 = new NullWrapper("java.lang.String");
308: }
309:
310: MethodWrapper methodWrapper = new MethodWrapper(
311: GroupServiceUtil.class.getName(), "getGroup",
312: new Object[] { paramObj0, paramObj1 });
313:
314: Object returnObj = null;
315:
316: try {
317: returnObj = TunnelUtil.invoke(httpPrincipal,
318: methodWrapper);
319: } catch (Exception e) {
320: if (e instanceof com.liferay.portal.SystemException) {
321: throw (com.liferay.portal.SystemException) e;
322: }
323:
324: if (e instanceof com.liferay.portal.PortalException) {
325: throw (com.liferay.portal.PortalException) e;
326: }
327:
328: throw new com.liferay.portal.SystemException(e);
329: }
330:
331: return (com.liferay.portal.model.Group) returnObj;
332: } catch (com.liferay.portal.SystemException se) {
333: _log.error(se, se);
334:
335: throw se;
336: }
337: }
338:
339: public static java.util.List getOrganizationsGroups(
340: HttpPrincipal httpPrincipal, java.util.List organizations)
341: throws com.liferay.portal.SystemException,
342: com.liferay.portal.PortalException {
343: try {
344: Object paramObj0 = organizations;
345:
346: if (organizations == null) {
347: paramObj0 = new NullWrapper("java.util.List");
348: }
349:
350: MethodWrapper methodWrapper = new MethodWrapper(
351: GroupServiceUtil.class.getName(),
352: "getOrganizationsGroups",
353: new Object[] { paramObj0 });
354:
355: Object returnObj = null;
356:
357: try {
358: returnObj = TunnelUtil.invoke(httpPrincipal,
359: methodWrapper);
360: } catch (Exception e) {
361: if (e instanceof com.liferay.portal.SystemException) {
362: throw (com.liferay.portal.SystemException) e;
363: }
364:
365: if (e instanceof com.liferay.portal.PortalException) {
366: throw (com.liferay.portal.PortalException) e;
367: }
368:
369: throw new com.liferay.portal.SystemException(e);
370: }
371:
372: return (java.util.List) returnObj;
373: } catch (com.liferay.portal.SystemException se) {
374: _log.error(se, se);
375:
376: throw se;
377: }
378: }
379:
380: public static java.util.List getUserGroupsGroups(
381: HttpPrincipal httpPrincipal, java.util.List userGroups)
382: throws com.liferay.portal.SystemException,
383: com.liferay.portal.PortalException {
384: try {
385: Object paramObj0 = userGroups;
386:
387: if (userGroups == null) {
388: paramObj0 = new NullWrapper("java.util.List");
389: }
390:
391: MethodWrapper methodWrapper = new MethodWrapper(
392: GroupServiceUtil.class.getName(),
393: "getUserGroupsGroups", new Object[] { paramObj0 });
394:
395: Object returnObj = null;
396:
397: try {
398: returnObj = TunnelUtil.invoke(httpPrincipal,
399: methodWrapper);
400: } catch (Exception e) {
401: if (e instanceof com.liferay.portal.SystemException) {
402: throw (com.liferay.portal.SystemException) e;
403: }
404:
405: if (e instanceof com.liferay.portal.PortalException) {
406: throw (com.liferay.portal.PortalException) e;
407: }
408:
409: throw new com.liferay.portal.SystemException(e);
410: }
411:
412: return (java.util.List) returnObj;
413: } catch (com.liferay.portal.SystemException se) {
414: _log.error(se, se);
415:
416: throw se;
417: }
418: }
419:
420: public static boolean hasUserGroup(HttpPrincipal httpPrincipal,
421: long userId, long groupId)
422: throws com.liferay.portal.SystemException {
423: try {
424: Object paramObj0 = new LongWrapper(userId);
425:
426: Object paramObj1 = new LongWrapper(groupId);
427:
428: MethodWrapper methodWrapper = new MethodWrapper(
429: GroupServiceUtil.class.getName(), "hasUserGroup",
430: new Object[] { paramObj0, paramObj1 });
431:
432: Object returnObj = null;
433:
434: try {
435: returnObj = TunnelUtil.invoke(httpPrincipal,
436: methodWrapper);
437: } catch (Exception e) {
438: if (e instanceof com.liferay.portal.SystemException) {
439: throw (com.liferay.portal.SystemException) e;
440: }
441:
442: throw new com.liferay.portal.SystemException(e);
443: }
444:
445: return ((Boolean) returnObj).booleanValue();
446: } catch (com.liferay.portal.SystemException se) {
447: _log.error(se, se);
448:
449: throw se;
450: }
451: }
452:
453: public static java.util.List search(HttpPrincipal httpPrincipal,
454: long companyId, java.lang.String name,
455: java.lang.String description, java.lang.String[] params,
456: int begin, int end)
457: throws com.liferay.portal.SystemException {
458: try {
459: Object paramObj0 = new LongWrapper(companyId);
460:
461: Object paramObj1 = name;
462:
463: if (name == null) {
464: paramObj1 = new NullWrapper("java.lang.String");
465: }
466:
467: Object paramObj2 = description;
468:
469: if (description == null) {
470: paramObj2 = new NullWrapper("java.lang.String");
471: }
472:
473: Object paramObj3 = params;
474:
475: if (params == null) {
476: paramObj3 = new NullWrapper("[Ljava.lang.String;");
477: }
478:
479: Object paramObj4 = new IntegerWrapper(begin);
480:
481: Object paramObj5 = new IntegerWrapper(end);
482:
483: MethodWrapper methodWrapper = new MethodWrapper(
484: GroupServiceUtil.class.getName(), "search",
485: new Object[] { paramObj0, paramObj1, paramObj2,
486: paramObj3, paramObj4, paramObj5 });
487:
488: Object returnObj = null;
489:
490: try {
491: returnObj = TunnelUtil.invoke(httpPrincipal,
492: methodWrapper);
493: } catch (Exception e) {
494: if (e instanceof com.liferay.portal.SystemException) {
495: throw (com.liferay.portal.SystemException) e;
496: }
497:
498: throw new com.liferay.portal.SystemException(e);
499: }
500:
501: return (java.util.List) returnObj;
502: } catch (com.liferay.portal.SystemException se) {
503: _log.error(se, se);
504:
505: throw se;
506: }
507: }
508:
509: public static int searchCount(HttpPrincipal httpPrincipal,
510: long companyId, java.lang.String name,
511: java.lang.String description, java.lang.String[] params)
512: throws com.liferay.portal.SystemException {
513: try {
514: Object paramObj0 = new LongWrapper(companyId);
515:
516: Object paramObj1 = name;
517:
518: if (name == null) {
519: paramObj1 = new NullWrapper("java.lang.String");
520: }
521:
522: Object paramObj2 = description;
523:
524: if (description == null) {
525: paramObj2 = new NullWrapper("java.lang.String");
526: }
527:
528: Object paramObj3 = params;
529:
530: if (params == null) {
531: paramObj3 = new NullWrapper("[Ljava.lang.String;");
532: }
533:
534: MethodWrapper methodWrapper = new MethodWrapper(
535: GroupServiceUtil.class.getName(), "searchCount",
536: new Object[] { paramObj0, paramObj1, paramObj2,
537: paramObj3 });
538:
539: Object returnObj = null;
540:
541: try {
542: returnObj = TunnelUtil.invoke(httpPrincipal,
543: methodWrapper);
544: } catch (Exception e) {
545: if (e instanceof com.liferay.portal.SystemException) {
546: throw (com.liferay.portal.SystemException) e;
547: }
548:
549: throw new com.liferay.portal.SystemException(e);
550: }
551:
552: return ((Integer) returnObj).intValue();
553: } catch (com.liferay.portal.SystemException se) {
554: _log.error(se, se);
555:
556: throw se;
557: }
558: }
559:
560: public static void setRoleGroups(HttpPrincipal httpPrincipal,
561: long roleId, long[] groupIds)
562: throws com.liferay.portal.SystemException,
563: com.liferay.portal.PortalException {
564: try {
565: Object paramObj0 = new LongWrapper(roleId);
566:
567: Object paramObj1 = groupIds;
568:
569: if (groupIds == null) {
570: paramObj1 = new NullWrapper("[J");
571: }
572:
573: MethodWrapper methodWrapper = new MethodWrapper(
574: GroupServiceUtil.class.getName(), "setRoleGroups",
575: new Object[] { paramObj0, paramObj1 });
576:
577: try {
578: TunnelUtil.invoke(httpPrincipal, methodWrapper);
579: } catch (Exception e) {
580: if (e instanceof com.liferay.portal.SystemException) {
581: throw (com.liferay.portal.SystemException) e;
582: }
583:
584: if (e instanceof com.liferay.portal.PortalException) {
585: throw (com.liferay.portal.PortalException) e;
586: }
587:
588: throw new com.liferay.portal.SystemException(e);
589: }
590: } catch (com.liferay.portal.SystemException se) {
591: _log.error(se, se);
592:
593: throw se;
594: }
595: }
596:
597: public static void unsetRoleGroups(HttpPrincipal httpPrincipal,
598: long roleId, long[] groupIds)
599: throws com.liferay.portal.SystemException,
600: com.liferay.portal.PortalException {
601: try {
602: Object paramObj0 = new LongWrapper(roleId);
603:
604: Object paramObj1 = groupIds;
605:
606: if (groupIds == null) {
607: paramObj1 = new NullWrapper("[J");
608: }
609:
610: MethodWrapper methodWrapper = new MethodWrapper(
611: GroupServiceUtil.class.getName(),
612: "unsetRoleGroups", new Object[] { paramObj0,
613: paramObj1 });
614:
615: try {
616: TunnelUtil.invoke(httpPrincipal, methodWrapper);
617: } catch (Exception e) {
618: if (e instanceof com.liferay.portal.SystemException) {
619: throw (com.liferay.portal.SystemException) e;
620: }
621:
622: if (e instanceof com.liferay.portal.PortalException) {
623: throw (com.liferay.portal.PortalException) e;
624: }
625:
626: throw new com.liferay.portal.SystemException(e);
627: }
628: } catch (com.liferay.portal.SystemException se) {
629: _log.error(se, se);
630:
631: throw se;
632: }
633: }
634:
635: public static com.liferay.portal.model.Group updateGroup(
636: HttpPrincipal httpPrincipal, long groupId,
637: java.lang.String name, java.lang.String description,
638: int type, java.lang.String friendlyURL, boolean active)
639: throws com.liferay.portal.SystemException,
640: com.liferay.portal.PortalException {
641: try {
642: Object paramObj0 = new LongWrapper(groupId);
643:
644: Object paramObj1 = name;
645:
646: if (name == null) {
647: paramObj1 = new NullWrapper("java.lang.String");
648: }
649:
650: Object paramObj2 = description;
651:
652: if (description == null) {
653: paramObj2 = new NullWrapper("java.lang.String");
654: }
655:
656: Object paramObj3 = new IntegerWrapper(type);
657:
658: Object paramObj4 = friendlyURL;
659:
660: if (friendlyURL == null) {
661: paramObj4 = new NullWrapper("java.lang.String");
662: }
663:
664: Object paramObj5 = new BooleanWrapper(active);
665:
666: MethodWrapper methodWrapper = new MethodWrapper(
667: GroupServiceUtil.class.getName(), "updateGroup",
668: new Object[] { paramObj0, paramObj1, paramObj2,
669: paramObj3, paramObj4, paramObj5 });
670:
671: Object returnObj = null;
672:
673: try {
674: returnObj = TunnelUtil.invoke(httpPrincipal,
675: methodWrapper);
676: } catch (Exception e) {
677: if (e instanceof com.liferay.portal.SystemException) {
678: throw (com.liferay.portal.SystemException) e;
679: }
680:
681: if (e instanceof com.liferay.portal.PortalException) {
682: throw (com.liferay.portal.PortalException) e;
683: }
684:
685: throw new com.liferay.portal.SystemException(e);
686: }
687:
688: return (com.liferay.portal.model.Group) returnObj;
689: } catch (com.liferay.portal.SystemException se) {
690: _log.error(se, se);
691:
692: throw se;
693: }
694: }
695:
696: public static com.liferay.portal.model.Group updateGroup(
697: HttpPrincipal httpPrincipal, long groupId,
698: java.lang.String typeSettings)
699: throws com.liferay.portal.SystemException,
700: com.liferay.portal.PortalException {
701: try {
702: Object paramObj0 = new LongWrapper(groupId);
703:
704: Object paramObj1 = typeSettings;
705:
706: if (typeSettings == null) {
707: paramObj1 = new NullWrapper("java.lang.String");
708: }
709:
710: MethodWrapper methodWrapper = new MethodWrapper(
711: GroupServiceUtil.class.getName(), "updateGroup",
712: new Object[] { paramObj0, paramObj1 });
713:
714: Object returnObj = null;
715:
716: try {
717: returnObj = TunnelUtil.invoke(httpPrincipal,
718: methodWrapper);
719: } catch (Exception e) {
720: if (e instanceof com.liferay.portal.SystemException) {
721: throw (com.liferay.portal.SystemException) e;
722: }
723:
724: if (e instanceof com.liferay.portal.PortalException) {
725: throw (com.liferay.portal.PortalException) e;
726: }
727:
728: throw new com.liferay.portal.SystemException(e);
729: }
730:
731: return (com.liferay.portal.model.Group) returnObj;
732: } catch (com.liferay.portal.SystemException se) {
733: _log.error(se, se);
734:
735: throw se;
736: }
737: }
738:
739: private static Log _log = LogFactoryUtil
740: .getLog(GroupServiceHttp.class);
741: }
|