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