| AnnouncementsFlagServiceHttp.java |
1 /**
2 * Copyright (c) 2000-2009 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 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 */
19
20 package com.liferay.portlet.announcements.service.http;
21
22 import com.liferay.portal.kernel.log.Log;
23 import com.liferay.portal.kernel.log.LogFactoryUtil;
24 import com.liferay.portal.kernel.util.IntegerWrapper;
25 import com.liferay.portal.kernel.util.LongWrapper;
26 import com.liferay.portal.kernel.util.MethodWrapper;
27 import com.liferay.portal.security.auth.HttpPrincipal;
28 import com.liferay.portal.service.http.TunnelUtil;
29
30 import com.liferay.portlet.announcements.service.AnnouncementsFlagServiceUtil;
31
32 /**
33 * <a href="AnnouncementsFlagServiceHttp.java.html"><b><i>View Source</i></b></a>
34 *
35 * <p>
36 * ServiceBuilder generated this class. Modifications in this class will be
37 * overwritten the next time is generated.
38 * </p>
39 *
40 * <p>
41 * This class provides a HTTP utility for the
42 * <code>com.liferay.portlet.announcements.service.AnnouncementsFlagServiceUtil</code> service
43 * utility. The static methods of this class calls the same methods of the
44 * service utility. However, the signatures are different because it requires an
45 * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
46 * parameter.
47 * </p>
48 *
49 * <p>
50 * The benefits of using the HTTP utility is that it is fast and allows for
51 * tunneling without the cost of serializing to text. The drawback is that it
52 * only works with Java.
53 * </p>
54 *
55 * <p>
56 * Set the property <code>tunnel.servlet.hosts.allowed</code> in
57 * portal.properties to configure security.
58 * </p>
59 *
60 * <p>
61 * The HTTP utility is only generated for remote services.
62 * </p>
63 *
64 * @author Brian Wing Shun Chan
65 *
66 * @see com.liferay.portal.security.auth.HttpPrincipal
67 * @see com.liferay.portlet.announcements.service.AnnouncementsFlagServiceUtil
68 * @see com.liferay.portlet.announcements.service.http.AnnouncementsFlagServiceSoap
69 *
70 */
71 public class AnnouncementsFlagServiceHttp {
72 public static void addFlag(HttpPrincipal httpPrincipal, long entryId,
73 int value)
74 throws com.liferay.portal.PortalException,
75 com.liferay.portal.SystemException {
76 try {
77 Object paramObj0 = new LongWrapper(entryId);
78
79 Object paramObj1 = new IntegerWrapper(value);
80
81 MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsFlagServiceUtil.class.getName(),
82 "addFlag", new Object[] { paramObj0, paramObj1 });
83
84 try {
85 TunnelUtil.invoke(httpPrincipal, methodWrapper);
86 }
87 catch (Exception e) {
88 if (e instanceof com.liferay.portal.PortalException) {
89 throw (com.liferay.portal.PortalException)e;
90 }
91
92 if (e instanceof com.liferay.portal.SystemException) {
93 throw (com.liferay.portal.SystemException)e;
94 }
95
96 throw new com.liferay.portal.SystemException(e);
97 }
98 }
99 catch (com.liferay.portal.SystemException se) {
100 _log.error(se, se);
101
102 throw se;
103 }
104 }
105
106 public static com.liferay.portlet.announcements.model.AnnouncementsFlag getFlag(
107 HttpPrincipal httpPrincipal, long entryId, int value)
108 throws com.liferay.portal.PortalException,
109 com.liferay.portal.SystemException {
110 try {
111 Object paramObj0 = new LongWrapper(entryId);
112
113 Object paramObj1 = new IntegerWrapper(value);
114
115 MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsFlagServiceUtil.class.getName(),
116 "getFlag", new Object[] { paramObj0, paramObj1 });
117
118 Object returnObj = null;
119
120 try {
121 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
122 }
123 catch (Exception e) {
124 if (e instanceof com.liferay.portal.PortalException) {
125 throw (com.liferay.portal.PortalException)e;
126 }
127
128 if (e instanceof com.liferay.portal.SystemException) {
129 throw (com.liferay.portal.SystemException)e;
130 }
131
132 throw new com.liferay.portal.SystemException(e);
133 }
134
135 return (com.liferay.portlet.announcements.model.AnnouncementsFlag)returnObj;
136 }
137 catch (com.liferay.portal.SystemException se) {
138 _log.error(se, se);
139
140 throw se;
141 }
142 }
143
144 public static void deleteFlag(HttpPrincipal httpPrincipal, long flagId)
145 throws com.liferay.portal.PortalException,
146 com.liferay.portal.SystemException {
147 try {
148 Object paramObj0 = new LongWrapper(flagId);
149
150 MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsFlagServiceUtil.class.getName(),
151 "deleteFlag", new Object[] { paramObj0 });
152
153 try {
154 TunnelUtil.invoke(httpPrincipal, methodWrapper);
155 }
156 catch (Exception e) {
157 if (e instanceof com.liferay.portal.PortalException) {
158 throw (com.liferay.portal.PortalException)e;
159 }
160
161 if (e instanceof com.liferay.portal.SystemException) {
162 throw (com.liferay.portal.SystemException)e;
163 }
164
165 throw new com.liferay.portal.SystemException(e);
166 }
167 }
168 catch (com.liferay.portal.SystemException se) {
169 _log.error(se, se);
170
171 throw se;
172 }
173 }
174
175 private static Log _log = LogFactoryUtil.getLog(AnnouncementsFlagServiceHttp.class);
176 }