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.util.MethodHandler;
023    import com.liferay.portal.kernel.util.MethodKey;
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                    com.liferay.portal.service.ServiceContext serviceContext)
061                    throws com.liferay.portal.kernel.exception.PortalException {
062                    try {
063                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
064                                            "addPhone", _addPhoneParameterTypes0);
065    
066                            MethodHandler methodHandler = new MethodHandler(methodKey,
067                                            className, classPK, number, extension, typeId, primary,
068                                            serviceContext);
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.portal.model.Phone)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 deletePhone(HttpPrincipal httpPrincipal, long phoneId)
093                    throws com.liferay.portal.kernel.exception.PortalException {
094                    try {
095                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
096                                            "deletePhone", _deletePhoneParameterTypes1);
097    
098                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
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.portal.model.Phone getPhone(
119                    HttpPrincipal httpPrincipal, long phoneId)
120                    throws com.liferay.portal.kernel.exception.PortalException {
121                    try {
122                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
123                                            "getPhone", _getPhoneParameterTypes2);
124    
125                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
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.portal.model.Phone)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 java.util.List<com.liferay.portal.model.Phone> getPhones(
150                    HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
151                    throws com.liferay.portal.kernel.exception.PortalException {
152                    try {
153                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
154                                            "getPhones", _getPhonesParameterTypes3);
155    
156                            MethodHandler methodHandler = new MethodHandler(methodKey,
157                                            className, classPK);
158    
159                            Object returnObj = null;
160    
161                            try {
162                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
163                            }
164                            catch (Exception e) {
165                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
166                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
167                                    }
168    
169                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
170                            }
171    
172                            return (java.util.List<com.liferay.portal.model.Phone>)returnObj;
173                    }
174                    catch (com.liferay.portal.kernel.exception.SystemException se) {
175                            _log.error(se, se);
176    
177                            throw se;
178                    }
179            }
180    
181            public static com.liferay.portal.model.Phone updatePhone(
182                    HttpPrincipal httpPrincipal, long phoneId, java.lang.String number,
183                    java.lang.String extension, long typeId, boolean primary)
184                    throws com.liferay.portal.kernel.exception.PortalException {
185                    try {
186                            MethodKey methodKey = new MethodKey(PhoneServiceUtil.class,
187                                            "updatePhone", _updatePhoneParameterTypes4);
188    
189                            MethodHandler methodHandler = new MethodHandler(methodKey, phoneId,
190                                            number, extension, typeId, primary);
191    
192                            Object returnObj = null;
193    
194                            try {
195                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
196                            }
197                            catch (Exception e) {
198                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
199                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
200                                    }
201    
202                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
203                            }
204    
205                            return (com.liferay.portal.model.Phone)returnObj;
206                    }
207                    catch (com.liferay.portal.kernel.exception.SystemException se) {
208                            _log.error(se, se);
209    
210                            throw se;
211                    }
212            }
213    
214            private static Log _log = LogFactoryUtil.getLog(PhoneServiceHttp.class);
215            private static final Class<?>[] _addPhoneParameterTypes0 = new Class[] {
216                            java.lang.String.class, long.class, java.lang.String.class,
217                            java.lang.String.class, long.class, boolean.class,
218                            com.liferay.portal.service.ServiceContext.class
219                    };
220            private static final Class<?>[] _deletePhoneParameterTypes1 = new Class[] {
221                            long.class
222                    };
223            private static final Class<?>[] _getPhoneParameterTypes2 = new Class[] {
224                            long.class
225                    };
226            private static final Class<?>[] _getPhonesParameterTypes3 = new Class[] {
227                            java.lang.String.class, long.class
228                    };
229            private static final Class<?>[] _updatePhoneParameterTypes4 = new Class[] {
230                            long.class, java.lang.String.class, java.lang.String.class,
231                            long.class, boolean.class
232                    };
233    }