001
014
015 package com.liferay.portlet.imagegallery.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.IntegerWrapper;
020 import com.liferay.portal.kernel.util.LongWrapper;
021 import com.liferay.portal.kernel.util.MethodWrapper;
022 import com.liferay.portal.kernel.util.NullWrapper;
023 import com.liferay.portal.security.auth.HttpPrincipal;
024 import com.liferay.portal.service.http.TunnelUtil;
025
026 import com.liferay.portlet.imagegallery.service.IGImageServiceUtil;
027
028
058 public class IGImageServiceHttp {
059 public static com.liferay.portlet.imagegallery.model.IGImage addImage(
060 HttpPrincipal httpPrincipal, long groupId, long folderId,
061 java.lang.String name, java.lang.String description, java.io.File file,
062 java.lang.String contentType,
063 com.liferay.portal.service.ServiceContext serviceContext)
064 throws com.liferay.portal.kernel.exception.PortalException,
065 com.liferay.portal.kernel.exception.SystemException {
066 try {
067 Object paramObj0 = new LongWrapper(groupId);
068
069 Object paramObj1 = new LongWrapper(folderId);
070
071 Object paramObj2 = name;
072
073 if (name == null) {
074 paramObj2 = new NullWrapper("java.lang.String");
075 }
076
077 Object paramObj3 = description;
078
079 if (description == null) {
080 paramObj3 = new NullWrapper("java.lang.String");
081 }
082
083 Object paramObj4 = file;
084
085 if (file == null) {
086 paramObj4 = new NullWrapper("java.io.File");
087 }
088
089 Object paramObj5 = contentType;
090
091 if (contentType == null) {
092 paramObj5 = new NullWrapper("java.lang.String");
093 }
094
095 Object paramObj6 = serviceContext;
096
097 if (serviceContext == null) {
098 paramObj6 = new NullWrapper(
099 "com.liferay.portal.service.ServiceContext");
100 }
101
102 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
103 "addImage",
104 new Object[] {
105 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
106 paramObj5, paramObj6
107 });
108
109 Object returnObj = null;
110
111 try {
112 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
113 }
114 catch (Exception e) {
115 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
116 throw (com.liferay.portal.kernel.exception.PortalException)e;
117 }
118
119 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
120 throw (com.liferay.portal.kernel.exception.SystemException)e;
121 }
122
123 throw new com.liferay.portal.kernel.exception.SystemException(e);
124 }
125
126 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
127 }
128 catch (com.liferay.portal.kernel.exception.SystemException se) {
129 _log.error(se, se);
130
131 throw se;
132 }
133 }
134
135 public static void deleteImage(HttpPrincipal httpPrincipal, long imageId)
136 throws com.liferay.portal.kernel.exception.PortalException,
137 com.liferay.portal.kernel.exception.SystemException {
138 try {
139 Object paramObj0 = new LongWrapper(imageId);
140
141 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
142 "deleteImage", new Object[] { paramObj0 });
143
144 try {
145 TunnelUtil.invoke(httpPrincipal, methodWrapper);
146 }
147 catch (Exception e) {
148 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149 throw (com.liferay.portal.kernel.exception.PortalException)e;
150 }
151
152 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
153 throw (com.liferay.portal.kernel.exception.SystemException)e;
154 }
155
156 throw new com.liferay.portal.kernel.exception.SystemException(e);
157 }
158 }
159 catch (com.liferay.portal.kernel.exception.SystemException se) {
160 _log.error(se, se);
161
162 throw se;
163 }
164 }
165
166 public static void deleteImageByFolderIdAndNameWithExtension(
167 HttpPrincipal httpPrincipal, long groupId, long folderId,
168 java.lang.String nameWithExtension)
169 throws com.liferay.portal.kernel.exception.PortalException,
170 com.liferay.portal.kernel.exception.SystemException {
171 try {
172 Object paramObj0 = new LongWrapper(groupId);
173
174 Object paramObj1 = new LongWrapper(folderId);
175
176 Object paramObj2 = nameWithExtension;
177
178 if (nameWithExtension == null) {
179 paramObj2 = new NullWrapper("java.lang.String");
180 }
181
182 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
183 "deleteImageByFolderIdAndNameWithExtension",
184 new Object[] { paramObj0, paramObj1, paramObj2 });
185
186 try {
187 TunnelUtil.invoke(httpPrincipal, methodWrapper);
188 }
189 catch (Exception e) {
190 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
191 throw (com.liferay.portal.kernel.exception.PortalException)e;
192 }
193
194 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
195 throw (com.liferay.portal.kernel.exception.SystemException)e;
196 }
197
198 throw new com.liferay.portal.kernel.exception.SystemException(e);
199 }
200 }
201 catch (com.liferay.portal.kernel.exception.SystemException se) {
202 _log.error(se, se);
203
204 throw se;
205 }
206 }
207
208 public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getGroupImages(
209 HttpPrincipal httpPrincipal, long groupId, long userId, int start,
210 int end) throws com.liferay.portal.kernel.exception.SystemException {
211 try {
212 Object paramObj0 = new LongWrapper(groupId);
213
214 Object paramObj1 = new LongWrapper(userId);
215
216 Object paramObj2 = new IntegerWrapper(start);
217
218 Object paramObj3 = new IntegerWrapper(end);
219
220 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
221 "getGroupImages",
222 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
223
224 Object returnObj = null;
225
226 try {
227 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
228 }
229 catch (Exception e) {
230 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
231 throw (com.liferay.portal.kernel.exception.SystemException)e;
232 }
233
234 throw new com.liferay.portal.kernel.exception.SystemException(e);
235 }
236
237 return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
238 }
239 catch (com.liferay.portal.kernel.exception.SystemException se) {
240 _log.error(se, se);
241
242 throw se;
243 }
244 }
245
246 public static int getGroupImagesCount(HttpPrincipal httpPrincipal,
247 long groupId, long userId)
248 throws com.liferay.portal.kernel.exception.SystemException {
249 try {
250 Object paramObj0 = new LongWrapper(groupId);
251
252 Object paramObj1 = new LongWrapper(userId);
253
254 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
255 "getGroupImagesCount", new Object[] { paramObj0, paramObj1 });
256
257 Object returnObj = null;
258
259 try {
260 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
261 }
262 catch (Exception e) {
263 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
264 throw (com.liferay.portal.kernel.exception.SystemException)e;
265 }
266
267 throw new com.liferay.portal.kernel.exception.SystemException(e);
268 }
269
270 return ((Integer)returnObj).intValue();
271 }
272 catch (com.liferay.portal.kernel.exception.SystemException se) {
273 _log.error(se, se);
274
275 throw se;
276 }
277 }
278
279 public static com.liferay.portlet.imagegallery.model.IGImage getImage(
280 HttpPrincipal httpPrincipal, long imageId)
281 throws com.liferay.portal.kernel.exception.PortalException,
282 com.liferay.portal.kernel.exception.SystemException {
283 try {
284 Object paramObj0 = new LongWrapper(imageId);
285
286 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
287 "getImage", new Object[] { paramObj0 });
288
289 Object returnObj = null;
290
291 try {
292 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
293 }
294 catch (Exception e) {
295 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
296 throw (com.liferay.portal.kernel.exception.PortalException)e;
297 }
298
299 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
300 throw (com.liferay.portal.kernel.exception.SystemException)e;
301 }
302
303 throw new com.liferay.portal.kernel.exception.SystemException(e);
304 }
305
306 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
307 }
308 catch (com.liferay.portal.kernel.exception.SystemException se) {
309 _log.error(se, se);
310
311 throw se;
312 }
313 }
314
315 public static com.liferay.portlet.imagegallery.model.IGImage getImageByFolderIdAndNameWithExtension(
316 HttpPrincipal httpPrincipal, long groupId, long folderId,
317 java.lang.String nameWithExtension)
318 throws com.liferay.portal.kernel.exception.PortalException,
319 com.liferay.portal.kernel.exception.SystemException {
320 try {
321 Object paramObj0 = new LongWrapper(groupId);
322
323 Object paramObj1 = new LongWrapper(folderId);
324
325 Object paramObj2 = nameWithExtension;
326
327 if (nameWithExtension == null) {
328 paramObj2 = new NullWrapper("java.lang.String");
329 }
330
331 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
332 "getImageByFolderIdAndNameWithExtension",
333 new Object[] { paramObj0, paramObj1, paramObj2 });
334
335 Object returnObj = null;
336
337 try {
338 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
339 }
340 catch (Exception e) {
341 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
342 throw (com.liferay.portal.kernel.exception.PortalException)e;
343 }
344
345 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
346 throw (com.liferay.portal.kernel.exception.SystemException)e;
347 }
348
349 throw new com.liferay.portal.kernel.exception.SystemException(e);
350 }
351
352 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
353 }
354 catch (com.liferay.portal.kernel.exception.SystemException se) {
355 _log.error(se, se);
356
357 throw se;
358 }
359 }
360
361 public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
362 HttpPrincipal httpPrincipal, long largeImageId)
363 throws com.liferay.portal.kernel.exception.PortalException,
364 com.liferay.portal.kernel.exception.SystemException {
365 try {
366 Object paramObj0 = new LongWrapper(largeImageId);
367
368 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
369 "getImageByLargeImageId", new Object[] { paramObj0 });
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.kernel.exception.PortalException) {
378 throw (com.liferay.portal.kernel.exception.PortalException)e;
379 }
380
381 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
382 throw (com.liferay.portal.kernel.exception.SystemException)e;
383 }
384
385 throw new com.liferay.portal.kernel.exception.SystemException(e);
386 }
387
388 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
389 }
390 catch (com.liferay.portal.kernel.exception.SystemException se) {
391 _log.error(se, se);
392
393 throw se;
394 }
395 }
396
397 public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
398 HttpPrincipal httpPrincipal, long smallImageId)
399 throws com.liferay.portal.kernel.exception.PortalException,
400 com.liferay.portal.kernel.exception.SystemException {
401 try {
402 Object paramObj0 = new LongWrapper(smallImageId);
403
404 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
405 "getImageBySmallImageId", new Object[] { paramObj0 });
406
407 Object returnObj = null;
408
409 try {
410 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
411 }
412 catch (Exception e) {
413 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
414 throw (com.liferay.portal.kernel.exception.PortalException)e;
415 }
416
417 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
418 throw (com.liferay.portal.kernel.exception.SystemException)e;
419 }
420
421 throw new com.liferay.portal.kernel.exception.SystemException(e);
422 }
423
424 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
425 }
426 catch (com.liferay.portal.kernel.exception.SystemException se) {
427 _log.error(se, se);
428
429 throw se;
430 }
431 }
432
433 public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
434 HttpPrincipal httpPrincipal, long groupId, long folderId)
435 throws com.liferay.portal.kernel.exception.SystemException {
436 try {
437 Object paramObj0 = new LongWrapper(groupId);
438
439 Object paramObj1 = new LongWrapper(folderId);
440
441 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
442 "getImages", new Object[] { paramObj0, paramObj1 });
443
444 Object returnObj = null;
445
446 try {
447 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
448 }
449 catch (Exception e) {
450 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
451 throw (com.liferay.portal.kernel.exception.SystemException)e;
452 }
453
454 throw new com.liferay.portal.kernel.exception.SystemException(e);
455 }
456
457 return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
458 }
459 catch (com.liferay.portal.kernel.exception.SystemException se) {
460 _log.error(se, se);
461
462 throw se;
463 }
464 }
465
466 public static java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
467 HttpPrincipal httpPrincipal, long groupId, long folderId, int start,
468 int end) throws com.liferay.portal.kernel.exception.SystemException {
469 try {
470 Object paramObj0 = new LongWrapper(groupId);
471
472 Object paramObj1 = new LongWrapper(folderId);
473
474 Object paramObj2 = new IntegerWrapper(start);
475
476 Object paramObj3 = new IntegerWrapper(end);
477
478 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
479 "getImages",
480 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
481
482 Object returnObj = null;
483
484 try {
485 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
486 }
487 catch (Exception e) {
488 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
489 throw (com.liferay.portal.kernel.exception.SystemException)e;
490 }
491
492 throw new com.liferay.portal.kernel.exception.SystemException(e);
493 }
494
495 return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
496 }
497 catch (com.liferay.portal.kernel.exception.SystemException se) {
498 _log.error(se, se);
499
500 throw se;
501 }
502 }
503
504 public static int getImagesCount(HttpPrincipal httpPrincipal, long groupId,
505 long folderId)
506 throws com.liferay.portal.kernel.exception.SystemException {
507 try {
508 Object paramObj0 = new LongWrapper(groupId);
509
510 Object paramObj1 = new LongWrapper(folderId);
511
512 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
513 "getImagesCount", new Object[] { paramObj0, paramObj1 });
514
515 Object returnObj = null;
516
517 try {
518 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
519 }
520 catch (Exception e) {
521 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
522 throw (com.liferay.portal.kernel.exception.SystemException)e;
523 }
524
525 throw new com.liferay.portal.kernel.exception.SystemException(e);
526 }
527
528 return ((Integer)returnObj).intValue();
529 }
530 catch (com.liferay.portal.kernel.exception.SystemException se) {
531 _log.error(se, se);
532
533 throw se;
534 }
535 }
536
537 public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
538 HttpPrincipal httpPrincipal, long imageId, long groupId, long folderId,
539 java.lang.String name, java.lang.String description, java.io.File file,
540 java.lang.String contentType,
541 com.liferay.portal.service.ServiceContext serviceContext)
542 throws com.liferay.portal.kernel.exception.PortalException,
543 com.liferay.portal.kernel.exception.SystemException {
544 try {
545 Object paramObj0 = new LongWrapper(imageId);
546
547 Object paramObj1 = new LongWrapper(groupId);
548
549 Object paramObj2 = new LongWrapper(folderId);
550
551 Object paramObj3 = name;
552
553 if (name == null) {
554 paramObj3 = new NullWrapper("java.lang.String");
555 }
556
557 Object paramObj4 = description;
558
559 if (description == null) {
560 paramObj4 = new NullWrapper("java.lang.String");
561 }
562
563 Object paramObj5 = file;
564
565 if (file == null) {
566 paramObj5 = new NullWrapper("java.io.File");
567 }
568
569 Object paramObj6 = contentType;
570
571 if (contentType == null) {
572 paramObj6 = new NullWrapper("java.lang.String");
573 }
574
575 Object paramObj7 = serviceContext;
576
577 if (serviceContext == null) {
578 paramObj7 = new NullWrapper(
579 "com.liferay.portal.service.ServiceContext");
580 }
581
582 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
583 "updateImage",
584 new Object[] {
585 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
586 paramObj5, paramObj6, paramObj7
587 });
588
589 Object returnObj = null;
590
591 try {
592 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
593 }
594 catch (Exception e) {
595 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
596 throw (com.liferay.portal.kernel.exception.PortalException)e;
597 }
598
599 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
600 throw (com.liferay.portal.kernel.exception.SystemException)e;
601 }
602
603 throw new com.liferay.portal.kernel.exception.SystemException(e);
604 }
605
606 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
607 }
608 catch (com.liferay.portal.kernel.exception.SystemException se) {
609 _log.error(se, se);
610
611 throw se;
612 }
613 }
614
615 private static Log _log = LogFactoryUtil.getLog(IGImageServiceHttp.class);
616 }