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