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.portlet.messageboards.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.LongWrapper;
026: import com.liferay.portal.kernel.util.MethodWrapper;
027: import com.liferay.portal.security.auth.HttpPrincipal;
028: import com.liferay.portal.service.http.TunnelUtil;
029:
030: import com.liferay.portlet.messageboards.service.MBBanServiceUtil;
031:
032: /**
033: * <a href="MBBanServiceHttp.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.portlet.messageboards.service.MBBanServiceUtil</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.portlet.messageboards.service.MBBanServiceUtil
068: * @see com.liferay.portlet.messageboards.service.http.MBBanServiceSoap
069: *
070: */
071: public class MBBanServiceHttp {
072: public static com.liferay.portlet.messageboards.model.MBBan addBan(
073: HttpPrincipal httpPrincipal, long plid, long banUserId)
074: throws com.liferay.portal.SystemException,
075: com.liferay.portal.PortalException {
076: try {
077: Object paramObj0 = new LongWrapper(plid);
078:
079: Object paramObj1 = new LongWrapper(banUserId);
080:
081: MethodWrapper methodWrapper = new MethodWrapper(
082: MBBanServiceUtil.class.getName(), "addBan",
083: new Object[] { paramObj0, paramObj1 });
084:
085: Object returnObj = null;
086:
087: try {
088: returnObj = TunnelUtil.invoke(httpPrincipal,
089: methodWrapper);
090: } catch (Exception e) {
091: if (e instanceof com.liferay.portal.SystemException) {
092: throw (com.liferay.portal.SystemException) e;
093: }
094:
095: if (e instanceof com.liferay.portal.PortalException) {
096: throw (com.liferay.portal.PortalException) e;
097: }
098:
099: throw new com.liferay.portal.SystemException(e);
100: }
101:
102: return (com.liferay.portlet.messageboards.model.MBBan) returnObj;
103: } catch (com.liferay.portal.SystemException se) {
104: _log.error(se, se);
105:
106: throw se;
107: }
108: }
109:
110: public static void deleteBan(HttpPrincipal httpPrincipal,
111: long plid, long banUserId)
112: throws com.liferay.portal.SystemException,
113: com.liferay.portal.PortalException {
114: try {
115: Object paramObj0 = new LongWrapper(plid);
116:
117: Object paramObj1 = new LongWrapper(banUserId);
118:
119: MethodWrapper methodWrapper = new MethodWrapper(
120: MBBanServiceUtil.class.getName(), "deleteBan",
121: new Object[] { paramObj0, paramObj1 });
122:
123: try {
124: TunnelUtil.invoke(httpPrincipal, methodWrapper);
125: } catch (Exception e) {
126: if (e instanceof com.liferay.portal.SystemException) {
127: throw (com.liferay.portal.SystemException) e;
128: }
129:
130: if (e instanceof com.liferay.portal.PortalException) {
131: throw (com.liferay.portal.PortalException) e;
132: }
133:
134: throw new com.liferay.portal.SystemException(e);
135: }
136: } catch (com.liferay.portal.SystemException se) {
137: _log.error(se, se);
138:
139: throw se;
140: }
141: }
142:
143: private static Log _log = LogFactoryUtil
144: .getLog(MBBanServiceHttp.class);
145: }
|