| AnnouncementsDeliveryServiceHttp.java |
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.portlet.announcements.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.LongWrapper;
21 import com.liferay.portal.kernel.util.MethodWrapper;
22 import com.liferay.portal.kernel.util.NullWrapper;
23 import com.liferay.portal.security.auth.HttpPrincipal;
24 import com.liferay.portal.service.http.TunnelUtil;
25
26 import com.liferay.portlet.announcements.service.AnnouncementsDeliveryServiceUtil;
27
28 /**
29 * <a href="AnnouncementsDeliveryServiceHttp.java.html"><b><i>View Source</i></b></a>
30 *
31 * <p>
32 * ServiceBuilder generated this class. Modifications in this class will be
33 * overwritten the next time is generated.
34 * </p>
35 *
36 * <p>
37 * This class provides a HTTP utility for the
38 * {@link com.liferay.portlet.announcements.service.AnnouncementsDeliveryServiceUtil} service utility. The
39 * static methods of this class calls the same methods of the service utility.
40 * However, the signatures are different because it requires an additional
41 * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42 * </p>
43 *
44 * <p>
45 * The benefits of using the HTTP utility is that it is fast and allows for
46 * tunneling without the cost of serializing to text. The drawback is that it
47 * only works with Java.
48 * </p>
49 *
50 * <p>
51 * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52 * configure security.
53 * </p>
54 *
55 * <p>
56 * The HTTP utility is only generated for remote services.
57 * </p>
58 *
59 * @author Brian Wing Shun Chan
60 * @see AnnouncementsDeliveryServiceSoap
61 * @see com.liferay.portal.security.auth.HttpPrincipal
62 * @see com.liferay.portlet.announcements.service.AnnouncementsDeliveryServiceUtil
63 * @generated
64 */
65 public class AnnouncementsDeliveryServiceHttp {
66 public static com.liferay.portlet.announcements.model.AnnouncementsDelivery updateDelivery(
67 HttpPrincipal httpPrincipal, long userId, java.lang.String type,
68 boolean email, boolean sms, boolean website)
69 throws com.liferay.portal.kernel.exception.PortalException,
70 com.liferay.portal.kernel.exception.SystemException {
71 try {
72 Object paramObj0 = new LongWrapper(userId);
73
74 Object paramObj1 = type;
75
76 if (type == null) {
77 paramObj1 = new NullWrapper("java.lang.String");
78 }
79
80 Object paramObj2 = new BooleanWrapper(email);
81
82 Object paramObj3 = new BooleanWrapper(sms);
83
84 Object paramObj4 = new BooleanWrapper(website);
85
86 MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsDeliveryServiceUtil.class.getName(),
87 "updateDelivery",
88 new Object[] {
89 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4
90 });
91
92 Object returnObj = null;
93
94 try {
95 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
96 }
97 catch (Exception e) {
98 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
99 throw (com.liferay.portal.kernel.exception.PortalException)e;
100 }
101
102 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
103 throw (com.liferay.portal.kernel.exception.SystemException)e;
104 }
105
106 throw new com.liferay.portal.kernel.exception.SystemException(e);
107 }
108
109 return (com.liferay.portlet.announcements.model.AnnouncementsDelivery)returnObj;
110 }
111 catch (com.liferay.portal.kernel.exception.SystemException se) {
112 _log.error(se, se);
113
114 throw se;
115 }
116 }
117
118 private static Log _log = LogFactoryUtil.getLog(AnnouncementsDeliveryServiceHttp.class);
119 }