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