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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.http.TunnelUtil;
26  
27  import com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil;
28  
29  /**
30   * <a href="SCProductVersionServiceHttp.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a HTTP utility for the
39   * {@link com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil} service utility. The
40   * static methods of this class calls the same methods of the service utility.
41   * However, the signatures are different because it requires an additional
42   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
43   * </p>
44   *
45   * <p>
46   * The benefits of using the HTTP utility is that it is fast and allows for
47   * tunneling without the cost of serializing to text. The drawback is that it
48   * only works with Java.
49   * </p>
50   *
51   * <p>
52   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
53   * configure security.
54   * </p>
55   *
56   * <p>
57   * The HTTP utility is only generated for remote services.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       SCProductVersionServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil
64   * @generated
65   */
66  public class SCProductVersionServiceHttp {
67      public static com.liferay.portlet.softwarecatalog.model.SCProductVersion addProductVersion(
68          HttpPrincipal httpPrincipal, long productEntryId,
69          java.lang.String version, java.lang.String changeLog,
70          java.lang.String downloadPageURL, java.lang.String directDownloadURL,
71          boolean testDirectDownloadURL, boolean repoStoreArtifact,
72          long[] frameworkVersionIds, boolean addCommunityPermissions,
73          boolean addGuestPermissions)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              Object paramObj0 = new LongWrapper(productEntryId);
78  
79              Object paramObj1 = version;
80  
81              if (version == null) {
82                  paramObj1 = new NullWrapper("java.lang.String");
83              }
84  
85              Object paramObj2 = changeLog;
86  
87              if (changeLog == null) {
88                  paramObj2 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj3 = downloadPageURL;
92  
93              if (downloadPageURL == null) {
94                  paramObj3 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj4 = directDownloadURL;
98  
99              if (directDownloadURL == null) {
100                 paramObj4 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
104 
105             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
106 
107             Object paramObj7 = frameworkVersionIds;
108 
109             if (frameworkVersionIds == null) {
110                 paramObj7 = new NullWrapper("[J");
111             }
112 
113             Object paramObj8 = new BooleanWrapper(addCommunityPermissions);
114 
115             Object paramObj9 = new BooleanWrapper(addGuestPermissions);
116 
117             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
118                     "addProductVersion",
119                     new Object[] {
120                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
121                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
122                     });
123 
124             Object returnObj = null;
125 
126             try {
127                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
128             }
129             catch (Exception e) {
130                 if (e instanceof com.liferay.portal.PortalException) {
131                     throw (com.liferay.portal.PortalException)e;
132                 }
133 
134                 if (e instanceof com.liferay.portal.SystemException) {
135                     throw (com.liferay.portal.SystemException)e;
136                 }
137 
138                 throw new com.liferay.portal.SystemException(e);
139             }
140 
141             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
142         }
143         catch (com.liferay.portal.SystemException se) {
144             _log.error(se, se);
145 
146             throw se;
147         }
148     }
149 
150     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion addProductVersion(
151         HttpPrincipal httpPrincipal, long productEntryId,
152         java.lang.String version, java.lang.String changeLog,
153         java.lang.String downloadPageURL, java.lang.String directDownloadURL,
154         boolean testDirectDownloadURL, boolean repoStoreArtifact,
155         long[] frameworkVersionIds, java.lang.String[] communityPermissions,
156         java.lang.String[] guestPermissions)
157         throws com.liferay.portal.PortalException,
158             com.liferay.portal.SystemException {
159         try {
160             Object paramObj0 = new LongWrapper(productEntryId);
161 
162             Object paramObj1 = version;
163 
164             if (version == null) {
165                 paramObj1 = new NullWrapper("java.lang.String");
166             }
167 
168             Object paramObj2 = changeLog;
169 
170             if (changeLog == null) {
171                 paramObj2 = new NullWrapper("java.lang.String");
172             }
173 
174             Object paramObj3 = downloadPageURL;
175 
176             if (downloadPageURL == null) {
177                 paramObj3 = new NullWrapper("java.lang.String");
178             }
179 
180             Object paramObj4 = directDownloadURL;
181 
182             if (directDownloadURL == null) {
183                 paramObj4 = new NullWrapper("java.lang.String");
184             }
185 
186             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
187 
188             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
189 
190             Object paramObj7 = frameworkVersionIds;
191 
192             if (frameworkVersionIds == null) {
193                 paramObj7 = new NullWrapper("[J");
194             }
195 
196             Object paramObj8 = communityPermissions;
197 
198             if (communityPermissions == null) {
199                 paramObj8 = new NullWrapper("[Ljava.lang.String;");
200             }
201 
202             Object paramObj9 = guestPermissions;
203 
204             if (guestPermissions == null) {
205                 paramObj9 = new NullWrapper("[Ljava.lang.String;");
206             }
207 
208             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
209                     "addProductVersion",
210                     new Object[] {
211                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
212                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
213                     });
214 
215             Object returnObj = null;
216 
217             try {
218                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
219             }
220             catch (Exception e) {
221                 if (e instanceof com.liferay.portal.PortalException) {
222                     throw (com.liferay.portal.PortalException)e;
223                 }
224 
225                 if (e instanceof com.liferay.portal.SystemException) {
226                     throw (com.liferay.portal.SystemException)e;
227                 }
228 
229                 throw new com.liferay.portal.SystemException(e);
230             }
231 
232             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
233         }
234         catch (com.liferay.portal.SystemException se) {
235             _log.error(se, se);
236 
237             throw se;
238         }
239     }
240 
241     public static void deleteProductVersion(HttpPrincipal httpPrincipal,
242         long productVersionId)
243         throws com.liferay.portal.PortalException,
244             com.liferay.portal.SystemException {
245         try {
246             Object paramObj0 = new LongWrapper(productVersionId);
247 
248             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
249                     "deleteProductVersion", new Object[] { paramObj0 });
250 
251             try {
252                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
253             }
254             catch (Exception e) {
255                 if (e instanceof com.liferay.portal.PortalException) {
256                     throw (com.liferay.portal.PortalException)e;
257                 }
258 
259                 if (e instanceof com.liferay.portal.SystemException) {
260                     throw (com.liferay.portal.SystemException)e;
261                 }
262 
263                 throw new com.liferay.portal.SystemException(e);
264             }
265         }
266         catch (com.liferay.portal.SystemException se) {
267             _log.error(se, se);
268 
269             throw se;
270         }
271     }
272 
273     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion getProductVersion(
274         HttpPrincipal httpPrincipal, long productVersionId)
275         throws com.liferay.portal.PortalException,
276             com.liferay.portal.SystemException {
277         try {
278             Object paramObj0 = new LongWrapper(productVersionId);
279 
280             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
281                     "getProductVersion", new Object[] { paramObj0 });
282 
283             Object returnObj = null;
284 
285             try {
286                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
287             }
288             catch (Exception e) {
289                 if (e instanceof com.liferay.portal.PortalException) {
290                     throw (com.liferay.portal.PortalException)e;
291                 }
292 
293                 if (e instanceof com.liferay.portal.SystemException) {
294                     throw (com.liferay.portal.SystemException)e;
295                 }
296 
297                 throw new com.liferay.portal.SystemException(e);
298             }
299 
300             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
301         }
302         catch (com.liferay.portal.SystemException se) {
303             _log.error(se, se);
304 
305             throw se;
306         }
307     }
308 
309     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getProductVersions(
310         HttpPrincipal httpPrincipal, long productEntryId, int start, int end)
311         throws com.liferay.portal.PortalException,
312             com.liferay.portal.SystemException {
313         try {
314             Object paramObj0 = new LongWrapper(productEntryId);
315 
316             Object paramObj1 = new IntegerWrapper(start);
317 
318             Object paramObj2 = new IntegerWrapper(end);
319 
320             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
321                     "getProductVersions",
322                     new Object[] { paramObj0, paramObj1, paramObj2 });
323 
324             Object returnObj = null;
325 
326             try {
327                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
328             }
329             catch (Exception e) {
330                 if (e instanceof com.liferay.portal.PortalException) {
331                     throw (com.liferay.portal.PortalException)e;
332                 }
333 
334                 if (e instanceof com.liferay.portal.SystemException) {
335                     throw (com.liferay.portal.SystemException)e;
336                 }
337 
338                 throw new com.liferay.portal.SystemException(e);
339             }
340 
341             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)returnObj;
342         }
343         catch (com.liferay.portal.SystemException se) {
344             _log.error(se, se);
345 
346             throw se;
347         }
348     }
349 
350     public static int getProductVersionsCount(HttpPrincipal httpPrincipal,
351         long productEntryId)
352         throws com.liferay.portal.PortalException,
353             com.liferay.portal.SystemException {
354         try {
355             Object paramObj0 = new LongWrapper(productEntryId);
356 
357             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
358                     "getProductVersionsCount", new Object[] { paramObj0 });
359 
360             Object returnObj = null;
361 
362             try {
363                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
364             }
365             catch (Exception e) {
366                 if (e instanceof com.liferay.portal.PortalException) {
367                     throw (com.liferay.portal.PortalException)e;
368                 }
369 
370                 if (e instanceof com.liferay.portal.SystemException) {
371                     throw (com.liferay.portal.SystemException)e;
372                 }
373 
374                 throw new com.liferay.portal.SystemException(e);
375             }
376 
377             return ((Integer)returnObj).intValue();
378         }
379         catch (com.liferay.portal.SystemException se) {
380             _log.error(se, se);
381 
382             throw se;
383         }
384     }
385 
386     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion updateProductVersion(
387         HttpPrincipal httpPrincipal, long productVersionId,
388         java.lang.String version, java.lang.String changeLog,
389         java.lang.String downloadPageURL, java.lang.String directDownloadURL,
390         boolean testDirectDownloadURL, boolean repoStoreArtifact,
391         long[] frameworkVersionIds)
392         throws com.liferay.portal.PortalException,
393             com.liferay.portal.SystemException {
394         try {
395             Object paramObj0 = new LongWrapper(productVersionId);
396 
397             Object paramObj1 = version;
398 
399             if (version == null) {
400                 paramObj1 = new NullWrapper("java.lang.String");
401             }
402 
403             Object paramObj2 = changeLog;
404 
405             if (changeLog == null) {
406                 paramObj2 = new NullWrapper("java.lang.String");
407             }
408 
409             Object paramObj3 = downloadPageURL;
410 
411             if (downloadPageURL == null) {
412                 paramObj3 = new NullWrapper("java.lang.String");
413             }
414 
415             Object paramObj4 = directDownloadURL;
416 
417             if (directDownloadURL == null) {
418                 paramObj4 = new NullWrapper("java.lang.String");
419             }
420 
421             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
422 
423             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
424 
425             Object paramObj7 = frameworkVersionIds;
426 
427             if (frameworkVersionIds == null) {
428                 paramObj7 = new NullWrapper("[J");
429             }
430 
431             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
432                     "updateProductVersion",
433                     new Object[] {
434                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
435                         paramObj5, paramObj6, paramObj7
436                     });
437 
438             Object returnObj = null;
439 
440             try {
441                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
442             }
443             catch (Exception e) {
444                 if (e instanceof com.liferay.portal.PortalException) {
445                     throw (com.liferay.portal.PortalException)e;
446                 }
447 
448                 if (e instanceof com.liferay.portal.SystemException) {
449                     throw (com.liferay.portal.SystemException)e;
450                 }
451 
452                 throw new com.liferay.portal.SystemException(e);
453             }
454 
455             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
456         }
457         catch (com.liferay.portal.SystemException se) {
458             _log.error(se, se);
459 
460             throw se;
461         }
462     }
463 
464     private static Log _log = LogFactoryUtil.getLog(SCProductVersionServiceHttp.class);
465 }