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.DoubleWrapper;
26  import com.liferay.portal.kernel.util.IntegerWrapper;
27  import com.liferay.portal.kernel.util.LongWrapper;
28  import com.liferay.portal.kernel.util.MethodWrapper;
29  import com.liferay.portal.kernel.util.NullWrapper;
30  import com.liferay.portal.security.auth.HttpPrincipal;
31  import com.liferay.portal.service.http.TunnelUtil;
32  
33  import com.liferay.portlet.journal.service.JournalFeedServiceUtil;
34  
35  /**
36   * <a href="JournalFeedServiceHttp.java.html"><b><i>View Source</i></b></a>
37   *
38   * <p>
39   * ServiceBuilder generated this class. Modifications in this class will be
40   * overwritten the next time is generated.
41   * </p>
42   *
43   * <p>
44   * This class provides a HTTP utility for the
45   * <code>com.liferay.portlet.journal.service.JournalFeedServiceUtil</code> service
46   * utility. The static methods of this class calls the same methods of the
47   * service utility. However, the signatures are different because it requires an
48   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
49   * 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 <code>tunnel.servlet.hosts.allowed</code> in
60   * portal.properties to 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   *
69   * @see com.liferay.portal.security.auth.HttpPrincipal
70   * @see com.liferay.portlet.journal.service.JournalFeedServiceUtil
71   * @see com.liferay.portlet.journal.service.http.JournalFeedServiceSoap
72   *
73   */
74  public class JournalFeedServiceHttp {
75      public static com.liferay.portlet.journal.model.JournalFeed addFeed(
76          HttpPrincipal httpPrincipal, long groupId, java.lang.String feedId,
77          boolean autoFeedId, java.lang.String name,
78          java.lang.String description, java.lang.String type,
79          java.lang.String structureId, java.lang.String templateId,
80          java.lang.String rendererTemplateId, int delta,
81          java.lang.String orderByCol, java.lang.String orderByType,
82          java.lang.String targetLayoutFriendlyUrl,
83          java.lang.String targetPortletId, java.lang.String contentField,
84          java.lang.String feedType, double feedVersion,
85          com.liferay.portal.service.ServiceContext serviceContext)
86          throws com.liferay.portal.PortalException,
87              com.liferay.portal.SystemException {
88          try {
89              Object paramObj0 = new LongWrapper(groupId);
90  
91              Object paramObj1 = feedId;
92  
93              if (feedId == null) {
94                  paramObj1 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj2 = new BooleanWrapper(autoFeedId);
98  
99              Object paramObj3 = name;
100 
101             if (name == null) {
102                 paramObj3 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj4 = description;
106 
107             if (description == null) {
108                 paramObj4 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj5 = type;
112 
113             if (type == null) {
114                 paramObj5 = new NullWrapper("java.lang.String");
115             }
116 
117             Object paramObj6 = structureId;
118 
119             if (structureId == null) {
120                 paramObj6 = new NullWrapper("java.lang.String");
121             }
122 
123             Object paramObj7 = templateId;
124 
125             if (templateId == null) {
126                 paramObj7 = new NullWrapper("java.lang.String");
127             }
128 
129             Object paramObj8 = rendererTemplateId;
130 
131             if (rendererTemplateId == null) {
132                 paramObj8 = new NullWrapper("java.lang.String");
133             }
134 
135             Object paramObj9 = new IntegerWrapper(delta);
136 
137             Object paramObj10 = orderByCol;
138 
139             if (orderByCol == null) {
140                 paramObj10 = new NullWrapper("java.lang.String");
141             }
142 
143             Object paramObj11 = orderByType;
144 
145             if (orderByType == null) {
146                 paramObj11 = new NullWrapper("java.lang.String");
147             }
148 
149             Object paramObj12 = targetLayoutFriendlyUrl;
150 
151             if (targetLayoutFriendlyUrl == null) {
152                 paramObj12 = new NullWrapper("java.lang.String");
153             }
154 
155             Object paramObj13 = targetPortletId;
156 
157             if (targetPortletId == null) {
158                 paramObj13 = new NullWrapper("java.lang.String");
159             }
160 
161             Object paramObj14 = contentField;
162 
163             if (contentField == null) {
164                 paramObj14 = new NullWrapper("java.lang.String");
165             }
166 
167             Object paramObj15 = feedType;
168 
169             if (feedType == null) {
170                 paramObj15 = new NullWrapper("java.lang.String");
171             }
172 
173             Object paramObj16 = new DoubleWrapper(feedVersion);
174 
175             Object paramObj17 = serviceContext;
176 
177             if (serviceContext == null) {
178                 paramObj17 = new NullWrapper(
179                         "com.liferay.portal.service.ServiceContext");
180             }
181 
182             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
183                     "addFeed",
184                     new Object[] {
185                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
186                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
187                         paramObj10, paramObj11, paramObj12, paramObj13,
188                         paramObj14, paramObj15, paramObj16, paramObj17
189                     });
190 
191             Object returnObj = null;
192 
193             try {
194                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
195             }
196             catch (Exception e) {
197                 if (e instanceof com.liferay.portal.PortalException) {
198                     throw (com.liferay.portal.PortalException)e;
199                 }
200 
201                 if (e instanceof com.liferay.portal.SystemException) {
202                     throw (com.liferay.portal.SystemException)e;
203                 }
204 
205                 throw new com.liferay.portal.SystemException(e);
206             }
207 
208             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
209         }
210         catch (com.liferay.portal.SystemException se) {
211             _log.error(se, se);
212 
213             throw se;
214         }
215     }
216 
217     public static void deleteFeed(HttpPrincipal httpPrincipal, long groupId,
218         long feedId)
219         throws com.liferay.portal.PortalException,
220             com.liferay.portal.SystemException {
221         try {
222             Object paramObj0 = new LongWrapper(groupId);
223 
224             Object paramObj1 = new LongWrapper(feedId);
225 
226             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
227                     "deleteFeed", new Object[] { paramObj0, paramObj1 });
228 
229             try {
230                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
231             }
232             catch (Exception e) {
233                 if (e instanceof com.liferay.portal.PortalException) {
234                     throw (com.liferay.portal.PortalException)e;
235                 }
236 
237                 if (e instanceof com.liferay.portal.SystemException) {
238                     throw (com.liferay.portal.SystemException)e;
239                 }
240 
241                 throw new com.liferay.portal.SystemException(e);
242             }
243         }
244         catch (com.liferay.portal.SystemException se) {
245             _log.error(se, se);
246 
247             throw se;
248         }
249     }
250 
251     public static void deleteFeed(HttpPrincipal httpPrincipal, long groupId,
252         java.lang.String feedId)
253         throws com.liferay.portal.PortalException,
254             com.liferay.portal.SystemException {
255         try {
256             Object paramObj0 = new LongWrapper(groupId);
257 
258             Object paramObj1 = feedId;
259 
260             if (feedId == null) {
261                 paramObj1 = new NullWrapper("java.lang.String");
262             }
263 
264             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
265                     "deleteFeed", new Object[] { paramObj0, paramObj1 });
266 
267             try {
268                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
269             }
270             catch (Exception e) {
271                 if (e instanceof com.liferay.portal.PortalException) {
272                     throw (com.liferay.portal.PortalException)e;
273                 }
274 
275                 if (e instanceof com.liferay.portal.SystemException) {
276                     throw (com.liferay.portal.SystemException)e;
277                 }
278 
279                 throw new com.liferay.portal.SystemException(e);
280             }
281         }
282         catch (com.liferay.portal.SystemException se) {
283             _log.error(se, se);
284 
285             throw se;
286         }
287     }
288 
289     public static com.liferay.portlet.journal.model.JournalFeed getFeed(
290         HttpPrincipal httpPrincipal, long groupId, long feedId)
291         throws com.liferay.portal.PortalException,
292             com.liferay.portal.SystemException {
293         try {
294             Object paramObj0 = new LongWrapper(groupId);
295 
296             Object paramObj1 = new LongWrapper(feedId);
297 
298             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
299                     "getFeed", new Object[] { paramObj0, paramObj1 });
300 
301             Object returnObj = null;
302 
303             try {
304                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
305             }
306             catch (Exception e) {
307                 if (e instanceof com.liferay.portal.PortalException) {
308                     throw (com.liferay.portal.PortalException)e;
309                 }
310 
311                 if (e instanceof com.liferay.portal.SystemException) {
312                     throw (com.liferay.portal.SystemException)e;
313                 }
314 
315                 throw new com.liferay.portal.SystemException(e);
316             }
317 
318             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
319         }
320         catch (com.liferay.portal.SystemException se) {
321             _log.error(se, se);
322 
323             throw se;
324         }
325     }
326 
327     public static com.liferay.portlet.journal.model.JournalFeed getFeed(
328         HttpPrincipal httpPrincipal, long groupId, java.lang.String feedId)
329         throws com.liferay.portal.PortalException,
330             com.liferay.portal.SystemException {
331         try {
332             Object paramObj0 = new LongWrapper(groupId);
333 
334             Object paramObj1 = feedId;
335 
336             if (feedId == null) {
337                 paramObj1 = new NullWrapper("java.lang.String");
338             }
339 
340             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
341                     "getFeed", new Object[] { paramObj0, paramObj1 });
342 
343             Object returnObj = null;
344 
345             try {
346                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
347             }
348             catch (Exception e) {
349                 if (e instanceof com.liferay.portal.PortalException) {
350                     throw (com.liferay.portal.PortalException)e;
351                 }
352 
353                 if (e instanceof com.liferay.portal.SystemException) {
354                     throw (com.liferay.portal.SystemException)e;
355                 }
356 
357                 throw new com.liferay.portal.SystemException(e);
358             }
359 
360             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
361         }
362         catch (com.liferay.portal.SystemException se) {
363             _log.error(se, se);
364 
365             throw se;
366         }
367     }
368 
369     public static com.liferay.portlet.journal.model.JournalFeed updateFeed(
370         HttpPrincipal httpPrincipal, long groupId, java.lang.String feedId,
371         java.lang.String name, java.lang.String description,
372         java.lang.String type, java.lang.String structureId,
373         java.lang.String templateId, java.lang.String rendererTemplateId,
374         int delta, java.lang.String orderByCol, java.lang.String orderByType,
375         java.lang.String targetLayoutFriendlyUrl,
376         java.lang.String targetPortletId, java.lang.String contentField,
377         java.lang.String feedType, double feedVersion,
378         com.liferay.portal.service.ServiceContext serviceContext)
379         throws com.liferay.portal.PortalException,
380             com.liferay.portal.SystemException {
381         try {
382             Object paramObj0 = new LongWrapper(groupId);
383 
384             Object paramObj1 = feedId;
385 
386             if (feedId == null) {
387                 paramObj1 = new NullWrapper("java.lang.String");
388             }
389 
390             Object paramObj2 = name;
391 
392             if (name == null) {
393                 paramObj2 = new NullWrapper("java.lang.String");
394             }
395 
396             Object paramObj3 = description;
397 
398             if (description == null) {
399                 paramObj3 = new NullWrapper("java.lang.String");
400             }
401 
402             Object paramObj4 = type;
403 
404             if (type == null) {
405                 paramObj4 = new NullWrapper("java.lang.String");
406             }
407 
408             Object paramObj5 = structureId;
409 
410             if (structureId == null) {
411                 paramObj5 = new NullWrapper("java.lang.String");
412             }
413 
414             Object paramObj6 = templateId;
415 
416             if (templateId == null) {
417                 paramObj6 = new NullWrapper("java.lang.String");
418             }
419 
420             Object paramObj7 = rendererTemplateId;
421 
422             if (rendererTemplateId == null) {
423                 paramObj7 = new NullWrapper("java.lang.String");
424             }
425 
426             Object paramObj8 = new IntegerWrapper(delta);
427 
428             Object paramObj9 = orderByCol;
429 
430             if (orderByCol == null) {
431                 paramObj9 = new NullWrapper("java.lang.String");
432             }
433 
434             Object paramObj10 = orderByType;
435 
436             if (orderByType == null) {
437                 paramObj10 = new NullWrapper("java.lang.String");
438             }
439 
440             Object paramObj11 = targetLayoutFriendlyUrl;
441 
442             if (targetLayoutFriendlyUrl == null) {
443                 paramObj11 = new NullWrapper("java.lang.String");
444             }
445 
446             Object paramObj12 = targetPortletId;
447 
448             if (targetPortletId == null) {
449                 paramObj12 = new NullWrapper("java.lang.String");
450             }
451 
452             Object paramObj13 = contentField;
453 
454             if (contentField == null) {
455                 paramObj13 = new NullWrapper("java.lang.String");
456             }
457 
458             Object paramObj14 = feedType;
459 
460             if (feedType == null) {
461                 paramObj14 = new NullWrapper("java.lang.String");
462             }
463 
464             Object paramObj15 = new DoubleWrapper(feedVersion);
465 
466             Object paramObj16 = serviceContext;
467 
468             if (serviceContext == null) {
469                 paramObj16 = new NullWrapper(
470                         "com.liferay.portal.service.ServiceContext");
471             }
472 
473             MethodWrapper methodWrapper = new MethodWrapper(JournalFeedServiceUtil.class.getName(),
474                     "updateFeed",
475                     new Object[] {
476                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
477                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
478                         paramObj10, paramObj11, paramObj12, paramObj13,
479                         paramObj14, paramObj15, paramObj16
480                     });
481 
482             Object returnObj = null;
483 
484             try {
485                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
486             }
487             catch (Exception e) {
488                 if (e instanceof com.liferay.portal.PortalException) {
489                     throw (com.liferay.portal.PortalException)e;
490                 }
491 
492                 if (e instanceof com.liferay.portal.SystemException) {
493                     throw (com.liferay.portal.SystemException)e;
494                 }
495 
496                 throw new com.liferay.portal.SystemException(e);
497             }
498 
499             return (com.liferay.portlet.journal.model.JournalFeed)returnObj;
500         }
501         catch (com.liferay.portal.SystemException se) {
502             _log.error(se, se);
503 
504             throw se;
505         }
506     }
507 
508     private static Log _log = LogFactoryUtil.getLog(JournalFeedServiceHttp.class);
509 }