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