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,
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 = 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 = serviceContext;
114 
115             if (serviceContext == null) {
116                 paramObj8 = new NullWrapper(
117                         "com.liferay.portal.service.ServiceContext");
118             }
119 
120             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
121                     "addProductVersion",
122                     new Object[] {
123                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
124                         paramObj5, paramObj6, paramObj7, paramObj8
125                     });
126 
127             Object returnObj = null;
128 
129             try {
130                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
131             }
132             catch (Exception e) {
133                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
134                     throw (com.liferay.portal.kernel.exception.PortalException)e;
135                 }
136 
137                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
138                     throw (com.liferay.portal.kernel.exception.SystemException)e;
139                 }
140 
141                 throw new com.liferay.portal.kernel.exception.SystemException(e);
142             }
143 
144             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
145         }
146         catch (com.liferay.portal.kernel.exception.SystemException se) {
147             _log.error(se, se);
148 
149             throw se;
150         }
151     }
152 
153     public static void deleteProductVersion(HttpPrincipal httpPrincipal,
154         long productVersionId)
155         throws com.liferay.portal.kernel.exception.PortalException,
156             com.liferay.portal.kernel.exception.SystemException {
157         try {
158             Object paramObj0 = new LongWrapper(productVersionId);
159 
160             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
161                     "deleteProductVersion", new Object[] { paramObj0 });
162 
163             try {
164                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
165             }
166             catch (Exception e) {
167                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
168                     throw (com.liferay.portal.kernel.exception.PortalException)e;
169                 }
170 
171                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
172                     throw (com.liferay.portal.kernel.exception.SystemException)e;
173                 }
174 
175                 throw new com.liferay.portal.kernel.exception.SystemException(e);
176             }
177         }
178         catch (com.liferay.portal.kernel.exception.SystemException se) {
179             _log.error(se, se);
180 
181             throw se;
182         }
183     }
184 
185     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion getProductVersion(
186         HttpPrincipal httpPrincipal, long productVersionId)
187         throws com.liferay.portal.kernel.exception.PortalException,
188             com.liferay.portal.kernel.exception.SystemException {
189         try {
190             Object paramObj0 = new LongWrapper(productVersionId);
191 
192             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
193                     "getProductVersion", new Object[] { paramObj0 });
194 
195             Object returnObj = null;
196 
197             try {
198                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
199             }
200             catch (Exception e) {
201                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
202                     throw (com.liferay.portal.kernel.exception.PortalException)e;
203                 }
204 
205                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
206                     throw (com.liferay.portal.kernel.exception.SystemException)e;
207                 }
208 
209                 throw new com.liferay.portal.kernel.exception.SystemException(e);
210             }
211 
212             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
213         }
214         catch (com.liferay.portal.kernel.exception.SystemException se) {
215             _log.error(se, se);
216 
217             throw se;
218         }
219     }
220 
221     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion> getProductVersions(
222         HttpPrincipal httpPrincipal, long productEntryId, int start, int end)
223         throws com.liferay.portal.kernel.exception.PortalException,
224             com.liferay.portal.kernel.exception.SystemException {
225         try {
226             Object paramObj0 = new LongWrapper(productEntryId);
227 
228             Object paramObj1 = new IntegerWrapper(start);
229 
230             Object paramObj2 = new IntegerWrapper(end);
231 
232             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
233                     "getProductVersions",
234                     new Object[] { paramObj0, paramObj1, paramObj2 });
235 
236             Object returnObj = null;
237 
238             try {
239                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
240             }
241             catch (Exception e) {
242                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
243                     throw (com.liferay.portal.kernel.exception.PortalException)e;
244                 }
245 
246                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
247                     throw (com.liferay.portal.kernel.exception.SystemException)e;
248                 }
249 
250                 throw new com.liferay.portal.kernel.exception.SystemException(e);
251             }
252 
253             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCProductVersion>)returnObj;
254         }
255         catch (com.liferay.portal.kernel.exception.SystemException se) {
256             _log.error(se, se);
257 
258             throw se;
259         }
260     }
261 
262     public static int getProductVersionsCount(HttpPrincipal httpPrincipal,
263         long productEntryId)
264         throws com.liferay.portal.kernel.exception.PortalException,
265             com.liferay.portal.kernel.exception.SystemException {
266         try {
267             Object paramObj0 = new LongWrapper(productEntryId);
268 
269             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
270                     "getProductVersionsCount", new Object[] { paramObj0 });
271 
272             Object returnObj = null;
273 
274             try {
275                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
276             }
277             catch (Exception e) {
278                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
279                     throw (com.liferay.portal.kernel.exception.PortalException)e;
280                 }
281 
282                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
283                     throw (com.liferay.portal.kernel.exception.SystemException)e;
284                 }
285 
286                 throw new com.liferay.portal.kernel.exception.SystemException(e);
287             }
288 
289             return ((Integer)returnObj).intValue();
290         }
291         catch (com.liferay.portal.kernel.exception.SystemException se) {
292             _log.error(se, se);
293 
294             throw se;
295         }
296     }
297 
298     public static com.liferay.portlet.softwarecatalog.model.SCProductVersion updateProductVersion(
299         HttpPrincipal httpPrincipal, long productVersionId,
300         java.lang.String version, java.lang.String changeLog,
301         java.lang.String downloadPageURL, java.lang.String directDownloadURL,
302         boolean testDirectDownloadURL, boolean repoStoreArtifact,
303         long[] frameworkVersionIds)
304         throws com.liferay.portal.kernel.exception.PortalException,
305             com.liferay.portal.kernel.exception.SystemException {
306         try {
307             Object paramObj0 = new LongWrapper(productVersionId);
308 
309             Object paramObj1 = version;
310 
311             if (version == null) {
312                 paramObj1 = new NullWrapper("java.lang.String");
313             }
314 
315             Object paramObj2 = changeLog;
316 
317             if (changeLog == null) {
318                 paramObj2 = new NullWrapper("java.lang.String");
319             }
320 
321             Object paramObj3 = downloadPageURL;
322 
323             if (downloadPageURL == null) {
324                 paramObj3 = new NullWrapper("java.lang.String");
325             }
326 
327             Object paramObj4 = directDownloadURL;
328 
329             if (directDownloadURL == null) {
330                 paramObj4 = new NullWrapper("java.lang.String");
331             }
332 
333             Object paramObj5 = new BooleanWrapper(testDirectDownloadURL);
334 
335             Object paramObj6 = new BooleanWrapper(repoStoreArtifact);
336 
337             Object paramObj7 = frameworkVersionIds;
338 
339             if (frameworkVersionIds == null) {
340                 paramObj7 = new NullWrapper("[J");
341             }
342 
343             MethodWrapper methodWrapper = new MethodWrapper(SCProductVersionServiceUtil.class.getName(),
344                     "updateProductVersion",
345                     new Object[] {
346                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
347                         paramObj5, paramObj6, paramObj7
348                     });
349 
350             Object returnObj = null;
351 
352             try {
353                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
354             }
355             catch (Exception e) {
356                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
357                     throw (com.liferay.portal.kernel.exception.PortalException)e;
358                 }
359 
360                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
361                     throw (com.liferay.portal.kernel.exception.SystemException)e;
362                 }
363 
364                 throw new com.liferay.portal.kernel.exception.SystemException(e);
365             }
366 
367             return (com.liferay.portlet.softwarecatalog.model.SCProductVersion)returnObj;
368         }
369         catch (com.liferay.portal.kernel.exception.SystemException se) {
370             _log.error(se, se);
371 
372             throw se;
373         }
374     }
375 
376     private static Log _log = LogFactoryUtil.getLog(SCProductVersionServiceHttp.class);
377 }