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.LongWrapper;
020 import com.liferay.portal.kernel.util.MethodWrapper;
021 import com.liferay.portal.kernel.util.NullWrapper;
022 import com.liferay.portal.security.auth.HttpPrincipal;
023 import com.liferay.portal.service.http.TunnelUtil;
024
025 import com.liferay.portlet.imagegallery.service.IGImageServiceUtil;
026
027
057 public class IGImageServiceHttp {
058 public static com.liferay.portlet.imagegallery.model.IGImage addImage(
059 HttpPrincipal httpPrincipal, long groupId, long folderId,
060 java.lang.String name, java.lang.String description, java.io.File file,
061 java.lang.String contentType,
062 com.liferay.portal.service.ServiceContext serviceContext)
063 throws com.liferay.portal.kernel.exception.PortalException,
064 com.liferay.portal.kernel.exception.SystemException {
065 try {
066 Object paramObj0 = new LongWrapper(groupId);
067
068 Object paramObj1 = new LongWrapper(folderId);
069
070 Object paramObj2 = name;
071
072 if (name == null) {
073 paramObj2 = new NullWrapper("java.lang.String");
074 }
075
076 Object paramObj3 = description;
077
078 if (description == null) {
079 paramObj3 = new NullWrapper("java.lang.String");
080 }
081
082 Object paramObj4 = file;
083
084 if (file == null) {
085 paramObj4 = new NullWrapper("java.io.File");
086 }
087
088 Object paramObj5 = contentType;
089
090 if (contentType == null) {
091 paramObj5 = new NullWrapper("java.lang.String");
092 }
093
094 Object paramObj6 = serviceContext;
095
096 if (serviceContext == null) {
097 paramObj6 = new NullWrapper(
098 "com.liferay.portal.service.ServiceContext");
099 }
100
101 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
102 "addImage",
103 new Object[] {
104 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
105 paramObj5, paramObj6
106 });
107
108 Object returnObj = null;
109
110 try {
111 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
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 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
126 }
127 catch (com.liferay.portal.kernel.exception.SystemException se) {
128 _log.error(se, se);
129
130 throw se;
131 }
132 }
133
134 public static void deleteImage(HttpPrincipal httpPrincipal, long imageId)
135 throws com.liferay.portal.kernel.exception.PortalException,
136 com.liferay.portal.kernel.exception.SystemException {
137 try {
138 Object paramObj0 = new LongWrapper(imageId);
139
140 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
141 "deleteImage", new Object[] { paramObj0 });
142
143 try {
144 TunnelUtil.invoke(httpPrincipal, methodWrapper);
145 }
146 catch (Exception e) {
147 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
148 throw (com.liferay.portal.kernel.exception.PortalException)e;
149 }
150
151 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
152 throw (com.liferay.portal.kernel.exception.SystemException)e;
153 }
154
155 throw new com.liferay.portal.kernel.exception.SystemException(e);
156 }
157 }
158 catch (com.liferay.portal.kernel.exception.SystemException se) {
159 _log.error(se, se);
160
161 throw se;
162 }
163 }
164
165 public static void deleteImageByFolderIdAndNameWithExtension(
166 HttpPrincipal httpPrincipal, long groupId, long folderId,
167 java.lang.String nameWithExtension)
168 throws com.liferay.portal.kernel.exception.PortalException,
169 com.liferay.portal.kernel.exception.SystemException {
170 try {
171 Object paramObj0 = new LongWrapper(groupId);
172
173 Object paramObj1 = new LongWrapper(folderId);
174
175 Object paramObj2 = nameWithExtension;
176
177 if (nameWithExtension == null) {
178 paramObj2 = new NullWrapper("java.lang.String");
179 }
180
181 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
182 "deleteImageByFolderIdAndNameWithExtension",
183 new Object[] { paramObj0, paramObj1, paramObj2 });
184
185 try {
186 TunnelUtil.invoke(httpPrincipal, methodWrapper);
187 }
188 catch (Exception e) {
189 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
190 throw (com.liferay.portal.kernel.exception.PortalException)e;
191 }
192
193 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
194 throw (com.liferay.portal.kernel.exception.SystemException)e;
195 }
196
197 throw new com.liferay.portal.kernel.exception.SystemException(e);
198 }
199 }
200 catch (com.liferay.portal.kernel.exception.SystemException se) {
201 _log.error(se, se);
202
203 throw se;
204 }
205 }
206
207 public static com.liferay.portlet.imagegallery.model.IGImage getImage(
208 HttpPrincipal httpPrincipal, long imageId)
209 throws com.liferay.portal.kernel.exception.PortalException,
210 com.liferay.portal.kernel.exception.SystemException {
211 try {
212 Object paramObj0 = new LongWrapper(imageId);
213
214 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
215 "getImage", new Object[] { paramObj0 });
216
217 Object returnObj = null;
218
219 try {
220 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
221 }
222 catch (Exception e) {
223 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
224 throw (com.liferay.portal.kernel.exception.PortalException)e;
225 }
226
227 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
228 throw (com.liferay.portal.kernel.exception.SystemException)e;
229 }
230
231 throw new com.liferay.portal.kernel.exception.SystemException(e);
232 }
233
234 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
235 }
236 catch (com.liferay.portal.kernel.exception.SystemException se) {
237 _log.error(se, se);
238
239 throw se;
240 }
241 }
242
243 public static com.liferay.portlet.imagegallery.model.IGImage getImageByFolderIdAndNameWithExtension(
244 HttpPrincipal httpPrincipal, long groupId, long folderId,
245 java.lang.String nameWithExtension)
246 throws com.liferay.portal.kernel.exception.PortalException,
247 com.liferay.portal.kernel.exception.SystemException {
248 try {
249 Object paramObj0 = new LongWrapper(groupId);
250
251 Object paramObj1 = new LongWrapper(folderId);
252
253 Object paramObj2 = nameWithExtension;
254
255 if (nameWithExtension == null) {
256 paramObj2 = new NullWrapper("java.lang.String");
257 }
258
259 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
260 "getImageByFolderIdAndNameWithExtension",
261 new Object[] { paramObj0, paramObj1, paramObj2 });
262
263 Object returnObj = null;
264
265 try {
266 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
267 }
268 catch (Exception e) {
269 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
270 throw (com.liferay.portal.kernel.exception.PortalException)e;
271 }
272
273 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
274 throw (com.liferay.portal.kernel.exception.SystemException)e;
275 }
276
277 throw new com.liferay.portal.kernel.exception.SystemException(e);
278 }
279
280 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
281 }
282 catch (com.liferay.portal.kernel.exception.SystemException se) {
283 _log.error(se, se);
284
285 throw se;
286 }
287 }
288
289 public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
290 HttpPrincipal httpPrincipal, long largeImageId)
291 throws com.liferay.portal.kernel.exception.PortalException,
292 com.liferay.portal.kernel.exception.SystemException {
293 try {
294 Object paramObj0 = new LongWrapper(largeImageId);
295
296 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
297 "getImageByLargeImageId", new Object[] { paramObj0 });
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.kernel.exception.PortalException) {
306 throw (com.liferay.portal.kernel.exception.PortalException)e;
307 }
308
309 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
310 throw (com.liferay.portal.kernel.exception.SystemException)e;
311 }
312
313 throw new com.liferay.portal.kernel.exception.SystemException(e);
314 }
315
316 return (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
317 }
318 catch (com.liferay.portal.kernel.exception.SystemException se) {
319 _log.error(se, se);
320
321 throw se;
322 }
323 }
324
325 public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
326 HttpPrincipal httpPrincipal, long smallImageId)
327 throws com.liferay.portal.kernel.exception.PortalException,
328 com.liferay.portal.kernel.exception.SystemException {
329 try {
330 Object paramObj0 = new LongWrapper(smallImageId);
331
332 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
333 "getImageBySmallImageId", new Object[] { paramObj0 });
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 java.util.List<com.liferay.portlet.imagegallery.model.IGImage> getImages(
362 HttpPrincipal httpPrincipal, long groupId, long folderId)
363 throws com.liferay.portal.kernel.exception.PortalException,
364 com.liferay.portal.kernel.exception.SystemException {
365 try {
366 Object paramObj0 = new LongWrapper(groupId);
367
368 Object paramObj1 = new LongWrapper(folderId);
369
370 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
371 "getImages", new Object[] { paramObj0, paramObj1 });
372
373 Object returnObj = null;
374
375 try {
376 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
377 }
378 catch (Exception e) {
379 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
380 throw (com.liferay.portal.kernel.exception.PortalException)e;
381 }
382
383 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
384 throw (com.liferay.portal.kernel.exception.SystemException)e;
385 }
386
387 throw new com.liferay.portal.kernel.exception.SystemException(e);
388 }
389
390 return (java.util.List<com.liferay.portlet.imagegallery.model.IGImage>)returnObj;
391 }
392 catch (com.liferay.portal.kernel.exception.SystemException se) {
393 _log.error(se, se);
394
395 throw se;
396 }
397 }
398
399 public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
400 HttpPrincipal httpPrincipal, long imageId, long groupId, long folderId,
401 java.lang.String name, java.lang.String description, java.io.File file,
402 java.lang.String contentType,
403 com.liferay.portal.service.ServiceContext serviceContext)
404 throws com.liferay.portal.kernel.exception.PortalException,
405 com.liferay.portal.kernel.exception.SystemException {
406 try {
407 Object paramObj0 = new LongWrapper(imageId);
408
409 Object paramObj1 = new LongWrapper(groupId);
410
411 Object paramObj2 = new LongWrapper(folderId);
412
413 Object paramObj3 = name;
414
415 if (name == null) {
416 paramObj3 = new NullWrapper("java.lang.String");
417 }
418
419 Object paramObj4 = description;
420
421 if (description == null) {
422 paramObj4 = new NullWrapper("java.lang.String");
423 }
424
425 Object paramObj5 = file;
426
427 if (file == null) {
428 paramObj5 = new NullWrapper("java.io.File");
429 }
430
431 Object paramObj6 = contentType;
432
433 if (contentType == null) {
434 paramObj6 = new NullWrapper("java.lang.String");
435 }
436
437 Object paramObj7 = serviceContext;
438
439 if (serviceContext == null) {
440 paramObj7 = new NullWrapper(
441 "com.liferay.portal.service.ServiceContext");
442 }
443
444 MethodWrapper methodWrapper = new MethodWrapper(IGImageServiceUtil.class.getName(),
445 "updateImage",
446 new Object[] {
447 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
448 paramObj5, paramObj6, paramObj7
449 });
450
451 Object returnObj = null;
452
453 try {
454 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
455 }
456 catch (Exception e) {
457 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
458 throw (com.liferay.portal.kernel.exception.PortalException)e;
459 }
460
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 (com.liferay.portlet.imagegallery.model.IGImage)returnObj;
469 }
470 catch (com.liferay.portal.kernel.exception.SystemException se) {
471 _log.error(se, se);
472
473 throw se;
474 }
475 }
476
477 private static Log _log = LogFactoryUtil.getLog(IGImageServiceHttp.class);
478 }