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   * {@link com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil} service utility. The
48   * static methods of this class calls the same methods of the service utility.
49   * However, the signatures are different because it requires an additional
50   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
61   * configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author    Brian Wing Shun Chan
69   * @see       SCProductVersionServiceSoap
70   * @see       com.liferay.portal.security.auth.HttpPrincipal
71   * @see       com.liferay.portlet.softwarecatalog.service.SCProductVersionServiceUtil
72   * @generated
73   */
74  public class SCProductVersionServiceHttp {
75      public static com.liferay.portlet.softwarecatalog.model.SCProductVersion addProductVersion(
76          HttpPrincipal httpPrincipal, long productEntryId,
77          java.lang.String version, java.lang.String changeLog,
78          java.lang.String downloadPageURL, java.lang.String directDownloadURL,
79          boolean testDirectDownloadURL, boolean repoStoreArtifact,
80          long[] frameworkVersionIds,
81          com.liferay.portal.service.ServiceContext serviceContext)
82          throws com.liferay.portal.PortalException,
83              com.liferay.portal.SystemException {
84          try {
85              Object paramObj0 = new LongWrapper(productEntryId);
86  
87              Object paramObj1 = version;
88  
89              if (version == null) {
90                  paramObj1 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj2 = changeLog;
94  
95              if (changeLog == null) {
96                  paramObj2 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj3 = downloadPageURL;
100 
101             if (downloadPageURL == null) {
102                 paramObj3 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj4 = directDownloadURL;
106 
107             if (directDownloadURL == null) {
108                 paramObj4 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
112 
113             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
114 
115             Object paramObj7 = frameworkVersionIds;
116 
117             if (frameworkVersionIds == null) {
118                 paramObj7 = new NullWrapper("[J");
119             }
120 
121             Object paramObj8 = serviceContext;
122 
123             if (serviceContext == null) {
124                 paramObj8 = new NullWrapper(
125                         "com.liferay.portal.service.ServiceContext");
126             }
127 
128             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
129                     "addProductVersion",
130                     new Object[] {
131                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
132                         paramObj5, paramObj6, paramObj7, paramObj8
133                     });
134 
135             Object returnObj = null;
136 
137             try {
138                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
139             }
140             catch (Exception e) {
141                 if (e instanceof com.liferay.portal.PortalException) {
142                     throw (com.liferay.portal.PortalException)e;
143                 }
144 
145                 if (e instanceof com.liferay.portal.SystemException) {
146                     throw (com.liferay.portal.SystemException)e;
147                 }
148 
149                 throw new com.liferay.portal.SystemException(e);
150             }
151 
152             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
153         }
154         catch (com.liferay.portal.SystemException se) {
155             _log.error(se, se);
156 
157             throw se;
158         }
159     }
160 
161     public static void deleteProductVersion(HttpPrincipal httpPrincipal,
162         long productVersionId)
163         throws com.liferay.portal.PortalException,
164             com.liferay.portal.SystemException {
165         try {
166             Object paramObj0 = new LongWrapper(productVersionId);
167 
168             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
169                     "deleteProductVersion", new Object[] { paramObj0 });
170 
171             try {
172                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
173             }
174             catch (Exception e) {
175                 if (e instanceof com.liferay.portal.PortalException) {
176                     throw (com.liferay.portal.PortalException)e;
177                 }
178 
179                 if (e instanceof com.liferay.portal.SystemException) {
180                     throw (com.liferay.portal.SystemException)e;
181                 }
182 
183                 throw new com.liferay.portal.SystemException(e);
184             }
185         }
186         catch (com.liferay.portal.SystemException se) {
187             _log.error(se, se);
188 
189             throw se;
190         }
191     }
192 
193     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion getProductVersion(
194         HttpPrincipal httpPrincipal, long productVersionId)
195         throws com.liferay.portal.PortalException,
196             com.liferay.portal.SystemException {
197         try {
198             Object paramObj0 = new LongWrapper(productVersionId);
199 
200             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
201                     "getProductVersion", new Object[] { paramObj0 });
202 
203             Object returnObj = null;
204 
205             try {
206                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
207             }
208             catch (Exception e) {
209                 if (e instanceof com.liferay.portal.PortalException) {
210                     throw (com.liferay.portal.PortalException)e;
211                 }
212 
213                 if (e instanceof com.liferay.portal.SystemException) {
214                     throw (com.liferay.portal.SystemException)e;
215                 }
216 
217                 throw new com.liferay.portal.SystemException(e);
218             }
219 
220             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
221         }
222         catch (com.liferay.portal.SystemException se) {
223             _log.error(se, se);
224 
225             throw se;
226         }
227     }
228 
229     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getProductVersions(
230         HttpPrincipal httpPrincipal, long productEntryId, int start, int end)
231         throws com.liferay.portal.PortalException,
232             com.liferay.portal.SystemException {
233         try {
234             Object paramObj0 = new LongWrapper(productEntryId);
235 
236             Object paramObj1 = new IntegerWrapper(start);
237 
238             Object paramObj2 = new IntegerWrapper(end);
239 
240             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
241                     "getProductVersions",
242                     new Object[] { paramObj0, paramObj1, paramObj2 });
243 
244             Object returnObj = null;
245 
246             try {
247                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
248             }
249             catch (Exception e) {
250                 if (e instanceof com.liferay.portal.PortalException) {
251                     throw (com.liferay.portal.PortalException)e;
252                 }
253 
254                 if (e instanceof com.liferay.portal.SystemException) {
255                     throw (com.liferay.portal.SystemException)e;
256                 }
257 
258                 throw new com.liferay.portal.SystemException(e);
259             }
260 
261             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)returnObj;
262         }
263         catch (com.liferay.portal.SystemException se) {
264             _log.error(se, se);
265 
266             throw se;
267         }
268     }
269 
270     public static int getProductVersionsCount(HttpPrincipal httpPrincipal,
271         long productEntryId)
272         throws com.liferay.portal.PortalException,
273             com.liferay.portal.SystemException {
274         try {
275             Object paramObj0 = new LongWrapper(productEntryId);
276 
277             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
278                     "getProductVersionsCount", new Object[] { paramObj0 });
279 
280             Object returnObj = null;
281 
282             try {
283                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
284             }
285             catch (Exception e) {
286                 if (e instanceof com.liferay.portal.PortalException) {
287                     throw (com.liferay.portal.PortalException)e;
288                 }
289 
290                 if (e instanceof com.liferay.portal.SystemException) {
291                     throw (com.liferay.portal.SystemException)e;
292                 }
293 
294                 throw new com.liferay.portal.SystemException(e);
295             }
296 
297             return ((Integer)returnObj).intValue();
298         }
299         catch (com.liferay.portal.SystemException se) {
300             _log.error(se, se);
301 
302             throw se;
303         }
304     }
305 
306     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion updateProductVersion(
307         HttpPrincipal httpPrincipal, long productVersionId,
308         java.lang.String version, java.lang.String changeLog,
309         java.lang.String downloadPageURL, java.lang.String directDownloadURL,
310         boolean testDirectDownloadURL, boolean repoStoreArtifact,
311         long[] frameworkVersionIds)
312         throws com.liferay.portal.PortalException,
313             com.liferay.portal.SystemException {
314         try {
315             Object paramObj0 = new LongWrapper(productVersionId);
316 
317             Object paramObj1 = version;
318 
319             if (version == null) {
320                 paramObj1 = new NullWrapper("java.lang.String");
321             }
322 
323             Object paramObj2 = changeLog;
324 
325             if (changeLog == null) {
326                 paramObj2 = new NullWrapper("java.lang.String");
327             }
328 
329             Object paramObj3 = downloadPageURL;
330 
331             if (downloadPageURL == null) {
332                 paramObj3 = new NullWrapper("java.lang.String");
333             }
334 
335             Object paramObj4 = directDownloadURL;
336 
337             if (directDownloadURL == null) {
338                 paramObj4 = new NullWrapper("java.lang.String");
339             }
340 
341             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
342 
343             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
344 
345             Object paramObj7 = frameworkVersionIds;
346 
347             if (frameworkVersionIds == null) {
348                 paramObj7 = new NullWrapper("[J");
349             }
350 
351             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
352                     "updateProductVersion",
353                     new Object[] {
354                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
355                         paramObj5, paramObj6, paramObj7
356                     });
357 
358             Object returnObj = null;
359 
360             try {
361                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
362             }
363             catch (Exception e) {
364                 if (e instanceof com.liferay.portal.PortalException) {
365                     throw (com.liferay.portal.PortalException)e;
366                 }
367 
368                 if (e instanceof com.liferay.portal.SystemException) {
369                     throw (com.liferay.portal.SystemException)e;
370                 }
371 
372                 throw new com.liferay.portal.SystemException(e);
373             }
374 
375             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
376         }
377         catch (com.liferay.portal.SystemException se) {
378             _log.error(se, se);
379 
380             throw se;
381         }
382     }
383 
384     private static Log _log = LogFactoryUtil.getLog(SCProductVersionServiceHttp.class);
385 }