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