001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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.IntegerWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.MembershipRequestServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portal.service.MembershipRequestServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author    Brian Wing Shun Chan
051     * @see       MembershipRequestServiceSoap
052     * @see       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portal.service.MembershipRequestServiceUtil
054     * @generated
055     */
056    public class MembershipRequestServiceHttp {
057            public static com.liferay.portal.model.MembershipRequest addMembershipRequest(
058                    HttpPrincipal httpPrincipal, long groupId, java.lang.String comments)
059                    throws com.liferay.portal.kernel.exception.PortalException,
060                            com.liferay.portal.kernel.exception.SystemException {
061                    try {
062                            Object paramObj0 = new LongWrapper(groupId);
063    
064                            Object paramObj1 = comments;
065    
066                            if (comments == null) {
067                                    paramObj1 = new NullWrapper("java.lang.String");
068                            }
069    
070                            MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
071                                            "addMembershipRequest",
072                                            new Object[] { paramObj0, paramObj1 });
073    
074                            Object returnObj = null;
075    
076                            try {
077                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
078                            }
079                            catch (Exception e) {
080                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
081                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
082                                    }
083    
084                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
085                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
086                                    }
087    
088                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
089                            }
090    
091                            return (com.liferay.portal.model.MembershipRequest)returnObj;
092                    }
093                    catch (com.liferay.portal.kernel.exception.SystemException se) {
094                            _log.error(se, se);
095    
096                            throw se;
097                    }
098            }
099    
100            public static void deleteMembershipRequests(HttpPrincipal httpPrincipal,
101                    long groupId, int statusId)
102                    throws com.liferay.portal.kernel.exception.PortalException,
103                            com.liferay.portal.kernel.exception.SystemException {
104                    try {
105                            Object paramObj0 = new LongWrapper(groupId);
106    
107                            Object paramObj1 = new IntegerWrapper(statusId);
108    
109                            MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
110                                            "deleteMembershipRequests",
111                                            new Object[] { paramObj0, paramObj1 });
112    
113                            try {
114                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
115                            }
116                            catch (Exception e) {
117                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
118                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
119                                    }
120    
121                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
122                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
123                                    }
124    
125                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
126                            }
127                    }
128                    catch (com.liferay.portal.kernel.exception.SystemException se) {
129                            _log.error(se, se);
130    
131                            throw se;
132                    }
133            }
134    
135            public static com.liferay.portal.model.MembershipRequest getMembershipRequest(
136                    HttpPrincipal httpPrincipal, long membershipRequestId)
137                    throws com.liferay.portal.kernel.exception.PortalException,
138                            com.liferay.portal.kernel.exception.SystemException {
139                    try {
140                            Object paramObj0 = new LongWrapper(membershipRequestId);
141    
142                            MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
143                                            "getMembershipRequest", new Object[] { paramObj0 });
144    
145                            Object returnObj = null;
146    
147                            try {
148                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
149                            }
150                            catch (Exception e) {
151                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
152                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
153                                    }
154    
155                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
156                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
157                                    }
158    
159                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
160                            }
161    
162                            return (com.liferay.portal.model.MembershipRequest)returnObj;
163                    }
164                    catch (com.liferay.portal.kernel.exception.SystemException se) {
165                            _log.error(se, se);
166    
167                            throw se;
168                    }
169            }
170    
171            public static void updateStatus(HttpPrincipal httpPrincipal,
172                    long membershipRequestId, java.lang.String reviewComments, int statusId)
173                    throws com.liferay.portal.kernel.exception.PortalException,
174                            com.liferay.portal.kernel.exception.SystemException {
175                    try {
176                            Object paramObj0 = new LongWrapper(membershipRequestId);
177    
178                            Object paramObj1 = reviewComments;
179    
180                            if (reviewComments == null) {
181                                    paramObj1 = new NullWrapper("java.lang.String");
182                            }
183    
184                            Object paramObj2 = new IntegerWrapper(statusId);
185    
186                            MethodWrapper methodWrapper = new MethodWrapper(MembershipRequestServiceUtil.class.getName(),
187                                            "updateStatus",
188                                            new Object[] { paramObj0, paramObj1, paramObj2 });
189    
190                            try {
191                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
192                            }
193                            catch (Exception e) {
194                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
195                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
196                                    }
197    
198                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
199                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
200                                    }
201    
202                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
203                            }
204                    }
205                    catch (com.liferay.portal.kernel.exception.SystemException se) {
206                            _log.error(se, se);
207    
208                            throw se;
209                    }
210            }
211    
212            private static Log _log = LogFactoryUtil.getLog(MembershipRequestServiceHttp.class);
213    }