001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.softwarecatalog.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       SCLicenseServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil
054     * @generated
055     */
056    public class SCLicenseServiceHttp {
057            public static com.liferay.portlet.softwarecatalog.model.SCLicense addLicense(
058                    HttpPrincipal httpPrincipal, java.lang.String name,
059                    java.lang.String url, boolean openSource, boolean active,
060                    boolean recommended)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
065                                            "addLicense", _addLicenseParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey, name,
068                                            url, openSource, active, recommended);
069    
070                            Object returnObj = null;
071    
072                            try {
073                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
074                            }
075                            catch (Exception e) {
076                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
077                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
078                                    }
079    
080                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
081                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
082                                    }
083    
084                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
085                            }
086    
087                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
088                    }
089                    catch (com.liferay.portal.kernel.exception.SystemException se) {
090                            _log.error(se, se);
091    
092                            throw se;
093                    }
094            }
095    
096            public static void deleteLicense(HttpPrincipal httpPrincipal, long licenseId)
097                    throws com.liferay.portal.kernel.exception.PortalException,
098                            com.liferay.portal.kernel.exception.SystemException {
099                    try {
100                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
101                                            "deleteLicense", _deleteLicenseParameterTypes1);
102    
103                            MethodHandler methodHandler = new MethodHandler(methodKey, licenseId);
104    
105                            try {
106                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
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                    catch (com.liferay.portal.kernel.exception.SystemException se) {
121                            _log.error(se, se);
122    
123                            throw se;
124                    }
125            }
126    
127            public static com.liferay.portlet.softwarecatalog.model.SCLicense getLicense(
128                    HttpPrincipal httpPrincipal, long licenseId)
129                    throws com.liferay.portal.kernel.exception.PortalException,
130                            com.liferay.portal.kernel.exception.SystemException {
131                    try {
132                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
133                                            "getLicense", _getLicenseParameterTypes2);
134    
135                            MethodHandler methodHandler = new MethodHandler(methodKey, licenseId);
136    
137                            Object returnObj = null;
138    
139                            try {
140                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
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                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
155                    }
156                    catch (com.liferay.portal.kernel.exception.SystemException se) {
157                            _log.error(se, se);
158    
159                            throw se;
160                    }
161            }
162    
163            public static com.liferay.portlet.softwarecatalog.model.SCLicense updateLicense(
164                    HttpPrincipal httpPrincipal, long licenseId, java.lang.String name,
165                    java.lang.String url, boolean openSource, boolean active,
166                    boolean recommended)
167                    throws com.liferay.portal.kernel.exception.PortalException,
168                            com.liferay.portal.kernel.exception.SystemException {
169                    try {
170                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class.getName(),
171                                            "updateLicense", _updateLicenseParameterTypes3);
172    
173                            MethodHandler methodHandler = new MethodHandler(methodKey,
174                                            licenseId, name, url, openSource, active, recommended);
175    
176                            Object returnObj = null;
177    
178                            try {
179                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
180                            }
181                            catch (Exception e) {
182                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
183                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
184                                    }
185    
186                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
187                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
188                                    }
189    
190                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
191                            }
192    
193                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
194                    }
195                    catch (com.liferay.portal.kernel.exception.SystemException se) {
196                            _log.error(se, se);
197    
198                            throw se;
199                    }
200            }
201    
202            private static Log _log = LogFactoryUtil.getLog(SCLicenseServiceHttp.class);
203            private static final Class<?>[] _addLicenseParameterTypes0 = new Class[] {
204                            java.lang.String.class, java.lang.String.class, boolean.class,
205                            boolean.class, boolean.class
206                    };
207            private static final Class<?>[] _deleteLicenseParameterTypes1 = new Class[] {
208                            long.class
209                    };
210            private static final Class<?>[] _getLicenseParameterTypes2 = new Class[] {
211                            long.class
212                    };
213            private static final Class<?>[] _updateLicenseParameterTypes3 = new Class[] {
214                            long.class, java.lang.String.class, java.lang.String.class,
215                            boolean.class, boolean.class, boolean.class
216                    };
217    }