1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.PhoneServiceUtil;
23  
24  /**
25   * <a href="PhoneServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.PhoneServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       PhoneServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.PhoneServiceUtil
59   * @generated
60   */
61  public class PhoneServiceHttp {
62      public static com.liferay.portal.model.Phone addPhone(
63          HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
64          java.lang.String number, java.lang.String extension, int typeId,
65          boolean primary)
66          throws com.liferay.portal.PortalException,
67              com.liferay.portal.SystemException {
68          try {
69              MethodKey methodKey = new MethodKey(PhoneServiceUtil.class.getName(),
70                      "addPhone", _addPhoneParameterTypes0);
71  
72              MethodHandler methodHandler = new MethodHandler(methodKey,
73                      className, classPK, number, extension, typeId, primary);
74  
75              Object returnObj = null;
76  
77              try {
78                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
79              }
80              catch (Exception e) {
81                  if (e instanceof com.liferay.portal.PortalException) {
82                      throw (com.liferay.portal.PortalException)e;
83                  }
84  
85                  if (e instanceof com.liferay.portal.SystemException) {
86                      throw (com.liferay.portal.SystemException)e;
87                  }
88  
89                  throw new com.liferay.portal.SystemException(e);
90              }
91  
92              return (com.liferay.portal.model.Phone)returnObj;
93          }
94          catch (com.liferay.portal.SystemException se) {
95              _log.error(se, se);
96  
97              throw se;
98          }
99      }
100 
101     public static void deletePhone(HttpPrincipal httpPrincipal, long phoneId)
102         throws com.liferay.portal.PortalException,
103             com.liferay.portal.SystemException {
104         try {
105             MethodKey methodKey = new MethodKey(PhoneServiceUtil.class.getName(),
106                     "deletePhone", _deletePhoneParameterTypes1);
107 
108             MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
109 
110             try {
111                 TunnelUtil.invoke(httpPrincipal, methodHandler);
112             }
113             catch (Exception e) {
114                 if (e instanceof com.liferay.portal.PortalException) {
115                     throw (com.liferay.portal.PortalException)e;
116                 }
117 
118                 if (e instanceof com.liferay.portal.SystemException) {
119                     throw (com.liferay.portal.SystemException)e;
120                 }
121 
122                 throw new com.liferay.portal.SystemException(e);
123             }
124         }
125         catch (com.liferay.portal.SystemException se) {
126             _log.error(se, se);
127 
128             throw se;
129         }
130     }
131 
132     public static com.liferay.portal.model.Phone getPhone(
133         HttpPrincipal httpPrincipal, long phoneId)
134         throws com.liferay.portal.PortalException,
135             com.liferay.portal.SystemException {
136         try {
137             MethodKey methodKey = new MethodKey(PhoneServiceUtil.class.getName(),
138                     "getPhone", _getPhoneParameterTypes2);
139 
140             MethodHandler methodHandler = new MethodHandler(methodKey, phoneId);
141 
142             Object returnObj = null;
143 
144             try {
145                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
146             }
147             catch (Exception e) {
148                 if (e instanceof com.liferay.portal.PortalException) {
149                     throw (com.liferay.portal.PortalException)e;
150                 }
151 
152                 if (e instanceof com.liferay.portal.SystemException) {
153                     throw (com.liferay.portal.SystemException)e;
154                 }
155 
156                 throw new com.liferay.portal.SystemException(e);
157             }
158 
159             return (com.liferay.portal.model.Phone)returnObj;
160         }
161         catch (com.liferay.portal.SystemException se) {
162             _log.error(se, se);
163 
164             throw se;
165         }
166     }
167 
168     public static java.util.List<com.liferay.portal.model.Phone> getPhones(
169         HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
170         throws com.liferay.portal.PortalException,
171             com.liferay.portal.SystemException {
172         try {
173             MethodKey methodKey = new MethodKey(PhoneServiceUtil.class.getName(),
174                     "getPhones", _getPhonesParameterTypes3);
175 
176             MethodHandler methodHandler = new MethodHandler(methodKey,
177                     className, classPK);
178 
179             Object returnObj = null;
180 
181             try {
182                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
183             }
184             catch (Exception e) {
185                 if (e instanceof com.liferay.portal.PortalException) {
186                     throw (com.liferay.portal.PortalException)e;
187                 }
188 
189                 if (e instanceof com.liferay.portal.SystemException) {
190                     throw (com.liferay.portal.SystemException)e;
191                 }
192 
193                 throw new com.liferay.portal.SystemException(e);
194             }
195 
196             return (java.util.List<com.liferay.portal.model.Phone>)returnObj;
197         }
198         catch (com.liferay.portal.SystemException se) {
199             _log.error(se, se);
200 
201             throw se;
202         }
203     }
204 
205     public static com.liferay.portal.model.Phone updatePhone(
206         HttpPrincipal httpPrincipal, long phoneId, java.lang.String number,
207         java.lang.String extension, int typeId, boolean primary)
208         throws com.liferay.portal.PortalException,
209             com.liferay.portal.SystemException {
210         try {
211             MethodKey methodKey = new MethodKey(PhoneServiceUtil.class.getName(),
212                     "updatePhone", _updatePhoneParameterTypes4);
213 
214             MethodHandler methodHandler = new MethodHandler(methodKey, phoneId,
215                     number, extension, typeId, primary);
216 
217             Object returnObj = null;
218 
219             try {
220                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
221             }
222             catch (Exception e) {
223                 if (e instanceof com.liferay.portal.PortalException) {
224                     throw (com.liferay.portal.PortalException)e;
225                 }
226 
227                 if (e instanceof com.liferay.portal.SystemException) {
228                     throw (com.liferay.portal.SystemException)e;
229                 }
230 
231                 throw new com.liferay.portal.SystemException(e);
232             }
233 
234             return (com.liferay.portal.model.Phone)returnObj;
235         }
236         catch (com.liferay.portal.SystemException se) {
237             _log.error(se, se);
238 
239             throw se;
240         }
241     }
242 
243     private static Log _log = LogFactoryUtil.getLog(PhoneServiceHttp.class);
244     private static final Class<?>[] _addPhoneParameterTypes0 = new Class[] {
245             java.lang.String.class, long.class, java.lang.String.class,
246             java.lang.String.class, int.class, boolean.class
247         };
248     private static final Class<?>[] _deletePhoneParameterTypes1 = new Class[] {
249             long.class
250         };
251     private static final Class<?>[] _getPhoneParameterTypes2 = new Class[] {
252             long.class
253         };
254     private static final Class<?>[] _getPhonesParameterTypes3 = new Class[] {
255             java.lang.String.class, long.class
256         };
257     private static final Class<?>[] _updatePhoneParameterTypes4 = new Class[] {
258             long.class, java.lang.String.class, java.lang.String.class,
259             int.class, boolean.class
260         };
261 }