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.announcements.kernel.service.AnnouncementsEntryServiceUtil;
020    
021    import com.liferay.portal.kernel.log.Log;
022    import com.liferay.portal.kernel.log.LogFactoryUtil;
023    import com.liferay.portal.kernel.security.auth.HttpPrincipal;
024    import com.liferay.portal.kernel.util.MethodHandler;
025    import com.liferay.portal.kernel.util.MethodKey;
026    import com.liferay.portal.service.http.TunnelUtil;
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.announcements.kernel.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.announcements.kernel.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 void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
101                    throws com.liferay.portal.kernel.exception.PortalException {
102                    try {
103                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
104                                            "deleteEntry", _deleteEntryParameterTypes1);
105    
106                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
107    
108                            try {
109                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
110                            }
111                            catch (Exception e) {
112                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
113                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
114                                    }
115    
116                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
117                            }
118                    }
119                    catch (com.liferay.portal.kernel.exception.SystemException se) {
120                            _log.error(se, se);
121    
122                            throw se;
123                    }
124            }
125    
126            public static com.liferay.announcements.kernel.model.AnnouncementsEntry getEntry(
127                    HttpPrincipal httpPrincipal, long entryId)
128                    throws com.liferay.portal.kernel.exception.PortalException {
129                    try {
130                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
131                                            "getEntry", _getEntryParameterTypes2);
132    
133                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
134    
135                            Object returnObj = null;
136    
137                            try {
138                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
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                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
146                            }
147    
148                            return (com.liferay.announcements.kernel.model.AnnouncementsEntry)returnObj;
149                    }
150                    catch (com.liferay.portal.kernel.exception.SystemException se) {
151                            _log.error(se, se);
152    
153                            throw se;
154                    }
155            }
156    
157            public static com.liferay.announcements.kernel.model.AnnouncementsEntry updateEntry(
158                    HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
159                    java.lang.String content, java.lang.String url, java.lang.String type,
160                    int displayDateMonth, int displayDateDay, int displayDateYear,
161                    int displayDateHour, int displayDateMinute, boolean displayImmediately,
162                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
163                    int expirationDateHour, int expirationDateMinute, int priority)
164                    throws com.liferay.portal.kernel.exception.PortalException {
165                    try {
166                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
167                                            "updateEntry", _updateEntryParameterTypes3);
168    
169                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
170                                            title, content, url, type, displayDateMonth,
171                                            displayDateDay, displayDateYear, displayDateHour,
172                                            displayDateMinute, displayImmediately, expirationDateMonth,
173                                            expirationDateDay, expirationDateYear, expirationDateHour,
174                                            expirationDateMinute, priority);
175    
176                            Object returnObj = null;
177    
178                            try {
179                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
180                            }
181                            catch (Exception e) {
182                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
183                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
184                                    }
185    
186                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
187                            }
188    
189                            return (com.liferay.announcements.kernel.model.AnnouncementsEntry)returnObj;
190                    }
191                    catch (com.liferay.portal.kernel.exception.SystemException se) {
192                            _log.error(se, se);
193    
194                            throw se;
195                    }
196            }
197    
198            private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
199            private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
200                            long.class, long.class, long.class, java.lang.String.class,
201                            java.lang.String.class, java.lang.String.class,
202                            java.lang.String.class, int.class, int.class, int.class, int.class,
203                            int.class, boolean.class, int.class, int.class, int.class, int.class,
204                            int.class, int.class, boolean.class
205                    };
206            private static final Class<?>[] _deleteEntryParameterTypes1 = new Class[] {
207                            long.class
208                    };
209            private static final Class<?>[] _getEntryParameterTypes2 = new Class[] {
210                            long.class
211                    };
212            private static final Class<?>[] _updateEntryParameterTypes3 = new Class[] {
213                            long.class, java.lang.String.class, java.lang.String.class,
214                            java.lang.String.class, java.lang.String.class, int.class, int.class,
215                            int.class, int.class, int.class, boolean.class, int.class, int.class,
216                            int.class, int.class, int.class, int.class
217                    };
218    }