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.EmailAddressServiceUtil;
23  
24  /**
25   * <a href="EmailAddressServiceHttp.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.EmailAddressServiceUtil} 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       EmailAddressServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.EmailAddressServiceUtil
59   * @generated
60   */
61  public class EmailAddressServiceHttp {
62      public static com.liferay.portal.model.EmailAddress addEmailAddress(
63          HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
64          java.lang.String address, int typeId, boolean primary)
65          throws com.liferay.portal.PortalException,
66              com.liferay.portal.SystemException {
67          try {
68              MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class.getName(),
69                      "addEmailAddress", _addEmailAddressParameterTypes0);
70  
71              MethodHandler methodHandler = new MethodHandler(methodKey,
72                      className, classPK, address, typeId, primary);
73  
74              Object returnObj = null;
75  
76              try {
77                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
78              }
79              catch (Exception e) {
80                  if (e instanceof com.liferay.portal.PortalException) {
81                      throw (com.liferay.portal.PortalException)e;
82                  }
83  
84                  if (e instanceof com.liferay.portal.SystemException) {
85                      throw (com.liferay.portal.SystemException)e;
86                  }
87  
88                  throw new com.liferay.portal.SystemException(e);
89              }
90  
91              return (com.liferay.portal.model.EmailAddress)returnObj;
92          }
93          catch (com.liferay.portal.SystemException se) {
94              _log.error(se, se);
95  
96              throw se;
97          }
98      }
99  
100     public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
101         long emailAddressId)
102         throws com.liferay.portal.PortalException,
103             com.liferay.portal.SystemException {
104         try {
105             MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class.getName(),
106                     "deleteEmailAddress", _deleteEmailAddressParameterTypes1);
107 
108             MethodHandler methodHandler = new MethodHandler(methodKey,
109                     emailAddressId);
110 
111             try {
112                 TunnelUtil.invoke(httpPrincipal, methodHandler);
113             }
114             catch (Exception e) {
115                 if (e instanceof com.liferay.portal.PortalException) {
116                     throw (com.liferay.portal.PortalException)e;
117                 }
118 
119                 if (e instanceof com.liferay.portal.SystemException) {
120                     throw (com.liferay.portal.SystemException)e;
121                 }
122 
123                 throw new com.liferay.portal.SystemException(e);
124             }
125         }
126         catch (com.liferay.portal.SystemException se) {
127             _log.error(se, se);
128 
129             throw se;
130         }
131     }
132 
133     public static com.liferay.portal.model.EmailAddress getEmailAddress(
134         HttpPrincipal httpPrincipal, long emailAddressId)
135         throws com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException {
137         try {
138             MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class.getName(),
139                     "getEmailAddress", _getEmailAddressParameterTypes2);
140 
141             MethodHandler methodHandler = new MethodHandler(methodKey,
142                     emailAddressId);
143 
144             Object returnObj = null;
145 
146             try {
147                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148             }
149             catch (Exception e) {
150                 if (e instanceof com.liferay.portal.PortalException) {
151                     throw (com.liferay.portal.PortalException)e;
152                 }
153 
154                 if (e instanceof com.liferay.portal.SystemException) {
155                     throw (com.liferay.portal.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.SystemException(e);
159             }
160 
161             return (com.liferay.portal.model.EmailAddress)returnObj;
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static java.util.List<com.liferay.portal.model.EmailAddress> getEmailAddresses(
171         HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
172         throws com.liferay.portal.PortalException,
173             com.liferay.portal.SystemException {
174         try {
175             MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class.getName(),
176                     "getEmailAddresses", _getEmailAddressesParameterTypes3);
177 
178             MethodHandler methodHandler = new MethodHandler(methodKey,
179                     className, classPK);
180 
181             Object returnObj = null;
182 
183             try {
184                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
185             }
186             catch (Exception e) {
187                 if (e instanceof com.liferay.portal.PortalException) {
188                     throw (com.liferay.portal.PortalException)e;
189                 }
190 
191                 if (e instanceof com.liferay.portal.SystemException) {
192                     throw (com.liferay.portal.SystemException)e;
193                 }
194 
195                 throw new com.liferay.portal.SystemException(e);
196             }
197 
198             return (java.util.List<com.liferay.portal.model.EmailAddress>)returnObj;
199         }
200         catch (com.liferay.portal.SystemException se) {
201             _log.error(se, se);
202 
203             throw se;
204         }
205     }
206 
207     public static com.liferay.portal.model.EmailAddress updateEmailAddress(
208         HttpPrincipal httpPrincipal, long emailAddressId,
209         java.lang.String address, int typeId, boolean primary)
210         throws com.liferay.portal.PortalException,
211             com.liferay.portal.SystemException {
212         try {
213             MethodKey methodKey = new MethodKey(EmailAddressServiceUtil.class.getName(),
214                     "updateEmailAddress", _updateEmailAddressParameterTypes4);
215 
216             MethodHandler methodHandler = new MethodHandler(methodKey,
217                     emailAddressId, address, typeId, primary);
218 
219             Object returnObj = null;
220 
221             try {
222                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
223             }
224             catch (Exception e) {
225                 if (e instanceof com.liferay.portal.PortalException) {
226                     throw (com.liferay.portal.PortalException)e;
227                 }
228 
229                 if (e instanceof com.liferay.portal.SystemException) {
230                     throw (com.liferay.portal.SystemException)e;
231                 }
232 
233                 throw new com.liferay.portal.SystemException(e);
234             }
235 
236             return (com.liferay.portal.model.EmailAddress)returnObj;
237         }
238         catch (com.liferay.portal.SystemException se) {
239             _log.error(se, se);
240 
241             throw se;
242         }
243     }
244 
245     private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
246     private static final Class<?>[] _addEmailAddressParameterTypes0 = new Class[] {
247             java.lang.String.class, long.class, java.lang.String.class,
248             int.class, boolean.class
249         };
250     private static final Class<?>[] _deleteEmailAddressParameterTypes1 = new Class[] {
251             long.class
252         };
253     private static final Class<?>[] _getEmailAddressParameterTypes2 = new Class[] {
254             long.class
255         };
256     private static final Class<?>[] _getEmailAddressesParameterTypes3 = new Class[] {
257             java.lang.String.class, long.class
258         };
259     private static final Class<?>[] _updateEmailAddressParameterTypes4 = new Class[] {
260             long.class, java.lang.String.class, int.class, boolean.class
261         };
262 }