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.SCFrameworkVersionServiceUtil;
28  
29  /**
30   * <a href="SCFrameworkVersionServiceHttp.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.SCFrameworkVersionServiceUtil} 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       SCFrameworkVersionServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.softwarecatalog.service.SCFrameworkVersionServiceUtil
64   * @generated
65   */
66  public class SCFrameworkVersionServiceHttp {
67      public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion addFrameworkVersion(
68          HttpPrincipal httpPrincipal, java.lang.String name,
69          java.lang.String url, boolean active, int priority,
70          com.liferay.portal.service.ServiceContext serviceContext)
71          throws com.liferay.portal.kernel.exception.PortalException,
72              com.liferay.portal.kernel.exception.SystemException {
73          try {
74              Object paramObj0 = name;
75  
76              if (name == null) {
77                  paramObj0 = new NullWrapper("java.lang.String");
78              }
79  
80              Object paramObj1 = url;
81  
82              if (url == null) {
83                  paramObj1 = new NullWrapper("java.lang.String");
84              }
85  
86              Object paramObj2 = new BooleanWrapper(active);
87  
88              Object paramObj3 = new IntegerWrapper(priority);
89  
90              Object paramObj4 = serviceContext;
91  
92              if (serviceContext == null) {
93                  paramObj4 = new NullWrapper(
94                          "com.liferay.portal.service.ServiceContext");
95              }
96  
97              MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
98                      "addFrameworkVersion",
99                      new Object[] {
100                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
101                     });
102 
103             Object returnObj = null;
104 
105             try {
106                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
107             }
108             catch (Exception e) {
109                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110                     throw (com.liferay.portal.kernel.exception.PortalException)e;
111                 }
112 
113                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114                     throw (com.liferay.portal.kernel.exception.SystemException)e;
115                 }
116 
117                 throw new com.liferay.portal.kernel.exception.SystemException(e);
118             }
119 
120             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
121         }
122         catch (com.liferay.portal.kernel.exception.SystemException se) {
123             _log.error(se, se);
124 
125             throw se;
126         }
127     }
128 
129     public static void deleteFrameworkVersion(HttpPrincipal httpPrincipal,
130         long frameworkVersionId)
131         throws com.liferay.portal.kernel.exception.PortalException,
132             com.liferay.portal.kernel.exception.SystemException {
133         try {
134             Object paramObj0 = new LongWrapper(frameworkVersionId);
135 
136             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
137                     "deleteFrameworkVersion", new Object[] { paramObj0 });
138 
139             try {
140                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
141             }
142             catch (Exception e) {
143                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                     throw (com.liferay.portal.kernel.exception.PortalException)e;
145                 }
146 
147                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                     throw (com.liferay.portal.kernel.exception.SystemException)e;
149                 }
150 
151                 throw new com.liferay.portal.kernel.exception.SystemException(e);
152             }
153         }
154         catch (com.liferay.portal.kernel.exception.SystemException se) {
155             _log.error(se, se);
156 
157             throw se;
158         }
159     }
160 
161     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion getFrameworkVersion(
162         HttpPrincipal httpPrincipal, long frameworkVersionId)
163         throws com.liferay.portal.kernel.exception.PortalException,
164             com.liferay.portal.kernel.exception.SystemException {
165         try {
166             Object paramObj0 = new LongWrapper(frameworkVersionId);
167 
168             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
169                     "getFrameworkVersion", new Object[] { paramObj0 });
170 
171             Object returnObj = null;
172 
173             try {
174                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
175             }
176             catch (Exception e) {
177                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
178                     throw (com.liferay.portal.kernel.exception.PortalException)e;
179                 }
180 
181                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
182                     throw (com.liferay.portal.kernel.exception.SystemException)e;
183                 }
184 
185                 throw new com.liferay.portal.kernel.exception.SystemException(e);
186             }
187 
188             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
189         }
190         catch (com.liferay.portal.kernel.exception.SystemException se) {
191             _log.error(se, se);
192 
193             throw se;
194         }
195     }
196 
197     public static java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion> getFrameworkVersions(
198         HttpPrincipal httpPrincipal, long groupId, boolean active)
199         throws com.liferay.portal.kernel.exception.SystemException {
200         try {
201             Object paramObj0 = new LongWrapper(groupId);
202 
203             Object paramObj1 = new BooleanWrapper(active);
204 
205             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
206                     "getFrameworkVersions",
207                     new Object[] { paramObj0, paramObj1 });
208 
209             Object returnObj = null;
210 
211             try {
212                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
213             }
214             catch (Exception e) {
215                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
216                     throw (com.liferay.portal.kernel.exception.SystemException)e;
217                 }
218 
219                 throw new com.liferay.portal.kernel.exception.SystemException(e);
220             }
221 
222             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)returnObj;
223         }
224         catch (com.liferay.portal.kernel.exception.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.SCFrameworkVersion> getFrameworkVersions(
232         HttpPrincipal httpPrincipal, long groupId, boolean active, int start,
233         int end) throws com.liferay.portal.kernel.exception.SystemException {
234         try {
235             Object paramObj0 = new LongWrapper(groupId);
236 
237             Object paramObj1 = new BooleanWrapper(active);
238 
239             Object paramObj2 = new IntegerWrapper(start);
240 
241             Object paramObj3 = new IntegerWrapper(end);
242 
243             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
244                     "getFrameworkVersions",
245                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
246 
247             Object returnObj = null;
248 
249             try {
250                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
251             }
252             catch (Exception e) {
253                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
254                     throw (com.liferay.portal.kernel.exception.SystemException)e;
255                 }
256 
257                 throw new com.liferay.portal.kernel.exception.SystemException(e);
258             }
259 
260             return (java.util.List<com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion>)returnObj;
261         }
262         catch (com.liferay.portal.kernel.exception.SystemException se) {
263             _log.error(se, se);
264 
265             throw se;
266         }
267     }
268 
269     public static com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion updateFrameworkVersion(
270         HttpPrincipal httpPrincipal, long frameworkVersionId,
271         java.lang.String name, java.lang.String url, boolean active,
272         int priority)
273         throws com.liferay.portal.kernel.exception.PortalException,
274             com.liferay.portal.kernel.exception.SystemException {
275         try {
276             Object paramObj0 = new LongWrapper(frameworkVersionId);
277 
278             Object paramObj1 = name;
279 
280             if (name == null) {
281                 paramObj1 = new NullWrapper("java.lang.String");
282             }
283 
284             Object paramObj2 = url;
285 
286             if (url == null) {
287                 paramObj2 = new NullWrapper("java.lang.String");
288             }
289 
290             Object paramObj3 = new BooleanWrapper(active);
291 
292             Object paramObj4 = new IntegerWrapper(priority);
293 
294             MethodWrapper methodWrapper = new MethodWrapper(SCFrameworkVersionServiceUtil.class.getName(),
295                     "updateFrameworkVersion",
296                     new Object[] {
297                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
298                     });
299 
300             Object returnObj = null;
301 
302             try {
303                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
304             }
305             catch (Exception e) {
306                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
307                     throw (com.liferay.portal.kernel.exception.PortalException)e;
308                 }
309 
310                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
311                     throw (com.liferay.portal.kernel.exception.SystemException)e;
312                 }
313 
314                 throw new com.liferay.portal.kernel.exception.SystemException(e);
315             }
316 
317             return (com.liferay.portlet.softwarecatalog.model.SCFrameworkVersion)returnObj;
318         }
319         catch (com.liferay.portal.kernel.exception.SystemException se) {
320             _log.error(se, se);
321 
322             throw se;
323         }
324     }
325 
326     private static Log _log = LogFactoryUtil.getLog(SCFrameworkVersionServiceHttp.class);
327 }