1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.announcements.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.http.TunnelUtil;
26  
27  import com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil;
28  
29  /**
30   * <a href="AnnouncementsEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a HTTP utility for the
39   * {@link com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil} service utility. The
40   * static methods of this class calls the same methods of the service utility.
41   * However, the signatures are different because it requires an additional
42   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
43   * </p>
44   *
45   * <p>
46   * The benefits of using the HTTP utility is that it is fast and allows for
47   * tunneling without the cost of serializing to text. The drawback is that it
48   * only works with Java.
49   * </p>
50   *
51   * <p>
52   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
53   * configure security.
54   * </p>
55   *
56   * <p>
57   * The HTTP utility is only generated for remote services.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       AnnouncementsEntryServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil
64   * @generated
65   */
66  public class AnnouncementsEntryServiceHttp {
67      public static com.liferay.portlet.announcements.model.AnnouncementsEntry addEntry(
68          HttpPrincipal httpPrincipal, long plid, long classNameId, long classPK,
69          java.lang.String title, java.lang.String content, java.lang.String url,
70          java.lang.String type, int displayDateMonth, int displayDateDay,
71          int displayDateYear, int displayDateHour, int displayDateMinute,
72          int expirationDateMonth, int expirationDateDay, int expirationDateYear,
73          int expirationDateHour, int expirationDateMinute, int priority,
74          boolean alert)
75          throws com.liferay.portal.kernel.exception.PortalException,
76              com.liferay.portal.kernel.exception.SystemException {
77          try {
78              Object paramObj0 = new LongWrapper(plid);
79  
80              Object paramObj1 = new LongWrapper(classNameId);
81  
82              Object paramObj2 = new LongWrapper(classPK);
83  
84              Object paramObj3 = title;
85  
86              if (title == null) {
87                  paramObj3 = new NullWrapper("java.lang.String");
88              }
89  
90              Object paramObj4 = content;
91  
92              if (content == null) {
93                  paramObj4 = new NullWrapper("java.lang.String");
94              }
95  
96              Object paramObj5 = url;
97  
98              if (url == null) {
99                  paramObj5 = new NullWrapper("java.lang.String");
100             }
101 
102             Object paramObj6 = type;
103 
104             if (type == null) {
105                 paramObj6 = new NullWrapper("java.lang.String");
106             }
107 
108             Object paramObj7 = new IntegerWrapper(displayDateMonth);
109 
110             Object paramObj8 = new IntegerWrapper(displayDateDay);
111 
112             Object paramObj9 = new IntegerWrapper(displayDateYear);
113 
114             Object paramObj10 = new IntegerWrapper(displayDateHour);
115 
116             Object paramObj11 = new IntegerWrapper(displayDateMinute);
117 
118             Object paramObj12 = new IntegerWrapper(expirationDateMonth);
119 
120             Object paramObj13 = new IntegerWrapper(expirationDateDay);
121 
122             Object paramObj14 = new IntegerWrapper(expirationDateYear);
123 
124             Object paramObj15 = new IntegerWrapper(expirationDateHour);
125 
126             Object paramObj16 = new IntegerWrapper(expirationDateMinute);
127 
128             Object paramObj17 = new IntegerWrapper(priority);
129 
130             Object paramObj18 = new BooleanWrapper(alert);
131 
132             MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsEntryServiceUtil.class.getName(),
133                     "addEntry",
134                     new Object[] {
135                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
136                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
137                         paramObj10, paramObj11, paramObj12, paramObj13,
138                         paramObj14, paramObj15, paramObj16, paramObj17,
139                         paramObj18
140                     });
141 
142             Object returnObj = null;
143 
144             try {
145                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
146             }
147             catch (Exception e) {
148                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
149                     throw (com.liferay.portal.kernel.exception.PortalException)e;
150                 }
151 
152                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
153                     throw (com.liferay.portal.kernel.exception.SystemException)e;
154                 }
155 
156                 throw new com.liferay.portal.kernel.exception.SystemException(e);
157             }
158 
159             return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
160         }
161         catch (com.liferay.portal.kernel.exception.SystemException se) {
162             _log.error(se, se);
163 
164             throw se;
165         }
166     }
167 
168     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
169         throws com.liferay.portal.kernel.exception.PortalException,
170             com.liferay.portal.kernel.exception.SystemException {
171         try {
172             Object paramObj0 = new LongWrapper(entryId);
173 
174             MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsEntryServiceUtil.class.getName(),
175                     "deleteEntry", new Object[] { paramObj0 });
176 
177             try {
178                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
179             }
180             catch (Exception e) {
181                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
182                     throw (com.liferay.portal.kernel.exception.PortalException)e;
183                 }
184 
185                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
186                     throw (com.liferay.portal.kernel.exception.SystemException)e;
187                 }
188 
189                 throw new com.liferay.portal.kernel.exception.SystemException(e);
190             }
191         }
192         catch (com.liferay.portal.kernel.exception.SystemException se) {
193             _log.error(se, se);
194 
195             throw se;
196         }
197     }
198 
199     public static com.liferay.portlet.announcements.model.AnnouncementsEntry updateEntry(
200         HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
201         java.lang.String content, java.lang.String url, java.lang.String type,
202         int displayDateMonth, int displayDateDay, int displayDateYear,
203         int displayDateHour, int displayDateMinute, int expirationDateMonth,
204         int expirationDateDay, int expirationDateYear, int expirationDateHour,
205         int expirationDateMinute, int priority)
206         throws com.liferay.portal.kernel.exception.PortalException,
207             com.liferay.portal.kernel.exception.SystemException {
208         try {
209             Object paramObj0 = new LongWrapper(entryId);
210 
211             Object paramObj1 = title;
212 
213             if (title == null) {
214                 paramObj1 = new NullWrapper("java.lang.String");
215             }
216 
217             Object paramObj2 = content;
218 
219             if (content == null) {
220                 paramObj2 = new NullWrapper("java.lang.String");
221             }
222 
223             Object paramObj3 = url;
224 
225             if (url == null) {
226                 paramObj3 = new NullWrapper("java.lang.String");
227             }
228 
229             Object paramObj4 = type;
230 
231             if (type == null) {
232                 paramObj4 = new NullWrapper("java.lang.String");
233             }
234 
235             Object paramObj5 = new IntegerWrapper(displayDateMonth);
236 
237             Object paramObj6 = new IntegerWrapper(displayDateDay);
238 
239             Object paramObj7 = new IntegerWrapper(displayDateYear);
240 
241             Object paramObj8 = new IntegerWrapper(displayDateHour);
242 
243             Object paramObj9 = new IntegerWrapper(displayDateMinute);
244 
245             Object paramObj10 = new IntegerWrapper(expirationDateMonth);
246 
247             Object paramObj11 = new IntegerWrapper(expirationDateDay);
248 
249             Object paramObj12 = new IntegerWrapper(expirationDateYear);
250 
251             Object paramObj13 = new IntegerWrapper(expirationDateHour);
252 
253             Object paramObj14 = new IntegerWrapper(expirationDateMinute);
254 
255             Object paramObj15 = new IntegerWrapper(priority);
256 
257             MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsEntryServiceUtil.class.getName(),
258                     "updateEntry",
259                     new Object[] {
260                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
261                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
262                         paramObj10, paramObj11, paramObj12, paramObj13,
263                         paramObj14, paramObj15
264                     });
265 
266             Object returnObj = null;
267 
268             try {
269                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
270             }
271             catch (Exception e) {
272                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
273                     throw (com.liferay.portal.kernel.exception.PortalException)e;
274                 }
275 
276                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
277                     throw (com.liferay.portal.kernel.exception.SystemException)e;
278                 }
279 
280                 throw new com.liferay.portal.kernel.exception.SystemException(e);
281             }
282 
283             return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
284         }
285         catch (com.liferay.portal.kernel.exception.SystemException se) {
286             _log.error(se, se);
287 
288             throw se;
289         }
290     }
291 
292     private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
293 }