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.BooleanWrapper;
28 import com.liferay.portal.kernel.util.IntegerWrapper;
29 import com.liferay.portal.kernel.util.LongWrapper;
30 import com.liferay.portal.kernel.util.MethodWrapper;
31 import com.liferay.portal.kernel.util.NullWrapper;
32 import com.liferay.portal.security.auth.HttpPrincipal;
33 import com.liferay.portal.service.OrganizationServiceUtil;
34
35
72 public class OrganizationServiceHttp {
73 public static void addGroupOrganizations(HttpPrincipal httpPrincipal,
74 long groupId, long[] organizationIds)
75 throws com.liferay.portal.PortalException,
76 com.liferay.portal.SystemException {
77 try {
78 Object paramObj0 = new LongWrapper(groupId);
79
80 Object paramObj1 = organizationIds;
81
82 if (organizationIds == null) {
83 paramObj1 = new NullWrapper("[J");
84 }
85
86 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
87 "addGroupOrganizations",
88 new Object[] { paramObj0, paramObj1 });
89
90 try {
91 TunnelUtil.invoke(httpPrincipal, methodWrapper);
92 }
93 catch (Exception e) {
94 if (e instanceof com.liferay.portal.PortalException) {
95 throw (com.liferay.portal.PortalException)e;
96 }
97
98 if (e instanceof com.liferay.portal.SystemException) {
99 throw (com.liferay.portal.SystemException)e;
100 }
101
102 throw new com.liferay.portal.SystemException(e);
103 }
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.PortalException,
116 com.liferay.portal.SystemException {
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(OrganizationServiceUtil.class.getName(),
127 "addPasswordPolicyOrganizations",
128 new Object[] { paramObj0, paramObj1 });
129
130 try {
131 TunnelUtil.invoke(httpPrincipal, methodWrapper);
132 }
133 catch (Exception e) {
134 if (e instanceof com.liferay.portal.PortalException) {
135 throw (com.liferay.portal.PortalException)e;
136 }
137
138 if (e instanceof com.liferay.portal.SystemException) {
139 throw (com.liferay.portal.SystemException)e;
140 }
141
142 throw new com.liferay.portal.SystemException(e);
143 }
144 }
145 catch (com.liferay.portal.SystemException se) {
146 _log.error(se, se);
147
148 throw se;
149 }
150 }
151
152 public static com.liferay.portal.model.Organization addOrganization(
153 HttpPrincipal httpPrincipal, long parentOrganizationId,
154 java.lang.String name, int type, boolean recursable, long regionId,
155 long countryId, int statusId, java.lang.String comments)
156 throws com.liferay.portal.PortalException,
157 com.liferay.portal.SystemException {
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(OrganizationServiceUtil.class.getName(),
184 "addOrganization",
185 new Object[] {
186 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
187 paramObj5, paramObj6, paramObj7
188 });
189
190 Object returnObj = null;
191
192 try {
193 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
194 }
195 catch (Exception e) {
196 if (e instanceof com.liferay.portal.PortalException) {
197 throw (com.liferay.portal.PortalException)e;
198 }
199
200 if (e instanceof com.liferay.portal.SystemException) {
201 throw (com.liferay.portal.SystemException)e;
202 }
203
204 throw new com.liferay.portal.SystemException(e);
205 }
206
207 return (com.liferay.portal.model.Organization)returnObj;
208 }
209 catch (com.liferay.portal.SystemException se) {
210 _log.error(se, se);
211
212 throw se;
213 }
214 }
215
216 public static void deleteOrganization(HttpPrincipal httpPrincipal,
217 long organizationId)
218 throws com.liferay.portal.PortalException,
219 com.liferay.portal.SystemException {
220 try {
221 Object paramObj0 = new LongWrapper(organizationId);
222
223 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
224 "deleteOrganization", new Object[] { paramObj0 });
225
226 try {
227 TunnelUtil.invoke(httpPrincipal, methodWrapper);
228 }
229 catch (Exception e) {
230 if (e instanceof com.liferay.portal.PortalException) {
231 throw (com.liferay.portal.PortalException)e;
232 }
233
234 if (e instanceof com.liferay.portal.SystemException) {
235 throw (com.liferay.portal.SystemException)e;
236 }
237
238 throw new com.liferay.portal.SystemException(e);
239 }
240 }
241 catch (com.liferay.portal.SystemException se) {
242 _log.error(se, se);
243
244 throw se;
245 }
246 }
247
248 public static com.liferay.portal.model.Organization getOrganization(
249 HttpPrincipal httpPrincipal, long organizationId)
250 throws com.liferay.portal.PortalException,
251 com.liferay.portal.SystemException {
252 try {
253 Object paramObj0 = new LongWrapper(organizationId);
254
255 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
256 "getOrganization", new Object[] { paramObj0 });
257
258 Object returnObj = null;
259
260 try {
261 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
262 }
263 catch (Exception e) {
264 if (e instanceof com.liferay.portal.PortalException) {
265 throw (com.liferay.portal.PortalException)e;
266 }
267
268 if (e instanceof com.liferay.portal.SystemException) {
269 throw (com.liferay.portal.SystemException)e;
270 }
271
272 throw new com.liferay.portal.SystemException(e);
273 }
274
275 return (com.liferay.portal.model.Organization)returnObj;
276 }
277 catch (com.liferay.portal.SystemException se) {
278 _log.error(se, se);
279
280 throw se;
281 }
282 }
283
284 public static long getOrganizationId(HttpPrincipal httpPrincipal,
285 long companyId, java.lang.String name)
286 throws com.liferay.portal.SystemException {
287 try {
288 Object paramObj0 = new LongWrapper(companyId);
289
290 Object paramObj1 = name;
291
292 if (name == null) {
293 paramObj1 = new NullWrapper("java.lang.String");
294 }
295
296 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
297 "getOrganizationId", new Object[] { paramObj0, paramObj1 });
298
299 Object returnObj = null;
300
301 try {
302 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
303 }
304 catch (Exception e) {
305 if (e instanceof com.liferay.portal.SystemException) {
306 throw (com.liferay.portal.SystemException)e;
307 }
308
309 throw new com.liferay.portal.SystemException(e);
310 }
311
312 return ((Long)returnObj).longValue();
313 }
314 catch (com.liferay.portal.SystemException se) {
315 _log.error(se, se);
316
317 throw se;
318 }
319 }
320
321 public static java.util.List<com.liferay.portal.model.Organization> getUserOrganizations(
322 HttpPrincipal httpPrincipal, long userId)
323 throws com.liferay.portal.PortalException,
324 com.liferay.portal.SystemException {
325 try {
326 Object paramObj0 = new LongWrapper(userId);
327
328 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
329 "getUserOrganizations", new Object[] { paramObj0 });
330
331 Object returnObj = null;
332
333 try {
334 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
335 }
336 catch (Exception e) {
337 if (e instanceof com.liferay.portal.PortalException) {
338 throw (com.liferay.portal.PortalException)e;
339 }
340
341 if (e instanceof com.liferay.portal.SystemException) {
342 throw (com.liferay.portal.SystemException)e;
343 }
344
345 throw new com.liferay.portal.SystemException(e);
346 }
347
348 return (java.util.List<com.liferay.portal.model.Organization>)returnObj;
349 }
350 catch (com.liferay.portal.SystemException se) {
351 _log.error(se, se);
352
353 throw se;
354 }
355 }
356
357 public static java.util.List<com.liferay.portal.model.Organization> getUserOrganizations(
358 HttpPrincipal httpPrincipal, long userId, boolean inheritUserGroups)
359 throws com.liferay.portal.PortalException,
360 com.liferay.portal.SystemException {
361 try {
362 Object paramObj0 = new LongWrapper(userId);
363
364 Object paramObj1 = new BooleanWrapper(inheritUserGroups);
365
366 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
367 "getUserOrganizations",
368 new Object[] { paramObj0, paramObj1 });
369
370 Object returnObj = null;
371
372 try {
373 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
374 }
375 catch (Exception e) {
376 if (e instanceof com.liferay.portal.PortalException) {
377 throw (com.liferay.portal.PortalException)e;
378 }
379
380 if (e instanceof com.liferay.portal.SystemException) {
381 throw (com.liferay.portal.SystemException)e;
382 }
383
384 throw new com.liferay.portal.SystemException(e);
385 }
386
387 return (java.util.List<com.liferay.portal.model.Organization>)returnObj;
388 }
389 catch (com.liferay.portal.SystemException se) {
390 _log.error(se, se);
391
392 throw se;
393 }
394 }
395
396 public static void setGroupOrganizations(HttpPrincipal httpPrincipal,
397 long groupId, long[] organizationIds)
398 throws com.liferay.portal.PortalException,
399 com.liferay.portal.SystemException {
400 try {
401 Object paramObj0 = new LongWrapper(groupId);
402
403 Object paramObj1 = organizationIds;
404
405 if (organizationIds == null) {
406 paramObj1 = new NullWrapper("[J");
407 }
408
409 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
410 "setGroupOrganizations",
411 new Object[] { paramObj0, paramObj1 });
412
413 try {
414 TunnelUtil.invoke(httpPrincipal, methodWrapper);
415 }
416 catch (Exception e) {
417 if (e instanceof com.liferay.portal.PortalException) {
418 throw (com.liferay.portal.PortalException)e;
419 }
420
421 if (e instanceof com.liferay.portal.SystemException) {
422 throw (com.liferay.portal.SystemException)e;
423 }
424
425 throw new com.liferay.portal.SystemException(e);
426 }
427 }
428 catch (com.liferay.portal.SystemException se) {
429 _log.error(se, se);
430
431 throw se;
432 }
433 }
434
435 public static void unsetGroupOrganizations(HttpPrincipal httpPrincipal,
436 long groupId, long[] organizationIds)
437 throws com.liferay.portal.PortalException,
438 com.liferay.portal.SystemException {
439 try {
440 Object paramObj0 = new LongWrapper(groupId);
441
442 Object paramObj1 = organizationIds;
443
444 if (organizationIds == null) {
445 paramObj1 = new NullWrapper("[J");
446 }
447
448 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
449 "unsetGroupOrganizations",
450 new Object[] { paramObj0, paramObj1 });
451
452 try {
453 TunnelUtil.invoke(httpPrincipal, methodWrapper);
454 }
455 catch (Exception e) {
456 if (e instanceof com.liferay.portal.PortalException) {
457 throw (com.liferay.portal.PortalException)e;
458 }
459
460 if (e instanceof com.liferay.portal.SystemException) {
461 throw (com.liferay.portal.SystemException)e;
462 }
463
464 throw new com.liferay.portal.SystemException(e);
465 }
466 }
467 catch (com.liferay.portal.SystemException se) {
468 _log.error(se, se);
469
470 throw se;
471 }
472 }
473
474 public static void unsetPasswordPolicyOrganizations(
475 HttpPrincipal httpPrincipal, long passwordPolicyId,
476 long[] organizationIds)
477 throws com.liferay.portal.PortalException,
478 com.liferay.portal.SystemException {
479 try {
480 Object paramObj0 = new LongWrapper(passwordPolicyId);
481
482 Object paramObj1 = organizationIds;
483
484 if (organizationIds == null) {
485 paramObj1 = new NullWrapper("[J");
486 }
487
488 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
489 "unsetPasswordPolicyOrganizations",
490 new Object[] { paramObj0, paramObj1 });
491
492 try {
493 TunnelUtil.invoke(httpPrincipal, methodWrapper);
494 }
495 catch (Exception e) {
496 if (e instanceof com.liferay.portal.PortalException) {
497 throw (com.liferay.portal.PortalException)e;
498 }
499
500 if (e instanceof com.liferay.portal.SystemException) {
501 throw (com.liferay.portal.SystemException)e;
502 }
503
504 throw new com.liferay.portal.SystemException(e);
505 }
506 }
507 catch (com.liferay.portal.SystemException se) {
508 _log.error(se, se);
509
510 throw se;
511 }
512 }
513
514 public static com.liferay.portal.model.Organization updateOrganization(
515 HttpPrincipal httpPrincipal, long organizationId,
516 long parentOrganizationId, java.lang.String name, int type,
517 boolean recursable, long regionId, long countryId, int statusId,
518 java.lang.String comments)
519 throws com.liferay.portal.PortalException,
520 com.liferay.portal.SystemException {
521 try {
522 Object paramObj0 = new LongWrapper(organizationId);
523
524 Object paramObj1 = new LongWrapper(parentOrganizationId);
525
526 Object paramObj2 = name;
527
528 if (name == null) {
529 paramObj2 = new NullWrapper("java.lang.String");
530 }
531
532 Object paramObj3 = new IntegerWrapper(type);
533
534 Object paramObj4 = new BooleanWrapper(recursable);
535
536 Object paramObj5 = new LongWrapper(regionId);
537
538 Object paramObj6 = new LongWrapper(countryId);
539
540 Object paramObj7 = new IntegerWrapper(statusId);
541
542 Object paramObj8 = comments;
543
544 if (comments == null) {
545 paramObj8 = new NullWrapper("java.lang.String");
546 }
547
548 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
549 "updateOrganization",
550 new Object[] {
551 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
552 paramObj5, paramObj6, paramObj7, paramObj8
553 });
554
555 Object returnObj = null;
556
557 try {
558 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
559 }
560 catch (Exception e) {
561 if (e instanceof com.liferay.portal.PortalException) {
562 throw (com.liferay.portal.PortalException)e;
563 }
564
565 if (e instanceof com.liferay.portal.SystemException) {
566 throw (com.liferay.portal.SystemException)e;
567 }
568
569 throw new com.liferay.portal.SystemException(e);
570 }
571
572 return (com.liferay.portal.model.Organization)returnObj;
573 }
574 catch (com.liferay.portal.SystemException se) {
575 _log.error(se, se);
576
577 throw se;
578 }
579 }
580
581 private static Log _log = LogFactoryUtil.getLog(OrganizationServiceHttp.class);
582 }