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