001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.shopping.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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.http.TunnelUtil;
026    
027    import com.liferay.portlet.shopping.service.ShoppingItemServiceUtil;
028    
029    /**
030     * <p>
031     * This class provides a HTTP utility for the
032     * {@link com.liferay.portlet.shopping.service.ShoppingItemServiceUtil} service utility. The
033     * static methods of this class calls the same methods of the service utility.
034     * However, the signatures are different because it requires an additional
035     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
036     * </p>
037     *
038     * <p>
039     * The benefits of using the HTTP utility is that it is fast and allows for
040     * tunneling without the cost of serializing to text. The drawback is that it
041     * only works with Java.
042     * </p>
043     *
044     * <p>
045     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
046     * configure security.
047     * </p>
048     *
049     * <p>
050     * The HTTP utility is only generated for remote services.
051     * </p>
052     *
053     * @author    Brian Wing Shun Chan
054     * @see       ShoppingItemServiceSoap
055     * @see       com.liferay.portal.security.auth.HttpPrincipal
056     * @see       com.liferay.portlet.shopping.service.ShoppingItemServiceUtil
057     * @generated
058     */
059    public class ShoppingItemServiceHttp {
060            public static void addBookItems(HttpPrincipal httpPrincipal, long groupId,
061                    long categoryId, java.lang.String[] isbns)
062                    throws com.liferay.portal.kernel.exception.PortalException,
063                            com.liferay.portal.kernel.exception.SystemException {
064                    try {
065                            Object paramObj0 = new LongWrapper(groupId);
066    
067                            Object paramObj1 = new LongWrapper(categoryId);
068    
069                            Object paramObj2 = isbns;
070    
071                            if (isbns == null) {
072                                    paramObj2 = new NullWrapper("[Ljava.lang.String;");
073                            }
074    
075                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
076                                            "addBookItems",
077                                            new Object[] { paramObj0, paramObj1, paramObj2 });
078    
079                            try {
080                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
081                            }
082                            catch (Exception e) {
083                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
084                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
085                                    }
086    
087                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
088                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
089                                    }
090    
091                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
092                            }
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 com.liferay.portlet.shopping.model.ShoppingItem addItem(
102                    HttpPrincipal httpPrincipal, long groupId, long categoryId,
103                    java.lang.String sku, java.lang.String name,
104                    java.lang.String description, java.lang.String properties,
105                    java.lang.String fieldsQuantities, boolean requiresShipping,
106                    int stockQuantity, boolean featured, java.lang.Boolean sale,
107                    boolean smallImage, java.lang.String smallImageURL,
108                    java.io.File smallFile, boolean mediumImage,
109                    java.lang.String mediumImageURL, java.io.File mediumFile,
110                    boolean largeImage, java.lang.String largeImageURL,
111                    java.io.File largeFile,
112                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
113                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
114                    com.liferay.portal.service.ServiceContext serviceContext)
115                    throws com.liferay.portal.kernel.exception.PortalException,
116                            com.liferay.portal.kernel.exception.SystemException {
117                    try {
118                            Object paramObj0 = new LongWrapper(groupId);
119    
120                            Object paramObj1 = new LongWrapper(categoryId);
121    
122                            Object paramObj2 = sku;
123    
124                            if (sku == null) {
125                                    paramObj2 = new NullWrapper("java.lang.String");
126                            }
127    
128                            Object paramObj3 = name;
129    
130                            if (name == null) {
131                                    paramObj3 = new NullWrapper("java.lang.String");
132                            }
133    
134                            Object paramObj4 = description;
135    
136                            if (description == null) {
137                                    paramObj4 = new NullWrapper("java.lang.String");
138                            }
139    
140                            Object paramObj5 = properties;
141    
142                            if (properties == null) {
143                                    paramObj5 = new NullWrapper("java.lang.String");
144                            }
145    
146                            Object paramObj6 = fieldsQuantities;
147    
148                            if (fieldsQuantities == null) {
149                                    paramObj6 = new NullWrapper("java.lang.String");
150                            }
151    
152                            Object paramObj7 = new BooleanWrapper(requiresShipping);
153    
154                            Object paramObj8 = new IntegerWrapper(stockQuantity);
155    
156                            Object paramObj9 = new BooleanWrapper(featured);
157    
158                            Object paramObj10 = sale;
159    
160                            if (sale == null) {
161                                    paramObj10 = new NullWrapper("java.lang.Boolean");
162                            }
163    
164                            Object paramObj11 = new BooleanWrapper(smallImage);
165    
166                            Object paramObj12 = smallImageURL;
167    
168                            if (smallImageURL == null) {
169                                    paramObj12 = new NullWrapper("java.lang.String");
170                            }
171    
172                            Object paramObj13 = smallFile;
173    
174                            if (smallFile == null) {
175                                    paramObj13 = new NullWrapper("java.io.File");
176                            }
177    
178                            Object paramObj14 = new BooleanWrapper(mediumImage);
179    
180                            Object paramObj15 = mediumImageURL;
181    
182                            if (mediumImageURL == null) {
183                                    paramObj15 = new NullWrapper("java.lang.String");
184                            }
185    
186                            Object paramObj16 = mediumFile;
187    
188                            if (mediumFile == null) {
189                                    paramObj16 = new NullWrapper("java.io.File");
190                            }
191    
192                            Object paramObj17 = new BooleanWrapper(largeImage);
193    
194                            Object paramObj18 = largeImageURL;
195    
196                            if (largeImageURL == null) {
197                                    paramObj18 = new NullWrapper("java.lang.String");
198                            }
199    
200                            Object paramObj19 = largeFile;
201    
202                            if (largeFile == null) {
203                                    paramObj19 = new NullWrapper("java.io.File");
204                            }
205    
206                            Object paramObj20 = itemFields;
207    
208                            if (itemFields == null) {
209                                    paramObj20 = new NullWrapper("java.util.List");
210                            }
211    
212                            Object paramObj21 = itemPrices;
213    
214                            if (itemPrices == null) {
215                                    paramObj21 = new NullWrapper("java.util.List");
216                            }
217    
218                            Object paramObj22 = serviceContext;
219    
220                            if (serviceContext == null) {
221                                    paramObj22 = new NullWrapper(
222                                                    "com.liferay.portal.service.ServiceContext");
223                            }
224    
225                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
226                                            "addItem",
227                                            new Object[] {
228                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
229                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
230                                                    paramObj10, paramObj11, paramObj12, paramObj13,
231                                                    paramObj14, paramObj15, paramObj16, paramObj17,
232                                                    paramObj18, paramObj19, paramObj20, paramObj21,
233                                                    paramObj22
234                                            });
235    
236                            Object returnObj = null;
237    
238                            try {
239                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
240                            }
241                            catch (Exception e) {
242                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
243                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
244                                    }
245    
246                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
247                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
248                                    }
249    
250                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
251                            }
252    
253                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
254                    }
255                    catch (com.liferay.portal.kernel.exception.SystemException se) {
256                            _log.error(se, se);
257    
258                            throw se;
259                    }
260            }
261    
262            public static void deleteItem(HttpPrincipal httpPrincipal, long itemId)
263                    throws com.liferay.portal.kernel.exception.PortalException,
264                            com.liferay.portal.kernel.exception.SystemException {
265                    try {
266                            Object paramObj0 = new LongWrapper(itemId);
267    
268                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
269                                            "deleteItem", new Object[] { paramObj0 });
270    
271                            try {
272                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
273                            }
274                            catch (Exception e) {
275                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
276                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
277                                    }
278    
279                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
280                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
281                                    }
282    
283                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
284                            }
285                    }
286                    catch (com.liferay.portal.kernel.exception.SystemException se) {
287                            _log.error(se, se);
288    
289                            throw se;
290                    }
291            }
292    
293            public static com.liferay.portlet.shopping.model.ShoppingItem getItem(
294                    HttpPrincipal httpPrincipal, long itemId)
295                    throws com.liferay.portal.kernel.exception.PortalException,
296                            com.liferay.portal.kernel.exception.SystemException {
297                    try {
298                            Object paramObj0 = new LongWrapper(itemId);
299    
300                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
301                                            "getItem", new Object[] { paramObj0 });
302    
303                            Object returnObj = null;
304    
305                            try {
306                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
307                            }
308                            catch (Exception e) {
309                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
310                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
311                                    }
312    
313                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
314                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
315                                    }
316    
317                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
318                            }
319    
320                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
321                    }
322                    catch (com.liferay.portal.kernel.exception.SystemException se) {
323                            _log.error(se, se);
324    
325                            throw se;
326                    }
327            }
328    
329            public static com.liferay.portlet.shopping.model.ShoppingItem updateItem(
330                    HttpPrincipal httpPrincipal, long itemId, long groupId,
331                    long categoryId, java.lang.String sku, java.lang.String name,
332                    java.lang.String description, java.lang.String properties,
333                    java.lang.String fieldsQuantities, boolean requiresShipping,
334                    int stockQuantity, boolean featured, java.lang.Boolean sale,
335                    boolean smallImage, java.lang.String smallImageURL,
336                    java.io.File smallFile, boolean mediumImage,
337                    java.lang.String mediumImageURL, java.io.File mediumFile,
338                    boolean largeImage, java.lang.String largeImageURL,
339                    java.io.File largeFile,
340                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemField> itemFields,
341                    java.util.List<com.liferay.portlet.shopping.model.ShoppingItemPrice> itemPrices,
342                    com.liferay.portal.service.ServiceContext serviceContext)
343                    throws com.liferay.portal.kernel.exception.PortalException,
344                            com.liferay.portal.kernel.exception.SystemException {
345                    try {
346                            Object paramObj0 = new LongWrapper(itemId);
347    
348                            Object paramObj1 = new LongWrapper(groupId);
349    
350                            Object paramObj2 = new LongWrapper(categoryId);
351    
352                            Object paramObj3 = sku;
353    
354                            if (sku == null) {
355                                    paramObj3 = new NullWrapper("java.lang.String");
356                            }
357    
358                            Object paramObj4 = name;
359    
360                            if (name == null) {
361                                    paramObj4 = new NullWrapper("java.lang.String");
362                            }
363    
364                            Object paramObj5 = description;
365    
366                            if (description == null) {
367                                    paramObj5 = new NullWrapper("java.lang.String");
368                            }
369    
370                            Object paramObj6 = properties;
371    
372                            if (properties == null) {
373                                    paramObj6 = new NullWrapper("java.lang.String");
374                            }
375    
376                            Object paramObj7 = fieldsQuantities;
377    
378                            if (fieldsQuantities == null) {
379                                    paramObj7 = new NullWrapper("java.lang.String");
380                            }
381    
382                            Object paramObj8 = new BooleanWrapper(requiresShipping);
383    
384                            Object paramObj9 = new IntegerWrapper(stockQuantity);
385    
386                            Object paramObj10 = new BooleanWrapper(featured);
387    
388                            Object paramObj11 = sale;
389    
390                            if (sale == null) {
391                                    paramObj11 = new NullWrapper("java.lang.Boolean");
392                            }
393    
394                            Object paramObj12 = new BooleanWrapper(smallImage);
395    
396                            Object paramObj13 = smallImageURL;
397    
398                            if (smallImageURL == null) {
399                                    paramObj13 = new NullWrapper("java.lang.String");
400                            }
401    
402                            Object paramObj14 = smallFile;
403    
404                            if (smallFile == null) {
405                                    paramObj14 = new NullWrapper("java.io.File");
406                            }
407    
408                            Object paramObj15 = new BooleanWrapper(mediumImage);
409    
410                            Object paramObj16 = mediumImageURL;
411    
412                            if (mediumImageURL == null) {
413                                    paramObj16 = new NullWrapper("java.lang.String");
414                            }
415    
416                            Object paramObj17 = mediumFile;
417    
418                            if (mediumFile == null) {
419                                    paramObj17 = new NullWrapper("java.io.File");
420                            }
421    
422                            Object paramObj18 = new BooleanWrapper(largeImage);
423    
424                            Object paramObj19 = largeImageURL;
425    
426                            if (largeImageURL == null) {
427                                    paramObj19 = new NullWrapper("java.lang.String");
428                            }
429    
430                            Object paramObj20 = largeFile;
431    
432                            if (largeFile == null) {
433                                    paramObj20 = new NullWrapper("java.io.File");
434                            }
435    
436                            Object paramObj21 = itemFields;
437    
438                            if (itemFields == null) {
439                                    paramObj21 = new NullWrapper("java.util.List");
440                            }
441    
442                            Object paramObj22 = itemPrices;
443    
444                            if (itemPrices == null) {
445                                    paramObj22 = new NullWrapper("java.util.List");
446                            }
447    
448                            Object paramObj23 = serviceContext;
449    
450                            if (serviceContext == null) {
451                                    paramObj23 = new NullWrapper(
452                                                    "com.liferay.portal.service.ServiceContext");
453                            }
454    
455                            MethodWrapper methodWrapper = new MethodWrapper(ShoppingItemServiceUtil.class.getName(),
456                                            "updateItem",
457                                            new Object[] {
458                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
459                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
460                                                    paramObj10, paramObj11, paramObj12, paramObj13,
461                                                    paramObj14, paramObj15, paramObj16, paramObj17,
462                                                    paramObj18, paramObj19, paramObj20, paramObj21,
463                                                    paramObj22, paramObj23
464                                            });
465    
466                            Object returnObj = null;
467    
468                            try {
469                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
470                            }
471                            catch (Exception e) {
472                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
473                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
474                                    }
475    
476                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
477                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
478                                    }
479    
480                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
481                            }
482    
483                            return (com.liferay.portlet.shopping.model.ShoppingItem)returnObj;
484                    }
485                    catch (com.liferay.portal.kernel.exception.SystemException se) {
486                            _log.error(se, se);
487    
488                            throw se;
489                    }
490            }
491    
492            private static Log _log = LogFactoryUtil.getLog(ShoppingItemServiceHttp.class);
493    }