001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.kernel.util.BooleanWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.journal.service.JournalTemplateServiceUtil;
027    
028    /**
029     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.journal.service.JournalTemplateServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it requires an additional
034     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
035     * </p>
036     *
037     * <p>
038     * The benefits of using the HTTP utility is that it is fast and allows for
039     * tunneling without the cost of serializing to text. The drawback is that it
040     * only works with Java.
041     * </p>
042     *
043     * <p>
044     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
045     * configure security.
046     * </p>
047     *
048     * <p>
049     * The HTTP utility is only generated for remote services.
050     * </p>
051     *
052     * @author    Brian Wing Shun Chan
053     * @see       JournalTemplateServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.journal.service.JournalTemplateServiceUtil
056     * @generated
057     */
058    public class JournalTemplateServiceHttp {
059            public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
060                    HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
061                    boolean autoTemplateId, java.lang.String structureId,
062                    java.lang.String name, java.lang.String description,
063                    java.lang.String xsl, boolean formatXsl, java.lang.String langType,
064                    boolean cacheable,
065                    com.liferay.portal.service.ServiceContext serviceContext)
066                    throws com.liferay.portal.kernel.exception.PortalException,
067                            com.liferay.portal.kernel.exception.SystemException {
068                    try {
069                            Object paramObj0 = new LongWrapper(groupId);
070    
071                            Object paramObj1 = templateId;
072    
073                            if (templateId == null) {
074                                    paramObj1 = new NullWrapper("java.lang.String");
075                            }
076    
077                            Object paramObj2 = new BooleanWrapper(autoTemplateId);
078    
079                            Object paramObj3 = structureId;
080    
081                            if (structureId == null) {
082                                    paramObj3 = new NullWrapper("java.lang.String");
083                            }
084    
085                            Object paramObj4 = name;
086    
087                            if (name == null) {
088                                    paramObj4 = new NullWrapper("java.lang.String");
089                            }
090    
091                            Object paramObj5 = description;
092    
093                            if (description == null) {
094                                    paramObj5 = new NullWrapper("java.lang.String");
095                            }
096    
097                            Object paramObj6 = xsl;
098    
099                            if (xsl == null) {
100                                    paramObj6 = new NullWrapper("java.lang.String");
101                            }
102    
103                            Object paramObj7 = new BooleanWrapper(formatXsl);
104    
105                            Object paramObj8 = langType;
106    
107                            if (langType == null) {
108                                    paramObj8 = new NullWrapper("java.lang.String");
109                            }
110    
111                            Object paramObj9 = new BooleanWrapper(cacheable);
112    
113                            Object paramObj10 = serviceContext;
114    
115                            if (serviceContext == null) {
116                                    paramObj10 = new NullWrapper(
117                                                    "com.liferay.portal.service.ServiceContext");
118                            }
119    
120                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
121                                            "addTemplate",
122                                            new Object[] {
123                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
124                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
125                                                    paramObj10
126                                            });
127    
128                            Object returnObj = null;
129    
130                            try {
131                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
132                            }
133                            catch (Exception e) {
134                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
135                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
136                                    }
137    
138                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
139                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
140                                    }
141    
142                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
143                            }
144    
145                            return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
146                    }
147                    catch (com.liferay.portal.kernel.exception.SystemException se) {
148                            _log.error(se, se);
149    
150                            throw se;
151                    }
152            }
153    
154            public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
155                    HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
156                    boolean autoTemplateId, java.lang.String structureId,
157                    java.lang.String name, java.lang.String description,
158                    java.lang.String xsl, boolean formatXsl, java.lang.String langType,
159                    boolean cacheable, boolean smallImage, java.lang.String smallImageURL,
160                    java.io.File smallFile,
161                    com.liferay.portal.service.ServiceContext serviceContext)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            Object paramObj0 = new LongWrapper(groupId);
166    
167                            Object paramObj1 = templateId;
168    
169                            if (templateId == null) {
170                                    paramObj1 = new NullWrapper("java.lang.String");
171                            }
172    
173                            Object paramObj2 = new BooleanWrapper(autoTemplateId);
174    
175                            Object paramObj3 = structureId;
176    
177                            if (structureId == null) {
178                                    paramObj3 = new NullWrapper("java.lang.String");
179                            }
180    
181                            Object paramObj4 = name;
182    
183                            if (name == null) {
184                                    paramObj4 = new NullWrapper("java.lang.String");
185                            }
186    
187                            Object paramObj5 = description;
188    
189                            if (description == null) {
190                                    paramObj5 = new NullWrapper("java.lang.String");
191                            }
192    
193                            Object paramObj6 = xsl;
194    
195                            if (xsl == null) {
196                                    paramObj6 = new NullWrapper("java.lang.String");
197                            }
198    
199                            Object paramObj7 = new BooleanWrapper(formatXsl);
200    
201                            Object paramObj8 = langType;
202    
203                            if (langType == null) {
204                                    paramObj8 = new NullWrapper("java.lang.String");
205                            }
206    
207                            Object paramObj9 = new BooleanWrapper(cacheable);
208    
209                            Object paramObj10 = new BooleanWrapper(smallImage);
210    
211                            Object paramObj11 = smallImageURL;
212    
213                            if (smallImageURL == null) {
214                                    paramObj11 = new NullWrapper("java.lang.String");
215                            }
216    
217                            Object paramObj12 = smallFile;
218    
219                            if (smallFile == null) {
220                                    paramObj12 = new NullWrapper("java.io.File");
221                            }
222    
223                            Object paramObj13 = serviceContext;
224    
225                            if (serviceContext == null) {
226                                    paramObj13 = new NullWrapper(
227                                                    "com.liferay.portal.service.ServiceContext");
228                            }
229    
230                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
231                                            "addTemplate",
232                                            new Object[] {
233                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
234                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
235                                                    paramObj10, paramObj11, paramObj12, paramObj13
236                                            });
237    
238                            Object returnObj = null;
239    
240                            try {
241                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
242                            }
243                            catch (Exception e) {
244                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
245                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
246                                    }
247    
248                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
249                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
250                                    }
251    
252                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
253                            }
254    
255                            return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
256                    }
257                    catch (com.liferay.portal.kernel.exception.SystemException se) {
258                            _log.error(se, se);
259    
260                            throw se;
261                    }
262            }
263    
264            public static com.liferay.portlet.journal.model.JournalTemplate copyTemplate(
265                    HttpPrincipal httpPrincipal, long groupId,
266                    java.lang.String oldTemplateId, java.lang.String newTemplateId,
267                    boolean autoTemplateId)
268                    throws com.liferay.portal.kernel.exception.PortalException,
269                            com.liferay.portal.kernel.exception.SystemException {
270                    try {
271                            Object paramObj0 = new LongWrapper(groupId);
272    
273                            Object paramObj1 = oldTemplateId;
274    
275                            if (oldTemplateId == null) {
276                                    paramObj1 = new NullWrapper("java.lang.String");
277                            }
278    
279                            Object paramObj2 = newTemplateId;
280    
281                            if (newTemplateId == null) {
282                                    paramObj2 = new NullWrapper("java.lang.String");
283                            }
284    
285                            Object paramObj3 = new BooleanWrapper(autoTemplateId);
286    
287                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
288                                            "copyTemplate",
289                                            new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
290    
291                            Object returnObj = null;
292    
293                            try {
294                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
295                            }
296                            catch (Exception e) {
297                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
298                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
299                                    }
300    
301                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
302                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
303                                    }
304    
305                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
306                            }
307    
308                            return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
309                    }
310                    catch (com.liferay.portal.kernel.exception.SystemException se) {
311                            _log.error(se, se);
312    
313                            throw se;
314                    }
315            }
316    
317            public static void deleteTemplate(HttpPrincipal httpPrincipal,
318                    long groupId, java.lang.String templateId)
319                    throws com.liferay.portal.kernel.exception.PortalException,
320                            com.liferay.portal.kernel.exception.SystemException {
321                    try {
322                            Object paramObj0 = new LongWrapper(groupId);
323    
324                            Object paramObj1 = templateId;
325    
326                            if (templateId == null) {
327                                    paramObj1 = new NullWrapper("java.lang.String");
328                            }
329    
330                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
331                                            "deleteTemplate", new Object[] { paramObj0, paramObj1 });
332    
333                            try {
334                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
335                            }
336                            catch (Exception e) {
337                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
338                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
339                                    }
340    
341                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
342                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
343                                    }
344    
345                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
346                            }
347                    }
348                    catch (com.liferay.portal.kernel.exception.SystemException se) {
349                            _log.error(se, se);
350    
351                            throw se;
352                    }
353            }
354    
355            public static java.util.List<com.liferay.portlet.journal.model.JournalTemplate> getStructureTemplates(
356                    HttpPrincipal httpPrincipal, long groupId, java.lang.String structureId)
357                    throws com.liferay.portal.kernel.exception.PortalException,
358                            com.liferay.portal.kernel.exception.SystemException {
359                    try {
360                            Object paramObj0 = new LongWrapper(groupId);
361    
362                            Object paramObj1 = structureId;
363    
364                            if (structureId == null) {
365                                    paramObj1 = new NullWrapper("java.lang.String");
366                            }
367    
368                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
369                                            "getStructureTemplates",
370                                            new Object[] { paramObj0, paramObj1 });
371    
372                            Object returnObj = null;
373    
374                            try {
375                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
376                            }
377                            catch (Exception e) {
378                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
379                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
380                                    }
381    
382                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
383                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
384                                    }
385    
386                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
387                            }
388    
389                            return (java.util.List<com.liferay.portlet.journal.model.JournalTemplate>)returnObj;
390                    }
391                    catch (com.liferay.portal.kernel.exception.SystemException se) {
392                            _log.error(se, se);
393    
394                            throw se;
395                    }
396            }
397    
398            public static com.liferay.portlet.journal.model.JournalTemplate getTemplate(
399                    HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId)
400                    throws com.liferay.portal.kernel.exception.PortalException,
401                            com.liferay.portal.kernel.exception.SystemException {
402                    try {
403                            Object paramObj0 = new LongWrapper(groupId);
404    
405                            Object paramObj1 = templateId;
406    
407                            if (templateId == null) {
408                                    paramObj1 = new NullWrapper("java.lang.String");
409                            }
410    
411                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
412                                            "getTemplate", new Object[] { paramObj0, paramObj1 });
413    
414                            Object returnObj = null;
415    
416                            try {
417                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
418                            }
419                            catch (Exception e) {
420                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
421                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
422                                    }
423    
424                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
425                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
426                                    }
427    
428                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
429                            }
430    
431                            return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
432                    }
433                    catch (com.liferay.portal.kernel.exception.SystemException se) {
434                            _log.error(se, se);
435    
436                            throw se;
437                    }
438            }
439    
440            public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
441                    HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
442                    java.lang.String structureId, java.lang.String name,
443                    java.lang.String description, java.lang.String xsl, boolean formatXsl,
444                    java.lang.String langType, boolean cacheable,
445                    com.liferay.portal.service.ServiceContext serviceContext)
446                    throws com.liferay.portal.kernel.exception.PortalException,
447                            com.liferay.portal.kernel.exception.SystemException {
448                    try {
449                            Object paramObj0 = new LongWrapper(groupId);
450    
451                            Object paramObj1 = templateId;
452    
453                            if (templateId == null) {
454                                    paramObj1 = new NullWrapper("java.lang.String");
455                            }
456    
457                            Object paramObj2 = structureId;
458    
459                            if (structureId == null) {
460                                    paramObj2 = new NullWrapper("java.lang.String");
461                            }
462    
463                            Object paramObj3 = name;
464    
465                            if (name == null) {
466                                    paramObj3 = new NullWrapper("java.lang.String");
467                            }
468    
469                            Object paramObj4 = description;
470    
471                            if (description == null) {
472                                    paramObj4 = new NullWrapper("java.lang.String");
473                            }
474    
475                            Object paramObj5 = xsl;
476    
477                            if (xsl == null) {
478                                    paramObj5 = new NullWrapper("java.lang.String");
479                            }
480    
481                            Object paramObj6 = new BooleanWrapper(formatXsl);
482    
483                            Object paramObj7 = langType;
484    
485                            if (langType == null) {
486                                    paramObj7 = new NullWrapper("java.lang.String");
487                            }
488    
489                            Object paramObj8 = new BooleanWrapper(cacheable);
490    
491                            Object paramObj9 = serviceContext;
492    
493                            if (serviceContext == null) {
494                                    paramObj9 = new NullWrapper(
495                                                    "com.liferay.portal.service.ServiceContext");
496                            }
497    
498                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
499                                            "updateTemplate",
500                                            new Object[] {
501                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
502                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9
503                                            });
504    
505                            Object returnObj = null;
506    
507                            try {
508                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
509                            }
510                            catch (Exception e) {
511                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
512                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
513                                    }
514    
515                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
516                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
517                                    }
518    
519                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
520                            }
521    
522                            return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
523                    }
524                    catch (com.liferay.portal.kernel.exception.SystemException se) {
525                            _log.error(se, se);
526    
527                            throw se;
528                    }
529            }
530    
531            public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
532                    HttpPrincipal httpPrincipal, long groupId, java.lang.String templateId,
533                    java.lang.String structureId, java.lang.String name,
534                    java.lang.String description, java.lang.String xsl, boolean formatXsl,
535                    java.lang.String langType, boolean cacheable, boolean smallImage,
536                    java.lang.String smallImageURL, java.io.File smallFile,
537                    com.liferay.portal.service.ServiceContext serviceContext)
538                    throws com.liferay.portal.kernel.exception.PortalException,
539                            com.liferay.portal.kernel.exception.SystemException {
540                    try {
541                            Object paramObj0 = new LongWrapper(groupId);
542    
543                            Object paramObj1 = templateId;
544    
545                            if (templateId == null) {
546                                    paramObj1 = new NullWrapper("java.lang.String");
547                            }
548    
549                            Object paramObj2 = structureId;
550    
551                            if (structureId == null) {
552                                    paramObj2 = new NullWrapper("java.lang.String");
553                            }
554    
555                            Object paramObj3 = name;
556    
557                            if (name == null) {
558                                    paramObj3 = new NullWrapper("java.lang.String");
559                            }
560    
561                            Object paramObj4 = description;
562    
563                            if (description == null) {
564                                    paramObj4 = new NullWrapper("java.lang.String");
565                            }
566    
567                            Object paramObj5 = xsl;
568    
569                            if (xsl == null) {
570                                    paramObj5 = new NullWrapper("java.lang.String");
571                            }
572    
573                            Object paramObj6 = new BooleanWrapper(formatXsl);
574    
575                            Object paramObj7 = langType;
576    
577                            if (langType == null) {
578                                    paramObj7 = new NullWrapper("java.lang.String");
579                            }
580    
581                            Object paramObj8 = new BooleanWrapper(cacheable);
582    
583                            Object paramObj9 = new BooleanWrapper(smallImage);
584    
585                            Object paramObj10 = smallImageURL;
586    
587                            if (smallImageURL == null) {
588                                    paramObj10 = new NullWrapper("java.lang.String");
589                            }
590    
591                            Object paramObj11 = smallFile;
592    
593                            if (smallFile == null) {
594                                    paramObj11 = new NullWrapper("java.io.File");
595                            }
596    
597                            Object paramObj12 = serviceContext;
598    
599                            if (serviceContext == null) {
600                                    paramObj12 = new NullWrapper(
601                                                    "com.liferay.portal.service.ServiceContext");
602                            }
603    
604                            MethodWrapper methodWrapper = new MethodWrapper(JournalTemplateServiceUtil.class.getName(),
605                                            "updateTemplate",
606                                            new Object[] {
607                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
608                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
609                                                    paramObj10, paramObj11, paramObj12
610                                            });
611    
612                            Object returnObj = null;
613    
614                            try {
615                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
616                            }
617                            catch (Exception e) {
618                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
619                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
620                                    }
621    
622                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
623                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
624                                    }
625    
626                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
627                            }
628    
629                            return (com.liferay.portlet.journal.model.JournalTemplate)returnObj;
630                    }
631                    catch (com.liferay.portal.kernel.exception.SystemException se) {
632                            _log.error(se, se);
633    
634                            throw se;
635                    }
636            }
637    
638            private static Log _log = LogFactoryUtil.getLog(JournalTemplateServiceHttp.class);
639    }