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.kernel.util.NullWrapper;
028: import com.liferay.portal.security.auth.HttpPrincipal;
029: import com.liferay.portal.service.http.TunnelUtil;
030:
031: import com.liferay.portlet.messageboards.service.MBThreadServiceUtil;
032:
033: /**
034: * <a href="MBThreadServiceHttp.java.html"><b><i>View Source</i></b></a>
035: *
036: * <p>
037: * ServiceBuilder generated this class. Modifications in this class will be
038: * overwritten the next time is generated.
039: * </p>
040: *
041: * <p>
042: * This class provides a HTTP utility for the
043: * <code>com.liferay.portlet.messageboards.service.MBThreadServiceUtil</code> service
044: * utility. The static methods of this class calls the same methods of the
045: * service utility. However, the signatures are different because it requires an
046: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
047: * parameter.
048: * </p>
049: *
050: * <p>
051: * The benefits of using the HTTP utility is that it is fast and allows for
052: * tunneling without the cost of serializing to text. The drawback is that it
053: * only works with Java.
054: * </p>
055: *
056: * <p>
057: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
058: * portal.properties to configure security.
059: * </p>
060: *
061: * <p>
062: * The HTTP utility is only generated for remote services.
063: * </p>
064: *
065: * @author Brian Wing Shun Chan
066: *
067: * @see com.liferay.portal.security.auth.HttpPrincipal
068: * @see com.liferay.portlet.messageboards.service.MBThreadServiceUtil
069: * @see com.liferay.portlet.messageboards.service.http.MBThreadServiceSoap
070: *
071: */
072: public class MBThreadServiceHttp {
073: public static com.liferay.portlet.messageboards.model.MBThread moveThread(
074: HttpPrincipal httpPrincipal, long categoryId, long threadId)
075: throws com.liferay.portal.SystemException,
076: com.liferay.portal.PortalException {
077: try {
078: Object paramObj0 = new LongWrapper(categoryId);
079:
080: Object paramObj1 = new LongWrapper(threadId);
081:
082: MethodWrapper methodWrapper = new MethodWrapper(
083: MBThreadServiceUtil.class.getName(), "moveThread",
084: new Object[] { paramObj0, paramObj1 });
085:
086: Object returnObj = null;
087:
088: try {
089: returnObj = TunnelUtil.invoke(httpPrincipal,
090: methodWrapper);
091: } catch (Exception e) {
092: if (e instanceof com.liferay.portal.SystemException) {
093: throw (com.liferay.portal.SystemException) e;
094: }
095:
096: if (e instanceof com.liferay.portal.PortalException) {
097: throw (com.liferay.portal.PortalException) e;
098: }
099:
100: throw new com.liferay.portal.SystemException(e);
101: }
102:
103: return (com.liferay.portlet.messageboards.model.MBThread) returnObj;
104: } catch (com.liferay.portal.SystemException se) {
105: _log.error(se, se);
106:
107: throw se;
108: }
109: }
110:
111: public static com.liferay.portlet.messageboards.model.MBThread splitThread(
112: HttpPrincipal httpPrincipal, long messageId,
113: javax.portlet.PortletPreferences prefs,
114: com.liferay.portal.theme.ThemeDisplay themeDisplay)
115: throws com.liferay.portal.SystemException,
116: com.liferay.portal.PortalException {
117: try {
118: Object paramObj0 = new LongWrapper(messageId);
119:
120: Object paramObj1 = prefs;
121:
122: if (prefs == null) {
123: paramObj1 = new NullWrapper(
124: "javax.portlet.PortletPreferences");
125: }
126:
127: Object paramObj2 = themeDisplay;
128:
129: if (themeDisplay == null) {
130: paramObj2 = new NullWrapper(
131: "com.liferay.portal.theme.ThemeDisplay");
132: }
133:
134: MethodWrapper methodWrapper = new MethodWrapper(
135: MBThreadServiceUtil.class.getName(), "splitThread",
136: new Object[] { paramObj0, paramObj1, paramObj2 });
137:
138: Object returnObj = null;
139:
140: try {
141: returnObj = TunnelUtil.invoke(httpPrincipal,
142: methodWrapper);
143: } catch (Exception e) {
144: if (e instanceof com.liferay.portal.SystemException) {
145: throw (com.liferay.portal.SystemException) e;
146: }
147:
148: if (e instanceof com.liferay.portal.PortalException) {
149: throw (com.liferay.portal.PortalException) e;
150: }
151:
152: throw new com.liferay.portal.SystemException(e);
153: }
154:
155: return (com.liferay.portlet.messageboards.model.MBThread) returnObj;
156: } catch (com.liferay.portal.SystemException se) {
157: _log.error(se, se);
158:
159: throw se;
160: }
161: }
162:
163: private static Log _log = LogFactoryUtil
164: .getLog(MBThreadServiceHttp.class);
165: }
|