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.documentlibrary.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.documentlibrary.service.DLFolderServiceUtil;
033:
034: /**
035: * <a href="DLFolderServiceHttp.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.documentlibrary.service.DLFolderServiceUtil</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.documentlibrary.service.DLFolderServiceUtil
070: * @see com.liferay.portlet.documentlibrary.service.http.DLFolderServiceSoap
071: *
072: */
073: public class DLFolderServiceHttp {
074: public static com.liferay.portlet.documentlibrary.model.DLFolder 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: DLFolderServiceUtil.class.getName(), "addFolder",
105: new Object[] { paramObj0, paramObj1, paramObj2,
106: paramObj3, paramObj4, paramObj5 });
107:
108: Object returnObj = null;
109:
110: try {
111: returnObj = TunnelUtil.invoke(httpPrincipal,
112: methodWrapper);
113: } catch (Exception e) {
114: if (e instanceof com.liferay.portal.SystemException) {
115: throw (com.liferay.portal.SystemException) e;
116: }
117:
118: if (e instanceof com.liferay.portal.PortalException) {
119: throw (com.liferay.portal.PortalException) e;
120: }
121:
122: throw new com.liferay.portal.SystemException(e);
123: }
124:
125: return (com.liferay.portlet.documentlibrary.model.DLFolder) returnObj;
126: } catch (com.liferay.portal.SystemException se) {
127: _log.error(se, se);
128:
129: throw se;
130: }
131: }
132:
133: public static com.liferay.portlet.documentlibrary.model.DLFolder addFolder(
134: HttpPrincipal httpPrincipal, long plid,
135: long parentFolderId, java.lang.String name,
136: java.lang.String description,
137: java.lang.String[] communityPermissions,
138: java.lang.String[] guestPermissions)
139: throws com.liferay.portal.SystemException,
140: com.liferay.portal.PortalException {
141: try {
142: Object paramObj0 = new LongWrapper(plid);
143:
144: Object paramObj1 = new LongWrapper(parentFolderId);
145:
146: Object paramObj2 = name;
147:
148: if (name == null) {
149: paramObj2 = new NullWrapper("java.lang.String");
150: }
151:
152: Object paramObj3 = description;
153:
154: if (description == null) {
155: paramObj3 = new NullWrapper("java.lang.String");
156: }
157:
158: Object paramObj4 = communityPermissions;
159:
160: if (communityPermissions == null) {
161: paramObj4 = new NullWrapper("[Ljava.lang.String;");
162: }
163:
164: Object paramObj5 = guestPermissions;
165:
166: if (guestPermissions == null) {
167: paramObj5 = new NullWrapper("[Ljava.lang.String;");
168: }
169:
170: MethodWrapper methodWrapper = new MethodWrapper(
171: DLFolderServiceUtil.class.getName(), "addFolder",
172: new Object[] { paramObj0, paramObj1, paramObj2,
173: paramObj3, paramObj4, paramObj5 });
174:
175: Object returnObj = null;
176:
177: try {
178: returnObj = TunnelUtil.invoke(httpPrincipal,
179: methodWrapper);
180: } catch (Exception e) {
181: if (e instanceof com.liferay.portal.SystemException) {
182: throw (com.liferay.portal.SystemException) e;
183: }
184:
185: if (e instanceof com.liferay.portal.PortalException) {
186: throw (com.liferay.portal.PortalException) e;
187: }
188:
189: throw new com.liferay.portal.SystemException(e);
190: }
191:
192: return (com.liferay.portlet.documentlibrary.model.DLFolder) returnObj;
193: } catch (com.liferay.portal.SystemException se) {
194: _log.error(se, se);
195:
196: throw se;
197: }
198: }
199:
200: public static com.liferay.portlet.documentlibrary.model.DLFolder copyFolder(
201: HttpPrincipal httpPrincipal, long plid,
202: long sourceFolderId, long parentFolderId,
203: java.lang.String name, java.lang.String description,
204: boolean addCommunityPermissions, boolean addGuestPermissions)
205: throws com.liferay.portal.SystemException,
206: com.liferay.portal.PortalException {
207: try {
208: Object paramObj0 = new LongWrapper(plid);
209:
210: Object paramObj1 = new LongWrapper(sourceFolderId);
211:
212: Object paramObj2 = new LongWrapper(parentFolderId);
213:
214: Object paramObj3 = name;
215:
216: if (name == null) {
217: paramObj3 = new NullWrapper("java.lang.String");
218: }
219:
220: Object paramObj4 = description;
221:
222: if (description == null) {
223: paramObj4 = new NullWrapper("java.lang.String");
224: }
225:
226: Object paramObj5 = new BooleanWrapper(
227: addCommunityPermissions);
228:
229: Object paramObj6 = new BooleanWrapper(addGuestPermissions);
230:
231: MethodWrapper methodWrapper = new MethodWrapper(
232: DLFolderServiceUtil.class.getName(),
233: "copyFolder",
234: new Object[] { paramObj0, paramObj1, paramObj2,
235: paramObj3, paramObj4, paramObj5, paramObj6 });
236:
237: Object returnObj = null;
238:
239: try {
240: returnObj = TunnelUtil.invoke(httpPrincipal,
241: methodWrapper);
242: } catch (Exception e) {
243: if (e instanceof com.liferay.portal.SystemException) {
244: throw (com.liferay.portal.SystemException) e;
245: }
246:
247: if (e instanceof com.liferay.portal.PortalException) {
248: throw (com.liferay.portal.PortalException) e;
249: }
250:
251: throw new com.liferay.portal.SystemException(e);
252: }
253:
254: return (com.liferay.portlet.documentlibrary.model.DLFolder) returnObj;
255: } catch (com.liferay.portal.SystemException se) {
256: _log.error(se, se);
257:
258: throw se;
259: }
260: }
261:
262: public static void deleteFolder(HttpPrincipal httpPrincipal,
263: long folderId) throws com.liferay.portal.SystemException,
264: com.liferay.portal.PortalException {
265: try {
266: Object paramObj0 = new LongWrapper(folderId);
267:
268: MethodWrapper methodWrapper = new MethodWrapper(
269: DLFolderServiceUtil.class.getName(),
270: "deleteFolder", new Object[] { paramObj0 });
271:
272: try {
273: TunnelUtil.invoke(httpPrincipal, methodWrapper);
274: } catch (Exception e) {
275: if (e instanceof com.liferay.portal.SystemException) {
276: throw (com.liferay.portal.SystemException) e;
277: }
278:
279: if (e instanceof com.liferay.portal.PortalException) {
280: throw (com.liferay.portal.PortalException) e;
281: }
282:
283: throw new com.liferay.portal.SystemException(e);
284: }
285: } catch (com.liferay.portal.SystemException se) {
286: _log.error(se, se);
287:
288: throw se;
289: }
290: }
291:
292: public static void deleteFolder(HttpPrincipal httpPrincipal,
293: long groupId, long parentFolderId, java.lang.String name)
294: throws com.liferay.portal.SystemException,
295: com.liferay.portal.PortalException {
296: try {
297: Object paramObj0 = new LongWrapper(groupId);
298:
299: Object paramObj1 = new LongWrapper(parentFolderId);
300:
301: Object paramObj2 = name;
302:
303: if (name == null) {
304: paramObj2 = new NullWrapper("java.lang.String");
305: }
306:
307: MethodWrapper methodWrapper = new MethodWrapper(
308: DLFolderServiceUtil.class.getName(),
309: "deleteFolder", new Object[] { paramObj0,
310: paramObj1, paramObj2 });
311:
312: try {
313: TunnelUtil.invoke(httpPrincipal, methodWrapper);
314: } catch (Exception e) {
315: if (e instanceof com.liferay.portal.SystemException) {
316: throw (com.liferay.portal.SystemException) e;
317: }
318:
319: if (e instanceof com.liferay.portal.PortalException) {
320: throw (com.liferay.portal.PortalException) e;
321: }
322:
323: throw new com.liferay.portal.SystemException(e);
324: }
325: } catch (com.liferay.portal.SystemException se) {
326: _log.error(se, se);
327:
328: throw se;
329: }
330: }
331:
332: public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
333: HttpPrincipal httpPrincipal, long folderId)
334: throws com.liferay.portal.SystemException,
335: com.liferay.portal.PortalException {
336: try {
337: Object paramObj0 = new LongWrapper(folderId);
338:
339: MethodWrapper methodWrapper = new MethodWrapper(
340: DLFolderServiceUtil.class.getName(), "getFolder",
341: new Object[] { paramObj0 });
342:
343: Object returnObj = null;
344:
345: try {
346: returnObj = TunnelUtil.invoke(httpPrincipal,
347: methodWrapper);
348: } catch (Exception e) {
349: if (e instanceof com.liferay.portal.SystemException) {
350: throw (com.liferay.portal.SystemException) e;
351: }
352:
353: if (e instanceof com.liferay.portal.PortalException) {
354: throw (com.liferay.portal.PortalException) e;
355: }
356:
357: throw new com.liferay.portal.SystemException(e);
358: }
359:
360: return (com.liferay.portlet.documentlibrary.model.DLFolder) returnObj;
361: } catch (com.liferay.portal.SystemException se) {
362: _log.error(se, se);
363:
364: throw se;
365: }
366: }
367:
368: public static com.liferay.portlet.documentlibrary.model.DLFolder getFolder(
369: HttpPrincipal httpPrincipal, long groupId,
370: long parentFolderId, java.lang.String name)
371: throws com.liferay.portal.SystemException,
372: com.liferay.portal.PortalException {
373: try {
374: Object paramObj0 = new LongWrapper(groupId);
375:
376: Object paramObj1 = new LongWrapper(parentFolderId);
377:
378: Object paramObj2 = name;
379:
380: if (name == null) {
381: paramObj2 = new NullWrapper("java.lang.String");
382: }
383:
384: MethodWrapper methodWrapper = new MethodWrapper(
385: DLFolderServiceUtil.class.getName(), "getFolder",
386: new Object[] { paramObj0, paramObj1, paramObj2 });
387:
388: Object returnObj = null;
389:
390: try {
391: returnObj = TunnelUtil.invoke(httpPrincipal,
392: methodWrapper);
393: } catch (Exception e) {
394: if (e instanceof com.liferay.portal.SystemException) {
395: throw (com.liferay.portal.SystemException) e;
396: }
397:
398: if (e instanceof com.liferay.portal.PortalException) {
399: throw (com.liferay.portal.PortalException) e;
400: }
401:
402: throw new com.liferay.portal.SystemException(e);
403: }
404:
405: return (com.liferay.portlet.documentlibrary.model.DLFolder) returnObj;
406: } catch (com.liferay.portal.SystemException se) {
407: _log.error(se, se);
408:
409: throw se;
410: }
411: }
412:
413: public static long getFolderId(HttpPrincipal httpPrincipal,
414: long groupId, long parentFolderId, java.lang.String name)
415: throws com.liferay.portal.SystemException,
416: com.liferay.portal.PortalException {
417: try {
418: Object paramObj0 = new LongWrapper(groupId);
419:
420: Object paramObj1 = new LongWrapper(parentFolderId);
421:
422: Object paramObj2 = name;
423:
424: if (name == null) {
425: paramObj2 = new NullWrapper("java.lang.String");
426: }
427:
428: MethodWrapper methodWrapper = new MethodWrapper(
429: DLFolderServiceUtil.class.getName(), "getFolderId",
430: new Object[] { paramObj0, paramObj1, paramObj2 });
431:
432: Object returnObj = null;
433:
434: try {
435: returnObj = TunnelUtil.invoke(httpPrincipal,
436: methodWrapper);
437: } catch (Exception e) {
438: if (e instanceof com.liferay.portal.SystemException) {
439: throw (com.liferay.portal.SystemException) e;
440: }
441:
442: if (e instanceof com.liferay.portal.PortalException) {
443: throw (com.liferay.portal.PortalException) e;
444: }
445:
446: throw new com.liferay.portal.SystemException(e);
447: }
448:
449: return ((Long) returnObj).longValue();
450: } catch (com.liferay.portal.SystemException se) {
451: _log.error(se, se);
452:
453: throw se;
454: }
455: }
456:
457: public static void reIndexSearch(HttpPrincipal httpPrincipal,
458: long companyId) throws com.liferay.portal.SystemException,
459: com.liferay.portal.PortalException {
460: try {
461: Object paramObj0 = new LongWrapper(companyId);
462:
463: MethodWrapper methodWrapper = new MethodWrapper(
464: DLFolderServiceUtil.class.getName(),
465: "reIndexSearch", new Object[] { paramObj0 });
466:
467: try {
468: TunnelUtil.invoke(httpPrincipal, methodWrapper);
469: } catch (Exception e) {
470: if (e instanceof com.liferay.portal.SystemException) {
471: throw (com.liferay.portal.SystemException) e;
472: }
473:
474: if (e instanceof com.liferay.portal.PortalException) {
475: throw (com.liferay.portal.PortalException) e;
476: }
477:
478: throw new com.liferay.portal.SystemException(e);
479: }
480: } catch (com.liferay.portal.SystemException se) {
481: _log.error(se, se);
482:
483: throw se;
484: }
485: }
486:
487: public static com.liferay.portlet.documentlibrary.model.DLFolder updateFolder(
488: HttpPrincipal httpPrincipal, long folderId,
489: long parentFolderId, java.lang.String name,
490: java.lang.String description)
491: throws com.liferay.portal.SystemException,
492: com.liferay.portal.PortalException {
493: try {
494: Object paramObj0 = new LongWrapper(folderId);
495:
496: Object paramObj1 = new LongWrapper(parentFolderId);
497:
498: Object paramObj2 = name;
499:
500: if (name == null) {
501: paramObj2 = new NullWrapper("java.lang.String");
502: }
503:
504: Object paramObj3 = description;
505:
506: if (description == null) {
507: paramObj3 = new NullWrapper("java.lang.String");
508: }
509:
510: MethodWrapper methodWrapper = new MethodWrapper(
511: DLFolderServiceUtil.class.getName(),
512: "updateFolder", new Object[] { paramObj0,
513: paramObj1, paramObj2, paramObj3 });
514:
515: Object returnObj = null;
516:
517: try {
518: returnObj = TunnelUtil.invoke(httpPrincipal,
519: methodWrapper);
520: } catch (Exception e) {
521: if (e instanceof com.liferay.portal.SystemException) {
522: throw (com.liferay.portal.SystemException) e;
523: }
524:
525: if (e instanceof com.liferay.portal.PortalException) {
526: throw (com.liferay.portal.PortalException) e;
527: }
528:
529: throw new com.liferay.portal.SystemException(e);
530: }
531:
532: return (com.liferay.portlet.documentlibrary.model.DLFolder) returnObj;
533: } catch (com.liferay.portal.SystemException se) {
534: _log.error(se, se);
535:
536: throw se;
537: }
538: }
539:
540: private static Log _log = LogFactoryUtil
541: .getLog(DLFolderServiceHttp.class);
542: }
|