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