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.DoubleWrapper;
027: import com.liferay.portal.kernel.util.LongWrapper;
028: import com.liferay.portal.kernel.util.MethodWrapper;
029: import com.liferay.portal.kernel.util.NullWrapper;
030: import com.liferay.portal.security.auth.HttpPrincipal;
031: import com.liferay.portal.service.http.TunnelUtil;
032:
033: import com.liferay.portlet.documentlibrary.service.DLFileEntryServiceUtil;
034:
035: /**
036: * <a href="DLFileEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
037: *
038: * <p>
039: * ServiceBuilder generated this class. Modifications in this class will be
040: * overwritten the next time is generated.
041: * </p>
042: *
043: * <p>
044: * This class provides a HTTP utility for the
045: * <code>com.liferay.portlet.documentlibrary.service.DLFileEntryServiceUtil</code> service
046: * utility. The static methods of this class calls the same methods of the
047: * service utility. However, the signatures are different because it requires an
048: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
049: * parameter.
050: * </p>
051: *
052: * <p>
053: * The benefits of using the HTTP utility is that it is fast and allows for
054: * tunneling without the cost of serializing to text. The drawback is that it
055: * only works with Java.
056: * </p>
057: *
058: * <p>
059: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
060: * portal.properties to configure security.
061: * </p>
062: *
063: * <p>
064: * The HTTP utility is only generated for remote services.
065: * </p>
066: *
067: * @author Brian Wing Shun Chan
068: *
069: * @see com.liferay.portal.security.auth.HttpPrincipal
070: * @see com.liferay.portlet.documentlibrary.service.DLFileEntryServiceUtil
071: * @see com.liferay.portlet.documentlibrary.service.http.DLFileEntryServiceSoap
072: *
073: */
074: public class DLFileEntryServiceHttp {
075: public static com.liferay.portlet.documentlibrary.model.DLFileEntry addFileEntry(
076: HttpPrincipal httpPrincipal, long folderId,
077: java.lang.String name, java.lang.String title,
078: java.lang.String description,
079: java.lang.String[] tagsEntries,
080: java.lang.String extraSettings, byte[] byteArray,
081: boolean addCommunityPermissions, boolean addGuestPermissions)
082: throws com.liferay.portal.SystemException,
083: com.liferay.portal.PortalException {
084: try {
085: Object paramObj0 = new LongWrapper(folderId);
086:
087: Object paramObj1 = name;
088:
089: if (name == null) {
090: paramObj1 = new NullWrapper("java.lang.String");
091: }
092:
093: Object paramObj2 = title;
094:
095: if (title == null) {
096: paramObj2 = new NullWrapper("java.lang.String");
097: }
098:
099: Object paramObj3 = description;
100:
101: if (description == null) {
102: paramObj3 = new NullWrapper("java.lang.String");
103: }
104:
105: Object paramObj4 = tagsEntries;
106:
107: if (tagsEntries == null) {
108: paramObj4 = new NullWrapper("[Ljava.lang.String;");
109: }
110:
111: Object paramObj5 = extraSettings;
112:
113: if (extraSettings == null) {
114: paramObj5 = new NullWrapper("java.lang.String");
115: }
116:
117: Object paramObj6 = byteArray;
118:
119: if (byteArray == null) {
120: paramObj6 = new NullWrapper("[B");
121: }
122:
123: Object paramObj7 = new BooleanWrapper(
124: addCommunityPermissions);
125:
126: Object paramObj8 = new BooleanWrapper(addGuestPermissions);
127:
128: MethodWrapper methodWrapper = new MethodWrapper(
129: DLFileEntryServiceUtil.class.getName(),
130: "addFileEntry",
131: new Object[] { paramObj0, paramObj1, paramObj2,
132: paramObj3, paramObj4, paramObj5, paramObj6,
133: paramObj7, paramObj8 });
134:
135: Object returnObj = null;
136:
137: try {
138: returnObj = TunnelUtil.invoke(httpPrincipal,
139: methodWrapper);
140: } catch (Exception e) {
141: if (e instanceof com.liferay.portal.SystemException) {
142: throw (com.liferay.portal.SystemException) e;
143: }
144:
145: if (e instanceof com.liferay.portal.PortalException) {
146: throw (com.liferay.portal.PortalException) e;
147: }
148:
149: throw new com.liferay.portal.SystemException(e);
150: }
151:
152: return (com.liferay.portlet.documentlibrary.model.DLFileEntry) returnObj;
153: } catch (com.liferay.portal.SystemException se) {
154: _log.error(se, se);
155:
156: throw se;
157: }
158: }
159:
160: public static com.liferay.portlet.documentlibrary.model.DLFileEntry addFileEntry(
161: HttpPrincipal httpPrincipal, long folderId,
162: java.lang.String name, java.lang.String title,
163: java.lang.String description,
164: java.lang.String[] tagsEntries,
165: java.lang.String extraSettings, byte[] byteArray,
166: java.lang.String[] communityPermissions,
167: java.lang.String[] guestPermissions)
168: throws com.liferay.portal.SystemException,
169: com.liferay.portal.PortalException {
170: try {
171: Object paramObj0 = new LongWrapper(folderId);
172:
173: Object paramObj1 = name;
174:
175: if (name == null) {
176: paramObj1 = new NullWrapper("java.lang.String");
177: }
178:
179: Object paramObj2 = title;
180:
181: if (title == null) {
182: paramObj2 = new NullWrapper("java.lang.String");
183: }
184:
185: Object paramObj3 = description;
186:
187: if (description == null) {
188: paramObj3 = new NullWrapper("java.lang.String");
189: }
190:
191: Object paramObj4 = tagsEntries;
192:
193: if (tagsEntries == null) {
194: paramObj4 = new NullWrapper("[Ljava.lang.String;");
195: }
196:
197: Object paramObj5 = extraSettings;
198:
199: if (extraSettings == null) {
200: paramObj5 = new NullWrapper("java.lang.String");
201: }
202:
203: Object paramObj6 = byteArray;
204:
205: if (byteArray == null) {
206: paramObj6 = new NullWrapper("[B");
207: }
208:
209: Object paramObj7 = communityPermissions;
210:
211: if (communityPermissions == null) {
212: paramObj7 = new NullWrapper("[Ljava.lang.String;");
213: }
214:
215: Object paramObj8 = guestPermissions;
216:
217: if (guestPermissions == null) {
218: paramObj8 = new NullWrapper("[Ljava.lang.String;");
219: }
220:
221: MethodWrapper methodWrapper = new MethodWrapper(
222: DLFileEntryServiceUtil.class.getName(),
223: "addFileEntry",
224: new Object[] { paramObj0, paramObj1, paramObj2,
225: paramObj3, paramObj4, paramObj5, paramObj6,
226: paramObj7, paramObj8 });
227:
228: Object returnObj = null;
229:
230: try {
231: returnObj = TunnelUtil.invoke(httpPrincipal,
232: methodWrapper);
233: } catch (Exception e) {
234: if (e instanceof com.liferay.portal.SystemException) {
235: throw (com.liferay.portal.SystemException) e;
236: }
237:
238: if (e instanceof com.liferay.portal.PortalException) {
239: throw (com.liferay.portal.PortalException) e;
240: }
241:
242: throw new com.liferay.portal.SystemException(e);
243: }
244:
245: return (com.liferay.portlet.documentlibrary.model.DLFileEntry) returnObj;
246: } catch (com.liferay.portal.SystemException se) {
247: _log.error(se, se);
248:
249: throw se;
250: }
251: }
252:
253: public static void deleteFileEntry(HttpPrincipal httpPrincipal,
254: long folderId, java.lang.String name)
255: throws com.liferay.portal.SystemException,
256: com.liferay.portal.PortalException,
257: java.rmi.RemoteException {
258: try {
259: Object paramObj0 = new LongWrapper(folderId);
260:
261: Object paramObj1 = name;
262:
263: if (name == null) {
264: paramObj1 = new NullWrapper("java.lang.String");
265: }
266:
267: MethodWrapper methodWrapper = new MethodWrapper(
268: DLFileEntryServiceUtil.class.getName(),
269: "deleteFileEntry", new Object[] { paramObj0,
270: paramObj1 });
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: if (e instanceof java.rmi.RemoteException) {
284: throw (java.rmi.RemoteException) e;
285: }
286:
287: throw new com.liferay.portal.SystemException(e);
288: }
289: } catch (com.liferay.portal.SystemException se) {
290: _log.error(se, se);
291:
292: throw se;
293: }
294: }
295:
296: public static void deleteFileEntry(HttpPrincipal httpPrincipal,
297: long folderId, java.lang.String name, double version)
298: throws com.liferay.portal.SystemException,
299: com.liferay.portal.PortalException,
300: java.rmi.RemoteException {
301: try {
302: Object paramObj0 = new LongWrapper(folderId);
303:
304: Object paramObj1 = name;
305:
306: if (name == null) {
307: paramObj1 = new NullWrapper("java.lang.String");
308: }
309:
310: Object paramObj2 = new DoubleWrapper(version);
311:
312: MethodWrapper methodWrapper = new MethodWrapper(
313: DLFileEntryServiceUtil.class.getName(),
314: "deleteFileEntry", new Object[] { paramObj0,
315: paramObj1, paramObj2 });
316:
317: try {
318: TunnelUtil.invoke(httpPrincipal, methodWrapper);
319: } catch (Exception e) {
320: if (e instanceof com.liferay.portal.SystemException) {
321: throw (com.liferay.portal.SystemException) e;
322: }
323:
324: if (e instanceof com.liferay.portal.PortalException) {
325: throw (com.liferay.portal.PortalException) e;
326: }
327:
328: if (e instanceof java.rmi.RemoteException) {
329: throw (java.rmi.RemoteException) e;
330: }
331:
332: throw new com.liferay.portal.SystemException(e);
333: }
334: } catch (com.liferay.portal.SystemException se) {
335: _log.error(se, se);
336:
337: throw se;
338: }
339: }
340:
341: public static void deleteFileEntryByTitle(
342: HttpPrincipal httpPrincipal, long folderId,
343: java.lang.String titleWithExtension)
344: throws com.liferay.portal.SystemException,
345: com.liferay.portal.PortalException,
346: java.rmi.RemoteException {
347: try {
348: Object paramObj0 = new LongWrapper(folderId);
349:
350: Object paramObj1 = titleWithExtension;
351:
352: if (titleWithExtension == null) {
353: paramObj1 = new NullWrapper("java.lang.String");
354: }
355:
356: MethodWrapper methodWrapper = new MethodWrapper(
357: DLFileEntryServiceUtil.class.getName(),
358: "deleteFileEntryByTitle", new Object[] { paramObj0,
359: paramObj1 });
360:
361: try {
362: TunnelUtil.invoke(httpPrincipal, methodWrapper);
363: } catch (Exception e) {
364: if (e instanceof com.liferay.portal.SystemException) {
365: throw (com.liferay.portal.SystemException) e;
366: }
367:
368: if (e instanceof com.liferay.portal.PortalException) {
369: throw (com.liferay.portal.PortalException) e;
370: }
371:
372: if (e instanceof java.rmi.RemoteException) {
373: throw (java.rmi.RemoteException) e;
374: }
375:
376: throw new com.liferay.portal.SystemException(e);
377: }
378: } catch (com.liferay.portal.SystemException se) {
379: _log.error(se, se);
380:
381: throw se;
382: }
383: }
384:
385: public static com.liferay.portlet.documentlibrary.model.DLFileEntry getFileEntry(
386: HttpPrincipal httpPrincipal, long folderId,
387: java.lang.String name)
388: throws com.liferay.portal.SystemException,
389: com.liferay.portal.PortalException {
390: try {
391: Object paramObj0 = new LongWrapper(folderId);
392:
393: Object paramObj1 = name;
394:
395: if (name == null) {
396: paramObj1 = new NullWrapper("java.lang.String");
397: }
398:
399: MethodWrapper methodWrapper = new MethodWrapper(
400: DLFileEntryServiceUtil.class.getName(),
401: "getFileEntry",
402: new Object[] { paramObj0, paramObj1 });
403:
404: Object returnObj = null;
405:
406: try {
407: returnObj = TunnelUtil.invoke(httpPrincipal,
408: methodWrapper);
409: } catch (Exception e) {
410: if (e instanceof com.liferay.portal.SystemException) {
411: throw (com.liferay.portal.SystemException) e;
412: }
413:
414: if (e instanceof com.liferay.portal.PortalException) {
415: throw (com.liferay.portal.PortalException) e;
416: }
417:
418: throw new com.liferay.portal.SystemException(e);
419: }
420:
421: return (com.liferay.portlet.documentlibrary.model.DLFileEntry) returnObj;
422: } catch (com.liferay.portal.SystemException se) {
423: _log.error(se, se);
424:
425: throw se;
426: }
427: }
428:
429: public static com.liferay.portlet.documentlibrary.model.DLFileEntry getFileEntryByTitle(
430: HttpPrincipal httpPrincipal, long folderId,
431: java.lang.String titleWithExtension)
432: throws com.liferay.portal.SystemException,
433: com.liferay.portal.PortalException {
434: try {
435: Object paramObj0 = new LongWrapper(folderId);
436:
437: Object paramObj1 = titleWithExtension;
438:
439: if (titleWithExtension == null) {
440: paramObj1 = new NullWrapper("java.lang.String");
441: }
442:
443: MethodWrapper methodWrapper = new MethodWrapper(
444: DLFileEntryServiceUtil.class.getName(),
445: "getFileEntryByTitle", new Object[] { paramObj0,
446: paramObj1 });
447:
448: Object returnObj = null;
449:
450: try {
451: returnObj = TunnelUtil.invoke(httpPrincipal,
452: methodWrapper);
453: } catch (Exception e) {
454: if (e instanceof com.liferay.portal.SystemException) {
455: throw (com.liferay.portal.SystemException) e;
456: }
457:
458: if (e instanceof com.liferay.portal.PortalException) {
459: throw (com.liferay.portal.PortalException) e;
460: }
461:
462: throw new com.liferay.portal.SystemException(e);
463: }
464:
465: return (com.liferay.portlet.documentlibrary.model.DLFileEntry) returnObj;
466: } catch (com.liferay.portal.SystemException se) {
467: _log.error(se, se);
468:
469: throw se;
470: }
471: }
472:
473: public static void lockFileEntry(HttpPrincipal httpPrincipal,
474: long folderId, java.lang.String name)
475: throws com.liferay.portal.SystemException,
476: com.liferay.portal.PortalException,
477: java.rmi.RemoteException {
478: try {
479: Object paramObj0 = new LongWrapper(folderId);
480:
481: Object paramObj1 = name;
482:
483: if (name == null) {
484: paramObj1 = new NullWrapper("java.lang.String");
485: }
486:
487: MethodWrapper methodWrapper = new MethodWrapper(
488: DLFileEntryServiceUtil.class.getName(),
489: "lockFileEntry", new Object[] { paramObj0,
490: paramObj1 });
491:
492: try {
493: TunnelUtil.invoke(httpPrincipal, methodWrapper);
494: } catch (Exception e) {
495: if (e instanceof com.liferay.portal.SystemException) {
496: throw (com.liferay.portal.SystemException) e;
497: }
498:
499: if (e instanceof com.liferay.portal.PortalException) {
500: throw (com.liferay.portal.PortalException) e;
501: }
502:
503: if (e instanceof java.rmi.RemoteException) {
504: throw (java.rmi.RemoteException) e;
505: }
506:
507: throw new com.liferay.portal.SystemException(e);
508: }
509: } catch (com.liferay.portal.SystemException se) {
510: _log.error(se, se);
511:
512: throw se;
513: }
514: }
515:
516: public static void unlockFileEntry(HttpPrincipal httpPrincipal,
517: long folderId, java.lang.String name)
518: throws com.liferay.portal.SystemException,
519: com.liferay.portal.PortalException,
520: java.rmi.RemoteException {
521: try {
522: Object paramObj0 = new LongWrapper(folderId);
523:
524: Object paramObj1 = name;
525:
526: if (name == null) {
527: paramObj1 = new NullWrapper("java.lang.String");
528: }
529:
530: MethodWrapper methodWrapper = new MethodWrapper(
531: DLFileEntryServiceUtil.class.getName(),
532: "unlockFileEntry", new Object[] { paramObj0,
533: paramObj1 });
534:
535: try {
536: TunnelUtil.invoke(httpPrincipal, methodWrapper);
537: } catch (Exception e) {
538: if (e instanceof com.liferay.portal.SystemException) {
539: throw (com.liferay.portal.SystemException) e;
540: }
541:
542: if (e instanceof com.liferay.portal.PortalException) {
543: throw (com.liferay.portal.PortalException) e;
544: }
545:
546: if (e instanceof java.rmi.RemoteException) {
547: throw (java.rmi.RemoteException) e;
548: }
549:
550: throw new com.liferay.portal.SystemException(e);
551: }
552: } catch (com.liferay.portal.SystemException se) {
553: _log.error(se, se);
554:
555: throw se;
556: }
557: }
558:
559: public static com.liferay.portlet.documentlibrary.model.DLFileEntry updateFileEntry(
560: HttpPrincipal httpPrincipal, long folderId,
561: long newFolderId, java.lang.String name,
562: java.lang.String sourceFileName, java.lang.String title,
563: java.lang.String description,
564: java.lang.String[] tagsEntries,
565: java.lang.String extraSettings, byte[] byteArray)
566: throws com.liferay.portal.SystemException,
567: com.liferay.portal.PortalException,
568: java.rmi.RemoteException {
569: try {
570: Object paramObj0 = new LongWrapper(folderId);
571:
572: Object paramObj1 = new LongWrapper(newFolderId);
573:
574: Object paramObj2 = name;
575:
576: if (name == null) {
577: paramObj2 = new NullWrapper("java.lang.String");
578: }
579:
580: Object paramObj3 = sourceFileName;
581:
582: if (sourceFileName == null) {
583: paramObj3 = new NullWrapper("java.lang.String");
584: }
585:
586: Object paramObj4 = title;
587:
588: if (title == null) {
589: paramObj4 = new NullWrapper("java.lang.String");
590: }
591:
592: Object paramObj5 = description;
593:
594: if (description == null) {
595: paramObj5 = new NullWrapper("java.lang.String");
596: }
597:
598: Object paramObj6 = tagsEntries;
599:
600: if (tagsEntries == null) {
601: paramObj6 = new NullWrapper("[Ljava.lang.String;");
602: }
603:
604: Object paramObj7 = extraSettings;
605:
606: if (extraSettings == null) {
607: paramObj7 = new NullWrapper("java.lang.String");
608: }
609:
610: Object paramObj8 = byteArray;
611:
612: if (byteArray == null) {
613: paramObj8 = new NullWrapper("[B");
614: }
615:
616: MethodWrapper methodWrapper = new MethodWrapper(
617: DLFileEntryServiceUtil.class.getName(),
618: "updateFileEntry",
619: new Object[] { paramObj0, paramObj1, paramObj2,
620: paramObj3, paramObj4, paramObj5, paramObj6,
621: paramObj7, paramObj8 });
622:
623: Object returnObj = null;
624:
625: try {
626: returnObj = TunnelUtil.invoke(httpPrincipal,
627: methodWrapper);
628: } catch (Exception e) {
629: if (e instanceof com.liferay.portal.SystemException) {
630: throw (com.liferay.portal.SystemException) e;
631: }
632:
633: if (e instanceof com.liferay.portal.PortalException) {
634: throw (com.liferay.portal.PortalException) e;
635: }
636:
637: if (e instanceof java.rmi.RemoteException) {
638: throw (java.rmi.RemoteException) e;
639: }
640:
641: throw new com.liferay.portal.SystemException(e);
642: }
643:
644: return (com.liferay.portlet.documentlibrary.model.DLFileEntry) returnObj;
645: } catch (com.liferay.portal.SystemException se) {
646: _log.error(se, se);
647:
648: throw se;
649: }
650: }
651:
652: private static Log _log = LogFactoryUtil
653: .getLog(DLFileEntryServiceHttp.class);
654: }
|