001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.MembershipRequestServiceUtil;
023    
024    /**
025     * <p>
026     * This class provides a HTTP utility for the
027     * {@link com.liferay.portal.service.MembershipRequestServiceUtil} service utility. The
028     * static methods of this class calls the same methods of the service utility.
029     * However, the signatures are different because it requires an additional
030     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
031     * </p>
032     *
033     * <p>
034     * The benefits of using the HTTP utility is that it is fast and allows for
035     * tunneling without the cost of serializing to text. The drawback is that it
036     * only works with Java.
037     * </p>
038     *
039     * <p>
040     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
041     * configure security.
042     * </p>
043     *
044     * <p>
045     * The HTTP utility is only generated for remote services.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       MembershipRequestServiceSoap
050     * @see       com.liferay.portal.security.auth.HttpPrincipal
051     * @see       com.liferay.portal.service.MembershipRequestServiceUtil
052     * @generated
053     */
054    public class MembershipRequestServiceHttp {
055            public static com.liferay.portal.model.MembershipRequest addMembershipRequest(
056                    HttpPrincipal httpPrincipal, long groupId, java.lang.String comments)
057                    throws com.liferay.portal.kernel.exception.PortalException,
058                            com.liferay.portal.kernel.exception.SystemException {
059                    try {
060                            MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
061                                            "addMembershipRequest", _addMembershipRequestParameterTypes0);
062    
063                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
064                                            comments);
065    
066                            Object returnObj = null;
067    
068                            try {
069                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
070                            }
071                            catch (Exception e) {
072                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
073                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
074                                    }
075    
076                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
077                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
078                                    }
079    
080                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
081                            }
082    
083                            return (com.liferay.portal.model.MembershipRequest)returnObj;
084                    }
085                    catch (com.liferay.portal.kernel.exception.SystemException se) {
086                            _log.error(se, se);
087    
088                            throw se;
089                    }
090            }
091    
092            public static void deleteMembershipRequests(HttpPrincipal httpPrincipal,
093                    long groupId, int statusId)
094                    throws com.liferay.portal.kernel.exception.PortalException,
095                            com.liferay.portal.kernel.exception.SystemException {
096                    try {
097                            MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
098                                            "deleteMembershipRequests",
099                                            _deleteMembershipRequestsParameterTypes1);
100    
101                            MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
102                                            statusId);
103    
104                            try {
105                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
106                            }
107                            catch (Exception e) {
108                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
109                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
110                                    }
111    
112                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
113                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static com.liferay.portal.model.MembershipRequest getMembershipRequest(
127                    HttpPrincipal httpPrincipal, long membershipRequestId)
128                    throws com.liferay.portal.kernel.exception.PortalException,
129                            com.liferay.portal.kernel.exception.SystemException {
130                    try {
131                            MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
132                                            "getMembershipRequest", _getMembershipRequestParameterTypes2);
133    
134                            MethodHandler methodHandler = new MethodHandler(methodKey,
135                                            membershipRequestId);
136    
137                            Object returnObj = null;
138    
139                            try {
140                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
141                            }
142                            catch (Exception e) {
143                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
144                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
145                                    }
146    
147                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
148                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
149                                    }
150    
151                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
152                            }
153    
154                            return (com.liferay.portal.model.MembershipRequest)returnObj;
155                    }
156                    catch (com.liferay.portal.kernel.exception.SystemException se) {
157                            _log.error(se, se);
158    
159                            throw se;
160                    }
161            }
162    
163            public static void updateStatus(HttpPrincipal httpPrincipal,
164                    long membershipRequestId, java.lang.String reviewComments, int statusId)
165                    throws com.liferay.portal.kernel.exception.PortalException,
166                            com.liferay.portal.kernel.exception.SystemException {
167                    try {
168                            MethodKey methodKey = new MethodKey(MembershipRequestServiceUtil.class.getName(),
169                                            "updateStatus", _updateStatusParameterTypes3);
170    
171                            MethodHandler methodHandler = new MethodHandler(methodKey,
172                                            membershipRequestId, reviewComments, statusId);
173    
174                            try {
175                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
176                            }
177                            catch (Exception e) {
178                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
179                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
180                                    }
181    
182                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
183                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
184                                    }
185    
186                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
187                            }
188                    }
189                    catch (com.liferay.portal.kernel.exception.SystemException se) {
190                            _log.error(se, se);
191    
192                            throw se;
193                    }
194            }
195    
196            private static Log _log = LogFactoryUtil.getLog(MembershipRequestServiceHttp.class);
197            private static final Class<?>[] _addMembershipRequestParameterTypes0 = new Class[] {
198                            long.class, java.lang.String.class
199                    };
200            private static final Class<?>[] _deleteMembershipRequestsParameterTypes1 = new Class[] {
201                            long.class, int.class
202                    };
203            private static final Class<?>[] _getMembershipRequestParameterTypes2 = new Class[] {
204                            long.class
205                    };
206            private static final Class<?>[] _updateStatusParameterTypes3 = new Class[] {
207                            long.class, java.lang.String.class, int.class
208                    };
209    }