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