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.announcements.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.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.http.TunnelUtil;
026    
027    import com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil;
028    
029    /**
030     * <p>
031     * This class provides a HTTP utility for the
032     * {@link com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil} service utility. The
033     * static methods of this class calls the same methods of the service utility.
034     * However, the signatures are different because it requires an additional
035     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
036     * </p>
037     *
038     * <p>
039     * The benefits of using the HTTP utility is that it is fast and allows for
040     * tunneling without the cost of serializing to text. The drawback is that it
041     * only works with Java.
042     * </p>
043     *
044     * <p>
045     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
046     * configure security.
047     * </p>
048     *
049     * <p>
050     * The HTTP utility is only generated for remote services.
051     * </p>
052     *
053     * @author    Brian Wing Shun Chan
054     * @see       AnnouncementsEntryServiceSoap
055     * @see       com.liferay.portal.security.auth.HttpPrincipal
056     * @see       com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil
057     * @generated
058     */
059    public class AnnouncementsEntryServiceHttp {
060            public static com.liferay.portlet.announcements.model.AnnouncementsEntry addEntry(
061                    HttpPrincipal httpPrincipal, long plid, long classNameId, long classPK,
062                    java.lang.String title, java.lang.String content, java.lang.String url,
063                    java.lang.String type, int displayDateMonth, int displayDateDay,
064                    int displayDateYear, int displayDateHour, int displayDateMinute,
065                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
066                    int expirationDateHour, int expirationDateMinute, int priority,
067                    boolean alert)
068                    throws com.liferay.portal.kernel.exception.PortalException,
069                            com.liferay.portal.kernel.exception.SystemException {
070                    try {
071                            Object paramObj0 = new LongWrapper(plid);
072    
073                            Object paramObj1 = new LongWrapper(classNameId);
074    
075                            Object paramObj2 = new LongWrapper(classPK);
076    
077                            Object paramObj3 = title;
078    
079                            if (title == null) {
080                                    paramObj3 = new NullWrapper("java.lang.String");
081                            }
082    
083                            Object paramObj4 = content;
084    
085                            if (content == null) {
086                                    paramObj4 = new NullWrapper("java.lang.String");
087                            }
088    
089                            Object paramObj5 = url;
090    
091                            if (url == null) {
092                                    paramObj5 = new NullWrapper("java.lang.String");
093                            }
094    
095                            Object paramObj6 = type;
096    
097                            if (type == null) {
098                                    paramObj6 = new NullWrapper("java.lang.String");
099                            }
100    
101                            Object paramObj7 = new IntegerWrapper(displayDateMonth);
102    
103                            Object paramObj8 = new IntegerWrapper(displayDateDay);
104    
105                            Object paramObj9 = new IntegerWrapper(displayDateYear);
106    
107                            Object paramObj10 = new IntegerWrapper(displayDateHour);
108    
109                            Object paramObj11 = new IntegerWrapper(displayDateMinute);
110    
111                            Object paramObj12 = new IntegerWrapper(expirationDateMonth);
112    
113                            Object paramObj13 = new IntegerWrapper(expirationDateDay);
114    
115                            Object paramObj14 = new IntegerWrapper(expirationDateYear);
116    
117                            Object paramObj15 = new IntegerWrapper(expirationDateHour);
118    
119                            Object paramObj16 = new IntegerWrapper(expirationDateMinute);
120    
121                            Object paramObj17 = new IntegerWrapper(priority);
122    
123                            Object paramObj18 = new BooleanWrapper(alert);
124    
125                            MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsEntryServiceUtil.class.getName(),
126                                            "addEntry",
127                                            new Object[] {
128                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
129                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
130                                                    paramObj10, paramObj11, paramObj12, paramObj13,
131                                                    paramObj14, paramObj15, paramObj16, paramObj17,
132                                                    paramObj18
133                                            });
134    
135                            Object returnObj = null;
136    
137                            try {
138                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
139                            }
140                            catch (Exception e) {
141                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
142                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
143                                    }
144    
145                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
146                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
147                                    }
148    
149                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
150                            }
151    
152                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
153                    }
154                    catch (com.liferay.portal.kernel.exception.SystemException se) {
155                            _log.error(se, se);
156    
157                            throw se;
158                    }
159            }
160    
161            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
162                    throws com.liferay.portal.kernel.exception.PortalException,
163                            com.liferay.portal.kernel.exception.SystemException {
164                    try {
165                            Object paramObj0 = new LongWrapper(entryId);
166    
167                            MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsEntryServiceUtil.class.getName(),
168                                            "deleteEntry", new Object[] { paramObj0 });
169    
170                            try {
171                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
172                            }
173                            catch (Exception e) {
174                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
175                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
176                                    }
177    
178                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
179                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
180                                    }
181    
182                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
183                            }
184                    }
185                    catch (com.liferay.portal.kernel.exception.SystemException se) {
186                            _log.error(se, se);
187    
188                            throw se;
189                    }
190            }
191    
192            public static com.liferay.portlet.announcements.model.AnnouncementsEntry updateEntry(
193                    HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
194                    java.lang.String content, java.lang.String url, java.lang.String type,
195                    int displayDateMonth, int displayDateDay, int displayDateYear,
196                    int displayDateHour, int displayDateMinute, int expirationDateMonth,
197                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
198                    int expirationDateMinute, int priority)
199                    throws com.liferay.portal.kernel.exception.PortalException,
200                            com.liferay.portal.kernel.exception.SystemException {
201                    try {
202                            Object paramObj0 = new LongWrapper(entryId);
203    
204                            Object paramObj1 = title;
205    
206                            if (title == null) {
207                                    paramObj1 = new NullWrapper("java.lang.String");
208                            }
209    
210                            Object paramObj2 = content;
211    
212                            if (content == null) {
213                                    paramObj2 = new NullWrapper("java.lang.String");
214                            }
215    
216                            Object paramObj3 = url;
217    
218                            if (url == null) {
219                                    paramObj3 = new NullWrapper("java.lang.String");
220                            }
221    
222                            Object paramObj4 = type;
223    
224                            if (type == null) {
225                                    paramObj4 = new NullWrapper("java.lang.String");
226                            }
227    
228                            Object paramObj5 = new IntegerWrapper(displayDateMonth);
229    
230                            Object paramObj6 = new IntegerWrapper(displayDateDay);
231    
232                            Object paramObj7 = new IntegerWrapper(displayDateYear);
233    
234                            Object paramObj8 = new IntegerWrapper(displayDateHour);
235    
236                            Object paramObj9 = new IntegerWrapper(displayDateMinute);
237    
238                            Object paramObj10 = new IntegerWrapper(expirationDateMonth);
239    
240                            Object paramObj11 = new IntegerWrapper(expirationDateDay);
241    
242                            Object paramObj12 = new IntegerWrapper(expirationDateYear);
243    
244                            Object paramObj13 = new IntegerWrapper(expirationDateHour);
245    
246                            Object paramObj14 = new IntegerWrapper(expirationDateMinute);
247    
248                            Object paramObj15 = new IntegerWrapper(priority);
249    
250                            MethodWrapper methodWrapper = new MethodWrapper(AnnouncementsEntryServiceUtil.class.getName(),
251                                            "updateEntry",
252                                            new Object[] {
253                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
254                                                    paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
255                                                    paramObj10, paramObj11, paramObj12, paramObj13,
256                                                    paramObj14, paramObj15
257                                            });
258    
259                            Object returnObj = null;
260    
261                            try {
262                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
263                            }
264                            catch (Exception e) {
265                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
266                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
267                                    }
268    
269                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
270                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
271                                    }
272    
273                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
274                            }
275    
276                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
277                    }
278                    catch (com.liferay.portal.kernel.exception.SystemException se) {
279                            _log.error(se, se);
280    
281                            throw se;
282                    }
283            }
284    
285            private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
286    }