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.SystemException,
78 com.liferay.portal.PortalException {
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.SystemException) {
97 throw (com.liferay.portal.SystemException)e;
98 }
99
100 if (e instanceof com.liferay.portal.PortalException) {
101 throw (com.liferay.portal.PortalException)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.SystemException,
118 com.liferay.portal.PortalException {
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.SystemException) {
137 throw (com.liferay.portal.SystemException)e;
138 }
139
140 if (e instanceof com.liferay.portal.PortalException) {
141 throw (com.liferay.portal.PortalException)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.SystemException,
159 com.liferay.portal.PortalException {
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.SystemException) {
199 throw (com.liferay.portal.SystemException)e;
200 }
201
202 if (e instanceof com.liferay.portal.PortalException) {
203 throw (com.liferay.portal.PortalException)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.SystemException,
221 com.liferay.portal.PortalException {
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.SystemException) {
233 throw (com.liferay.portal.SystemException)e;
234 }
235
236 if (e instanceof com.liferay.portal.PortalException) {
237 throw (com.liferay.portal.PortalException)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.SystemException,
253 com.liferay.portal.PortalException {
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.SystemException) {
267 throw (com.liferay.portal.SystemException)e;
268 }
269
270 if (e instanceof com.liferay.portal.PortalException) {
271 throw (com.liferay.portal.PortalException)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 com.liferay.portal.PortalException {
290 try {
291 Object paramObj0 = new LongWrapper(companyId);
292
293 Object paramObj1 = name;
294
295 if (name == null) {
296 paramObj1 = new NullWrapper("java.lang.String");
297 }
298
299 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
300 "getOrganizationId", new Object[] { paramObj0, paramObj1 });
301
302 Object returnObj = null;
303
304 try {
305 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
306 }
307 catch (Exception e) {
308 if (e instanceof com.liferay.portal.SystemException) {
309 throw (com.liferay.portal.SystemException)e;
310 }
311
312 if (e instanceof com.liferay.portal.PortalException) {
313 throw (com.liferay.portal.PortalException)e;
314 }
315
316 throw new com.liferay.portal.SystemException(e);
317 }
318
319 return ((Long)returnObj).longValue();
320 }
321 catch (com.liferay.portal.SystemException se) {
322 _log.error(se, se);
323
324 throw se;
325 }
326 }
327
328 public static java.util.List<com.liferay.portal.model.Organization> getUserOrganizations(
329 HttpPrincipal httpPrincipal, long userId)
330 throws com.liferay.portal.SystemException,
331 com.liferay.portal.PortalException {
332 try {
333 Object paramObj0 = new LongWrapper(userId);
334
335 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
336 "getUserOrganizations", new Object[] { paramObj0 });
337
338 Object returnObj = null;
339
340 try {
341 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
342 }
343 catch (Exception e) {
344 if (e instanceof com.liferay.portal.SystemException) {
345 throw (com.liferay.portal.SystemException)e;
346 }
347
348 if (e instanceof com.liferay.portal.PortalException) {
349 throw (com.liferay.portal.PortalException)e;
350 }
351
352 throw new com.liferay.portal.SystemException(e);
353 }
354
355 return (java.util.List<com.liferay.portal.model.Organization>)returnObj;
356 }
357 catch (com.liferay.portal.SystemException se) {
358 _log.error(se, se);
359
360 throw se;
361 }
362 }
363
364 public static void setGroupOrganizations(HttpPrincipal httpPrincipal,
365 long groupId, long[] organizationIds)
366 throws com.liferay.portal.SystemException,
367 com.liferay.portal.PortalException {
368 try {
369 Object paramObj0 = new LongWrapper(groupId);
370
371 Object paramObj1 = organizationIds;
372
373 if (organizationIds == null) {
374 paramObj1 = new NullWrapper("[J");
375 }
376
377 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
378 "setGroupOrganizations",
379 new Object[] { paramObj0, paramObj1 });
380
381 try {
382 TunnelUtil.invoke(httpPrincipal, methodWrapper);
383 }
384 catch (Exception e) {
385 if (e instanceof com.liferay.portal.SystemException) {
386 throw (com.liferay.portal.SystemException)e;
387 }
388
389 if (e instanceof com.liferay.portal.PortalException) {
390 throw (com.liferay.portal.PortalException)e;
391 }
392
393 throw new com.liferay.portal.SystemException(e);
394 }
395 }
396 catch (com.liferay.portal.SystemException se) {
397 _log.error(se, se);
398
399 throw se;
400 }
401 }
402
403 public static void unsetGroupOrganizations(HttpPrincipal httpPrincipal,
404 long groupId, long[] organizationIds)
405 throws com.liferay.portal.SystemException,
406 com.liferay.portal.PortalException {
407 try {
408 Object paramObj0 = new LongWrapper(groupId);
409
410 Object paramObj1 = organizationIds;
411
412 if (organizationIds == null) {
413 paramObj1 = new NullWrapper("[J");
414 }
415
416 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
417 "unsetGroupOrganizations",
418 new Object[] { paramObj0, paramObj1 });
419
420 try {
421 TunnelUtil.invoke(httpPrincipal, methodWrapper);
422 }
423 catch (Exception e) {
424 if (e instanceof com.liferay.portal.SystemException) {
425 throw (com.liferay.portal.SystemException)e;
426 }
427
428 if (e instanceof com.liferay.portal.PortalException) {
429 throw (com.liferay.portal.PortalException)e;
430 }
431
432 throw new com.liferay.portal.SystemException(e);
433 }
434 }
435 catch (com.liferay.portal.SystemException se) {
436 _log.error(se, se);
437
438 throw se;
439 }
440 }
441
442 public static void unsetPasswordPolicyOrganizations(
443 HttpPrincipal httpPrincipal, long passwordPolicyId,
444 long[] organizationIds)
445 throws com.liferay.portal.SystemException,
446 com.liferay.portal.PortalException {
447 try {
448 Object paramObj0 = new LongWrapper(passwordPolicyId);
449
450 Object paramObj1 = organizationIds;
451
452 if (organizationIds == null) {
453 paramObj1 = new NullWrapper("[J");
454 }
455
456 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
457 "unsetPasswordPolicyOrganizations",
458 new Object[] { paramObj0, paramObj1 });
459
460 try {
461 TunnelUtil.invoke(httpPrincipal, methodWrapper);
462 }
463 catch (Exception e) {
464 if (e instanceof com.liferay.portal.SystemException) {
465 throw (com.liferay.portal.SystemException)e;
466 }
467
468 if (e instanceof com.liferay.portal.PortalException) {
469 throw (com.liferay.portal.PortalException)e;
470 }
471
472 throw new com.liferay.portal.SystemException(e);
473 }
474 }
475 catch (com.liferay.portal.SystemException se) {
476 _log.error(se, se);
477
478 throw se;
479 }
480 }
481
482 public static com.liferay.portal.model.Organization updateOrganization(
483 HttpPrincipal httpPrincipal, long organizationId,
484 long parentOrganizationId, java.lang.String name, int type,
485 boolean recursable, long regionId, long countryId, int statusId,
486 java.lang.String comments)
487 throws com.liferay.portal.SystemException,
488 com.liferay.portal.PortalException {
489 try {
490 Object paramObj0 = new LongWrapper(organizationId);
491
492 Object paramObj1 = new LongWrapper(parentOrganizationId);
493
494 Object paramObj2 = name;
495
496 if (name == null) {
497 paramObj2 = new NullWrapper("java.lang.String");
498 }
499
500 Object paramObj3 = new IntegerWrapper(type);
501
502 Object paramObj4 = new BooleanWrapper(recursable);
503
504 Object paramObj5 = new LongWrapper(regionId);
505
506 Object paramObj6 = new LongWrapper(countryId);
507
508 Object paramObj7 = new IntegerWrapper(statusId);
509
510 Object paramObj8 = comments;
511
512 if (comments == null) {
513 paramObj8 = new NullWrapper("java.lang.String");
514 }
515
516 MethodWrapper methodWrapper = new MethodWrapper(OrganizationServiceUtil.class.getName(),
517 "updateOrganization",
518 new Object[] {
519 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
520 paramObj5, paramObj6, paramObj7, paramObj8
521 });
522
523 Object returnObj = null;
524
525 try {
526 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
527 }
528 catch (Exception e) {
529 if (e instanceof com.liferay.portal.SystemException) {
530 throw (com.liferay.portal.SystemException)e;
531 }
532
533 if (e instanceof com.liferay.portal.PortalException) {
534 throw (com.liferay.portal.PortalException)e;
535 }
536
537 throw new com.liferay.portal.SystemException(e);
538 }
539
540 return (com.liferay.portal.model.Organization)returnObj;
541 }
542 catch (com.liferay.portal.SystemException se) {
543 _log.error(se, se);
544
545 throw se;
546 }
547 }
548
549 private static Log _log = LogFactoryUtil.getLog(OrganizationServiceHttp.class);
550 }