001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.imagegallery.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.BooleanWrapper;
026: import com.liferay.portal.kernel.util.LongWrapper;
027: import com.liferay.portal.kernel.util.MethodWrapper;
028: import com.liferay.portal.kernel.util.NullWrapper;
029: import com.liferay.portal.security.auth.HttpPrincipal;
030: import com.liferay.portal.service.http.TunnelUtil;
031:
032: import com.liferay.portlet.imagegallery.service.IGImageServiceUtil;
033:
034: /**
035: * <a href="IGImageServiceHttp.java.html"><b><i>View Source</i></b></a>
036: *
037: * <p>
038: * ServiceBuilder generated this class. Modifications in this class will be
039: * overwritten the next time is generated.
040: * </p>
041: *
042: * <p>
043: * This class provides a HTTP utility for the
044: * <code>com.liferay.portlet.imagegallery.service.IGImageServiceUtil</code> service
045: * utility. The static methods of this class calls the same methods of the
046: * service utility. However, the signatures are different because it requires an
047: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
048: * parameter.
049: * </p>
050: *
051: * <p>
052: * The benefits of using the HTTP utility is that it is fast and allows for
053: * tunneling without the cost of serializing to text. The drawback is that it
054: * only works with Java.
055: * </p>
056: *
057: * <p>
058: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
059: * portal.properties to configure security.
060: * </p>
061: *
062: * <p>
063: * The HTTP utility is only generated for remote services.
064: * </p>
065: *
066: * @author Brian Wing Shun Chan
067: *
068: * @see com.liferay.portal.security.auth.HttpPrincipal
069: * @see com.liferay.portlet.imagegallery.service.IGImageServiceUtil
070: * @see com.liferay.portlet.imagegallery.service.http.IGImageServiceSoap
071: *
072: */
073: public class IGImageServiceHttp {
074: public static com.liferay.portlet.imagegallery.model.IGImage addImage(
075: HttpPrincipal httpPrincipal, long folderId,
076: java.lang.String description, java.io.File file,
077: java.lang.String contentType,
078: java.lang.String[] tagsEntries,
079: boolean addCommunityPermissions, boolean addGuestPermissions)
080: throws com.liferay.portal.SystemException,
081: com.liferay.portal.PortalException {
082: try {
083: Object paramObj0 = new LongWrapper(folderId);
084:
085: Object paramObj1 = description;
086:
087: if (description == null) {
088: paramObj1 = new NullWrapper("java.lang.String");
089: }
090:
091: Object paramObj2 = file;
092:
093: if (file == null) {
094: paramObj2 = new NullWrapper("java.io.File");
095: }
096:
097: Object paramObj3 = contentType;
098:
099: if (contentType == null) {
100: paramObj3 = new NullWrapper("java.lang.String");
101: }
102:
103: Object paramObj4 = tagsEntries;
104:
105: if (tagsEntries == null) {
106: paramObj4 = new NullWrapper("[Ljava.lang.String;");
107: }
108:
109: Object paramObj5 = new BooleanWrapper(
110: addCommunityPermissions);
111:
112: Object paramObj6 = new BooleanWrapper(addGuestPermissions);
113:
114: MethodWrapper methodWrapper = new MethodWrapper(
115: IGImageServiceUtil.class.getName(),
116: "addImage",
117: new Object[] { paramObj0, paramObj1, paramObj2,
118: paramObj3, paramObj4, paramObj5, paramObj6 });
119:
120: Object returnObj = null;
121:
122: try {
123: returnObj = TunnelUtil.invoke(httpPrincipal,
124: methodWrapper);
125: } catch (Exception e) {
126: if (e instanceof com.liferay.portal.SystemException) {
127: throw (com.liferay.portal.SystemException) e;
128: }
129:
130: if (e instanceof com.liferay.portal.PortalException) {
131: throw (com.liferay.portal.PortalException) e;
132: }
133:
134: throw new com.liferay.portal.SystemException(e);
135: }
136:
137: return (com.liferay.portlet.imagegallery.model.IGImage) returnObj;
138: } catch (com.liferay.portal.SystemException se) {
139: _log.error(se, se);
140:
141: throw se;
142: }
143: }
144:
145: public static com.liferay.portlet.imagegallery.model.IGImage addImage(
146: HttpPrincipal httpPrincipal, long folderId,
147: java.lang.String description, java.io.File file,
148: java.lang.String contentType,
149: java.lang.String[] tagsEntries,
150: java.lang.String[] communityPermissions,
151: java.lang.String[] guestPermissions)
152: throws com.liferay.portal.SystemException,
153: com.liferay.portal.PortalException {
154: try {
155: Object paramObj0 = new LongWrapper(folderId);
156:
157: Object paramObj1 = description;
158:
159: if (description == null) {
160: paramObj1 = new NullWrapper("java.lang.String");
161: }
162:
163: Object paramObj2 = file;
164:
165: if (file == null) {
166: paramObj2 = new NullWrapper("java.io.File");
167: }
168:
169: Object paramObj3 = contentType;
170:
171: if (contentType == null) {
172: paramObj3 = new NullWrapper("java.lang.String");
173: }
174:
175: Object paramObj4 = tagsEntries;
176:
177: if (tagsEntries == null) {
178: paramObj4 = new NullWrapper("[Ljava.lang.String;");
179: }
180:
181: Object paramObj5 = communityPermissions;
182:
183: if (communityPermissions == null) {
184: paramObj5 = new NullWrapper("[Ljava.lang.String;");
185: }
186:
187: Object paramObj6 = guestPermissions;
188:
189: if (guestPermissions == null) {
190: paramObj6 = new NullWrapper("[Ljava.lang.String;");
191: }
192:
193: MethodWrapper methodWrapper = new MethodWrapper(
194: IGImageServiceUtil.class.getName(),
195: "addImage",
196: new Object[] { paramObj0, paramObj1, paramObj2,
197: paramObj3, paramObj4, paramObj5, paramObj6 });
198:
199: Object returnObj = null;
200:
201: try {
202: returnObj = TunnelUtil.invoke(httpPrincipal,
203: methodWrapper);
204: } catch (Exception e) {
205: if (e instanceof com.liferay.portal.SystemException) {
206: throw (com.liferay.portal.SystemException) e;
207: }
208:
209: if (e instanceof com.liferay.portal.PortalException) {
210: throw (com.liferay.portal.PortalException) e;
211: }
212:
213: throw new com.liferay.portal.SystemException(e);
214: }
215:
216: return (com.liferay.portlet.imagegallery.model.IGImage) returnObj;
217: } catch (com.liferay.portal.SystemException se) {
218: _log.error(se, se);
219:
220: throw se;
221: }
222: }
223:
224: public static void deleteImage(HttpPrincipal httpPrincipal,
225: long imageId) throws com.liferay.portal.SystemException,
226: com.liferay.portal.PortalException {
227: try {
228: Object paramObj0 = new LongWrapper(imageId);
229:
230: MethodWrapper methodWrapper = new MethodWrapper(
231: IGImageServiceUtil.class.getName(), "deleteImage",
232: new Object[] { paramObj0 });
233:
234: try {
235: TunnelUtil.invoke(httpPrincipal, methodWrapper);
236: } catch (Exception e) {
237: if (e instanceof com.liferay.portal.SystemException) {
238: throw (com.liferay.portal.SystemException) e;
239: }
240:
241: if (e instanceof com.liferay.portal.PortalException) {
242: throw (com.liferay.portal.PortalException) e;
243: }
244:
245: throw new com.liferay.portal.SystemException(e);
246: }
247: } catch (com.liferay.portal.SystemException se) {
248: _log.error(se, se);
249:
250: throw se;
251: }
252: }
253:
254: public static com.liferay.portlet.imagegallery.model.IGImage getImage(
255: HttpPrincipal httpPrincipal, long imageId)
256: throws com.liferay.portal.SystemException,
257: com.liferay.portal.PortalException {
258: try {
259: Object paramObj0 = new LongWrapper(imageId);
260:
261: MethodWrapper methodWrapper = new MethodWrapper(
262: IGImageServiceUtil.class.getName(), "getImage",
263: new Object[] { paramObj0 });
264:
265: Object returnObj = null;
266:
267: try {
268: returnObj = TunnelUtil.invoke(httpPrincipal,
269: methodWrapper);
270: } catch (Exception e) {
271: if (e instanceof com.liferay.portal.SystemException) {
272: throw (com.liferay.portal.SystemException) e;
273: }
274:
275: if (e instanceof com.liferay.portal.PortalException) {
276: throw (com.liferay.portal.PortalException) e;
277: }
278:
279: throw new com.liferay.portal.SystemException(e);
280: }
281:
282: return (com.liferay.portlet.imagegallery.model.IGImage) returnObj;
283: } catch (com.liferay.portal.SystemException se) {
284: _log.error(se, se);
285:
286: throw se;
287: }
288: }
289:
290: public static com.liferay.portlet.imagegallery.model.IGImage getImageByLargeImageId(
291: HttpPrincipal httpPrincipal, long largeImageId)
292: throws com.liferay.portal.SystemException,
293: com.liferay.portal.PortalException {
294: try {
295: Object paramObj0 = new LongWrapper(largeImageId);
296:
297: MethodWrapper methodWrapper = new MethodWrapper(
298: IGImageServiceUtil.class.getName(),
299: "getImageByLargeImageId",
300: new Object[] { paramObj0 });
301:
302: Object returnObj = null;
303:
304: try {
305: returnObj = TunnelUtil.invoke(httpPrincipal,
306: methodWrapper);
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 (com.liferay.portlet.imagegallery.model.IGImage) returnObj;
320: } catch (com.liferay.portal.SystemException se) {
321: _log.error(se, se);
322:
323: throw se;
324: }
325: }
326:
327: public static com.liferay.portlet.imagegallery.model.IGImage getImageBySmallImageId(
328: HttpPrincipal httpPrincipal, long smallImageId)
329: throws com.liferay.portal.SystemException,
330: com.liferay.portal.PortalException {
331: try {
332: Object paramObj0 = new LongWrapper(smallImageId);
333:
334: MethodWrapper methodWrapper = new MethodWrapper(
335: IGImageServiceUtil.class.getName(),
336: "getImageBySmallImageId",
337: new Object[] { paramObj0 });
338:
339: Object returnObj = null;
340:
341: try {
342: returnObj = TunnelUtil.invoke(httpPrincipal,
343: methodWrapper);
344: } catch (Exception e) {
345: if (e instanceof com.liferay.portal.SystemException) {
346: throw (com.liferay.portal.SystemException) e;
347: }
348:
349: if (e instanceof com.liferay.portal.PortalException) {
350: throw (com.liferay.portal.PortalException) e;
351: }
352:
353: throw new com.liferay.portal.SystemException(e);
354: }
355:
356: return (com.liferay.portlet.imagegallery.model.IGImage) returnObj;
357: } catch (com.liferay.portal.SystemException se) {
358: _log.error(se, se);
359:
360: throw se;
361: }
362: }
363:
364: public static com.liferay.portlet.imagegallery.model.IGImage updateImage(
365: HttpPrincipal httpPrincipal, long imageId, long folderId,
366: java.lang.String description, java.io.File file,
367: java.lang.String contentType, java.lang.String[] tagsEntries)
368: throws com.liferay.portal.SystemException,
369: com.liferay.portal.PortalException {
370: try {
371: Object paramObj0 = new LongWrapper(imageId);
372:
373: Object paramObj1 = new LongWrapper(folderId);
374:
375: Object paramObj2 = description;
376:
377: if (description == null) {
378: paramObj2 = new NullWrapper("java.lang.String");
379: }
380:
381: Object paramObj3 = file;
382:
383: if (file == null) {
384: paramObj3 = new NullWrapper("java.io.File");
385: }
386:
387: Object paramObj4 = contentType;
388:
389: if (contentType == null) {
390: paramObj4 = new NullWrapper("java.lang.String");
391: }
392:
393: Object paramObj5 = tagsEntries;
394:
395: if (tagsEntries == null) {
396: paramObj5 = new NullWrapper("[Ljava.lang.String;");
397: }
398:
399: MethodWrapper methodWrapper = new MethodWrapper(
400: IGImageServiceUtil.class.getName(), "updateImage",
401: new Object[] { paramObj0, paramObj1, paramObj2,
402: paramObj3, paramObj4, paramObj5 });
403:
404: Object returnObj = null;
405:
406: try {
407: returnObj = TunnelUtil.invoke(httpPrincipal,
408: methodWrapper);
409: } catch (Exception e) {
410: if (e instanceof com.liferay.portal.SystemException) {
411: throw (com.liferay.portal.SystemException) e;
412: }
413:
414: if (e instanceof com.liferay.portal.PortalException) {
415: throw (com.liferay.portal.PortalException) e;
416: }
417:
418: throw new com.liferay.portal.SystemException(e);
419: }
420:
421: return (com.liferay.portlet.imagegallery.model.IGImage) returnObj;
422: } catch (com.liferay.portal.SystemException se) {
423: _log.error(se, se);
424:
425: throw se;
426: }
427: }
428:
429: private static Log _log = LogFactoryUtil
430: .getLog(IGImageServiceHttp.class);
431: }
|