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.portal.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.PhoneServiceUtil;
025    
026    /**
027     * Provides the HTTP utility for the
028     * {@link PhoneServiceUtil} service utility. The
029     * static methods of this class calls the same methods of the service utility.
030     * However, the signatures are different because it requires an additional
031     * {@link HttpPrincipal} parameter.
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author Brian Wing Shun Chan
049     * @see PhoneServiceSoap
050     * @see HttpPrincipal
051     * @see PhoneServiceUtil
052     * @generated
053     */
054    @ProviderType
055    public class PhoneServiceHttp {
056            public static com.liferay.portal.model.Phone addPhone(
057                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
058                    java.lang.String number, java.lang.String extension, long typeId,
059                    boolean primary)
060                    throws com.liferay.portal.kernel.exception.PortalException {
061                    try {
062                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
063                                            "addPhone", _addPhoneParameterTypes0);
064    
065                            MethodHandler methodHandler = new MethodHandler(methodKey,
066                                            className, classPK, number, extension, typeId, primary);
067    
068                            Object returnObj = null;
069    
070                            try {
071                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
072                            }
073                            catch (Exception e) {
074                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
075                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
076                                    }
077    
078                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
079                            }
080    
081                            return (com.liferay.portal.model.Phone)returnObj;
082                    }
083                    catch (com.liferay.portal.kernel.exception.SystemException se) {
084                            _log.error(se, se);
085    
086                            throw se;
087                    }
088            }
089    
090            public static com.liferay.portal.model.Phone addPhone(
091                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
092                    java.lang.String number, java.lang.String extension, long typeId,
093                    boolean primary,
094                    com.liferay.portal.service.ServiceContext serviceContext)
095                    throws com.liferay.portal.kernel.exception.PortalException {
096                    try {
097                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
098                                            "addPhone", _addPhoneParameterTypes1);
099    
100                            MethodHandler methodHandler = new MethodHandler(methodKey,
101                                            className, classPK, number, extension, typeId, primary,
102                                            serviceContext);
103    
104                            Object returnObj = null;
105    
106                            try {
107                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
108                            }
109                            catch (Exception e) {
110                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
111                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
112                                    }
113    
114                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
115                            }
116    
117                            return (com.liferay.portal.model.Phone)returnObj;
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static void deletePhone(HttpPrincipal httpPrincipal, long phoneId)
127                    throws com.liferay.portal.kernel.exception.PortalException {
128                    try {
129                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
130                                            "deletePhone", _deletePhoneParameterTypes2);
131    
132                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
133    
134                            try {
135                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
136                            }
137                            catch (Exception e) {
138                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
139                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
140                                    }
141    
142                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
143                            }
144                    }
145                    catch (com.liferay.portal.kernel.exception.SystemException se) {
146                            _log.error(se, se);
147    
148                            throw se;
149                    }
150            }
151    
152            public static com.liferay.portal.model.Phone getPhone(
153                    HttpPrincipal httpPrincipal, long phoneId)
154                    throws com.liferay.portal.kernel.exception.PortalException {
155                    try {
156                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
157                                            "getPhone", _getPhoneParameterTypes3);
158    
159                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
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.portal.model.Phone)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 java.util.List<com.liferay.portal.model.Phone> getPhones(
184                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
185                    throws com.liferay.portal.kernel.exception.PortalException {
186                    try {
187                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
188                                            "getPhones", _getPhonesParameterTypes4);
189    
190                            MethodHandler methodHandler = new MethodHandler(methodKey,
191                                            className, classPK);
192    
193                            Object returnObj = null;
194    
195                            try {
196                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
197                            }
198                            catch (Exception e) {
199                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
200                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
201                                    }
202    
203                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
204                            }
205    
206                            return (java.util.List<com.liferay.portal.model.Phone>)returnObj;
207                    }
208                    catch (com.liferay.portal.kernel.exception.SystemException se) {
209                            _log.error(se, se);
210    
211                            throw se;
212                    }
213            }
214    
215            public static com.liferay.portal.model.Phone updatePhone(
216                    HttpPrincipal httpPrincipal, long phoneId, java.lang.String number,
217                    java.lang.String extension, long typeId, boolean primary)
218                    throws com.liferay.portal.kernel.exception.PortalException {
219                    try {
220                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
221                                            "updatePhone", _updatePhoneParameterTypes5);
222    
223                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId,
224                                            number, extension, typeId, primary);
225    
226                            Object returnObj = null;
227    
228                            try {
229                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
230                            }
231                            catch (Exception e) {
232                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
233                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
234                                    }
235    
236                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
237                            }
238    
239                            return (com.liferay.portal.model.Phone)returnObj;
240                    }
241                    catch (com.liferay.portal.kernel.exception.SystemException se) {
242                            _log.error(se, se);
243    
244                            throw se;
245                    }
246            }
247    
248            private static Log _log = LogFactoryUtil.getLog(PhoneServiceHttp.class);
249            private static final Class<?>[] _addPhoneParameterTypes0 = new Class[] {
250                            java.lang.String.class, long.class, java.lang.String.class,
251                            java.lang.String.class, long.class, boolean.class
252                    };
253            private static final Class<?>[] _addPhoneParameterTypes1 = new Class[] {
254                            java.lang.String.class, long.class, java.lang.String.class,
255                            java.lang.String.class, long.class, boolean.class,
256                            com.liferay.portal.service.ServiceContext.class
257                    };
258            private static final Class<?>[] _deletePhoneParameterTypes2 = new Class[] {
259                            long.class
260                    };
261            private static final Class<?>[] _getPhoneParameterTypes3 = new Class[] {
262                            long.class
263                    };
264            private static final Class<?>[] _getPhonesParameterTypes4 = new Class[] {
265                            java.lang.String.class, long.class
266                    };
267            private static final Class<?>[] _updatePhoneParameterTypes5 = new Class[] {
268                            long.class, java.lang.String.class, java.lang.String.class,
269                            long.class, boolean.class
270                    };
271    }