001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.softwarecatalog.service.http;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link SCLicenseServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link HttpPrincipal} parameter.
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 HttpPrincipal
053     * @see SCLicenseServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class SCLicenseServiceHttp {
058            public static com.liferay.portlet.softwarecatalog.model.SCLicense addLicense(
059                    HttpPrincipal httpPrincipal, java.lang.String name,
060                    java.lang.String url, boolean openSource, boolean active,
061                    boolean recommended)
062                    throws com.liferay.portal.kernel.exception.PortalException {
063                    try {
064                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class,
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082    
083                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
084                    }
085                    catch (com.liferay.portal.kernel.exception.SystemException se) {
086                            _log.error(se, se);
087    
088                            throw se;
089                    }
090            }
091    
092            public static void deleteLicense(HttpPrincipal httpPrincipal, long licenseId)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class,
096                                            "deleteLicense", _deleteLicenseParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, licenseId);
099    
100                            try {
101                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
102                            }
103                            catch (Exception e) {
104                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
105                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
106                                    }
107    
108                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
109                            }
110                    }
111                    catch (com.liferay.portal.kernel.exception.SystemException se) {
112                            _log.error(se, se);
113    
114                            throw se;
115                    }
116            }
117    
118            public static com.liferay.portlet.softwarecatalog.model.SCLicense getLicense(
119                    HttpPrincipal httpPrincipal, long licenseId)
120                    throws com.liferay.portal.kernel.exception.PortalException {
121                    try {
122                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class,
123                                            "getLicense", _getLicenseParameterTypes2);
124    
125                            MethodHandler methodHandler = new MethodHandler(methodKey, licenseId);
126    
127                            Object returnObj = null;
128    
129                            try {
130                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
131                            }
132                            catch (Exception e) {
133                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
134                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
135                                    }
136    
137                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
138                            }
139    
140                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
141                    }
142                    catch (com.liferay.portal.kernel.exception.SystemException se) {
143                            _log.error(se, se);
144    
145                            throw se;
146                    }
147            }
148    
149            public static com.liferay.portlet.softwarecatalog.model.SCLicense updateLicense(
150                    HttpPrincipal httpPrincipal, long licenseId, java.lang.String name,
151                    java.lang.String url, boolean openSource, boolean active,
152                    boolean recommended)
153                    throws com.liferay.portal.kernel.exception.PortalException {
154                    try {
155                            MethodKey methodKey = new MethodKey(SCLicenseServiceUtil.class,
156                                            "updateLicense", _updateLicenseParameterTypes3);
157    
158                            MethodHandler methodHandler = new MethodHandler(methodKey,
159                                            licenseId, name, url, openSource, active, recommended);
160    
161                            Object returnObj = null;
162    
163                            try {
164                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
165                            }
166                            catch (Exception e) {
167                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
168                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
169                                    }
170    
171                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
172                            }
173    
174                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
175                    }
176                    catch (com.liferay.portal.kernel.exception.SystemException se) {
177                            _log.error(se, se);
178    
179                            throw se;
180                    }
181            }
182    
183            private static Log _log = LogFactoryUtil.getLog(SCLicenseServiceHttp.class);
184            private static final Class<?>[] _addLicenseParameterTypes0 = new Class[] {
185                            java.lang.String.class, java.lang.String.class, boolean.class,
186                            boolean.class, boolean.class
187                    };
188            private static final Class<?>[] _deleteLicenseParameterTypes1 = new Class[] {
189                            long.class
190                    };
191            private static final Class<?>[] _getLicenseParameterTypes2 = new Class[] {
192                            long.class
193                    };
194            private static final Class<?>[] _updateLicenseParameterTypes3 = new Class[] {
195                            long.class, java.lang.String.class, java.lang.String.class,
196                            boolean.class, boolean.class, boolean.class
197                    };
198    }