1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions 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.portal.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.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.MembershipRequestServiceUtil;
33  
34  /**
35   * <a href="MembershipRequestServiceHttp.java.html"><b><i>View Source</i></b></a>
36   *
37   * <p>
38   * ServiceBuilder generated this class. Modifications in this class will be
39   * overwritten the next time is generated.
40   * </p>
41   *
42   * <p>
43   * This class provides a HTTP utility for the
44   * {@link com.liferay.portal.service.MembershipRequestServiceUtil} service utility. The
45   * static methods of this class calls the same methods of the service utility.
46   * However, the signatures are different because it requires an additional
47   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
48   * </p>
49   *
50   * <p>
51   * The benefits of using the HTTP utility is that it is fast and allows for
52   * tunneling without the cost of serializing to text. The drawback is that it
53   * only works with Java.
54   * </p>
55   *
56   * <p>
57   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
58   * configure security.
59   * </p>
60   *
61   * <p>
62   * The HTTP utility is only generated for remote services.
63   * </p>
64   *
65   * @author    Brian Wing Shun Chan
66   * @see       MembershipRequestServiceSoap
67   * @see       com.liferay.portal.security.auth.HttpPrincipal
68   * @see       com.liferay.portal.service.MembershipRequestServiceUtil
69   * @generated
70   */
71  public class MembershipRequestServiceHttp {
72      public static com.liferay.portal.model.MembershipRequest addMembershipRequest(
73          HttpPrincipal httpPrincipal, long groupId, java.lang.String comments)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              Object paramObj0 = new LongWrapper(groupId);
78  
79              Object paramObj1 = comments;
80  
81              if (comments == null) {
82                  paramObj1 = new NullWrapper("java.lang.String");
83              }
84  
85              MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
86                      "addMembershipRequest",
87                      new Object[] { paramObj0, paramObj1 });
88  
89              Object returnObj = null;
90  
91              try {
92                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
93              }
94              catch (Exception e) {
95                  if (e instanceof com.liferay.portal.PortalException) {
96                      throw (com.liferay.portal.PortalException)e;
97                  }
98  
99                  if (e instanceof com.liferay.portal.SystemException) {
100                     throw (com.liferay.portal.SystemException)e;
101                 }
102 
103                 throw new com.liferay.portal.SystemException(e);
104             }
105 
106             return (com.liferay.portal.model.MembershipRequest)returnObj;
107         }
108         catch (com.liferay.portal.SystemException se) {
109             _log.error(se, se);
110 
111             throw se;
112         }
113     }
114 
115     public static void deleteMembershipRequests(HttpPrincipal httpPrincipal,
116         long groupId, int statusId)
117         throws com.liferay.portal.PortalException,
118             com.liferay.portal.SystemException {
119         try {
120             Object paramObj0 = new LongWrapper(groupId);
121 
122             Object paramObj1 = new IntegerWrapper(statusId);
123 
124             MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
125                     "deleteMembershipRequests",
126                     new Object[] { paramObj0, paramObj1 });
127 
128             try {
129                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
130             }
131             catch (Exception e) {
132                 if (e instanceof com.liferay.portal.PortalException) {
133                     throw (com.liferay.portal.PortalException)e;
134                 }
135 
136                 if (e instanceof com.liferay.portal.SystemException) {
137                     throw (com.liferay.portal.SystemException)e;
138                 }
139 
140                 throw new com.liferay.portal.SystemException(e);
141             }
142         }
143         catch (com.liferay.portal.SystemException se) {
144             _log.error(se, se);
145 
146             throw se;
147         }
148     }
149 
150     public static com.liferay.portal.model.MembershipRequest getMembershipRequest(
151         HttpPrincipal httpPrincipal, long membershipRequestId)
152         throws com.liferay.portal.PortalException,
153             com.liferay.portal.SystemException {
154         try {
155             Object paramObj0 = new LongWrapper(membershipRequestId);
156 
157             MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
158                     "getMembershipRequest", new Object[] { paramObj0 });
159 
160             Object returnObj = null;
161 
162             try {
163                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
164             }
165             catch (Exception e) {
166                 if (e instanceof com.liferay.portal.PortalException) {
167                     throw (com.liferay.portal.PortalException)e;
168                 }
169 
170                 if (e instanceof com.liferay.portal.SystemException) {
171                     throw (com.liferay.portal.SystemException)e;
172                 }
173 
174                 throw new com.liferay.portal.SystemException(e);
175             }
176 
177             return (com.liferay.portal.model.MembershipRequest)returnObj;
178         }
179         catch (com.liferay.portal.SystemException se) {
180             _log.error(se, se);
181 
182             throw se;
183         }
184     }
185 
186     public static void updateStatus(HttpPrincipal httpPrincipal,
187         long membershipRequestId, java.lang.String reviewComments, int statusId)
188         throws com.liferay.portal.PortalException,
189             com.liferay.portal.SystemException {
190         try {
191             Object paramObj0 = new LongWrapper(membershipRequestId);
192 
193             Object paramObj1 = reviewComments;
194 
195             if (reviewComments == null) {
196                 paramObj1 = new NullWrapper("java.lang.String");
197             }
198 
199             Object paramObj2 = new IntegerWrapper(statusId);
200 
201             MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
202                     "updateStatus",
203                     new Object[] { paramObj0, paramObj1, paramObj2 });
204 
205             try {
206                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
207             }
208             catch (Exception e) {
209                 if (e instanceof com.liferay.portal.PortalException) {
210                     throw (com.liferay.portal.PortalException)e;
211                 }
212 
213                 if (e instanceof com.liferay.portal.SystemException) {
214                     throw (com.liferay.portal.SystemException)e;
215                 }
216 
217                 throw new com.liferay.portal.SystemException(e);
218             }
219         }
220         catch (com.liferay.portal.SystemException se) {
221             _log.error(se, se);
222 
223             throw se;
224         }
225     }
226 
227     private static Log _log = LogFactoryUtil.getLog(MembershipRequestServiceHttp.class);
228 }