1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil;
25  
26  /**
27   * <a href="SCLicenseServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       SCLicenseServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil
61   * @generated
62   */
63  public class SCLicenseServiceHttp {
64      public static com.liferay.portlet.softwarecatalog.model.SCLicense addLicense(
65          HttpPrincipal httpPrincipal, java.lang.String name,
66          java.lang.String url, boolean openSource, boolean active,
67          boolean recommended)
68          throws com.liferay.portal.PortalException,
69              com.liferay.portal.SystemException {
70          try {
71              MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
72                      "addLicense", _addLicenseParameterTypes0);
73  
74              MethodHandler methodHandler = new MethodHandler(methodKey, name,
75                      url, openSource, active, recommended);
76  
77              Object returnObj = null;
78  
79              try {
80                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
81              }
82              catch (Exception e) {
83                  if (e instanceof com.liferay.portal.PortalException) {
84                      throw (com.liferay.portal.PortalException)e;
85                  }
86  
87                  if (e instanceof com.liferay.portal.SystemException) {
88                      throw (com.liferay.portal.SystemException)e;
89                  }
90  
91                  throw new com.liferay.portal.SystemException(e);
92              }
93  
94              return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
95          }
96          catch (com.liferay.portal.SystemException se) {
97              _log.error(se, se);
98  
99              throw se;
100         }
101     }
102 
103     public static void deleteLicense(HttpPrincipal httpPrincipal, long licenseId)
104         throws com.liferay.portal.PortalException,
105             com.liferay.portal.SystemException {
106         try {
107             MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
108                     "deleteLicense", _deleteLicenseParameterTypes1);
109 
110             MethodHandler methodHandler = new MethodHandler(methodKey, licenseId);
111 
112             try {
113                 TunnelUtil.invoke(httpPrincipal, methodHandler);
114             }
115             catch (Exception e) {
116                 if (e instanceof com.liferay.portal.PortalException) {
117                     throw (com.liferay.portal.PortalException)e;
118                 }
119 
120                 if (e instanceof com.liferay.portal.SystemException) {
121                     throw (com.liferay.portal.SystemException)e;
122                 }
123 
124                 throw new com.liferay.portal.SystemException(e);
125             }
126         }
127         catch (com.liferay.portal.SystemException se) {
128             _log.error(se, se);
129 
130             throw se;
131         }
132     }
133 
134     public static com.liferay.portlet.softwarecatalog.model.SCLicense getLicense(
135         HttpPrincipal httpPrincipal, long licenseId)
136         throws com.liferay.portal.PortalException,
137             com.liferay.portal.SystemException {
138         try {
139             MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
140                     "getLicense", _getLicenseParameterTypes2);
141 
142             MethodHandler methodHandler = new MethodHandler(methodKey, licenseId);
143 
144             Object returnObj = null;
145 
146             try {
147                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148             }
149             catch (Exception e) {
150                 if (e instanceof com.liferay.portal.PortalException) {
151                     throw (com.liferay.portal.PortalException)e;
152                 }
153 
154                 if (e instanceof com.liferay.portal.SystemException) {
155                     throw (com.liferay.portal.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.SystemException(e);
159             }
160 
161             return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static com.liferay.portlet.softwarecatalog.model.SCLicense updateLicense(
171         HttpPrincipal httpPrincipal, long licenseId, java.lang.String name,
172         java.lang.String url, boolean openSource, boolean active,
173         boolean recommended)
174         throws com.liferay.portal.PortalException,
175             com.liferay.portal.SystemException {
176         try {
177             MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
178                     "updateLicense", _updateLicenseParameterTypes3);
179 
180             MethodHandler methodHandler = new MethodHandler(methodKey,
181                     licenseId, name, url, openSource, active, recommended);
182 
183             Object returnObj = null;
184 
185             try {
186                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
187             }
188             catch (Exception e) {
189                 if (e instanceof com.liferay.portal.PortalException) {
190                     throw (com.liferay.portal.PortalException)e;
191                 }
192 
193                 if (e instanceof com.liferay.portal.SystemException) {
194                     throw (com.liferay.portal.SystemException)e;
195                 }
196 
197                 throw new com.liferay.portal.SystemException(e);
198             }
199 
200             return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
201         }
202         catch (com.liferay.portal.SystemException se) {
203             _log.error(se, se);
204 
205             throw se;
206         }
207     }
208 
209     private static Log _log = LogFactoryUtil.getLog(SCLicenseServiceHttp.class);
210     private static final Class<?>[] _addLicenseParameterTypes0 = new Class[] {
211             java.lang.String.class, java.lang.String.class, boolean.class,
212             boolean.class, boolean.class
213         };
214     private static final Class<?>[] _deleteLicenseParameterTypes1 = new Class[] {
215             long.class
216         };
217     private static final Class<?>[] _getLicenseParameterTypes2 = new Class[] {
218             long.class
219         };
220     private static final Class<?>[] _updateLicenseParameterTypes3 = new Class[] {
221             long.class, java.lang.String.class, java.lang.String.class,
222             boolean.class, boolean.class, boolean.class
223         };
224 }