1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.journal.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.DoubleWrapper;
29  import com.liferay.portal.kernel.util.IntegerWrapper;
30  import com.liferay.portal.kernel.util.LongWrapper;
31  import com.liferay.portal.kernel.util.MethodWrapper;
32  import com.liferay.portal.kernel.util.NullWrapper;
33  import com.liferay.portal.security.auth.HttpPrincipal;
34  import com.liferay.portal.service.http.TunnelUtil;
35  
36  import com.liferay.portlet.journal.service.JournalFeedServiceUtil;
37  
38  /**
39   * <a href="JournalFeedServiceHttp.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be
43   * overwritten the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class provides a HTTP utility for the
48   * <code>com.liferay.portlet.journal.service.JournalFeedServiceUtil</code> service
49   * utility. The static methods of this class calls the same methods of the
50   * service utility. However, the signatures are different because it requires an
51   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
52   * parameter.
53   * </p>
54   *
55   * <p>
56   * The benefits of using the HTTP utility is that it is fast and allows for
57   * tunneling without the cost of serializing to text. The drawback is that it
58   * only works with Java.
59   * </p>
60   *
61   * <p>
62   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
63   * portal.properties to configure security.
64   * </p>
65   *
66   * <p>
67   * The HTTP utility is only generated for remote services.
68   * </p>
69   *
70   * @author Brian Wing Shun Chan
71   *
72   * @see com.liferay.portal.security.auth.HttpPrincipal
73   * @see com.liferay.portlet.journal.service.JournalFeedServiceUtil
74   * @see com.liferay.portlet.journal.service.http.JournalFeedServiceSoap
75   *
76   */
77  public class JournalFeedServiceHttp {
78      public static com.liferay.portlet.journal.model.JournalFeed addFeed(
79          HttpPrincipal httpPrincipal, long groupId, java.lang.String feedId,
80          boolean autoFeedId, java.lang.String name,
81          java.lang.String description, java.lang.String type,
82          java.lang.String structureId, java.lang.String templateId,
83          java.lang.String rendererTemplateId, int delta,
84          java.lang.String orderByCol, java.lang.String orderByType,
85          java.lang.String targetLayoutFriendlyUrl,
86          java.lang.String targetPortletId, java.lang.String contentField,
87          java.lang.String feedType, double feedVersion,
88          com.liferay.portal.service.ServiceContext serviceContext)
89          throws com.liferay.portal.PortalException,
90              com.liferay.portal.SystemException {
91          try {
92              Object paramObj0 = new LongWrapper(groupId);
93  
94              Object paramObj1 = feedId;
95  
96              if (feedId == null) {
97                  paramObj1 = new NullWrapper("java.lang.String");
98              }
99  
100             Object paramObj2 = new BooleanWrapper(autoFeedId);
101 
102             Object paramObj3 = name;
103 
104             if (name == null) {
105                 paramObj3 = new NullWrapper("java.lang.String");
106             }
107 
108             Object paramObj4 = description;
109 
110             if (description == null) {
111                 paramObj4 = new NullWrapper("java.lang.String");
112             }
113 
114             Object paramObj5 = type;
115 
116             if (type == null) {
117                 paramObj5 = new NullWrapper("java.lang.String");
118             }
119 
120             Object paramObj6 = structureId;
121 
122             if (structureId == null) {
123                 paramObj6 = new NullWrapper("java.lang.String");
124             }
125 
126             Object paramObj7 = templateId;
127 
128             if (templateId == null) {
129                 paramObj7 = new NullWrapper("java.lang.String");
130             }
131 
132             Object paramObj8 = rendererTemplateId;
133 
134             if (rendererTemplateId == null) {
135                 paramObj8 = new NullWrapper("java.lang.String");
136             }
137 
138             Object paramObj9 = new IntegerWrapper(delta);
139 
140             Object paramObj10 = orderByCol;
141 
142             if (orderByCol == null) {
143                 paramObj10 = new NullWrapper("java.lang.String");
144             }
145 
146             Object paramObj11 = orderByType;
147 
148             if (orderByType == null) {
149                 paramObj11 = new NullWrapper("java.lang.String");
150             }
151 
152             Object paramObj12 = targetLayoutFriendlyUrl;
153 
154             if (targetLayoutFriendlyUrl == null) {
155                 paramObj12 = new NullWrapper("java.lang.String");
156             }
157 
158             Object paramObj13 = targetPortletId;
159 
160             if (targetPortletId == null) {
161                 paramObj13 = new NullWrapper("java.lang.String");
162             }
163 
164             Object paramObj14 = contentField;
165 
166             if (contentField == null) {
167                 paramObj14 = new NullWrapper("java.lang.String");
168             }
169 
170             Object paramObj15 = feedType;
171 
172             if (feedType == null) {
173                 paramObj15 = new NullWrapper("java.lang.String");
174             }
175 
176             Object paramObj16 = new DoubleWrapper(feedVersion);
177 
178             Object paramObj17 = serviceContext;
179 
180             if (serviceContext == null) {
181                 paramObj17 = new NullWrapper(
182                         "com.liferay.portal.service.ServiceContext");
183             }
184 
185             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
186                     "addFeed",
187                     new Object[] {
188                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
189                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
190                         paramObj10, paramObj11, paramObj12, paramObj13,
191                         paramObj14, paramObj15, paramObj16, paramObj17
192                     });
193 
194             Object returnObj = null;
195 
196             try {
197                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
198             }
199             catch (Exception e) {
200                 if (e instanceof com.liferay.portal.PortalException) {
201                     throw (com.liferay.portal.PortalException)e;
202                 }
203 
204                 if (e instanceof com.liferay.portal.SystemException) {
205                     throw (com.liferay.portal.SystemException)e;
206                 }
207 
208                 throw new com.liferay.portal.SystemException(e);
209             }
210 
211             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
212         }
213         catch (com.liferay.portal.SystemException se) {
214             _log.error(se, se);
215 
216             throw se;
217         }
218     }
219 
220     public static void deleteFeed(HttpPrincipal httpPrincipal, long groupId,
221         long feedId)
222         throws com.liferay.portal.PortalException,
223             com.liferay.portal.SystemException {
224         try {
225             Object paramObj0 = new LongWrapper(groupId);
226 
227             Object paramObj1 = new LongWrapper(feedId);
228 
229             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
230                     "deleteFeed", new Object[] { paramObj0, paramObj1 });
231 
232             try {
233                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
234             }
235             catch (Exception e) {
236                 if (e instanceof com.liferay.portal.PortalException) {
237                     throw (com.liferay.portal.PortalException)e;
238                 }
239 
240                 if (e instanceof com.liferay.portal.SystemException) {
241                     throw (com.liferay.portal.SystemException)e;
242                 }
243 
244                 throw new com.liferay.portal.SystemException(e);
245             }
246         }
247         catch (com.liferay.portal.SystemException se) {
248             _log.error(se, se);
249 
250             throw se;
251         }
252     }
253 
254     public static void deleteFeed(HttpPrincipal httpPrincipal, long groupId,
255         java.lang.String feedId)
256         throws com.liferay.portal.PortalException,
257             com.liferay.portal.SystemException {
258         try {
259             Object paramObj0 = new LongWrapper(groupId);
260 
261             Object paramObj1 = feedId;
262 
263             if (feedId == null) {
264                 paramObj1 = new NullWrapper("java.lang.String");
265             }
266 
267             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
268                     "deleteFeed", new Object[] { paramObj0, paramObj1 });
269 
270             try {
271                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
272             }
273             catch (Exception e) {
274                 if (e instanceof com.liferay.portal.PortalException) {
275                     throw (com.liferay.portal.PortalException)e;
276                 }
277 
278                 if (e instanceof com.liferay.portal.SystemException) {
279                     throw (com.liferay.portal.SystemException)e;
280                 }
281 
282                 throw new com.liferay.portal.SystemException(e);
283             }
284         }
285         catch (com.liferay.portal.SystemException se) {
286             _log.error(se, se);
287 
288             throw se;
289         }
290     }
291 
292     public static com.liferay.portlet.journal.model.JournalFeed getFeed(
293         HttpPrincipal httpPrincipal, long groupId, long feedId)
294         throws com.liferay.portal.PortalException,
295             com.liferay.portal.SystemException {
296         try {
297             Object paramObj0 = new LongWrapper(groupId);
298 
299             Object paramObj1 = new LongWrapper(feedId);
300 
301             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
302                     "getFeed", new Object[] { paramObj0, paramObj1 });
303 
304             Object returnObj = null;
305 
306             try {
307                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
308             }
309             catch (Exception e) {
310                 if (e instanceof com.liferay.portal.PortalException) {
311                     throw (com.liferay.portal.PortalException)e;
312                 }
313 
314                 if (e instanceof com.liferay.portal.SystemException) {
315                     throw (com.liferay.portal.SystemException)e;
316                 }
317 
318                 throw new com.liferay.portal.SystemException(e);
319             }
320 
321             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
322         }
323         catch (com.liferay.portal.SystemException se) {
324             _log.error(se, se);
325 
326             throw se;
327         }
328     }
329 
330     public static com.liferay.portlet.journal.model.JournalFeed getFeed(
331         HttpPrincipal httpPrincipal, long groupId, java.lang.String feedId)
332         throws com.liferay.portal.PortalException,
333             com.liferay.portal.SystemException {
334         try {
335             Object paramObj0 = new LongWrapper(groupId);
336 
337             Object paramObj1 = feedId;
338 
339             if (feedId == null) {
340                 paramObj1 = new NullWrapper("java.lang.String");
341             }
342 
343             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
344                     "getFeed", new Object[] { paramObj0, paramObj1 });
345 
346             Object returnObj = null;
347 
348             try {
349                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
350             }
351             catch (Exception e) {
352                 if (e instanceof com.liferay.portal.PortalException) {
353                     throw (com.liferay.portal.PortalException)e;
354                 }
355 
356                 if (e instanceof com.liferay.portal.SystemException) {
357                     throw (com.liferay.portal.SystemException)e;
358                 }
359 
360                 throw new com.liferay.portal.SystemException(e);
361             }
362 
363             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
364         }
365         catch (com.liferay.portal.SystemException se) {
366             _log.error(se, se);
367 
368             throw se;
369         }
370     }
371 
372     public static com.liferay.portlet.journal.model.JournalFeed updateFeed(
373         HttpPrincipal httpPrincipal, long groupId, java.lang.String feedId,
374         java.lang.String name, java.lang.String description,
375         java.lang.String type, java.lang.String structureId,
376         java.lang.String templateId, java.lang.String rendererTemplateId,
377         int delta, java.lang.String orderByCol, java.lang.String orderByType,
378         java.lang.String targetLayoutFriendlyUrl,
379         java.lang.String targetPortletId, java.lang.String contentField,
380         java.lang.String feedType, double feedVersion,
381         com.liferay.portal.service.ServiceContext serviceContext)
382         throws com.liferay.portal.PortalException,
383             com.liferay.portal.SystemException {
384         try {
385             Object paramObj0 = new LongWrapper(groupId);
386 
387             Object paramObj1 = feedId;
388 
389             if (feedId == null) {
390                 paramObj1 = new NullWrapper("java.lang.String");
391             }
392 
393             Object paramObj2 = name;
394 
395             if (name == null) {
396                 paramObj2 = new NullWrapper("java.lang.String");
397             }
398 
399             Object paramObj3 = description;
400 
401             if (description == null) {
402                 paramObj3 = new NullWrapper("java.lang.String");
403             }
404 
405             Object paramObj4 = type;
406 
407             if (type == null) {
408                 paramObj4 = new NullWrapper("java.lang.String");
409             }
410 
411             Object paramObj5 = structureId;
412 
413             if (structureId == null) {
414                 paramObj5 = new NullWrapper("java.lang.String");
415             }
416 
417             Object paramObj6 = templateId;
418 
419             if (templateId == null) {
420                 paramObj6 = new NullWrapper("java.lang.String");
421             }
422 
423             Object paramObj7 = rendererTemplateId;
424 
425             if (rendererTemplateId == null) {
426                 paramObj7 = new NullWrapper("java.lang.String");
427             }
428 
429             Object paramObj8 = new IntegerWrapper(delta);
430 
431             Object paramObj9 = orderByCol;
432 
433             if (orderByCol == null) {
434                 paramObj9 = new NullWrapper("java.lang.String");
435             }
436 
437             Object paramObj10 = orderByType;
438 
439             if (orderByType == null) {
440                 paramObj10 = new NullWrapper("java.lang.String");
441             }
442 
443             Object paramObj11 = targetLayoutFriendlyUrl;
444 
445             if (targetLayoutFriendlyUrl == null) {
446                 paramObj11 = new NullWrapper("java.lang.String");
447             }
448 
449             Object paramObj12 = targetPortletId;
450 
451             if (targetPortletId == null) {
452                 paramObj12 = new NullWrapper("java.lang.String");
453             }
454 
455             Object paramObj13 = contentField;
456 
457             if (contentField == null) {
458                 paramObj13 = new NullWrapper("java.lang.String");
459             }
460 
461             Object paramObj14 = feedType;
462 
463             if (feedType == null) {
464                 paramObj14 = new NullWrapper("java.lang.String");
465             }
466 
467             Object paramObj15 = new DoubleWrapper(feedVersion);
468 
469             Object paramObj16 = serviceContext;
470 
471             if (serviceContext == null) {
472                 paramObj16 = new NullWrapper(
473                         "com.liferay.portal.service.ServiceContext");
474             }
475 
476             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
477                     "updateFeed",
478                     new Object[] {
479                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
480                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
481                         paramObj10, paramObj11, paramObj12, paramObj13,
482                         paramObj14, paramObj15, paramObj16
483                     });
484 
485             Object returnObj = null;
486 
487             try {
488                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
489             }
490             catch (Exception e) {
491                 if (e instanceof com.liferay.portal.PortalException) {
492                     throw (com.liferay.portal.PortalException)e;
493                 }
494 
495                 if (e instanceof com.liferay.portal.SystemException) {
496                     throw (com.liferay.portal.SystemException)e;
497                 }
498 
499                 throw new com.liferay.portal.SystemException(e);
500             }
501 
502             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
503         }
504         catch (com.liferay.portal.SystemException se) {
505             _log.error(se, se);
506 
507             throw se;
508         }
509     }
510 
511     private static Log _log = LogFactoryUtil.getLog(JournalFeedServiceHttp.class);
512 }