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