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