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