1   /**
2    * Copyright (c) 2000-2010 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   *
12   *
13   */
14  
15  package com.liferay.portal.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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.MembershipRequestServiceUtil;
23  
24  /**
25   * <a href="MembershipRequestServiceHttp.java.html"><b><i>View Source</i></b></a>
26   *
27   * <p>
28   * ServiceBuilder generated this class. Modifications in this class will be
29   * overwritten the next time is generated.
30   * </p>
31   *
32   * <p>
33   * This class provides a HTTP utility for the
34   * {@link com.liferay.portal.service.MembershipRequestServiceUtil} service utility. The
35   * static methods of this class calls the same methods of the service utility.
36   * However, the signatures are different because it requires an additional
37   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
38   * </p>
39   *
40   * <p>
41   * The benefits of using the HTTP utility is that it is fast and allows for
42   * tunneling without the cost of serializing to text. The drawback is that it
43   * only works with Java.
44   * </p>
45   *
46   * <p>
47   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
48   * configure security.
49   * </p>
50   *
51   * <p>
52   * The HTTP utility is only generated for remote services.
53   * </p>
54   *
55   * @author    Brian Wing Shun Chan
56   * @see       MembershipRequestServiceSoap
57   * @see       com.liferay.portal.security.auth.HttpPrincipal
58   * @see       com.liferay.portal.service.MembershipRequestServiceUtil
59   * @generated
60   */
61  public class MembershipRequestServiceHttp {
62      public static com.liferay.portal.model.MembershipRequest addMembershipRequest(
63          HttpPrincipal httpPrincipal, long groupId, java.lang.String comments)
64          throws com.liferay.portal.PortalException,
65              com.liferay.portal.SystemException {
66          try {
67              MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
68                      "addMembershipRequest", _addMembershipRequestParameterTypes0);
69  
70              MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
71                      comments);
72  
73              Object returnObj = null;
74  
75              try {
76                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
77              }
78              catch (Exception e) {
79                  if (e instanceof com.liferay.portal.PortalException) {
80                      throw (com.liferay.portal.PortalException)e;
81                  }
82  
83                  if (e instanceof com.liferay.portal.SystemException) {
84                      throw (com.liferay.portal.SystemException)e;
85                  }
86  
87                  throw new com.liferay.portal.SystemException(e);
88              }
89  
90              return (com.liferay.portal.model.MembershipRequest)returnObj;
91          }
92          catch (com.liferay.portal.SystemException se) {
93              _log.error(se, se);
94  
95              throw se;
96          }
97      }
98  
99      public static void deleteMembershipRequests(HttpPrincipal httpPrincipal,
100         long groupId, int statusId)
101         throws com.liferay.portal.PortalException,
102             com.liferay.portal.SystemException {
103         try {
104             MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
105                     "deleteMembershipRequests",
106                     _deleteMembershipRequestsParameterTypes1);
107 
108             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
109                     statusId);
110 
111             try {
112                 TunnelUtil.invoke(httpPrincipal, methodHandler);
113             }
114             catch (Exception e) {
115                 if (e instanceof com.liferay.portal.PortalException) {
116                     throw (com.liferay.portal.PortalException)e;
117                 }
118 
119                 if (e instanceof com.liferay.portal.SystemException) {
120                     throw (com.liferay.portal.SystemException)e;
121                 }
122 
123                 throw new com.liferay.portal.SystemException(e);
124             }
125         }
126         catch (com.liferay.portal.SystemException se) {
127             _log.error(se, se);
128 
129             throw se;
130         }
131     }
132 
133     public static com.liferay.portal.model.MembershipRequest getMembershipRequest(
134         HttpPrincipal httpPrincipal, long membershipRequestId)
135         throws com.liferay.portal.PortalException,
136             com.liferay.portal.SystemException {
137         try {
138             MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
139                     "getMembershipRequest", _getMembershipRequestParameterTypes2);
140 
141             MethodHandler methodHandler = new MethodHandler(methodKey,
142                     membershipRequestId);
143 
144             Object returnObj = null;
145 
146             try {
147                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
148             }
149             catch (Exception e) {
150                 if (e instanceof com.liferay.portal.PortalException) {
151                     throw (com.liferay.portal.PortalException)e;
152                 }
153 
154                 if (e instanceof com.liferay.portal.SystemException) {
155                     throw (com.liferay.portal.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.SystemException(e);
159             }
160 
161             return (com.liferay.portal.model.MembershipRequest)returnObj;
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165 
166             throw se;
167         }
168     }
169 
170     public static void updateStatus(HttpPrincipal httpPrincipal,
171         long membershipRequestId, java.lang.String reviewComments, int statusId)
172         throws com.liferay.portal.PortalException,
173             com.liferay.portal.SystemException {
174         try {
175             MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
176                     "updateStatus", _updateStatusParameterTypes3);
177 
178             MethodHandler methodHandler = new MethodHandler(methodKey,
179                     membershipRequestId, reviewComments, statusId);
180 
181             try {
182                 TunnelUtil.invoke(httpPrincipal, methodHandler);
183             }
184             catch (Exception e) {
185                 if (e instanceof com.liferay.portal.PortalException) {
186                     throw (com.liferay.portal.PortalException)e;
187                 }
188 
189                 if (e instanceof com.liferay.portal.SystemException) {
190                     throw (com.liferay.portal.SystemException)e;
191                 }
192 
193                 throw new com.liferay.portal.SystemException(e);
194             }
195         }
196         catch (com.liferay.portal.SystemException se) {
197             _log.error(se, se);
198 
199             throw se;
200         }
201     }
202 
203     private static Log _log = LogFactoryUtil.getLog(MembershipRequestServiceHttp.class);
204     private static final Class<?>[] _addMembershipRequestParameterTypes0 = new Class[] {
205             long.class, java.lang.String.class
206         };
207     private static final Class<?>[] _deleteMembershipRequestsParameterTypes1 = new Class[] {
208             long.class, int.class
209         };
210     private static final Class<?>[] _getMembershipRequestParameterTypes2 = new Class[] {
211             long.class
212         };
213     private static final Class<?>[] _updateStatusParameterTypes3 = new Class[] {
214             long.class, java.lang.String.class, int.class
215         };
216 }