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