001    /**
002     * Copyright (c) 2000-present 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.MethodHandler;
022    import com.liferay.portal.kernel.util.MethodKey;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil;
027    
028    /**
029     * Provides the HTTP utility for the
030     * {@link AnnouncementsEntryServiceUtil} service utility. The
031     * static methods of this class calls the same methods of the service utility.
032     * However, the signatures are different because it requires an additional
033     * {@link HttpPrincipal} parameter.
034     *
035     * <p>
036     * The benefits of using the HTTP utility is that it is fast and allows for
037     * tunneling without the cost of serializing to text. The drawback is that it
038     * only works with Java.
039     * </p>
040     *
041     * <p>
042     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
043     * configure security.
044     * </p>
045     *
046     * <p>
047     * The HTTP utility is only generated for remote services.
048     * </p>
049     *
050     * @author Brian Wing Shun Chan
051     * @see AnnouncementsEntryServiceSoap
052     * @see HttpPrincipal
053     * @see AnnouncementsEntryServiceUtil
054     * @generated
055     */
056    @ProviderType
057    public class AnnouncementsEntryServiceHttp {
058            public static com.liferay.portlet.announcements.model.AnnouncementsEntry addEntry(
059                    HttpPrincipal httpPrincipal, long plid, long classNameId, long classPK,
060                    java.lang.String title, java.lang.String content, java.lang.String url,
061                    java.lang.String type, int displayDateMonth, int displayDateDay,
062                    int displayDateYear, int displayDateHour, int displayDateMinute,
063                    boolean displayImmediately, int expirationDateMonth,
064                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
065                    int expirationDateMinute, int priority, boolean alert)
066                    throws com.liferay.portal.kernel.exception.PortalException {
067                    try {
068                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
069                                            "addEntry", _addEntryParameterTypes0);
070    
071                            MethodHandler methodHandler = new MethodHandler(methodKey, plid,
072                                            classNameId, classPK, title, content, url, type,
073                                            displayDateMonth, displayDateDay, displayDateYear,
074                                            displayDateHour, displayDateMinute, displayImmediately,
075                                            expirationDateMonth, expirationDateDay, expirationDateYear,
076                                            expirationDateHour, expirationDateMinute, priority, alert);
077    
078                            Object returnObj = null;
079    
080                            try {
081                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
082                            }
083                            catch (Exception e) {
084                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
085                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
086                                    }
087    
088                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
089                            }
090    
091                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
092                    }
093                    catch (com.liferay.portal.kernel.exception.SystemException se) {
094                            _log.error(se, se);
095    
096                            throw se;
097                    }
098            }
099    
100            public static com.liferay.portlet.announcements.model.AnnouncementsEntry addEntry(
101                    HttpPrincipal httpPrincipal, long plid, long classNameId, long classPK,
102                    java.lang.String title, java.lang.String content, java.lang.String url,
103                    java.lang.String type, int displayDateMonth, int displayDateDay,
104                    int displayDateYear, int displayDateHour, int displayDateMinute,
105                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
106                    int expirationDateHour, int expirationDateMinute, int priority,
107                    boolean alert)
108                    throws com.liferay.portal.kernel.exception.PortalException {
109                    try {
110                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
111                                            "addEntry", _addEntryParameterTypes1);
112    
113                            MethodHandler methodHandler = new MethodHandler(methodKey, plid,
114                                            classNameId, classPK, title, content, url, type,
115                                            displayDateMonth, displayDateDay, displayDateYear,
116                                            displayDateHour, displayDateMinute, expirationDateMonth,
117                                            expirationDateDay, expirationDateYear, expirationDateHour,
118                                            expirationDateMinute, priority, alert);
119    
120                            Object returnObj = null;
121    
122                            try {
123                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
124                            }
125                            catch (Exception e) {
126                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
127                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
128                                    }
129    
130                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
131                            }
132    
133                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
134                    }
135                    catch (com.liferay.portal.kernel.exception.SystemException se) {
136                            _log.error(se, se);
137    
138                            throw se;
139                    }
140            }
141    
142            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
143                    throws com.liferay.portal.kernel.exception.PortalException {
144                    try {
145                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
146                                            "deleteEntry", _deleteEntryParameterTypes2);
147    
148                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
149    
150                            try {
151                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
152                            }
153                            catch (Exception e) {
154                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
155                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
156                                    }
157    
158                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
159                            }
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 com.liferay.portlet.announcements.model.AnnouncementsEntry getEntry(
169                    HttpPrincipal httpPrincipal, long entryId)
170                    throws com.liferay.portal.kernel.exception.PortalException {
171                    try {
172                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
173                                            "getEntry", _getEntryParameterTypes3);
174    
175                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
176    
177                            Object returnObj = null;
178    
179                            try {
180                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
181                            }
182                            catch (Exception e) {
183                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
184                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
185                                    }
186    
187                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
188                            }
189    
190                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
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, boolean displayImmediately,
204                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
205                    int expirationDateHour, int expirationDateMinute, int priority)
206                    throws com.liferay.portal.kernel.exception.PortalException {
207                    try {
208                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
209                                            "updateEntry", _updateEntryParameterTypes4);
210    
211                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
212                                            title, content, url, type, displayDateMonth,
213                                            displayDateDay, displayDateYear, displayDateHour,
214                                            displayDateMinute, displayImmediately, expirationDateMonth,
215                                            expirationDateDay, expirationDateYear, expirationDateHour,
216                                            expirationDateMinute, priority);
217    
218                            Object returnObj = null;
219    
220                            try {
221                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
222                            }
223                            catch (Exception e) {
224                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
225                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
226                                    }
227    
228                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
229                            }
230    
231                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
232                    }
233                    catch (com.liferay.portal.kernel.exception.SystemException se) {
234                            _log.error(se, se);
235    
236                            throw se;
237                    }
238            }
239    
240            private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
241            private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
242                            long.class, long.class, long.class, java.lang.String.class,
243                            java.lang.String.class, java.lang.String.class,
244                            java.lang.String.class, int.class, int.class, int.class, int.class,
245                            int.class, boolean.class, int.class, int.class, int.class, int.class,
246                            int.class, int.class, boolean.class
247                    };
248            private static final Class<?>[] _addEntryParameterTypes1 = new Class[] {
249                            long.class, long.class, long.class, java.lang.String.class,
250                            java.lang.String.class, java.lang.String.class,
251                            java.lang.String.class, int.class, int.class, int.class, int.class,
252                            int.class, int.class, int.class, int.class, int.class, int.class,
253                            int.class, boolean.class
254                    };
255            private static final Class<?>[] _deleteEntryParameterTypes2 = new Class[] {
256                            long.class
257                    };
258            private static final Class<?>[] _getEntryParameterTypes3 = new Class[] {
259                            long.class
260                    };
261            private static final Class<?>[] _updateEntryParameterTypes4 = new Class[] {
262                            long.class, java.lang.String.class, java.lang.String.class,
263                            java.lang.String.class, java.lang.String.class, int.class, int.class,
264                            int.class, int.class, int.class, boolean.class, int.class, int.class,
265                            int.class, int.class, int.class, int.class
266                    };
267    }