001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.BooleanWrapper;
026: import com.liferay.portal.kernel.util.IntegerWrapper;
027: import com.liferay.portal.kernel.util.LongWrapper;
028: import com.liferay.portal.kernel.util.MethodWrapper;
029: import com.liferay.portal.kernel.util.NullWrapper;
030: import com.liferay.portal.security.auth.HttpPrincipal;
031: import com.liferay.portal.service.EmailAddressServiceUtil;
032:
033: /**
034: * <a href="EmailAddressServiceHttp.java.html"><b><i>View Source</i></b></a>
035: *
036: * <p>
037: * ServiceBuilder generated this class. Modifications in this class will be
038: * overwritten the next time is generated.
039: * </p>
040: *
041: * <p>
042: * This class provides a HTTP utility for the
043: * <code>com.liferay.portal.service.EmailAddressServiceUtil</code> service
044: * utility. The static methods of this class calls the same methods of the
045: * service utility. However, the signatures are different because it requires an
046: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
047: * parameter.
048: * </p>
049: *
050: * <p>
051: * The benefits of using the HTTP utility is that it is fast and allows for
052: * tunneling without the cost of serializing to text. The drawback is that it
053: * only works with Java.
054: * </p>
055: *
056: * <p>
057: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
058: * portal.properties to configure security.
059: * </p>
060: *
061: * <p>
062: * The HTTP utility is only generated for remote services.
063: * </p>
064: *
065: * @author Brian Wing Shun Chan
066: *
067: * @see com.liferay.portal.security.auth.HttpPrincipal
068: * @see com.liferay.portal.service.EmailAddressServiceUtil
069: * @see com.liferay.portal.service.http.EmailAddressServiceSoap
070: *
071: */
072: public class EmailAddressServiceHttp {
073: public static com.liferay.portal.model.EmailAddress addEmailAddress(
074: HttpPrincipal httpPrincipal, java.lang.String className,
075: long classPK, java.lang.String address, int typeId,
076: boolean primary) throws com.liferay.portal.SystemException,
077: com.liferay.portal.PortalException {
078: try {
079: Object paramObj0 = className;
080:
081: if (className == null) {
082: paramObj0 = new NullWrapper("java.lang.String");
083: }
084:
085: Object paramObj1 = new LongWrapper(classPK);
086:
087: Object paramObj2 = address;
088:
089: if (address == null) {
090: paramObj2 = new NullWrapper("java.lang.String");
091: }
092:
093: Object paramObj3 = new IntegerWrapper(typeId);
094:
095: Object paramObj4 = new BooleanWrapper(primary);
096:
097: MethodWrapper methodWrapper = new MethodWrapper(
098: EmailAddressServiceUtil.class.getName(),
099: "addEmailAddress",
100: new Object[] { paramObj0, paramObj1, paramObj2,
101: paramObj3, paramObj4 });
102:
103: Object returnObj = null;
104:
105: try {
106: returnObj = TunnelUtil.invoke(httpPrincipal,
107: methodWrapper);
108: } catch (Exception e) {
109: if (e instanceof com.liferay.portal.SystemException) {
110: throw (com.liferay.portal.SystemException) e;
111: }
112:
113: if (e instanceof com.liferay.portal.PortalException) {
114: throw (com.liferay.portal.PortalException) e;
115: }
116:
117: throw new com.liferay.portal.SystemException(e);
118: }
119:
120: return (com.liferay.portal.model.EmailAddress) returnObj;
121: } catch (com.liferay.portal.SystemException se) {
122: _log.error(se, se);
123:
124: throw se;
125: }
126: }
127:
128: public static void deleteEmailAddress(HttpPrincipal httpPrincipal,
129: long emailAddressId)
130: throws com.liferay.portal.SystemException,
131: com.liferay.portal.PortalException {
132: try {
133: Object paramObj0 = new LongWrapper(emailAddressId);
134:
135: MethodWrapper methodWrapper = new MethodWrapper(
136: EmailAddressServiceUtil.class.getName(),
137: "deleteEmailAddress", new Object[] { paramObj0 });
138:
139: try {
140: TunnelUtil.invoke(httpPrincipal, methodWrapper);
141: } catch (Exception e) {
142: if (e instanceof com.liferay.portal.SystemException) {
143: throw (com.liferay.portal.SystemException) e;
144: }
145:
146: if (e instanceof com.liferay.portal.PortalException) {
147: throw (com.liferay.portal.PortalException) e;
148: }
149:
150: throw new com.liferay.portal.SystemException(e);
151: }
152: } catch (com.liferay.portal.SystemException se) {
153: _log.error(se, se);
154:
155: throw se;
156: }
157: }
158:
159: public static com.liferay.portal.model.EmailAddress getEmailAddress(
160: HttpPrincipal httpPrincipal, long emailAddressId)
161: throws com.liferay.portal.SystemException,
162: com.liferay.portal.PortalException {
163: try {
164: Object paramObj0 = new LongWrapper(emailAddressId);
165:
166: MethodWrapper methodWrapper = new MethodWrapper(
167: EmailAddressServiceUtil.class.getName(),
168: "getEmailAddress", new Object[] { paramObj0 });
169:
170: Object returnObj = null;
171:
172: try {
173: returnObj = TunnelUtil.invoke(httpPrincipal,
174: methodWrapper);
175: } catch (Exception e) {
176: if (e instanceof com.liferay.portal.SystemException) {
177: throw (com.liferay.portal.SystemException) e;
178: }
179:
180: if (e instanceof com.liferay.portal.PortalException) {
181: throw (com.liferay.portal.PortalException) e;
182: }
183:
184: throw new com.liferay.portal.SystemException(e);
185: }
186:
187: return (com.liferay.portal.model.EmailAddress) returnObj;
188: } catch (com.liferay.portal.SystemException se) {
189: _log.error(se, se);
190:
191: throw se;
192: }
193: }
194:
195: public static java.util.List getEmailAddresses(
196: HttpPrincipal httpPrincipal, java.lang.String className,
197: long classPK) throws com.liferay.portal.SystemException,
198: com.liferay.portal.PortalException {
199: try {
200: Object paramObj0 = className;
201:
202: if (className == null) {
203: paramObj0 = new NullWrapper("java.lang.String");
204: }
205:
206: Object paramObj1 = new LongWrapper(classPK);
207:
208: MethodWrapper methodWrapper = new MethodWrapper(
209: EmailAddressServiceUtil.class.getName(),
210: "getEmailAddresses", new Object[] { paramObj0,
211: paramObj1 });
212:
213: Object returnObj = null;
214:
215: try {
216: returnObj = TunnelUtil.invoke(httpPrincipal,
217: methodWrapper);
218: } catch (Exception e) {
219: if (e instanceof com.liferay.portal.SystemException) {
220: throw (com.liferay.portal.SystemException) e;
221: }
222:
223: if (e instanceof com.liferay.portal.PortalException) {
224: throw (com.liferay.portal.PortalException) e;
225: }
226:
227: throw new com.liferay.portal.SystemException(e);
228: }
229:
230: return (java.util.List) returnObj;
231: } catch (com.liferay.portal.SystemException se) {
232: _log.error(se, se);
233:
234: throw se;
235: }
236: }
237:
238: public static com.liferay.portal.model.EmailAddress updateEmailAddress(
239: HttpPrincipal httpPrincipal, long emailAddressId,
240: java.lang.String address, int typeId, boolean primary)
241: throws com.liferay.portal.SystemException,
242: com.liferay.portal.PortalException {
243: try {
244: Object paramObj0 = new LongWrapper(emailAddressId);
245:
246: Object paramObj1 = address;
247:
248: if (address == null) {
249: paramObj1 = new NullWrapper("java.lang.String");
250: }
251:
252: Object paramObj2 = new IntegerWrapper(typeId);
253:
254: Object paramObj3 = new BooleanWrapper(primary);
255:
256: MethodWrapper methodWrapper = new MethodWrapper(
257: EmailAddressServiceUtil.class.getName(),
258: "updateEmailAddress", new Object[] { paramObj0,
259: paramObj1, paramObj2, paramObj3 });
260:
261: Object returnObj = null;
262:
263: try {
264: returnObj = TunnelUtil.invoke(httpPrincipal,
265: methodWrapper);
266: } catch (Exception e) {
267: if (e instanceof com.liferay.portal.SystemException) {
268: throw (com.liferay.portal.SystemException) e;
269: }
270:
271: if (e instanceof com.liferay.portal.PortalException) {
272: throw (com.liferay.portal.PortalException) e;
273: }
274:
275: throw new com.liferay.portal.SystemException(e);
276: }
277:
278: return (com.liferay.portal.model.EmailAddress) returnObj;
279: } catch (com.liferay.portal.SystemException se) {
280: _log.error(se, se);
281:
282: throw se;
283: }
284: }
285:
286: private static Log _log = LogFactoryUtil
287: .getLog(EmailAddressServiceHttp.class);
288: }
|