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.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.journal.service.JournalTemplateServiceUtil;
25  
26  /**
27   * <a href="JournalTemplateServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.journal.service.JournalTemplateServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       JournalTemplateServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.journal.service.JournalTemplateServiceUtil
61   * @generated
62   */
63  public class JournalTemplateServiceHttp {
64      public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
65          HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
66          boolean autoTemplateId, java.lang.String structureId,
67          java.lang.String name, java.lang.String description,
68          java.lang.String xsl, boolean formatXsl, java.lang.String langType,
69          boolean cacheable,
70          com.liferay.portal.service.ServiceContext serviceContext)
71          throws com.liferay.portal.PortalException,
72              com.liferay.portal.SystemException {
73          try {
74              MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
75                      "addTemplate", _addTemplateParameterTypes0);
76  
77              MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
78                      templateId, autoTemplateId, structureId, name, description,
79                      xsl, formatXsl, langType, cacheable, serviceContext);
80  
81              Object returnObj = null;
82  
83              try {
84                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
85              }
86              catch (Exception e) {
87                  if (e instanceof com.liferay.portal.PortalException) {
88                      throw (com.liferay.portal.PortalException)e;
89                  }
90  
91                  if (e instanceof com.liferay.portal.SystemException) {
92                      throw (com.liferay.portal.SystemException)e;
93                  }
94  
95                  throw new com.liferay.portal.SystemException(e);
96              }
97  
98              return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
99          }
100         catch (com.liferay.portal.SystemException se) {
101             _log.error(se, se);
102 
103             throw se;
104         }
105     }
106 
107     public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
108         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
109         boolean autoTemplateId, java.lang.String structureId,
110         java.lang.String name, java.lang.String description,
111         java.lang.String xsl, boolean formatXsl, java.lang.String langType,
112         boolean cacheable, boolean smallImage, java.lang.String smallImageURL,
113         java.io.File smallFile,
114         com.liferay.portal.service.ServiceContext serviceContext)
115         throws com.liferay.portal.PortalException,
116             com.liferay.portal.SystemException {
117         try {
118             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
119                     "addTemplate", _addTemplateParameterTypes1);
120 
121             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
122                     templateId, autoTemplateId, structureId, name, description,
123                     xsl, formatXsl, langType, cacheable, smallImage,
124                     smallImageURL, smallFile, serviceContext);
125 
126             Object returnObj = null;
127 
128             try {
129                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
130             }
131             catch (Exception e) {
132                 if (e instanceof com.liferay.portal.PortalException) {
133                     throw (com.liferay.portal.PortalException)e;
134                 }
135 
136                 if (e instanceof com.liferay.portal.SystemException) {
137                     throw (com.liferay.portal.SystemException)e;
138                 }
139 
140                 throw new com.liferay.portal.SystemException(e);
141             }
142 
143             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
144         }
145         catch (com.liferay.portal.SystemException se) {
146             _log.error(se, se);
147 
148             throw se;
149         }
150     }
151 
152     public static com.liferay.portlet.journal.model.JournalTemplate copyTemplate(
153         HttpPrincipal httpPrincipal, long groupId,
154         java.lang.String oldTemplateId, java.lang.String newTemplateId,
155         boolean autoTemplateId)
156         throws com.liferay.portal.PortalException,
157             com.liferay.portal.SystemException {
158         try {
159             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
160                     "copyTemplate", _copyTemplateParameterTypes2);
161 
162             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
163                     oldTemplateId, newTemplateId, autoTemplateId);
164 
165             Object returnObj = null;
166 
167             try {
168                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
169             }
170             catch (Exception e) {
171                 if (e instanceof com.liferay.portal.PortalException) {
172                     throw (com.liferay.portal.PortalException)e;
173                 }
174 
175                 if (e instanceof com.liferay.portal.SystemException) {
176                     throw (com.liferay.portal.SystemException)e;
177                 }
178 
179                 throw new com.liferay.portal.SystemException(e);
180             }
181 
182             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
183         }
184         catch (com.liferay.portal.SystemException se) {
185             _log.error(se, se);
186 
187             throw se;
188         }
189     }
190 
191     public static void deleteTemplate(HttpPrincipal httpPrincipal,
192         long groupId, java.lang.String templateId)
193         throws com.liferay.portal.PortalException,
194             com.liferay.portal.SystemException {
195         try {
196             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
197                     "deleteTemplate", _deleteTemplateParameterTypes3);
198 
199             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
200                     templateId);
201 
202             try {
203                 TunnelUtil.invoke(httpPrincipal, methodHandler);
204             }
205             catch (Exception e) {
206                 if (e instanceof com.liferay.portal.PortalException) {
207                     throw (com.liferay.portal.PortalException)e;
208                 }
209 
210                 if (e instanceof com.liferay.portal.SystemException) {
211                     throw (com.liferay.portal.SystemException)e;
212                 }
213 
214                 throw new com.liferay.portal.SystemException(e);
215             }
216         }
217         catch (com.liferay.portal.SystemException se) {
218             _log.error(se, se);
219 
220             throw se;
221         }
222     }
223 
224     public static java.util.List<com.liferay.portlet.journal.model.JournalTemplate> getStructureTemplates(
225         HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
226         throws com.liferay.portal.PortalException,
227             com.liferay.portal.SystemException {
228         try {
229             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
230                     "getStructureTemplates",
231                     _getStructureTemplatesParameterTypes4);
232 
233             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
234                     structureId);
235 
236             Object returnObj = null;
237 
238             try {
239                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
240             }
241             catch (Exception e) {
242                 if (e instanceof com.liferay.portal.PortalException) {
243                     throw (com.liferay.portal.PortalException)e;
244                 }
245 
246                 if (e instanceof com.liferay.portal.SystemException) {
247                     throw (com.liferay.portal.SystemException)e;
248                 }
249 
250                 throw new com.liferay.portal.SystemException(e);
251             }
252 
253             return (java.util.List<com.liferay.portlet.journal.model.JournalTemplate>)returnObj;
254         }
255         catch (com.liferay.portal.SystemException se) {
256             _log.error(se, se);
257 
258             throw se;
259         }
260     }
261 
262     public static com.liferay.portlet.journal.model.JournalTemplate getTemplate(
263         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId)
264         throws com.liferay.portal.PortalException,
265             com.liferay.portal.SystemException {
266         try {
267             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
268                     "getTemplate", _getTemplateParameterTypes5);
269 
270             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
271                     templateId);
272 
273             Object returnObj = null;
274 
275             try {
276                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
277             }
278             catch (Exception e) {
279                 if (e instanceof com.liferay.portal.PortalException) {
280                     throw (com.liferay.portal.PortalException)e;
281                 }
282 
283                 if (e instanceof com.liferay.portal.SystemException) {
284                     throw (com.liferay.portal.SystemException)e;
285                 }
286 
287                 throw new com.liferay.portal.SystemException(e);
288             }
289 
290             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
291         }
292         catch (com.liferay.portal.SystemException se) {
293             _log.error(se, se);
294 
295             throw se;
296         }
297     }
298 
299     public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
300         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
301         java.lang.String structureId, java.lang.String name,
302         java.lang.String description, java.lang.String xsl, boolean formatXsl,
303         java.lang.String langType, boolean cacheable,
304         com.liferay.portal.service.ServiceContext serviceContext)
305         throws com.liferay.portal.PortalException,
306             com.liferay.portal.SystemException {
307         try {
308             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
309                     "updateTemplate", _updateTemplateParameterTypes6);
310 
311             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
312                     templateId, structureId, name, description, xsl, formatXsl,
313                     langType, cacheable, serviceContext);
314 
315             Object returnObj = null;
316 
317             try {
318                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
319             }
320             catch (Exception e) {
321                 if (e instanceof com.liferay.portal.PortalException) {
322                     throw (com.liferay.portal.PortalException)e;
323                 }
324 
325                 if (e instanceof com.liferay.portal.SystemException) {
326                     throw (com.liferay.portal.SystemException)e;
327                 }
328 
329                 throw new com.liferay.portal.SystemException(e);
330             }
331 
332             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
333         }
334         catch (com.liferay.portal.SystemException se) {
335             _log.error(se, se);
336 
337             throw se;
338         }
339     }
340 
341     public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
342         HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
343         java.lang.String structureId, java.lang.String name,
344         java.lang.String description, java.lang.String xsl, boolean formatXsl,
345         java.lang.String langType, boolean cacheable, boolean smallImage,
346         java.lang.String smallImageURL, java.io.File smallFile,
347         com.liferay.portal.service.ServiceContext serviceContext)
348         throws com.liferay.portal.PortalException,
349             com.liferay.portal.SystemException {
350         try {
351             MethodKey methodKey = new MethodKey(JournalTemplateServiceUtil.class.getName(),
352                     "updateTemplate", _updateTemplateParameterTypes7);
353 
354             MethodHandler methodHandler = new MethodHandler(methodKey, groupId,
355                     templateId, structureId, name, description, xsl, formatXsl,
356                     langType, cacheable, smallImage, smallImageURL, smallFile,
357                     serviceContext);
358 
359             Object returnObj = null;
360 
361             try {
362                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
363             }
364             catch (Exception e) {
365                 if (e instanceof com.liferay.portal.PortalException) {
366                     throw (com.liferay.portal.PortalException)e;
367                 }
368 
369                 if (e instanceof com.liferay.portal.SystemException) {
370                     throw (com.liferay.portal.SystemException)e;
371                 }
372 
373                 throw new com.liferay.portal.SystemException(e);
374             }
375 
376             return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
377         }
378         catch (com.liferay.portal.SystemException se) {
379             _log.error(se, se);
380 
381             throw se;
382         }
383     }
384 
385     private static Log _log = LogFactoryUtil.getLog(JournalTemplateServiceHttp.class);
386     private static final Class<?>[] _addTemplateParameterTypes0 = new Class[] {
387             long.class, java.lang.String.class, boolean.class,
388             java.lang.String.class, java.lang.String.class,
389             java.lang.String.class, java.lang.String.class, boolean.class,
390             java.lang.String.class, boolean.class,
391             com.liferay.portal.service.ServiceContext.class
392         };
393     private static final Class<?>[] _addTemplateParameterTypes1 = new Class[] {
394             long.class, java.lang.String.class, boolean.class,
395             java.lang.String.class, java.lang.String.class,
396             java.lang.String.class, java.lang.String.class, boolean.class,
397             java.lang.String.class, boolean.class, boolean.class,
398             java.lang.String.class, java.io.File.class,
399             com.liferay.portal.service.ServiceContext.class
400         };
401     private static final Class<?>[] _copyTemplateParameterTypes2 = new Class[] {
402             long.class, java.lang.String.class, java.lang.String.class,
403             boolean.class
404         };
405     private static final Class<?>[] _deleteTemplateParameterTypes3 = new Class[] {
406             long.class, java.lang.String.class
407         };
408     private static final Class<?>[] _getStructureTemplatesParameterTypes4 = new Class[] {
409             long.class, java.lang.String.class
410         };
411     private static final Class<?>[] _getTemplateParameterTypes5 = new Class[] {
412             long.class, java.lang.String.class
413         };
414     private static final Class<?>[] _updateTemplateParameterTypes6 = new Class[] {
415             long.class, java.lang.String.class, java.lang.String.class,
416             java.lang.String.class, java.lang.String.class,
417             java.lang.String.class, boolean.class, java.lang.String.class,
418             boolean.class, com.liferay.portal.service.ServiceContext.class
419         };
420     private static final Class<?>[] _updateTemplateParameterTypes7 = new Class[] {
421             long.class, java.lang.String.class, java.lang.String.class,
422             java.lang.String.class, java.lang.String.class,
423             java.lang.String.class, boolean.class, java.lang.String.class,
424             boolean.class, boolean.class, java.lang.String.class,
425             java.io.File.class, com.liferay.portal.service.ServiceContext.class
426         };
427 }