1   /**
2    * Copyright (c) 2000-2008 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, java.lang.String templateId,
78          boolean autoTemplateId, long plid, 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.SystemException,
85              com.liferay.portal.PortalException {
86          try {
87              Object paramObj0 = templateId;
88  
89              if (templateId == null) {
90                  paramObj0 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj1 = new BooleanWrapper(autoTemplateId);
94  
95              Object paramObj2 = new LongWrapper(plid);
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.SystemException) {
165                     throw (com.liferay.portal.SystemException)e;
166                 }
167 
168                 if (e instanceof com.liferay.portal.PortalException) {
169                     throw (com.liferay.portal.PortalException)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, java.lang.String templateId,
186         boolean autoTemplateId, long plid, 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.SystemException,
193             com.liferay.portal.PortalException {
194         try {
195             Object paramObj0 = templateId;
196 
197             if (templateId == null) {
198                 paramObj0 = new NullWrapper("java.lang.String");
199             }
200 
201             Object paramObj1 = new BooleanWrapper(autoTemplateId);
202 
203             Object paramObj2 = new LongWrapper(plid);
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.SystemException) {
281                     throw (com.liferay.portal.SystemException)e;
282                 }
283 
284                 if (e instanceof com.liferay.portal.PortalException) {
285                     throw (com.liferay.portal.PortalException)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 void deleteTemplate(HttpPrincipal httpPrincipal,
301         long groupId, java.lang.String templateId)
302         throws com.liferay.portal.SystemException,
303             com.liferay.portal.PortalException {
304         try {
305             Object paramObj0 = new LongWrapper(groupId);
306 
307             Object paramObj1 = templateId;
308 
309             if (templateId == null) {
310                 paramObj1 = new NullWrapper("java.lang.String");
311             }
312 
313             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
314                     "deleteTemplate", new Object[] { paramObj0, paramObj1 });
315 
316             try {
317                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
318             }
319             catch (Exception e) {
320                 if (e instanceof com.liferay.portal.SystemException) {
321                     throw (com.liferay.portal.SystemException)e;
322                 }
323 
324                 if (e instanceof com.liferay.portal.PortalException) {
325                     throw (com.liferay.portal.PortalException)e;
326                 }
327 
328                 throw new com.liferay.portal.SystemException(e);
329             }
330         }
331         catch (com.liferay.portal.SystemException se) {
332             _log.error(se, se);
333 
334             throw se;
335         }
336     }
337 
338     public static java.util.List<com.liferay.portlet.journal.model.JournalTemplate> getStructureTemplates(
339         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
340         throws com.liferay.portal.SystemException,
341             com.liferay.portal.PortalException {
342         try {
343             Object paramObj0 = new LongWrapper(groupId);
344 
345             Object paramObj1 = structureId;
346 
347             if (structureId == null) {
348                 paramObj1 = new NullWrapper("java.lang.String");
349             }
350 
351             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
352                     "getStructureTemplates",
353                     new Object[] { paramObj0, paramObj1 });
354 
355             Object returnObj = null;
356 
357             try {
358                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
359             }
360             catch (Exception e) {
361                 if (e instanceof com.liferay.portal.SystemException) {
362                     throw (com.liferay.portal.SystemException)e;
363                 }
364 
365                 if (e instanceof com.liferay.portal.PortalException) {
366                     throw (com.liferay.portal.PortalException)e;
367                 }
368 
369                 throw new com.liferay.portal.SystemException(e);
370             }
371 
372             return (java.util.List<com.liferay.portlet.journal.model.JournalTemplate>)returnObj;
373         }
374         catch (com.liferay.portal.SystemException se) {
375             _log.error(se, se);
376 
377             throw se;
378         }
379     }
380 
381     public static com.liferay.portlet.journal.model.JournalTemplate getTemplate(
382         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId)
383         throws com.liferay.portal.SystemException,
384             com.liferay.portal.PortalException {
385         try {
386             Object paramObj0 = new LongWrapper(groupId);
387 
388             Object paramObj1 = templateId;
389 
390             if (templateId == null) {
391                 paramObj1 = new NullWrapper("java.lang.String");
392             }
393 
394             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
395                     "getTemplate", new Object[] { paramObj0, paramObj1 });
396 
397             Object returnObj = null;
398 
399             try {
400                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
401             }
402             catch (Exception e) {
403                 if (e instanceof com.liferay.portal.SystemException) {
404                     throw (com.liferay.portal.SystemException)e;
405                 }
406 
407                 if (e instanceof com.liferay.portal.PortalException) {
408                     throw (com.liferay.portal.PortalException)e;
409                 }
410 
411                 throw new com.liferay.portal.SystemException(e);
412             }
413 
414             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
415         }
416         catch (com.liferay.portal.SystemException se) {
417             _log.error(se, se);
418 
419             throw se;
420         }
421     }
422 
423     public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
424         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
425         java.lang.String structureId, java.lang.String name,
426         java.lang.String description, java.lang.String xsl, boolean formatXsl,
427         java.lang.String langType, boolean cacheable, boolean smallImage,
428         java.lang.String smallImageURL, java.io.File smallFile)
429         throws com.liferay.portal.SystemException,
430             com.liferay.portal.PortalException {
431         try {
432             Object paramObj0 = new LongWrapper(groupId);
433 
434             Object paramObj1 = templateId;
435 
436             if (templateId == null) {
437                 paramObj1 = new NullWrapper("java.lang.String");
438             }
439 
440             Object paramObj2 = structureId;
441 
442             if (structureId == null) {
443                 paramObj2 = new NullWrapper("java.lang.String");
444             }
445 
446             Object paramObj3 = name;
447 
448             if (name == null) {
449                 paramObj3 = new NullWrapper("java.lang.String");
450             }
451 
452             Object paramObj4 = description;
453 
454             if (description == null) {
455                 paramObj4 = new NullWrapper("java.lang.String");
456             }
457 
458             Object paramObj5 = xsl;
459 
460             if (xsl == null) {
461                 paramObj5 = new NullWrapper("java.lang.String");
462             }
463 
464             Object paramObj6 = new BooleanWrapper(formatXsl);
465 
466             Object paramObj7 = langType;
467 
468             if (langType == null) {
469                 paramObj7 = new NullWrapper("java.lang.String");
470             }
471 
472             Object paramObj8 = new BooleanWrapper(cacheable);
473 
474             Object paramObj9 = new BooleanWrapper(smallImage);
475 
476             Object paramObj10 = smallImageURL;
477 
478             if (smallImageURL == null) {
479                 paramObj10 = new NullWrapper("java.lang.String");
480             }
481 
482             Object paramObj11 = smallFile;
483 
484             if (smallFile == null) {
485                 paramObj11 = new NullWrapper("java.io.File");
486             }
487 
488             MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
489                     "updateTemplate",
490                     new Object[] {
491                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
492                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
493                         paramObj10, paramObj11
494                     });
495 
496             Object returnObj = null;
497 
498             try {
499                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
500             }
501             catch (Exception e) {
502                 if (e instanceof com.liferay.portal.SystemException) {
503                     throw (com.liferay.portal.SystemException)e;
504                 }
505 
506                 if (e instanceof com.liferay.portal.PortalException) {
507                     throw (com.liferay.portal.PortalException)e;
508                 }
509 
510                 throw new com.liferay.portal.SystemException(e);
511             }
512 
513             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
514         }
515         catch (com.liferay.portal.SystemException se) {
516             _log.error(se, se);
517 
518             throw se;
519         }
520     }
521 
522     private static Log _log = LogFactoryUtil.getLog(JournalTemplateServiceHttp.class);
523 }