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