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.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.http.TunnelUtil;
33  
34  import com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil;
35  
36  /**
37   * <a href="SCLicenseServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be
41   * overwritten the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the
46   * {@link com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil} service utility. The
47   * static methods of this class calls the same methods of the service utility.
48   * However, the signatures are different because it requires an additional
49   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60   * configure security.
61   * </p>
62   *
63   * <p>
64   * The HTTP utility is only generated for remote services.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       SCLicenseServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil
71   * @generated
72   */
73  public class SCLicenseServiceHttp {
74      public static com.liferay.portlet.softwarecatalog.model.SCLicense addLicense(
75          HttpPrincipal httpPrincipal, java.lang.String name,
76          java.lang.String url, boolean openSource, boolean active,
77          boolean recommended)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = name;
82  
83              if (name == null) {
84                  paramObj0 = new NullWrapper("java.lang.String");
85              }
86  
87              Object paramObj1 = url;
88  
89              if (url == null) {
90                  paramObj1 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj2 = new BooleanWrapper(openSource);
94  
95              Object paramObj3 = new BooleanWrapper(active);
96  
97              Object paramObj4 = new BooleanWrapper(recommended);
98  
99              MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
100                     "addLicense",
101                     new Object[] {
102                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
103                     });
104 
105             Object returnObj = null;
106 
107             try {
108                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
109             }
110             catch (Exception e) {
111                 if (e instanceof com.liferay.portal.PortalException) {
112                     throw (com.liferay.portal.PortalException)e;
113                 }
114 
115                 if (e instanceof com.liferay.portal.SystemException) {
116                     throw (com.liferay.portal.SystemException)e;
117                 }
118 
119                 throw new com.liferay.portal.SystemException(e);
120             }
121 
122             return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
123         }
124         catch (com.liferay.portal.SystemException se) {
125             _log.error(se, se);
126 
127             throw se;
128         }
129     }
130 
131     public static void deleteLicense(HttpPrincipal httpPrincipal, long licenseId)
132         throws com.liferay.portal.PortalException,
133             com.liferay.portal.SystemException {
134         try {
135             Object paramObj0 = new LongWrapper(licenseId);
136 
137             MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
138                     "deleteLicense", new Object[] { paramObj0 });
139 
140             try {
141                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
142             }
143             catch (Exception e) {
144                 if (e instanceof com.liferay.portal.PortalException) {
145                     throw (com.liferay.portal.PortalException)e;
146                 }
147 
148                 if (e instanceof com.liferay.portal.SystemException) {
149                     throw (com.liferay.portal.SystemException)e;
150                 }
151 
152                 throw new com.liferay.portal.SystemException(e);
153             }
154         }
155         catch (com.liferay.portal.SystemException se) {
156             _log.error(se, se);
157 
158             throw se;
159         }
160     }
161 
162     public static com.liferay.portlet.softwarecatalog.model.SCLicense getLicense(
163         HttpPrincipal httpPrincipal, long licenseId)
164         throws com.liferay.portal.PortalException,
165             com.liferay.portal.SystemException {
166         try {
167             Object paramObj0 = new LongWrapper(licenseId);
168 
169             MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
170                     "getLicense", new Object[] { paramObj0 });
171 
172             Object returnObj = null;
173 
174             try {
175                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
176             }
177             catch (Exception e) {
178                 if (e instanceof com.liferay.portal.PortalException) {
179                     throw (com.liferay.portal.PortalException)e;
180                 }
181 
182                 if (e instanceof com.liferay.portal.SystemException) {
183                     throw (com.liferay.portal.SystemException)e;
184                 }
185 
186                 throw new com.liferay.portal.SystemException(e);
187             }
188 
189             return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
190         }
191         catch (com.liferay.portal.SystemException se) {
192             _log.error(se, se);
193 
194             throw se;
195         }
196     }
197 
198     public static com.liferay.portlet.softwarecatalog.model.SCLicense updateLicense(
199         HttpPrincipal httpPrincipal, long licenseId, java.lang.String name,
200         java.lang.String url, boolean openSource, boolean active,
201         boolean recommended)
202         throws com.liferay.portal.PortalException,
203             com.liferay.portal.SystemException {
204         try {
205             Object paramObj0 = new LongWrapper(licenseId);
206 
207             Object paramObj1 = name;
208 
209             if (name == null) {
210                 paramObj1 = new NullWrapper("java.lang.String");
211             }
212 
213             Object paramObj2 = url;
214 
215             if (url == null) {
216                 paramObj2 = new NullWrapper("java.lang.String");
217             }
218 
219             Object paramObj3 = new BooleanWrapper(openSource);
220 
221             Object paramObj4 = new BooleanWrapper(active);
222 
223             Object paramObj5 = new BooleanWrapper(recommended);
224 
225             MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
226                     "updateLicense",
227                     new Object[] {
228                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
229                         paramObj5
230                     });
231 
232             Object returnObj = null;
233 
234             try {
235                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
236             }
237             catch (Exception e) {
238                 if (e instanceof com.liferay.portal.PortalException) {
239                     throw (com.liferay.portal.PortalException)e;
240                 }
241 
242                 if (e instanceof com.liferay.portal.SystemException) {
243                     throw (com.liferay.portal.SystemException)e;
244                 }
245 
246                 throw new com.liferay.portal.SystemException(e);
247             }
248 
249             return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
250         }
251         catch (com.liferay.portal.SystemException se) {
252             _log.error(se, se);
253 
254             throw se;
255         }
256     }
257 
258     private static Log _log = LogFactoryUtil.getLog(SCLicenseServiceHttp.class);
259 }