1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.EmailAddressServiceUtil;
26  
27  /**
28   * <a href="EmailAddressServiceHttp.java.html"><b><i>View Source</i></b></a>
29   *
30   * <p>
31   * ServiceBuilder generated this class. Modifications in this class will be
32   * overwritten the next time is generated.
33   * </p>
34   *
35   * <p>
36   * This class provides a HTTP utility for the
37   * {@link com.liferay.portal.service.EmailAddressServiceUtil} service utility. The
38   * static methods of this class calls the same methods of the service utility.
39   * However, the signatures are different because it requires an additional
40   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
41   * </p>
42   *
43   * <p>
44   * The benefits of using the HTTP utility is that it is fast and allows for
45   * tunneling without the cost of serializing to text. The drawback is that it
46   * only works with Java.
47   * </p>
48   *
49   * <p>
50   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
51   * configure security.
52   * </p>
53   *
54   * <p>
55   * The HTTP utility is only generated for remote services.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       EmailAddressServiceSoap
60   * @see       com.liferay.portal.security.auth.HttpPrincipal
61   * @see       com.liferay.portal.service.EmailAddressServiceUtil
62   * @generated
63   */
64  public class EmailAddressServiceHttp {
65      public static com.liferay.portal.model.EmailAddress addEmailAddress(
66          HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
67          java.lang.String address, int typeId, boolean primary)
68          throws com.liferay.portal.kernel.exception.PortalException,
69              com.liferay.portal.kernel.exception.SystemException {
70          try {
71              Object paramObj0 = className;
72  
73              if (className == null) {
74                  paramObj0 = new NullWrapper("java.lang.String");
75              }
76  
77              Object paramObj1 = new LongWrapper(classPK);
78  
79              Object paramObj2 = address;
80  
81              if (address == null) {
82                  paramObj2 = new NullWrapper("java.lang.String");
83              }
84  
85              Object paramObj3 = new IntegerWrapper(typeId);
86  
87              Object paramObj4 = new BooleanWrapper(primary);
88  
89              MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
90                      "addEmailAddress",
91                      new Object[] {
92                          paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
93                      });
94  
95              Object returnObj = null;
96  
97              try {
98                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
99              }
100             catch (Exception e) {
101                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
102                     throw (com.liferay.portal.kernel.exception.PortalException)e;
103                 }
104 
105                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
106                     throw (com.liferay.portal.kernel.exception.SystemException)e;
107                 }
108 
109                 throw new com.liferay.portal.kernel.exception.SystemException(e);
110             }
111 
112             return (com.liferay.portal.model.EmailAddress)returnObj;
113         }
114         catch (com.liferay.portal.kernel.exception.SystemException se) {
115             _log.error(se, se);
116 
117             throw se;
118         }
119     }
120 
121     public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
122         long emailAddressId)
123         throws com.liferay.portal.kernel.exception.PortalException,
124             com.liferay.portal.kernel.exception.SystemException {
125         try {
126             Object paramObj0 = new LongWrapper(emailAddressId);
127 
128             MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
129                     "deleteEmailAddress", 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.EmailAddress getEmailAddress(
154         HttpPrincipal httpPrincipal, long emailAddressId)
155         throws com.liferay.portal.kernel.exception.PortalException,
156             com.liferay.portal.kernel.exception.SystemException {
157         try {
158             Object paramObj0 = new LongWrapper(emailAddressId);
159 
160             MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
161                     "getEmailAddress", 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.EmailAddress)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.EmailAddress> getEmailAddresses(
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(EmailAddressServiceUtil.class.getName(),
203                     "getEmailAddresses", 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.EmailAddress>)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.EmailAddress updateEmailAddress(
232         HttpPrincipal httpPrincipal, long emailAddressId,
233         java.lang.String address, 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(emailAddressId);
238 
239             Object paramObj1 = address;
240 
241             if (address == null) {
242                 paramObj1 = new NullWrapper("java.lang.String");
243             }
244 
245             Object paramObj2 = new IntegerWrapper(typeId);
246 
247             Object paramObj3 = new BooleanWrapper(primary);
248 
249             MethodWrapper methodWrapper = new MethodWrapper(EmailAddressServiceUtil.class.getName(),
250                     "updateEmailAddress",
251                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
252 
253             Object returnObj = null;
254 
255             try {
256                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
257             }
258             catch (Exception e) {
259                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
260                     throw (com.liferay.portal.kernel.exception.PortalException)e;
261                 }
262 
263                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
264                     throw (com.liferay.portal.kernel.exception.SystemException)e;
265                 }
266 
267                 throw new com.liferay.portal.kernel.exception.SystemException(e);
268             }
269 
270             return (com.liferay.portal.model.EmailAddress)returnObj;
271         }
272         catch (com.liferay.portal.kernel.exception.SystemException se) {
273             _log.error(se, se);
274 
275             throw se;
276         }
277     }
278 
279     private static Log _log = LogFactoryUtil.getLog(EmailAddressServiceHttp.class);
280 }