2 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
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)
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
15 package com.liferay.portal.service.http;
17 import com.liferay.portal.kernel.log.Log;
18 import com.liferay.portal.kernel.log.LogFactoryUtil;
19 import com.liferay.portal.kernel.util.MethodHandler;
20 import com.liferay.portal.kernel.util.MethodKey;
21 import com.liferay.portal.security.auth.HttpPrincipal;
22 import com.liferay.portal.service.MembershipRequestServiceUtil;
26 * This class provides a HTTP utility for the
27 * {@link com.liferay.portal.service.MembershipRequestServiceUtil} service utility. The
28 * static methods of this class calls the same methods of the service utility.
29 * However, the signatures are different because it requires an additional
30 * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
34 * The benefits of using the HTTP utility is that it is fast and allows for
35 * tunneling without the cost of serializing to text. The drawback is that it
36 * only works with Java.
40 * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
45 * The HTTP utility is only generated for remote services.
48 * @author Brian Wing Shun Chan
49 * @see MembershipRequestServiceSoap
50 * @see com.liferay.portal.security.auth.HttpPrincipal
51 * @see com.liferay.portal.service.MembershipRequestServiceUtil
54 public class MembershipRequestServiceHttp {
55 public static com.liferay.portal.model.MembershipRequest addMembershipRequest(
56 HttpPrincipal httpPrincipal, long groupId, java.lang.String comments,
57 com.liferay.portal.service.ServiceContext serviceContext)
58 throws com.liferay.portal.kernel.exception.PortalException,
59 com.liferay.portal.kernel.exception.SystemException {
61 MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
62 "addMembershipRequest", _addMembershipRequestParameterTypes0);
64 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
65 comments, serviceContext);
67 Object returnObj = null;
70 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
73 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
74 throw (com.liferay.portal.kernel.exception.PortalException)e;
77 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
78 throw (com.liferay.portal.kernel.exception.SystemException)e;
81 throw new com.liferay.portal.kernel.exception.SystemException(e);
84 return (com.liferay.portal.model.MembershipRequest)returnObj;
86 catch (com.liferay.portal.kernel.exception.SystemException se) {
93 public static void deleteMembershipRequests(HttpPrincipal httpPrincipal,
94 long groupId, int statusId)
95 throws com.liferay.portal.kernel.exception.PortalException,
96 com.liferay.portal.kernel.exception.SystemException {
98 MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
99 "deleteMembershipRequests",
100 _deleteMembershipRequestsParameterTypes1);
102 MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
106 TunnelUtil.invoke(httpPrincipal, methodHandler);
108 catch (Exception e) {
109 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
110 throw (com.liferay.portal.kernel.exception.PortalException)e;
113 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
114 throw (com.liferay.portal.kernel.exception.SystemException)e;
117 throw new com.liferay.portal.kernel.exception.SystemException(e);
120 catch (com.liferay.portal.kernel.exception.SystemException se) {
127 public static com.liferay.portal.model.MembershipRequest getMembershipRequest(
128 HttpPrincipal httpPrincipal, long membershipRequestId)
129 throws com.liferay.portal.kernel.exception.PortalException,
130 com.liferay.portal.kernel.exception.SystemException {
132 MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
133 "getMembershipRequest", _getMembershipRequestParameterTypes2);
135 MethodHandler methodHandler = new MethodHandler(methodKey,
136 membershipRequestId);
138 Object returnObj = null;
141 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
143 catch (Exception e) {
144 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
145 throw (com.liferay.portal.kernel.exception.PortalException)e;
148 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
149 throw (com.liferay.portal.kernel.exception.SystemException)e;
152 throw new com.liferay.portal.kernel.exception.SystemException(e);
155 return (com.liferay.portal.model.MembershipRequest)returnObj;
157 catch (com.liferay.portal.kernel.exception.SystemException se) {
164 public static java.util.List<com.liferay.portal.model.MembershipRequest> getMembershipRequestByUserId(
165 HttpPrincipal httpPrincipal, long userId)
166 throws com.liferay.portal.kernel.exception.PortalException,
167 com.liferay.portal.kernel.exception.SystemException {
169 MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
170 "getMembershipRequest", long.class);
172 MethodHandler methodHandler = new MethodHandler(methodKey,
175 Object returnObj = null;
178 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
180 catch (Exception e) {
181 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182 throw (com.liferay.portal.kernel.exception.PortalException)e;
185 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186 throw (com.liferay.portal.kernel.exception.SystemException)e;
189 throw new com.liferay.portal.kernel.exception.SystemException(e);
192 return (java.util.List<com.liferay.portal.model.MembershipRequest>)returnObj;
194 catch (com.liferay.portal.kernel.exception.SystemException se) {
201 public static void updateStatus(HttpPrincipal httpPrincipal,
202 long membershipRequestId, java.lang.String reviewComments,
203 int statusId, com.liferay.portal.service.ServiceContext serviceContext)
204 throws com.liferay.portal.kernel.exception.PortalException,
205 com.liferay.portal.kernel.exception.SystemException {
207 MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
208 "updateStatus", _updateStatusParameterTypes3);
210 MethodHandler methodHandler = new MethodHandler(methodKey,
211 membershipRequestId, reviewComments, statusId,
215 TunnelUtil.invoke(httpPrincipal, methodHandler);
217 catch (Exception e) {
218 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
219 throw (com.liferay.portal.kernel.exception.PortalException)e;
222 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
223 throw (com.liferay.portal.kernel.exception.SystemException)e;
226 throw new com.liferay.portal.kernel.exception.SystemException(e);
229 catch (com.liferay.portal.kernel.exception.SystemException se) {
236 private static Log _log = LogFactoryUtil.getLog(MembershipRequestServiceHttp.class);
237 private static final Class<?>[] _addMembershipRequestParameterTypes0 = new Class[] {
238 long.class, java.lang.String.class,
239 com.liferay.portal.service.ServiceContext.class
241 private static final Class<?>[] _deleteMembershipRequestsParameterTypes1 = new Class[] {
242 long.class, int.class
244 private static final Class<?>[] _getMembershipRequestParameterTypes2 = new Class[] {
247 private static final Class<?>[] _updateStatusParameterTypes3 = new Class[] {
248 long.class, java.lang.String.class, int.class,
249 com.liferay.portal.service.ServiceContext.class