1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.softwarecatalog.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.http.TunnelUtil;
24  
25  import com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil;
26  
27  /**
28   * <a href="SCProductEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       SCProductEntryServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portlet.softwarecatalog.service.SCProductEntryServiceUtil
62   * @generated
63   */
64  public class SCProductEntryServiceHttp {
65      public static com.liferay.portlet.softwarecatalog.model.SCProductEntry addProductEntry(
66          HttpPrincipal httpPrincipal, java.lang.String name,
67          java.lang.String type, java.lang.String tags,
68          java.lang.String shortDescription, java.lang.String longDescription,
69          java.lang.String pageURL, java.lang.String author,
70          java.lang.String repoGroupId, java.lang.String repoArtifactId,
71          long[] licenseIds, java.util.List<byte[]> thumbnails,
72          java.util.List<byte[]> fullImages,
73          com.liferay.portal.service.ServiceContext serviceContext)
74          throws com.liferay.portal.kernel.exception.PortalException,
75              com.liferay.portal.kernel.exception.SystemException {
76          try {
77              Object paramObj0 = name;
78  
79              if (name == null) {
80                  paramObj0 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj1 = type;
84  
85              if (type == null) {
86                  paramObj1 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj2 = tags;
90  
91              if (tags == null) {
92                  paramObj2 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj3 = shortDescription;
96  
97              if (shortDescription == null) {
98                  paramObj3 = new NullWrapper("java.lang.String");
99              }
100 
101             Object paramObj4 = longDescription;
102 
103             if (longDescription == null) {
104                 paramObj4 = new NullWrapper("java.lang.String");
105             }
106 
107             Object paramObj5 = pageURL;
108 
109             if (pageURL == null) {
110                 paramObj5 = new NullWrapper("java.lang.String");
111             }
112 
113             Object paramObj6 = author;
114 
115             if (author == null) {
116                 paramObj6 = new NullWrapper("java.lang.String");
117             }
118 
119             Object paramObj7 = repoGroupId;
120 
121             if (repoGroupId == null) {
122                 paramObj7 = new NullWrapper("java.lang.String");
123             }
124 
125             Object paramObj8 = repoArtifactId;
126 
127             if (repoArtifactId == null) {
128                 paramObj8 = new NullWrapper("java.lang.String");
129             }
130 
131             Object paramObj9 = licenseIds;
132 
133             if (licenseIds == null) {
134                 paramObj9 = new NullWrapper("[J");
135             }
136 
137             Object paramObj10 = thumbnails;
138 
139             if (thumbnails == null) {
140                 paramObj10 = new NullWrapper("java.util.List");
141             }
142 
143             Object paramObj11 = fullImages;
144 
145             if (fullImages == null) {
146                 paramObj11 = new NullWrapper("java.util.List");
147             }
148 
149             Object paramObj12 = serviceContext;
150 
151             if (serviceContext == null) {
152                 paramObj12 = new NullWrapper(
153                         "com.liferay.portal.service.ServiceContext");
154             }
155 
156             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
157                     "addProductEntry",
158                     new Object[] {
159                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
160                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
161                         paramObj10, paramObj11, paramObj12
162                     });
163 
164             Object returnObj = null;
165 
166             try {
167                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
168             }
169             catch (Exception e) {
170                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                     throw (com.liferay.portal.kernel.exception.PortalException)e;
172                 }
173 
174                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
175                     throw (com.liferay.portal.kernel.exception.SystemException)e;
176                 }
177 
178                 throw new com.liferay.portal.kernel.exception.SystemException(e);
179             }
180 
181             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
182         }
183         catch (com.liferay.portal.kernel.exception.SystemException se) {
184             _log.error(se, se);
185 
186             throw se;
187         }
188     }
189 
190     public static void deleteProductEntry(HttpPrincipal httpPrincipal,
191         long productEntryId)
192         throws com.liferay.portal.kernel.exception.PortalException,
193             com.liferay.portal.kernel.exception.SystemException {
194         try {
195             Object paramObj0 = new LongWrapper(productEntryId);
196 
197             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
198                     "deleteProductEntry", new Object[] { paramObj0 });
199 
200             try {
201                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
202             }
203             catch (Exception e) {
204                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
205                     throw (com.liferay.portal.kernel.exception.PortalException)e;
206                 }
207 
208                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
209                     throw (com.liferay.portal.kernel.exception.SystemException)e;
210                 }
211 
212                 throw new com.liferay.portal.kernel.exception.SystemException(e);
213             }
214         }
215         catch (com.liferay.portal.kernel.exception.SystemException se) {
216             _log.error(se, se);
217 
218             throw se;
219         }
220     }
221 
222     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry getProductEntry(
223         HttpPrincipal httpPrincipal, long productEntryId)
224         throws com.liferay.portal.kernel.exception.PortalException,
225             com.liferay.portal.kernel.exception.SystemException {
226         try {
227             Object paramObj0 = new LongWrapper(productEntryId);
228 
229             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
230                     "getProductEntry", new Object[] { paramObj0 });
231 
232             Object returnObj = null;
233 
234             try {
235                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
236             }
237             catch (Exception e) {
238                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
239                     throw (com.liferay.portal.kernel.exception.PortalException)e;
240                 }
241 
242                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
243                     throw (com.liferay.portal.kernel.exception.SystemException)e;
244                 }
245 
246                 throw new com.liferay.portal.kernel.exception.SystemException(e);
247             }
248 
249             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
250         }
251         catch (com.liferay.portal.kernel.exception.SystemException se) {
252             _log.error(se, se);
253 
254             throw se;
255         }
256     }
257 
258     public static com.liferay.portlet.softwarecatalog.model.SCProductEntry updateProductEntry(
259         HttpPrincipal httpPrincipal, long productEntryId,
260         java.lang.String name, java.lang.String type, java.lang.String tags,
261         java.lang.String shortDescription, java.lang.String longDescription,
262         java.lang.String pageURL, java.lang.String author,
263         java.lang.String repoGroupId, java.lang.String repoArtifactId,
264         long[] licenseIds, java.util.List<byte[]> thumbnails,
265         java.util.List<byte[]> fullImages)
266         throws com.liferay.portal.kernel.exception.PortalException,
267             com.liferay.portal.kernel.exception.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(productEntryId);
270 
271             Object paramObj1 = name;
272 
273             if (name == null) {
274                 paramObj1 = new NullWrapper("java.lang.String");
275             }
276 
277             Object paramObj2 = type;
278 
279             if (type == null) {
280                 paramObj2 = new NullWrapper("java.lang.String");
281             }
282 
283             Object paramObj3 = tags;
284 
285             if (tags == null) {
286                 paramObj3 = new NullWrapper("java.lang.String");
287             }
288 
289             Object paramObj4 = shortDescription;
290 
291             if (shortDescription == null) {
292                 paramObj4 = new NullWrapper("java.lang.String");
293             }
294 
295             Object paramObj5 = longDescription;
296 
297             if (longDescription == null) {
298                 paramObj5 = new NullWrapper("java.lang.String");
299             }
300 
301             Object paramObj6 = pageURL;
302 
303             if (pageURL == null) {
304                 paramObj6 = new NullWrapper("java.lang.String");
305             }
306 
307             Object paramObj7 = author;
308 
309             if (author == null) {
310                 paramObj7 = new NullWrapper("java.lang.String");
311             }
312 
313             Object paramObj8 = repoGroupId;
314 
315             if (repoGroupId == null) {
316                 paramObj8 = new NullWrapper("java.lang.String");
317             }
318 
319             Object paramObj9 = repoArtifactId;
320 
321             if (repoArtifactId == null) {
322                 paramObj9 = new NullWrapper("java.lang.String");
323             }
324 
325             Object paramObj10 = licenseIds;
326 
327             if (licenseIds == null) {
328                 paramObj10 = new NullWrapper("[J");
329             }
330 
331             Object paramObj11 = thumbnails;
332 
333             if (thumbnails == null) {
334                 paramObj11 = new NullWrapper("java.util.List");
335             }
336 
337             Object paramObj12 = fullImages;
338 
339             if (fullImages == null) {
340                 paramObj12 = new NullWrapper("java.util.List");
341             }
342 
343             MethodWrapper methodWrapper = new MethodWrapper(SCProductEntryServiceUtil.class.getName(),
344                     "updateProductEntry",
345                     new Object[] {
346                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
347                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
348                         paramObj10, paramObj11, paramObj12
349                     });
350 
351             Object returnObj = null;
352 
353             try {
354                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
355             }
356             catch (Exception e) {
357                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
358                     throw (com.liferay.portal.kernel.exception.PortalException)e;
359                 }
360 
361                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
362                     throw (com.liferay.portal.kernel.exception.SystemException)e;
363                 }
364 
365                 throw new com.liferay.portal.kernel.exception.SystemException(e);
366             }
367 
368             return (com.liferay.portlet.softwarecatalog.model.SCProductEntry)returnObj;
369         }
370         catch (com.liferay.portal.kernel.exception.SystemException se) {
371             _log.error(se, se);
372 
373             throw se;
374         }
375     }
376 
377     private static Log _log = LogFactoryUtil.getLog(SCProductEntryServiceHttp.class);
378 }