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