001    /**
002     * Copyright (c) 2000-2010 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 com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.BooleanWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
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     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it requires an additional
034     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
035     * </p>
036     *
037     * <p>
038     * The benefits of using the HTTP utility is that it is fast and allows for
039     * tunneling without the cost of serializing to text. The drawback is that it
040     * only works with Java.
041     * </p>
042     *
043     * <p>
044     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
045     * configure security.
046     * </p>
047     *
048     * <p>
049     * The HTTP utility is only generated for remote services.
050     * </p>
051     *
052     * @author    Brian Wing Shun Chan
053     * @see       SCLicenseServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.softwarecatalog.service.SCLicenseServiceUtil
056     * @generated
057     */
058    public class SCLicenseServiceHttp {
059            public static com.liferay.portlet.softwarecatalog.model.SCLicense addLicense(
060                    HttpPrincipal httpPrincipal, java.lang.String name,
061                    java.lang.String url, boolean openSource, boolean active,
062                    boolean recommended)
063                    throws com.liferay.portal.kernel.exception.PortalException,
064                            com.liferay.portal.kernel.exception.SystemException {
065                    try {
066                            Object paramObj0 = name;
067    
068                            if (name == null) {
069                                    paramObj0 = new NullWrapper("java.lang.String");
070                            }
071    
072                            Object paramObj1 = url;
073    
074                            if (url == null) {
075                                    paramObj1 = new NullWrapper("java.lang.String");
076                            }
077    
078                            Object paramObj2 = new BooleanWrapper(openSource);
079    
080                            Object paramObj3 = new BooleanWrapper(active);
081    
082                            Object paramObj4 = new BooleanWrapper(recommended);
083    
084                            MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
085                                            "addLicense",
086                                            new Object[] {
087                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
088                                            });
089    
090                            Object returnObj = null;
091    
092                            try {
093                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
094                            }
095                            catch (Exception e) {
096                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
097                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
098                                    }
099    
100                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
101                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
102                                    }
103    
104                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
105                            }
106    
107                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
108                    }
109                    catch (com.liferay.portal.kernel.exception.SystemException se) {
110                            _log.error(se, se);
111    
112                            throw se;
113                    }
114            }
115    
116            public static void deleteLicense(HttpPrincipal httpPrincipal, long licenseId)
117                    throws com.liferay.portal.kernel.exception.PortalException,
118                            com.liferay.portal.kernel.exception.SystemException {
119                    try {
120                            Object paramObj0 = new LongWrapper(licenseId);
121    
122                            MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
123                                            "deleteLicense", new Object[] { paramObj0 });
124    
125                            try {
126                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
127                            }
128                            catch (Exception e) {
129                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
130                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
131                                    }
132    
133                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
134                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
135                                    }
136    
137                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
138                            }
139                    }
140                    catch (com.liferay.portal.kernel.exception.SystemException se) {
141                            _log.error(se, se);
142    
143                            throw se;
144                    }
145            }
146    
147            public static com.liferay.portlet.softwarecatalog.model.SCLicense getLicense(
148                    HttpPrincipal httpPrincipal, long licenseId)
149                    throws com.liferay.portal.kernel.exception.PortalException,
150                            com.liferay.portal.kernel.exception.SystemException {
151                    try {
152                            Object paramObj0 = new LongWrapper(licenseId);
153    
154                            MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
155                                            "getLicense", new Object[] { paramObj0 });
156    
157                            Object returnObj = null;
158    
159                            try {
160                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
161                            }
162                            catch (Exception e) {
163                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
164                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
165                                    }
166    
167                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
168                                            throw (com.liferay.portal.kernel.exception.SystemException)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            public static com.liferay.portlet.softwarecatalog.model.SCLicense updateLicense(
184                    HttpPrincipal httpPrincipal, long licenseId, java.lang.String name,
185                    java.lang.String url, boolean openSource, boolean active,
186                    boolean recommended)
187                    throws com.liferay.portal.kernel.exception.PortalException,
188                            com.liferay.portal.kernel.exception.SystemException {
189                    try {
190                            Object paramObj0 = new LongWrapper(licenseId);
191    
192                            Object paramObj1 = name;
193    
194                            if (name == null) {
195                                    paramObj1 = new NullWrapper("java.lang.String");
196                            }
197    
198                            Object paramObj2 = url;
199    
200                            if (url == null) {
201                                    paramObj2 = new NullWrapper("java.lang.String");
202                            }
203    
204                            Object paramObj3 = new BooleanWrapper(openSource);
205    
206                            Object paramObj4 = new BooleanWrapper(active);
207    
208                            Object paramObj5 = new BooleanWrapper(recommended);
209    
210                            MethodWrapper methodWrapper = new MethodWrapper(SCLicenseServiceUtil.class.getName(),
211                                            "updateLicense",
212                                            new Object[] {
213                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
214                                                    paramObj5
215                                            });
216    
217                            Object returnObj = null;
218    
219                            try {
220                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
221                            }
222                            catch (Exception e) {
223                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
224                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
225                                    }
226    
227                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
228                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
229                                    }
230    
231                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
232                            }
233    
234                            return (com.liferay.portlet.softwarecatalog.model.SCLicense)returnObj;
235                    }
236                    catch (com.liferay.portal.kernel.exception.SystemException se) {
237                            _log.error(se, se);
238    
239                            throw se;
240                    }
241            }
242    
243            private static Log _log = LogFactoryUtil.getLog(SCLicenseServiceHttp.class);
244    }