1   /**
2    * Copyright (c) 2000-2010 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   *
12   * 
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, java.lang.String templateId,
68          boolean autoTemplateId, long plid, 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, boolean smallImage, java.lang.String smallImageURL,
72          java.io.File smallFile, boolean addCommunityPermissions,
73          boolean addGuestPermissions)
74          throws com.liferay.portal.PortalException,
75              com.liferay.portal.SystemException {
76          try {
77              Object paramObj0 = templateId;
78  
79              if (templateId == null) {
80                  paramObj0 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj1 = new BooleanWrapper(autoTemplateId);
84  
85              Object paramObj2 = new LongWrapper(plid);
86  
87              Object paramObj3 = structureId;
88  
89              if (structureId == null) {
90                  paramObj3 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj4 = name;
94  
95              if (name == null) {
96                  paramObj4 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj5 = description;
100 
101             if (description == null) {
102                 paramObj5 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj6 = xsl;
106 
107             if (xsl == null) {
108                 paramObj6 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj7 = new BooleanWrapper(formatXsl);
112 
113             Object paramObj8 = langType;
114 
115             if (langType == null) {
116                 paramObj8 = new NullWrapper("java.lang.String");
117             }
118 
119             Object paramObj9 = new BooleanWrapper(cacheable);
120 
121             Object paramObj10 = new BooleanWrapper(smallImage);
122 
123             Object paramObj11 = smallImageURL;
124 
125             if (smallImageURL == null) {
126                 paramObj11 = new NullWrapper("java.lang.String");
127             }
128 
129             Object paramObj12 = smallFile;
130 
131             if (smallFile == null) {
132                 paramObj12 = new NullWrapper("java.io.File");
133             }
134 
135             Object paramObj13 = new BooleanWrapper(addCommunityPermissions);
136 
137             Object paramObj14 = new BooleanWrapper(addGuestPermissions);
138 
139             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
140                     "addTemplate",
141                     new Object[] {
142                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
143                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
144                         paramObj10, paramObj11, paramObj12, paramObj13,
145                         paramObj14
146                     });
147 
148             Object returnObj = null;
149 
150             try {
151                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
152             }
153             catch (Exception e) {
154                 if (e instanceof com.liferay.portal.PortalException) {
155                     throw (com.liferay.portal.PortalException)e;
156                 }
157 
158                 if (e instanceof com.liferay.portal.SystemException) {
159                     throw (com.liferay.portal.SystemException)e;
160                 }
161 
162                 throw new com.liferay.portal.SystemException(e);
163             }
164 
165             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
166         }
167         catch (com.liferay.portal.SystemException se) {
168             _log.error(se, se);
169 
170             throw se;
171         }
172     }
173 
174     public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
175         HttpPrincipal httpPrincipal, java.lang.String templateId,
176         boolean autoTemplateId, long plid, java.lang.String structureId,
177         java.lang.String name, java.lang.String description,
178         java.lang.String xsl, boolean formatXsl, java.lang.String langType,
179         boolean cacheable, boolean smallImage, java.lang.String smallImageURL,
180         java.io.File smallFile, java.lang.String[] communityPermissions,
181         java.lang.String[] guestPermissions)
182         throws com.liferay.portal.PortalException,
183             com.liferay.portal.SystemException {
184         try {
185             Object paramObj0 = templateId;
186 
187             if (templateId == null) {
188                 paramObj0 = new NullWrapper("java.lang.String");
189             }
190 
191             Object paramObj1 = new BooleanWrapper(autoTemplateId);
192 
193             Object paramObj2 = new LongWrapper(plid);
194 
195             Object paramObj3 = structureId;
196 
197             if (structureId == null) {
198                 paramObj3 = new NullWrapper("java.lang.String");
199             }
200 
201             Object paramObj4 = name;
202 
203             if (name == null) {
204                 paramObj4 = new NullWrapper("java.lang.String");
205             }
206 
207             Object paramObj5 = description;
208 
209             if (description == null) {
210                 paramObj5 = new NullWrapper("java.lang.String");
211             }
212 
213             Object paramObj6 = xsl;
214 
215             if (xsl == null) {
216                 paramObj6 = new NullWrapper("java.lang.String");
217             }
218 
219             Object paramObj7 = new BooleanWrapper(formatXsl);
220 
221             Object paramObj8 = langType;
222 
223             if (langType == null) {
224                 paramObj8 = new NullWrapper("java.lang.String");
225             }
226 
227             Object paramObj9 = new BooleanWrapper(cacheable);
228 
229             Object paramObj10 = new BooleanWrapper(smallImage);
230 
231             Object paramObj11 = smallImageURL;
232 
233             if (smallImageURL == null) {
234                 paramObj11 = new NullWrapper("java.lang.String");
235             }
236 
237             Object paramObj12 = smallFile;
238 
239             if (smallFile == null) {
240                 paramObj12 = new NullWrapper("java.io.File");
241             }
242 
243             Object paramObj13 = communityPermissions;
244 
245             if (communityPermissions == null) {
246                 paramObj13 = new NullWrapper("[Ljava.lang.String;");
247             }
248 
249             Object paramObj14 = guestPermissions;
250 
251             if (guestPermissions == null) {
252                 paramObj14 = new NullWrapper("[Ljava.lang.String;");
253             }
254 
255             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
256                     "addTemplate",
257                     new Object[] {
258                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
259                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
260                         paramObj10, paramObj11, paramObj12, paramObj13,
261                         paramObj14
262                     });
263 
264             Object returnObj = null;
265 
266             try {
267                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
268             }
269             catch (Exception e) {
270                 if (e instanceof com.liferay.portal.PortalException) {
271                     throw (com.liferay.portal.PortalException)e;
272                 }
273 
274                 if (e instanceof com.liferay.portal.SystemException) {
275                     throw (com.liferay.portal.SystemException)e;
276                 }
277 
278                 throw new com.liferay.portal.SystemException(e);
279             }
280 
281             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
282         }
283         catch (com.liferay.portal.SystemException se) {
284             _log.error(se, se);
285 
286             throw se;
287         }
288     }
289 
290     public static com.liferay.portlet.journal.model.JournalTemplate copyTemplate(
291         HttpPrincipal httpPrincipal, long groupId,
292         java.lang.String oldTemplateId, java.lang.String newTemplateId,
293         boolean autoTemplateId)
294         throws com.liferay.portal.PortalException,
295             com.liferay.portal.SystemException {
296         try {
297             Object paramObj0 = new LongWrapper(groupId);
298 
299             Object paramObj1 = oldTemplateId;
300 
301             if (oldTemplateId == null) {
302                 paramObj1 = new NullWrapper("java.lang.String");
303             }
304 
305             Object paramObj2 = newTemplateId;
306 
307             if (newTemplateId == null) {
308                 paramObj2 = new NullWrapper("java.lang.String");
309             }
310 
311             Object paramObj3 = new BooleanWrapper(autoTemplateId);
312 
313             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
314                     "copyTemplate",
315                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
316 
317             Object returnObj = null;
318 
319             try {
320                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
321             }
322             catch (Exception e) {
323                 if (e instanceof com.liferay.portal.PortalException) {
324                     throw (com.liferay.portal.PortalException)e;
325                 }
326 
327                 if (e instanceof com.liferay.portal.SystemException) {
328                     throw (com.liferay.portal.SystemException)e;
329                 }
330 
331                 throw new com.liferay.portal.SystemException(e);
332             }
333 
334             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
335         }
336         catch (com.liferay.portal.SystemException se) {
337             _log.error(se, se);
338 
339             throw se;
340         }
341     }
342 
343     public static void deleteTemplate(HttpPrincipal httpPrincipal,
344         long groupId, java.lang.String templateId)
345         throws com.liferay.portal.PortalException,
346             com.liferay.portal.SystemException {
347         try {
348             Object paramObj0 = new LongWrapper(groupId);
349 
350             Object paramObj1 = templateId;
351 
352             if (templateId == null) {
353                 paramObj1 = new NullWrapper("java.lang.String");
354             }
355 
356             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
357                     "deleteTemplate", new Object[] { paramObj0, paramObj1 });
358 
359             try {
360                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
361             }
362             catch (Exception e) {
363                 if (e instanceof com.liferay.portal.PortalException) {
364                     throw (com.liferay.portal.PortalException)e;
365                 }
366 
367                 if (e instanceof com.liferay.portal.SystemException) {
368                     throw (com.liferay.portal.SystemException)e;
369                 }
370 
371                 throw new com.liferay.portal.SystemException(e);
372             }
373         }
374         catch (com.liferay.portal.SystemException se) {
375             _log.error(se, se);
376 
377             throw se;
378         }
379     }
380 
381     public static java.util.List<com.liferay.portlet.journal.model.JournalTemplate> getStructureTemplates(
382         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
383         throws com.liferay.portal.PortalException,
384             com.liferay.portal.SystemException {
385         try {
386             Object paramObj0 = new LongWrapper(groupId);
387 
388             Object paramObj1 = structureId;
389 
390             if (structureId == null) {
391                 paramObj1 = new NullWrapper("java.lang.String");
392             }
393 
394             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
395                     "getStructureTemplates",
396                     new Object[] { paramObj0, paramObj1 });
397 
398             Object returnObj = null;
399 
400             try {
401                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
402             }
403             catch (Exception e) {
404                 if (e instanceof com.liferay.portal.PortalException) {
405                     throw (com.liferay.portal.PortalException)e;
406                 }
407 
408                 if (e instanceof com.liferay.portal.SystemException) {
409                     throw (com.liferay.portal.SystemException)e;
410                 }
411 
412                 throw new com.liferay.portal.SystemException(e);
413             }
414 
415             return (java.util.List<com.liferay.portlet.journal.model.JournalTemplate>)returnObj;
416         }
417         catch (com.liferay.portal.SystemException se) {
418             _log.error(se, se);
419 
420             throw se;
421         }
422     }
423 
424     public static com.liferay.portlet.journal.model.JournalTemplate getTemplate(
425         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId)
426         throws com.liferay.portal.PortalException,
427             com.liferay.portal.SystemException {
428         try {
429             Object paramObj0 = new LongWrapper(groupId);
430 
431             Object paramObj1 = templateId;
432 
433             if (templateId == null) {
434                 paramObj1 = new NullWrapper("java.lang.String");
435             }
436 
437             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
438                     "getTemplate", new Object[] { paramObj0, paramObj1 });
439 
440             Object returnObj = null;
441 
442             try {
443                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
444             }
445             catch (Exception e) {
446                 if (e instanceof com.liferay.portal.PortalException) {
447                     throw (com.liferay.portal.PortalException)e;
448                 }
449 
450                 if (e instanceof com.liferay.portal.SystemException) {
451                     throw (com.liferay.portal.SystemException)e;
452                 }
453 
454                 throw new com.liferay.portal.SystemException(e);
455             }
456 
457             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
458         }
459         catch (com.liferay.portal.SystemException se) {
460             _log.error(se, se);
461 
462             throw se;
463         }
464     }
465 
466     public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
467         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
468         java.lang.String structureId, java.lang.String name,
469         java.lang.String description, java.lang.String xsl, boolean formatXsl,
470         java.lang.String langType, boolean cacheable, boolean smallImage,
471         java.lang.String smallImageURL, java.io.File smallFile)
472         throws com.liferay.portal.PortalException,
473             com.liferay.portal.SystemException {
474         try {
475             Object paramObj0 = new LongWrapper(groupId);
476 
477             Object paramObj1 = templateId;
478 
479             if (templateId == null) {
480                 paramObj1 = new NullWrapper("java.lang.String");
481             }
482 
483             Object paramObj2 = structureId;
484 
485             if (structureId == null) {
486                 paramObj2 = new NullWrapper("java.lang.String");
487             }
488 
489             Object paramObj3 = name;
490 
491             if (name == null) {
492                 paramObj3 = new NullWrapper("java.lang.String");
493             }
494 
495             Object paramObj4 = description;
496 
497             if (description == null) {
498                 paramObj4 = new NullWrapper("java.lang.String");
499             }
500 
501             Object paramObj5 = xsl;
502 
503             if (xsl == null) {
504                 paramObj5 = new NullWrapper("java.lang.String");
505             }
506 
507             Object paramObj6 = new BooleanWrapper(formatXsl);
508 
509             Object paramObj7 = langType;
510 
511             if (langType == null) {
512                 paramObj7 = new NullWrapper("java.lang.String");
513             }
514 
515             Object paramObj8 = new BooleanWrapper(cacheable);
516 
517             Object paramObj9 = new BooleanWrapper(smallImage);
518 
519             Object paramObj10 = smallImageURL;
520 
521             if (smallImageURL == null) {
522                 paramObj10 = new NullWrapper("java.lang.String");
523             }
524 
525             Object paramObj11 = smallFile;
526 
527             if (smallFile == null) {
528                 paramObj11 = new NullWrapper("java.io.File");
529             }
530 
531             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
532                     "updateTemplate",
533                     new Object[] {
534                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
535                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
536                         paramObj10, paramObj11
537                     });
538 
539             Object returnObj = null;
540 
541             try {
542                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
543             }
544             catch (Exception e) {
545                 if (e instanceof com.liferay.portal.PortalException) {
546                     throw (com.liferay.portal.PortalException)e;
547                 }
548 
549                 if (e instanceof com.liferay.portal.SystemException) {
550                     throw (com.liferay.portal.SystemException)e;
551                 }
552 
553                 throw new com.liferay.portal.SystemException(e);
554             }
555 
556             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
557         }
558         catch (com.liferay.portal.SystemException se) {
559             _log.error(se, se);
560 
561             throw se;
562         }
563     }
564 
565     private static Log _log = LogFactoryUtil.getLog(JournalTemplateServiceHttp.class);
566 }