1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.BooleanWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.journal.service.JournalTemplateServiceUtil;
27  
28  /**
29   * <a href="JournalTemplateServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.journal.service.JournalTemplateServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       JournalTemplateServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.journal.service.JournalTemplateServiceUtil
63   * @generated
64   */
65  public class JournalTemplateServiceHttp {
66      public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
67          HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
68          boolean autoTemplateId, java.lang.String structureId,
69          java.lang.String name, java.lang.String description,
70          java.lang.String xsl, boolean formatXsl, java.lang.String langType,
71          boolean cacheable,
72          com.liferay.portal.service.ServiceContext serviceContext)
73          throws com.liferay.portal.kernel.exception.PortalException,
74              com.liferay.portal.kernel.exception.SystemException {
75          try {
76              Object paramObj0 = new LongWrapper(groupId);
77  
78              Object paramObj1 = templateId;
79  
80              if (templateId == null) {
81                  paramObj1 = new NullWrapper("java.lang.String");
82              }
83  
84              Object paramObj2 = new BooleanWrapper(autoTemplateId);
85  
86              Object paramObj3 = structureId;
87  
88              if (structureId == null) {
89                  paramObj3 = new NullWrapper("java.lang.String");
90              }
91  
92              Object paramObj4 = name;
93  
94              if (name == null) {
95                  paramObj4 = new NullWrapper("java.lang.String");
96              }
97  
98              Object paramObj5 = description;
99  
100             if (description == null) {
101                 paramObj5 = new NullWrapper("java.lang.String");
102             }
103 
104             Object paramObj6 = xsl;
105 
106             if (xsl == null) {
107                 paramObj6 = new NullWrapper("java.lang.String");
108             }
109 
110             Object paramObj7 = new BooleanWrapper(formatXsl);
111 
112             Object paramObj8 = langType;
113 
114             if (langType == null) {
115                 paramObj8 = new NullWrapper("java.lang.String");
116             }
117 
118             Object paramObj9 = new BooleanWrapper(cacheable);
119 
120             Object paramObj10 = serviceContext;
121 
122             if (serviceContext == null) {
123                 paramObj10 = new NullWrapper(
124                         "com.liferay.portal.service.ServiceContext");
125             }
126 
127             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
128                     "addTemplate",
129                     new Object[] {
130                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
131                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
132                         paramObj10
133                     });
134 
135             Object returnObj = null;
136 
137             try {
138                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
139             }
140             catch (Exception e) {
141                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                     throw (com.liferay.portal.kernel.exception.PortalException)e;
143                 }
144 
145                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
146                     throw (com.liferay.portal.kernel.exception.SystemException)e;
147                 }
148 
149                 throw new com.liferay.portal.kernel.exception.SystemException(e);
150             }
151 
152             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
153         }
154         catch (com.liferay.portal.kernel.exception.SystemException se) {
155             _log.error(se, se);
156 
157             throw se;
158         }
159     }
160 
161     public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
162         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
163         boolean autoTemplateId, java.lang.String structureId,
164         java.lang.String name, java.lang.String description,
165         java.lang.String xsl, boolean formatXsl, java.lang.String langType,
166         boolean cacheable, boolean smallImage, java.lang.String smallImageURL,
167         java.io.File smallFile,
168         com.liferay.portal.service.ServiceContext serviceContext)
169         throws com.liferay.portal.kernel.exception.PortalException,
170             com.liferay.portal.kernel.exception.SystemException {
171         try {
172             Object paramObj0 = new LongWrapper(groupId);
173 
174             Object paramObj1 = templateId;
175 
176             if (templateId == null) {
177                 paramObj1 = new NullWrapper("java.lang.String");
178             }
179 
180             Object paramObj2 = new BooleanWrapper(autoTemplateId);
181 
182             Object paramObj3 = structureId;
183 
184             if (structureId == null) {
185                 paramObj3 = new NullWrapper("java.lang.String");
186             }
187 
188             Object paramObj4 = name;
189 
190             if (name == null) {
191                 paramObj4 = new NullWrapper("java.lang.String");
192             }
193 
194             Object paramObj5 = description;
195 
196             if (description == null) {
197                 paramObj5 = new NullWrapper("java.lang.String");
198             }
199 
200             Object paramObj6 = xsl;
201 
202             if (xsl == null) {
203                 paramObj6 = new NullWrapper("java.lang.String");
204             }
205 
206             Object paramObj7 = new BooleanWrapper(formatXsl);
207 
208             Object paramObj8 = langType;
209 
210             if (langType == null) {
211                 paramObj8 = new NullWrapper("java.lang.String");
212             }
213 
214             Object paramObj9 = new BooleanWrapper(cacheable);
215 
216             Object paramObj10 = new BooleanWrapper(smallImage);
217 
218             Object paramObj11 = smallImageURL;
219 
220             if (smallImageURL == null) {
221                 paramObj11 = new NullWrapper("java.lang.String");
222             }
223 
224             Object paramObj12 = smallFile;
225 
226             if (smallFile == null) {
227                 paramObj12 = new NullWrapper("java.io.File");
228             }
229 
230             Object paramObj13 = serviceContext;
231 
232             if (serviceContext == null) {
233                 paramObj13 = new NullWrapper(
234                         "com.liferay.portal.service.ServiceContext");
235             }
236 
237             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
238                     "addTemplate",
239                     new Object[] {
240                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
241                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
242                         paramObj10, paramObj11, paramObj12, paramObj13
243                     });
244 
245             Object returnObj = null;
246 
247             try {
248                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
249             }
250             catch (Exception e) {
251                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
252                     throw (com.liferay.portal.kernel.exception.PortalException)e;
253                 }
254 
255                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
256                     throw (com.liferay.portal.kernel.exception.SystemException)e;
257                 }
258 
259                 throw new com.liferay.portal.kernel.exception.SystemException(e);
260             }
261 
262             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
263         }
264         catch (com.liferay.portal.kernel.exception.SystemException se) {
265             _log.error(se, se);
266 
267             throw se;
268         }
269     }
270 
271     public static com.liferay.portlet.journal.model.JournalTemplate copyTemplate(
272         HttpPrincipal httpPrincipal, long groupId,
273         java.lang.String oldTemplateId, java.lang.String newTemplateId,
274         boolean autoTemplateId)
275         throws com.liferay.portal.kernel.exception.PortalException,
276             com.liferay.portal.kernel.exception.SystemException {
277         try {
278             Object paramObj0 = new LongWrapper(groupId);
279 
280             Object paramObj1 = oldTemplateId;
281 
282             if (oldTemplateId == null) {
283                 paramObj1 = new NullWrapper("java.lang.String");
284             }
285 
286             Object paramObj2 = newTemplateId;
287 
288             if (newTemplateId == null) {
289                 paramObj2 = new NullWrapper("java.lang.String");
290             }
291 
292             Object paramObj3 = new BooleanWrapper(autoTemplateId);
293 
294             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
295                     "copyTemplate",
296                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
297 
298             Object returnObj = null;
299 
300             try {
301                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
302             }
303             catch (Exception e) {
304                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
305                     throw (com.liferay.portal.kernel.exception.PortalException)e;
306                 }
307 
308                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
309                     throw (com.liferay.portal.kernel.exception.SystemException)e;
310                 }
311 
312                 throw new com.liferay.portal.kernel.exception.SystemException(e);
313             }
314 
315             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
316         }
317         catch (com.liferay.portal.kernel.exception.SystemException se) {
318             _log.error(se, se);
319 
320             throw se;
321         }
322     }
323 
324     public static void deleteTemplate(HttpPrincipal httpPrincipal,
325         long groupId, java.lang.String templateId)
326         throws com.liferay.portal.kernel.exception.PortalException,
327             com.liferay.portal.kernel.exception.SystemException {
328         try {
329             Object paramObj0 = new LongWrapper(groupId);
330 
331             Object paramObj1 = templateId;
332 
333             if (templateId == null) {
334                 paramObj1 = new NullWrapper("java.lang.String");
335             }
336 
337             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
338                     "deleteTemplate", new Object[] { paramObj0, paramObj1 });
339 
340             try {
341                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
342             }
343             catch (Exception e) {
344                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
345                     throw (com.liferay.portal.kernel.exception.PortalException)e;
346                 }
347 
348                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
349                     throw (com.liferay.portal.kernel.exception.SystemException)e;
350                 }
351 
352                 throw new com.liferay.portal.kernel.exception.SystemException(e);
353             }
354         }
355         catch (com.liferay.portal.kernel.exception.SystemException se) {
356             _log.error(se, se);
357 
358             throw se;
359         }
360     }
361 
362     public static java.util.List<com.liferay.portlet.journal.model.JournalTemplate> getStructureTemplates(
363         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
364         throws com.liferay.portal.kernel.exception.PortalException,
365             com.liferay.portal.kernel.exception.SystemException {
366         try {
367             Object paramObj0 = new LongWrapper(groupId);
368 
369             Object paramObj1 = structureId;
370 
371             if (structureId == null) {
372                 paramObj1 = new NullWrapper("java.lang.String");
373             }
374 
375             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
376                     "getStructureTemplates",
377                     new Object[] { paramObj0, paramObj1 });
378 
379             Object returnObj = null;
380 
381             try {
382                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
383             }
384             catch (Exception e) {
385                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
386                     throw (com.liferay.portal.kernel.exception.PortalException)e;
387                 }
388 
389                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
390                     throw (com.liferay.portal.kernel.exception.SystemException)e;
391                 }
392 
393                 throw new com.liferay.portal.kernel.exception.SystemException(e);
394             }
395 
396             return (java.util.List<com.liferay.portlet.journal.model.JournalTemplate>)returnObj;
397         }
398         catch (com.liferay.portal.kernel.exception.SystemException se) {
399             _log.error(se, se);
400 
401             throw se;
402         }
403     }
404 
405     public static com.liferay.portlet.journal.model.JournalTemplate getTemplate(
406         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId)
407         throws com.liferay.portal.kernel.exception.PortalException,
408             com.liferay.portal.kernel.exception.SystemException {
409         try {
410             Object paramObj0 = new LongWrapper(groupId);
411 
412             Object paramObj1 = templateId;
413 
414             if (templateId == null) {
415                 paramObj1 = new NullWrapper("java.lang.String");
416             }
417 
418             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
419                     "getTemplate", new Object[] { paramObj0, paramObj1 });
420 
421             Object returnObj = null;
422 
423             try {
424                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
425             }
426             catch (Exception e) {
427                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
428                     throw (com.liferay.portal.kernel.exception.PortalException)e;
429                 }
430 
431                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
432                     throw (com.liferay.portal.kernel.exception.SystemException)e;
433                 }
434 
435                 throw new com.liferay.portal.kernel.exception.SystemException(e);
436             }
437 
438             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
439         }
440         catch (com.liferay.portal.kernel.exception.SystemException se) {
441             _log.error(se, se);
442 
443             throw se;
444         }
445     }
446 
447     public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
448         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
449         java.lang.String structureId, java.lang.String name,
450         java.lang.String description, java.lang.String xsl, boolean formatXsl,
451         java.lang.String langType, boolean cacheable,
452         com.liferay.portal.service.ServiceContext serviceContext)
453         throws com.liferay.portal.kernel.exception.PortalException,
454             com.liferay.portal.kernel.exception.SystemException {
455         try {
456             Object paramObj0 = new LongWrapper(groupId);
457 
458             Object paramObj1 = templateId;
459 
460             if (templateId == null) {
461                 paramObj1 = new NullWrapper("java.lang.String");
462             }
463 
464             Object paramObj2 = structureId;
465 
466             if (structureId == null) {
467                 paramObj2 = new NullWrapper("java.lang.String");
468             }
469 
470             Object paramObj3 = name;
471 
472             if (name == null) {
473                 paramObj3 = new NullWrapper("java.lang.String");
474             }
475 
476             Object paramObj4 = description;
477 
478             if (description == null) {
479                 paramObj4 = new NullWrapper("java.lang.String");
480             }
481 
482             Object paramObj5 = xsl;
483 
484             if (xsl == null) {
485                 paramObj5 = new NullWrapper("java.lang.String");
486             }
487 
488             Object paramObj6 = new BooleanWrapper(formatXsl);
489 
490             Object paramObj7 = langType;
491 
492             if (langType == null) {
493                 paramObj7 = new NullWrapper("java.lang.String");
494             }
495 
496             Object paramObj8 = new BooleanWrapper(cacheable);
497 
498             Object paramObj9 = serviceContext;
499 
500             if (serviceContext == null) {
501                 paramObj9 = new NullWrapper(
502                         "com.liferay.portal.service.ServiceContext");
503             }
504 
505             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
506                     "updateTemplate",
507                     new Object[] {
508                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
509                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
510                     });
511 
512             Object returnObj = null;
513 
514             try {
515                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
516             }
517             catch (Exception e) {
518                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
519                     throw (com.liferay.portal.kernel.exception.PortalException)e;
520                 }
521 
522                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
523                     throw (com.liferay.portal.kernel.exception.SystemException)e;
524                 }
525 
526                 throw new com.liferay.portal.kernel.exception.SystemException(e);
527             }
528 
529             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
530         }
531         catch (com.liferay.portal.kernel.exception.SystemException se) {
532             _log.error(se, se);
533 
534             throw se;
535         }
536     }
537 
538     public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
539         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
540         java.lang.String structureId, java.lang.String name,
541         java.lang.String description, java.lang.String xsl, boolean formatXsl,
542         java.lang.String langType, boolean cacheable, boolean smallImage,
543         java.lang.String smallImageURL, java.io.File smallFile,
544         com.liferay.portal.service.ServiceContext serviceContext)
545         throws com.liferay.portal.kernel.exception.PortalException,
546             com.liferay.portal.kernel.exception.SystemException {
547         try {
548             Object paramObj0 = new LongWrapper(groupId);
549 
550             Object paramObj1 = templateId;
551 
552             if (templateId == null) {
553                 paramObj1 = new NullWrapper("java.lang.String");
554             }
555 
556             Object paramObj2 = structureId;
557 
558             if (structureId == null) {
559                 paramObj2 = new NullWrapper("java.lang.String");
560             }
561 
562             Object paramObj3 = name;
563 
564             if (name == null) {
565                 paramObj3 = new NullWrapper("java.lang.String");
566             }
567 
568             Object paramObj4 = description;
569 
570             if (description == null) {
571                 paramObj4 = new NullWrapper("java.lang.String");
572             }
573 
574             Object paramObj5 = xsl;
575 
576             if (xsl == null) {
577                 paramObj5 = new NullWrapper("java.lang.String");
578             }
579 
580             Object paramObj6 = new BooleanWrapper(formatXsl);
581 
582             Object paramObj7 = langType;
583 
584             if (langType == null) {
585                 paramObj7 = new NullWrapper("java.lang.String");
586             }
587 
588             Object paramObj8 = new BooleanWrapper(cacheable);
589 
590             Object paramObj9 = new BooleanWrapper(smallImage);
591 
592             Object paramObj10 = smallImageURL;
593 
594             if (smallImageURL == null) {
595                 paramObj10 = new NullWrapper("java.lang.String");
596             }
597 
598             Object paramObj11 = smallFile;
599 
600             if (smallFile == null) {
601                 paramObj11 = new NullWrapper("java.io.File");
602             }
603 
604             Object paramObj12 = serviceContext;
605 
606             if (serviceContext == null) {
607                 paramObj12 = new NullWrapper(
608                         "com.liferay.portal.service.ServiceContext");
609             }
610 
611             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
612                     "updateTemplate",
613                     new Object[] {
614                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
615                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
616                         paramObj10, paramObj11, paramObj12
617                     });
618 
619             Object returnObj = null;
620 
621             try {
622                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
623             }
624             catch (Exception e) {
625                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
626                     throw (com.liferay.portal.kernel.exception.PortalException)e;
627                 }
628 
629                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
630                     throw (com.liferay.portal.kernel.exception.SystemException)e;
631                 }
632 
633                 throw new com.liferay.portal.kernel.exception.SystemException(e);
634             }
635 
636             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
637         }
638         catch (com.liferay.portal.kernel.exception.SystemException se) {
639             _log.error(se, se);
640 
641             throw se;
642         }
643     }
644 
645     private static Log _log = LogFactoryUtil.getLog(JournalTemplateServiceHttp.class);
646 }