001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.IntegerWrapper;
026: import com.liferay.portal.kernel.util.LongWrapper;
027: import com.liferay.portal.kernel.util.MethodWrapper;
028: import com.liferay.portal.kernel.util.NullWrapper;
029: import com.liferay.portal.security.auth.HttpPrincipal;
030: import com.liferay.portal.service.MembershipRequestServiceUtil;
031:
032: /**
033: * <a href="MembershipRequestServiceHttp.java.html"><b><i>View Source</i></b></a>
034: *
035: * <p>
036: * ServiceBuilder generated this class. Modifications in this class will be
037: * overwritten the next time is generated.
038: * </p>
039: *
040: * <p>
041: * This class provides a HTTP utility for the
042: * <code>com.liferay.portal.service.MembershipRequestServiceUtil</code> service
043: * utility. The static methods of this class calls the same methods of the
044: * service utility. However, the signatures are different because it requires an
045: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
046: * parameter.
047: * </p>
048: *
049: * <p>
050: * The benefits of using the HTTP utility is that it is fast and allows for
051: * tunneling without the cost of serializing to text. The drawback is that it
052: * only works with Java.
053: * </p>
054: *
055: * <p>
056: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
057: * portal.properties to configure security.
058: * </p>
059: *
060: * <p>
061: * The HTTP utility is only generated for remote services.
062: * </p>
063: *
064: * @author Brian Wing Shun Chan
065: *
066: * @see com.liferay.portal.security.auth.HttpPrincipal
067: * @see com.liferay.portal.service.MembershipRequestServiceUtil
068: * @see com.liferay.portal.service.http.MembershipRequestServiceSoap
069: *
070: */
071: public class MembershipRequestServiceHttp {
072: public static com.liferay.portal.model.MembershipRequest addMembershipRequest(
073: HttpPrincipal httpPrincipal, long groupId,
074: java.lang.String comments)
075: throws com.liferay.portal.SystemException,
076: com.liferay.portal.PortalException {
077: try {
078: Object paramObj0 = new LongWrapper(groupId);
079:
080: Object paramObj1 = comments;
081:
082: if (comments == null) {
083: paramObj1 = new NullWrapper("java.lang.String");
084: }
085:
086: MethodWrapper methodWrapper = new MethodWrapper(
087: MembershipRequestServiceUtil.class.getName(),
088: "addMembershipRequest", new Object[] { paramObj0,
089: paramObj1 });
090:
091: Object returnObj = null;
092:
093: try {
094: returnObj = TunnelUtil.invoke(httpPrincipal,
095: methodWrapper);
096: } catch (Exception e) {
097: if (e instanceof com.liferay.portal.SystemException) {
098: throw (com.liferay.portal.SystemException) e;
099: }
100:
101: if (e instanceof com.liferay.portal.PortalException) {
102: throw (com.liferay.portal.PortalException) e;
103: }
104:
105: throw new com.liferay.portal.SystemException(e);
106: }
107:
108: return (com.liferay.portal.model.MembershipRequest) returnObj;
109: } catch (com.liferay.portal.SystemException se) {
110: _log.error(se, se);
111:
112: throw se;
113: }
114: }
115:
116: public static void deleteMembershipRequests(
117: HttpPrincipal httpPrincipal, long groupId, int statusId)
118: throws com.liferay.portal.SystemException,
119: com.liferay.portal.PortalException {
120: try {
121: Object paramObj0 = new LongWrapper(groupId);
122:
123: Object paramObj1 = new IntegerWrapper(statusId);
124:
125: MethodWrapper methodWrapper = new MethodWrapper(
126: MembershipRequestServiceUtil.class.getName(),
127: "deleteMembershipRequests", new Object[] {
128: paramObj0, paramObj1 });
129:
130: try {
131: TunnelUtil.invoke(httpPrincipal, methodWrapper);
132: } catch (Exception e) {
133: if (e instanceof com.liferay.portal.SystemException) {
134: throw (com.liferay.portal.SystemException) e;
135: }
136:
137: if (e instanceof com.liferay.portal.PortalException) {
138: throw (com.liferay.portal.PortalException) e;
139: }
140:
141: throw new com.liferay.portal.SystemException(e);
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.SystemException,
153: com.liferay.portal.PortalException {
154: try {
155: Object paramObj0 = new LongWrapper(membershipRequestId);
156:
157: MethodWrapper methodWrapper = new MethodWrapper(
158: MembershipRequestServiceUtil.class.getName(),
159: "getMembershipRequest", new Object[] { paramObj0 });
160:
161: Object returnObj = null;
162:
163: try {
164: returnObj = TunnelUtil.invoke(httpPrincipal,
165: methodWrapper);
166: } catch (Exception e) {
167: if (e instanceof com.liferay.portal.SystemException) {
168: throw (com.liferay.portal.SystemException) e;
169: }
170:
171: if (e instanceof com.liferay.portal.PortalException) {
172: throw (com.liferay.portal.PortalException) e;
173: }
174:
175: throw new com.liferay.portal.SystemException(e);
176: }
177:
178: return (com.liferay.portal.model.MembershipRequest) returnObj;
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,
188: int statusId) throws com.liferay.portal.SystemException,
189: com.liferay.portal.PortalException {
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(
202: MembershipRequestServiceUtil.class.getName(),
203: "updateStatus", new Object[] { paramObj0,
204: paramObj1, paramObj2 });
205:
206: try {
207: TunnelUtil.invoke(httpPrincipal, methodWrapper);
208: } catch (Exception e) {
209: if (e instanceof com.liferay.portal.SystemException) {
210: throw (com.liferay.portal.SystemException) e;
211: }
212:
213: if (e instanceof com.liferay.portal.PortalException) {
214: throw (com.liferay.portal.PortalException) e;
215: }
216:
217: throw new com.liferay.portal.SystemException(e);
218: }
219: } catch (com.liferay.portal.SystemException se) {
220: _log.error(se, se);
221:
222: throw se;
223: }
224: }
225:
226: private static Log _log = LogFactoryUtil
227: .getLog(MembershipRequestServiceHttp.class);
228: }
|