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.bookmarks.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.bookmarks.service.BookmarksFolderServiceUtil;
033:
034: /**
035: * <a href="BookmarksFolderServiceHttp.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.bookmarks.service.BookmarksFolderServiceUtil</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.bookmarks.service.BookmarksFolderServiceUtil
070: * @see com.liferay.portlet.bookmarks.service.http.BookmarksFolderServiceSoap
071: *
072: */
073: public class BookmarksFolderServiceHttp {
074: public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
075: HttpPrincipal httpPrincipal, long plid,
076: long parentFolderId, java.lang.String name,
077: java.lang.String description,
078: boolean addCommunityPermissions, boolean addGuestPermissions)
079: throws com.liferay.portal.SystemException,
080: com.liferay.portal.PortalException {
081: try {
082: Object paramObj0 = new LongWrapper(plid);
083:
084: Object paramObj1 = new LongWrapper(parentFolderId);
085:
086: Object paramObj2 = name;
087:
088: if (name == null) {
089: paramObj2 = new NullWrapper("java.lang.String");
090: }
091:
092: Object paramObj3 = description;
093:
094: if (description == null) {
095: paramObj3 = new NullWrapper("java.lang.String");
096: }
097:
098: Object paramObj4 = new BooleanWrapper(
099: addCommunityPermissions);
100:
101: Object paramObj5 = new BooleanWrapper(addGuestPermissions);
102:
103: MethodWrapper methodWrapper = new MethodWrapper(
104: BookmarksFolderServiceUtil.class.getName(),
105: "addFolder",
106: new Object[] { paramObj0, paramObj1, paramObj2,
107: paramObj3, paramObj4, paramObj5 });
108:
109: Object returnObj = null;
110:
111: try {
112: returnObj = TunnelUtil.invoke(httpPrincipal,
113: methodWrapper);
114: } catch (Exception e) {
115: if (e instanceof com.liferay.portal.SystemException) {
116: throw (com.liferay.portal.SystemException) e;
117: }
118:
119: if (e instanceof com.liferay.portal.PortalException) {
120: throw (com.liferay.portal.PortalException) e;
121: }
122:
123: throw new com.liferay.portal.SystemException(e);
124: }
125:
126: return (com.liferay.portlet.bookmarks.model.BookmarksFolder) returnObj;
127: } catch (com.liferay.portal.SystemException se) {
128: _log.error(se, se);
129:
130: throw se;
131: }
132: }
133:
134: public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
135: HttpPrincipal httpPrincipal, long plid,
136: long parentFolderId, java.lang.String name,
137: java.lang.String description,
138: java.lang.String[] communityPermissions,
139: java.lang.String[] guestPermissions)
140: throws com.liferay.portal.SystemException,
141: com.liferay.portal.PortalException {
142: try {
143: Object paramObj0 = new LongWrapper(plid);
144:
145: Object paramObj1 = new LongWrapper(parentFolderId);
146:
147: Object paramObj2 = name;
148:
149: if (name == null) {
150: paramObj2 = new NullWrapper("java.lang.String");
151: }
152:
153: Object paramObj3 = description;
154:
155: if (description == null) {
156: paramObj3 = new NullWrapper("java.lang.String");
157: }
158:
159: Object paramObj4 = communityPermissions;
160:
161: if (communityPermissions == null) {
162: paramObj4 = new NullWrapper("[Ljava.lang.String;");
163: }
164:
165: Object paramObj5 = guestPermissions;
166:
167: if (guestPermissions == null) {
168: paramObj5 = new NullWrapper("[Ljava.lang.String;");
169: }
170:
171: MethodWrapper methodWrapper = new MethodWrapper(
172: BookmarksFolderServiceUtil.class.getName(),
173: "addFolder",
174: new Object[] { paramObj0, paramObj1, paramObj2,
175: paramObj3, paramObj4, paramObj5 });
176:
177: Object returnObj = null;
178:
179: try {
180: returnObj = TunnelUtil.invoke(httpPrincipal,
181: methodWrapper);
182: } catch (Exception e) {
183: if (e instanceof com.liferay.portal.SystemException) {
184: throw (com.liferay.portal.SystemException) e;
185: }
186:
187: if (e instanceof com.liferay.portal.PortalException) {
188: throw (com.liferay.portal.PortalException) e;
189: }
190:
191: throw new com.liferay.portal.SystemException(e);
192: }
193:
194: return (com.liferay.portlet.bookmarks.model.BookmarksFolder) returnObj;
195: } catch (com.liferay.portal.SystemException se) {
196: _log.error(se, se);
197:
198: throw se;
199: }
200: }
201:
202: public static void deleteFolder(HttpPrincipal httpPrincipal,
203: long folderId) throws com.liferay.portal.SystemException,
204: com.liferay.portal.PortalException {
205: try {
206: Object paramObj0 = new LongWrapper(folderId);
207:
208: MethodWrapper methodWrapper = new MethodWrapper(
209: BookmarksFolderServiceUtil.class.getName(),
210: "deleteFolder", new Object[] { paramObj0 });
211:
212: try {
213: TunnelUtil.invoke(httpPrincipal, methodWrapper);
214: } catch (Exception e) {
215: if (e instanceof com.liferay.portal.SystemException) {
216: throw (com.liferay.portal.SystemException) e;
217: }
218:
219: if (e instanceof com.liferay.portal.PortalException) {
220: throw (com.liferay.portal.PortalException) e;
221: }
222:
223: throw new com.liferay.portal.SystemException(e);
224: }
225: } catch (com.liferay.portal.SystemException se) {
226: _log.error(se, se);
227:
228: throw se;
229: }
230: }
231:
232: public static com.liferay.portlet.bookmarks.model.BookmarksFolder getFolder(
233: HttpPrincipal httpPrincipal, long folderId)
234: throws com.liferay.portal.SystemException,
235: com.liferay.portal.PortalException {
236: try {
237: Object paramObj0 = new LongWrapper(folderId);
238:
239: MethodWrapper methodWrapper = new MethodWrapper(
240: BookmarksFolderServiceUtil.class.getName(),
241: "getFolder", new Object[] { paramObj0 });
242:
243: Object returnObj = null;
244:
245: try {
246: returnObj = TunnelUtil.invoke(httpPrincipal,
247: methodWrapper);
248: } catch (Exception e) {
249: if (e instanceof com.liferay.portal.SystemException) {
250: throw (com.liferay.portal.SystemException) e;
251: }
252:
253: if (e instanceof com.liferay.portal.PortalException) {
254: throw (com.liferay.portal.PortalException) e;
255: }
256:
257: throw new com.liferay.portal.SystemException(e);
258: }
259:
260: return (com.liferay.portlet.bookmarks.model.BookmarksFolder) returnObj;
261: } catch (com.liferay.portal.SystemException se) {
262: _log.error(se, se);
263:
264: throw se;
265: }
266: }
267:
268: public static com.liferay.portlet.bookmarks.model.BookmarksFolder updateFolder(
269: HttpPrincipal httpPrincipal, long folderId,
270: long parentFolderId, java.lang.String name,
271: java.lang.String description, boolean mergeWithParentFolder)
272: throws com.liferay.portal.SystemException,
273: com.liferay.portal.PortalException {
274: try {
275: Object paramObj0 = new LongWrapper(folderId);
276:
277: Object paramObj1 = new LongWrapper(parentFolderId);
278:
279: Object paramObj2 = name;
280:
281: if (name == null) {
282: paramObj2 = new NullWrapper("java.lang.String");
283: }
284:
285: Object paramObj3 = description;
286:
287: if (description == null) {
288: paramObj3 = new NullWrapper("java.lang.String");
289: }
290:
291: Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
292:
293: MethodWrapper methodWrapper = new MethodWrapper(
294: BookmarksFolderServiceUtil.class.getName(),
295: "updateFolder",
296: new Object[] { paramObj0, paramObj1, paramObj2,
297: paramObj3, paramObj4 });
298:
299: Object returnObj = null;
300:
301: try {
302: returnObj = TunnelUtil.invoke(httpPrincipal,
303: methodWrapper);
304: } catch (Exception e) {
305: if (e instanceof com.liferay.portal.SystemException) {
306: throw (com.liferay.portal.SystemException) e;
307: }
308:
309: if (e instanceof com.liferay.portal.PortalException) {
310: throw (com.liferay.portal.PortalException) e;
311: }
312:
313: throw new com.liferay.portal.SystemException(e);
314: }
315:
316: return (com.liferay.portlet.bookmarks.model.BookmarksFolder) returnObj;
317: } catch (com.liferay.portal.SystemException se) {
318: _log.error(se, se);
319:
320: throw se;
321: }
322: }
323:
324: private static Log _log = LogFactoryUtil
325: .getLog(BookmarksFolderServiceHttp.class);
326: }
|