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.wiki.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.BooleanWrapper;
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.http.TunnelUtil;
031:
032: import com.liferay.portlet.wiki.service.WikiNodeServiceUtil;
033:
034: /**
035: * <a href="WikiNodeServiceHttp.java.html"><b><i>View Source</i></b></a>
036: *
037: * <p>
038: * ServiceBuilder generated this class. Modifications in this class will be
039: * overwritten the next time is generated.
040: * </p>
041: *
042: * <p>
043: * This class provides a HTTP utility for the
044: * <code>com.liferay.portlet.wiki.service.WikiNodeServiceUtil</code> service
045: * utility. The static methods of this class calls the same methods of the
046: * service utility. However, the signatures are different because it requires an
047: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
048: * parameter.
049: * </p>
050: *
051: * <p>
052: * The benefits of using the HTTP utility is that it is fast and allows for
053: * tunneling without the cost of serializing to text. The drawback is that it
054: * only works with Java.
055: * </p>
056: *
057: * <p>
058: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
059: * portal.properties to configure security.
060: * </p>
061: *
062: * <p>
063: * The HTTP utility is only generated for remote services.
064: * </p>
065: *
066: * @author Brian Wing Shun Chan
067: *
068: * @see com.liferay.portal.security.auth.HttpPrincipal
069: * @see com.liferay.portlet.wiki.service.WikiNodeServiceUtil
070: * @see com.liferay.portlet.wiki.service.http.WikiNodeServiceSoap
071: *
072: */
073: public class WikiNodeServiceHttp {
074: public static com.liferay.portlet.wiki.model.WikiNode addNode(
075: HttpPrincipal httpPrincipal, long plid,
076: java.lang.String name, java.lang.String description,
077: boolean addCommunityPermissions, boolean addGuestPermissions)
078: throws com.liferay.portal.SystemException,
079: com.liferay.portal.PortalException {
080: try {
081: Object paramObj0 = new LongWrapper(plid);
082:
083: Object paramObj1 = name;
084:
085: if (name == null) {
086: paramObj1 = new NullWrapper("java.lang.String");
087: }
088:
089: Object paramObj2 = description;
090:
091: if (description == null) {
092: paramObj2 = new NullWrapper("java.lang.String");
093: }
094:
095: Object paramObj3 = new BooleanWrapper(
096: addCommunityPermissions);
097:
098: Object paramObj4 = new BooleanWrapper(addGuestPermissions);
099:
100: MethodWrapper methodWrapper = new MethodWrapper(
101: WikiNodeServiceUtil.class.getName(), "addNode",
102: new Object[] { paramObj0, paramObj1, paramObj2,
103: paramObj3, paramObj4 });
104:
105: Object returnObj = null;
106:
107: try {
108: returnObj = TunnelUtil.invoke(httpPrincipal,
109: methodWrapper);
110: } catch (Exception e) {
111: if (e instanceof com.liferay.portal.SystemException) {
112: throw (com.liferay.portal.SystemException) e;
113: }
114:
115: if (e instanceof com.liferay.portal.PortalException) {
116: throw (com.liferay.portal.PortalException) e;
117: }
118:
119: throw new com.liferay.portal.SystemException(e);
120: }
121:
122: return (com.liferay.portlet.wiki.model.WikiNode) returnObj;
123: } catch (com.liferay.portal.SystemException se) {
124: _log.error(se, se);
125:
126: throw se;
127: }
128: }
129:
130: public static com.liferay.portlet.wiki.model.WikiNode addNode(
131: HttpPrincipal httpPrincipal, long plid,
132: java.lang.String name, java.lang.String description,
133: java.lang.String[] communityPermissions,
134: java.lang.String[] guestPermissions)
135: throws com.liferay.portal.SystemException,
136: com.liferay.portal.PortalException {
137: try {
138: Object paramObj0 = new LongWrapper(plid);
139:
140: Object paramObj1 = name;
141:
142: if (name == null) {
143: paramObj1 = new NullWrapper("java.lang.String");
144: }
145:
146: Object paramObj2 = description;
147:
148: if (description == null) {
149: paramObj2 = new NullWrapper("java.lang.String");
150: }
151:
152: Object paramObj3 = communityPermissions;
153:
154: if (communityPermissions == null) {
155: paramObj3 = new NullWrapper("[Ljava.lang.String;");
156: }
157:
158: Object paramObj4 = guestPermissions;
159:
160: if (guestPermissions == null) {
161: paramObj4 = new NullWrapper("[Ljava.lang.String;");
162: }
163:
164: MethodWrapper methodWrapper = new MethodWrapper(
165: WikiNodeServiceUtil.class.getName(), "addNode",
166: new Object[] { paramObj0, paramObj1, paramObj2,
167: paramObj3, paramObj4 });
168:
169: Object returnObj = null;
170:
171: try {
172: returnObj = TunnelUtil.invoke(httpPrincipal,
173: methodWrapper);
174: } catch (Exception e) {
175: if (e instanceof com.liferay.portal.SystemException) {
176: throw (com.liferay.portal.SystemException) e;
177: }
178:
179: if (e instanceof com.liferay.portal.PortalException) {
180: throw (com.liferay.portal.PortalException) e;
181: }
182:
183: throw new com.liferay.portal.SystemException(e);
184: }
185:
186: return (com.liferay.portlet.wiki.model.WikiNode) returnObj;
187: } catch (com.liferay.portal.SystemException se) {
188: _log.error(se, se);
189:
190: throw se;
191: }
192: }
193:
194: public static void deleteNode(HttpPrincipal httpPrincipal,
195: long nodeId) throws com.liferay.portal.SystemException,
196: com.liferay.portal.PortalException {
197: try {
198: Object paramObj0 = new LongWrapper(nodeId);
199:
200: MethodWrapper methodWrapper = new MethodWrapper(
201: WikiNodeServiceUtil.class.getName(), "deleteNode",
202: new Object[] { paramObj0 });
203:
204: try {
205: TunnelUtil.invoke(httpPrincipal, methodWrapper);
206: } catch (Exception e) {
207: if (e instanceof com.liferay.portal.SystemException) {
208: throw (com.liferay.portal.SystemException) e;
209: }
210:
211: if (e instanceof com.liferay.portal.PortalException) {
212: throw (com.liferay.portal.PortalException) e;
213: }
214:
215: throw new com.liferay.portal.SystemException(e);
216: }
217: } catch (com.liferay.portal.SystemException se) {
218: _log.error(se, se);
219:
220: throw se;
221: }
222: }
223:
224: public static com.liferay.portlet.wiki.model.WikiNode getNode(
225: HttpPrincipal httpPrincipal, long nodeId)
226: throws com.liferay.portal.SystemException,
227: com.liferay.portal.PortalException {
228: try {
229: Object paramObj0 = new LongWrapper(nodeId);
230:
231: MethodWrapper methodWrapper = new MethodWrapper(
232: WikiNodeServiceUtil.class.getName(), "getNode",
233: new Object[] { paramObj0 });
234:
235: Object returnObj = null;
236:
237: try {
238: returnObj = TunnelUtil.invoke(httpPrincipal,
239: methodWrapper);
240: } catch (Exception e) {
241: if (e instanceof com.liferay.portal.SystemException) {
242: throw (com.liferay.portal.SystemException) e;
243: }
244:
245: if (e instanceof com.liferay.portal.PortalException) {
246: throw (com.liferay.portal.PortalException) e;
247: }
248:
249: throw new com.liferay.portal.SystemException(e);
250: }
251:
252: return (com.liferay.portlet.wiki.model.WikiNode) returnObj;
253: } catch (com.liferay.portal.SystemException se) {
254: _log.error(se, se);
255:
256: throw se;
257: }
258: }
259:
260: public static com.liferay.portlet.wiki.model.WikiNode updateNode(
261: HttpPrincipal httpPrincipal, long nodeId,
262: java.lang.String name, java.lang.String description)
263: throws com.liferay.portal.SystemException,
264: com.liferay.portal.PortalException {
265: try {
266: Object paramObj0 = new LongWrapper(nodeId);
267:
268: Object paramObj1 = name;
269:
270: if (name == null) {
271: paramObj1 = new NullWrapper("java.lang.String");
272: }
273:
274: Object paramObj2 = description;
275:
276: if (description == null) {
277: paramObj2 = new NullWrapper("java.lang.String");
278: }
279:
280: MethodWrapper methodWrapper = new MethodWrapper(
281: WikiNodeServiceUtil.class.getName(), "updateNode",
282: new Object[] { paramObj0, paramObj1, paramObj2 });
283:
284: Object returnObj = null;
285:
286: try {
287: returnObj = TunnelUtil.invoke(httpPrincipal,
288: methodWrapper);
289: } catch (Exception e) {
290: if (e instanceof com.liferay.portal.SystemException) {
291: throw (com.liferay.portal.SystemException) e;
292: }
293:
294: if (e instanceof com.liferay.portal.PortalException) {
295: throw (com.liferay.portal.PortalException) e;
296: }
297:
298: throw new com.liferay.portal.SystemException(e);
299: }
300:
301: return (com.liferay.portlet.wiki.model.WikiNode) returnObj;
302: } catch (com.liferay.portal.SystemException se) {
303: _log.error(se, se);
304:
305: throw se;
306: }
307: }
308:
309: private static Log _log = LogFactoryUtil
310: .getLog(WikiNodeServiceHttp.class);
311: }
|