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