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