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.OrganizationServiceUtil;
032:
033: /**
034: * <a href="OrganizationServiceHttp.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.OrganizationServiceUtil</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.OrganizationServiceUtil
069: * @see com.liferay.portal.service.http.OrganizationServiceSoap
070: *
071: */
072: public class OrganizationServiceHttp {
073: public static void addGroupOrganizations(
074: HttpPrincipal httpPrincipal, long groupId,
075: long[] organizationIds)
076: throws com.liferay.portal.SystemException,
077: com.liferay.portal.PortalException {
078: try {
079: Object paramObj0 = new LongWrapper(groupId);
080:
081: Object paramObj1 = organizationIds;
082:
083: if (organizationIds == null) {
084: paramObj1 = new NullWrapper("[J");
085: }
086:
087: MethodWrapper methodWrapper = new MethodWrapper(
088: OrganizationServiceUtil.class.getName(),
089: "addGroupOrganizations", new Object[] { paramObj0,
090: paramObj1 });
091:
092: try {
093: TunnelUtil.invoke(httpPrincipal, methodWrapper);
094: } catch (Exception e) {
095: if (e instanceof com.liferay.portal.SystemException) {
096: throw (com.liferay.portal.SystemException) e;
097: }
098:
099: if (e instanceof com.liferay.portal.PortalException) {
100: throw (com.liferay.portal.PortalException) e;
101: }
102:
103: throw new com.liferay.portal.SystemException(e);
104: }
105: } catch (com.liferay.portal.SystemException se) {
106: _log.error(se, se);
107:
108: throw se;
109: }
110: }
111:
112: public static void addPasswordPolicyOrganizations(
113: HttpPrincipal httpPrincipal, long passwordPolicyId,
114: long[] organizationIds)
115: throws com.liferay.portal.SystemException,
116: com.liferay.portal.PortalException {
117: try {
118: Object paramObj0 = new LongWrapper(passwordPolicyId);
119:
120: Object paramObj1 = organizationIds;
121:
122: if (organizationIds == null) {
123: paramObj1 = new NullWrapper("[J");
124: }
125:
126: MethodWrapper methodWrapper = new MethodWrapper(
127: OrganizationServiceUtil.class.getName(),
128: "addPasswordPolicyOrganizations", new Object[] {
129: paramObj0, paramObj1 });
130:
131: try {
132: TunnelUtil.invoke(httpPrincipal, methodWrapper);
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: } catch (com.liferay.portal.SystemException se) {
145: _log.error(se, se);
146:
147: throw se;
148: }
149: }
150:
151: public static com.liferay.portal.model.Organization addOrganization(
152: HttpPrincipal httpPrincipal, long parentOrganizationId,
153: java.lang.String name, int type, boolean recursable,
154: long regionId, long countryId, int statusId,
155: java.lang.String comments)
156: throws com.liferay.portal.SystemException,
157: com.liferay.portal.PortalException {
158: try {
159: Object paramObj0 = new LongWrapper(parentOrganizationId);
160:
161: Object paramObj1 = name;
162:
163: if (name == null) {
164: paramObj1 = new NullWrapper("java.lang.String");
165: }
166:
167: Object paramObj2 = new IntegerWrapper(type);
168:
169: Object paramObj3 = new BooleanWrapper(recursable);
170:
171: Object paramObj4 = new LongWrapper(regionId);
172:
173: Object paramObj5 = new LongWrapper(countryId);
174:
175: Object paramObj6 = new IntegerWrapper(statusId);
176:
177: Object paramObj7 = comments;
178:
179: if (comments == null) {
180: paramObj7 = new NullWrapper("java.lang.String");
181: }
182:
183: MethodWrapper methodWrapper = new MethodWrapper(
184: OrganizationServiceUtil.class.getName(),
185: "addOrganization", new Object[] { paramObj0,
186: paramObj1, paramObj2, paramObj3, paramObj4,
187: paramObj5, paramObj6, paramObj7 });
188:
189: Object returnObj = null;
190:
191: try {
192: returnObj = TunnelUtil.invoke(httpPrincipal,
193: methodWrapper);
194: } catch (Exception e) {
195: if (e instanceof com.liferay.portal.SystemException) {
196: throw (com.liferay.portal.SystemException) e;
197: }
198:
199: if (e instanceof com.liferay.portal.PortalException) {
200: throw (com.liferay.portal.PortalException) e;
201: }
202:
203: throw new com.liferay.portal.SystemException(e);
204: }
205:
206: return (com.liferay.portal.model.Organization) returnObj;
207: } catch (com.liferay.portal.SystemException se) {
208: _log.error(se, se);
209:
210: throw se;
211: }
212: }
213:
214: public static void deleteOrganization(HttpPrincipal httpPrincipal,
215: long organizationId)
216: throws com.liferay.portal.SystemException,
217: com.liferay.portal.PortalException {
218: try {
219: Object paramObj0 = new LongWrapper(organizationId);
220:
221: MethodWrapper methodWrapper = new MethodWrapper(
222: OrganizationServiceUtil.class.getName(),
223: "deleteOrganization", new Object[] { paramObj0 });
224:
225: try {
226: TunnelUtil.invoke(httpPrincipal, methodWrapper);
227: } catch (Exception e) {
228: if (e instanceof com.liferay.portal.SystemException) {
229: throw (com.liferay.portal.SystemException) e;
230: }
231:
232: if (e instanceof com.liferay.portal.PortalException) {
233: throw (com.liferay.portal.PortalException) e;
234: }
235:
236: throw new com.liferay.portal.SystemException(e);
237: }
238: } catch (com.liferay.portal.SystemException se) {
239: _log.error(se, se);
240:
241: throw se;
242: }
243: }
244:
245: public static com.liferay.portal.model.Organization getOrganization(
246: HttpPrincipal httpPrincipal, long organizationId)
247: throws com.liferay.portal.SystemException,
248: com.liferay.portal.PortalException {
249: try {
250: Object paramObj0 = new LongWrapper(organizationId);
251:
252: MethodWrapper methodWrapper = new MethodWrapper(
253: OrganizationServiceUtil.class.getName(),
254: "getOrganization", new Object[] { paramObj0 });
255:
256: Object returnObj = null;
257:
258: try {
259: returnObj = TunnelUtil.invoke(httpPrincipal,
260: methodWrapper);
261: } catch (Exception e) {
262: if (e instanceof com.liferay.portal.SystemException) {
263: throw (com.liferay.portal.SystemException) e;
264: }
265:
266: if (e instanceof com.liferay.portal.PortalException) {
267: throw (com.liferay.portal.PortalException) e;
268: }
269:
270: throw new com.liferay.portal.SystemException(e);
271: }
272:
273: return (com.liferay.portal.model.Organization) returnObj;
274: } catch (com.liferay.portal.SystemException se) {
275: _log.error(se, se);
276:
277: throw se;
278: }
279: }
280:
281: public static long getOrganizationId(HttpPrincipal httpPrincipal,
282: long companyId, java.lang.String name)
283: throws com.liferay.portal.SystemException,
284: com.liferay.portal.PortalException {
285: try {
286: Object paramObj0 = new LongWrapper(companyId);
287:
288: Object paramObj1 = name;
289:
290: if (name == null) {
291: paramObj1 = new NullWrapper("java.lang.String");
292: }
293:
294: MethodWrapper methodWrapper = new MethodWrapper(
295: OrganizationServiceUtil.class.getName(),
296: "getOrganizationId", new Object[] { paramObj0,
297: paramObj1 });
298:
299: Object returnObj = null;
300:
301: try {
302: returnObj = TunnelUtil.invoke(httpPrincipal,
303: methodWrapper);
304: } catch (Exception e) {
305: if (e instanceof com.liferay.portal.SystemException) {
306: throw (com.liferay.portal.SystemException) e;
307: }
308:
309: if (e instanceof com.liferay.portal.PortalException) {
310: throw (com.liferay.portal.PortalException) e;
311: }
312:
313: throw new com.liferay.portal.SystemException(e);
314: }
315:
316: return ((Long) returnObj).longValue();
317: } catch (com.liferay.portal.SystemException se) {
318: _log.error(se, se);
319:
320: throw se;
321: }
322: }
323:
324: public static java.util.List getUserOrganizations(
325: HttpPrincipal httpPrincipal, long userId)
326: throws com.liferay.portal.SystemException,
327: com.liferay.portal.PortalException {
328: try {
329: Object paramObj0 = new LongWrapper(userId);
330:
331: MethodWrapper methodWrapper = new MethodWrapper(
332: OrganizationServiceUtil.class.getName(),
333: "getUserOrganizations", new Object[] { paramObj0 });
334:
335: Object returnObj = null;
336:
337: try {
338: returnObj = TunnelUtil.invoke(httpPrincipal,
339: methodWrapper);
340: } catch (Exception e) {
341: if (e instanceof com.liferay.portal.SystemException) {
342: throw (com.liferay.portal.SystemException) e;
343: }
344:
345: if (e instanceof com.liferay.portal.PortalException) {
346: throw (com.liferay.portal.PortalException) e;
347: }
348:
349: throw new com.liferay.portal.SystemException(e);
350: }
351:
352: return (java.util.List) returnObj;
353: } catch (com.liferay.portal.SystemException se) {
354: _log.error(se, se);
355:
356: throw se;
357: }
358: }
359:
360: public static void setGroupOrganizations(
361: HttpPrincipal httpPrincipal, long groupId,
362: long[] organizationIds)
363: throws com.liferay.portal.SystemException,
364: com.liferay.portal.PortalException {
365: try {
366: Object paramObj0 = new LongWrapper(groupId);
367:
368: Object paramObj1 = organizationIds;
369:
370: if (organizationIds == null) {
371: paramObj1 = new NullWrapper("[J");
372: }
373:
374: MethodWrapper methodWrapper = new MethodWrapper(
375: OrganizationServiceUtil.class.getName(),
376: "setGroupOrganizations", new Object[] { paramObj0,
377: paramObj1 });
378:
379: try {
380: TunnelUtil.invoke(httpPrincipal, methodWrapper);
381: } catch (Exception e) {
382: if (e instanceof com.liferay.portal.SystemException) {
383: throw (com.liferay.portal.SystemException) e;
384: }
385:
386: if (e instanceof com.liferay.portal.PortalException) {
387: throw (com.liferay.portal.PortalException) e;
388: }
389:
390: throw new com.liferay.portal.SystemException(e);
391: }
392: } catch (com.liferay.portal.SystemException se) {
393: _log.error(se, se);
394:
395: throw se;
396: }
397: }
398:
399: public static void unsetGroupOrganizations(
400: HttpPrincipal httpPrincipal, long groupId,
401: long[] organizationIds)
402: throws com.liferay.portal.SystemException,
403: com.liferay.portal.PortalException {
404: try {
405: Object paramObj0 = new LongWrapper(groupId);
406:
407: Object paramObj1 = organizationIds;
408:
409: if (organizationIds == null) {
410: paramObj1 = new NullWrapper("[J");
411: }
412:
413: MethodWrapper methodWrapper = new MethodWrapper(
414: OrganizationServiceUtil.class.getName(),
415: "unsetGroupOrganizations", new Object[] {
416: paramObj0, paramObj1 });
417:
418: try {
419: TunnelUtil.invoke(httpPrincipal, methodWrapper);
420: } catch (Exception e) {
421: if (e instanceof com.liferay.portal.SystemException) {
422: throw (com.liferay.portal.SystemException) e;
423: }
424:
425: if (e instanceof com.liferay.portal.PortalException) {
426: throw (com.liferay.portal.PortalException) e;
427: }
428:
429: throw new com.liferay.portal.SystemException(e);
430: }
431: } catch (com.liferay.portal.SystemException se) {
432: _log.error(se, se);
433:
434: throw se;
435: }
436: }
437:
438: public static void unsetPasswordPolicyOrganizations(
439: HttpPrincipal httpPrincipal, long passwordPolicyId,
440: long[] organizationIds)
441: throws com.liferay.portal.SystemException,
442: com.liferay.portal.PortalException {
443: try {
444: Object paramObj0 = new LongWrapper(passwordPolicyId);
445:
446: Object paramObj1 = organizationIds;
447:
448: if (organizationIds == null) {
449: paramObj1 = new NullWrapper("[J");
450: }
451:
452: MethodWrapper methodWrapper = new MethodWrapper(
453: OrganizationServiceUtil.class.getName(),
454: "unsetPasswordPolicyOrganizations", new Object[] {
455: paramObj0, paramObj1 });
456:
457: try {
458: TunnelUtil.invoke(httpPrincipal, methodWrapper);
459: } catch (Exception e) {
460: if (e instanceof com.liferay.portal.SystemException) {
461: throw (com.liferay.portal.SystemException) e;
462: }
463:
464: if (e instanceof com.liferay.portal.PortalException) {
465: throw (com.liferay.portal.PortalException) e;
466: }
467:
468: throw new com.liferay.portal.SystemException(e);
469: }
470: } catch (com.liferay.portal.SystemException se) {
471: _log.error(se, se);
472:
473: throw se;
474: }
475: }
476:
477: public static com.liferay.portal.model.Organization updateOrganization(
478: HttpPrincipal httpPrincipal, long organizationId,
479: long parentOrganizationId, java.lang.String name, int type,
480: boolean recursable, long regionId, long countryId,
481: int statusId, java.lang.String comments)
482: throws com.liferay.portal.SystemException,
483: com.liferay.portal.PortalException {
484: try {
485: Object paramObj0 = new LongWrapper(organizationId);
486:
487: Object paramObj1 = new LongWrapper(parentOrganizationId);
488:
489: Object paramObj2 = name;
490:
491: if (name == null) {
492: paramObj2 = new NullWrapper("java.lang.String");
493: }
494:
495: Object paramObj3 = new IntegerWrapper(type);
496:
497: Object paramObj4 = new BooleanWrapper(recursable);
498:
499: Object paramObj5 = new LongWrapper(regionId);
500:
501: Object paramObj6 = new LongWrapper(countryId);
502:
503: Object paramObj7 = new IntegerWrapper(statusId);
504:
505: Object paramObj8 = comments;
506:
507: if (comments == null) {
508: paramObj8 = new NullWrapper("java.lang.String");
509: }
510:
511: MethodWrapper methodWrapper = new MethodWrapper(
512: OrganizationServiceUtil.class.getName(),
513: "updateOrganization",
514: new Object[] { paramObj0, paramObj1, paramObj2,
515: paramObj3, paramObj4, paramObj5, paramObj6,
516: paramObj7, paramObj8 });
517:
518: Object returnObj = null;
519:
520: try {
521: returnObj = TunnelUtil.invoke(httpPrincipal,
522: methodWrapper);
523: } catch (Exception e) {
524: if (e instanceof com.liferay.portal.SystemException) {
525: throw (com.liferay.portal.SystemException) e;
526: }
527:
528: if (e instanceof com.liferay.portal.PortalException) {
529: throw (com.liferay.portal.PortalException) e;
530: }
531:
532: throw new com.liferay.portal.SystemException(e);
533: }
534:
535: return (com.liferay.portal.model.Organization) returnObj;
536: } catch (com.liferay.portal.SystemException se) {
537: _log.error(se, se);
538:
539: throw se;
540: }
541: }
542:
543: private static Log _log = LogFactoryUtil
544: .getLog(OrganizationServiceHttp.class);
545: }
|