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