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.security.auth.HttpPrincipal;
022    import com.liferay.portal.kernel.service.PhoneServiceUtil;
023    import com.liferay.portal.kernel.service.http.TunnelUtil;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    
027    /**
028     * Provides the HTTP utility for the
029     * {@link PhoneServiceUtil} 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 HttpPrincipal} parameter.
033     *
034     * <p>
035     * The benefits of using the HTTP utility is that it is fast and allows for
036     * tunneling without the cost of serializing to text. The drawback is that it
037     * only works with Java.
038     * </p>
039     *
040     * <p>
041     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
042     * configure security.
043     * </p>
044     *
045     * <p>
046     * The HTTP utility is only generated for remote services.
047     * </p>
048     *
049     * @author Brian Wing Shun Chan
050     * @see PhoneServiceSoap
051     * @see HttpPrincipal
052     * @see PhoneServiceUtil
053     * @generated
054     */
055    @ProviderType
056    public class PhoneServiceHttp {
057            public static com.liferay.portal.kernel.model.Phone addPhone(
058                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
059                    java.lang.String number, java.lang.String extension, long typeId,
060                    boolean primary,
061                    com.liferay.portal.kernel.service.ServiceContext serviceContext)
062                    throws com.liferay.portal.kernel.exception.PortalException {
063                    try {
064                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
065                                            "addPhone", _addPhoneParameterTypes0);
066    
067                            MethodHandler methodHandler = new MethodHandler(methodKey,
068                                            className, classPK, number, extension, typeId, primary,
069                                            serviceContext);
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
082                            }
083    
084                            return (com.liferay.portal.kernel.model.Phone)returnObj;
085                    }
086                    catch (com.liferay.portal.kernel.exception.SystemException se) {
087                            _log.error(se, se);
088    
089                            throw se;
090                    }
091            }
092    
093            public static void deletePhone(HttpPrincipal httpPrincipal, long phoneId)
094                    throws com.liferay.portal.kernel.exception.PortalException {
095                    try {
096                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
097                                            "deletePhone", _deletePhoneParameterTypes1);
098    
099                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
100    
101                            try {
102                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
103                            }
104                            catch (Exception e) {
105                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
106                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
107                                    }
108    
109                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
110                            }
111                    }
112                    catch (com.liferay.portal.kernel.exception.SystemException se) {
113                            _log.error(se, se);
114    
115                            throw se;
116                    }
117            }
118    
119            public static com.liferay.portal.kernel.model.Phone getPhone(
120                    HttpPrincipal httpPrincipal, long phoneId)
121                    throws com.liferay.portal.kernel.exception.PortalException {
122                    try {
123                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
124                                            "getPhone", _getPhoneParameterTypes2);
125    
126                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
127    
128                            Object returnObj = null;
129    
130                            try {
131                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
132                            }
133                            catch (Exception e) {
134                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
135                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
136                                    }
137    
138                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
139                            }
140    
141                            return (com.liferay.portal.kernel.model.Phone)returnObj;
142                    }
143                    catch (com.liferay.portal.kernel.exception.SystemException se) {
144                            _log.error(se, se);
145    
146                            throw se;
147                    }
148            }
149    
150            public static java.util.List<com.liferay.portal.kernel.model.Phone> getPhones(
151                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
152                    throws com.liferay.portal.kernel.exception.PortalException {
153                    try {
154                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
155                                            "getPhones", _getPhonesParameterTypes3);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey,
158                                            className, classPK);
159    
160                            Object returnObj = null;
161    
162                            try {
163                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
164                            }
165                            catch (Exception e) {
166                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
167                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
168                                    }
169    
170                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
171                            }
172    
173                            return (java.util.List<com.liferay.portal.kernel.model.Phone>)returnObj;
174                    }
175                    catch (com.liferay.portal.kernel.exception.SystemException se) {
176                            _log.error(se, se);
177    
178                            throw se;
179                    }
180            }
181    
182            public static com.liferay.portal.kernel.model.Phone updatePhone(
183                    HttpPrincipal httpPrincipal, long phoneId, java.lang.String number,
184                    java.lang.String extension, long typeId, boolean primary)
185                    throws com.liferay.portal.kernel.exception.PortalException {
186                    try {
187                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
188                                            "updatePhone", _updatePhoneParameterTypes4);
189    
190                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId,
191                                            number, extension, typeId, primary);
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 (com.liferay.portal.kernel.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            private static Log _log = LogFactoryUtil.getLog(PhoneServiceHttp.class);
216            private static final Class<?>[] _addPhoneParameterTypes0 = new Class[] {
217                            java.lang.String.class, long.class, java.lang.String.class,
218                            java.lang.String.class, long.class, boolean.class,
219                            com.liferay.portal.kernel.service.ServiceContext.class
220                    };
221            private static final Class<?>[] _deletePhoneParameterTypes1 = new Class[] {
222                            long.class
223                    };
224            private static final Class<?>[] _getPhoneParameterTypes2 = new Class[] {
225                            long.class
226                    };
227            private static final Class<?>[] _getPhonesParameterTypes3 = new Class[] {
228                            java.lang.String.class, long.class
229                    };
230            private static final Class<?>[] _updatePhoneParameterTypes4 = new Class[] {
231                            long.class, java.lang.String.class, java.lang.String.class,
232                            long.class, boolean.class
233                    };
234    }