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