001    /**
002     * Copyright (c) 2000-2013 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.MethodHandler;
020    import com.liferay.portal.kernel.util.MethodKey;
021    import com.liferay.portal.security.auth.HttpPrincipal;
022    import com.liferay.portal.service.http.TunnelUtil;
023    
024    import com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil;
025    
026    /**
027     * <p>
028     * This class provides a HTTP utility for the
029     * {@link com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil} service utility. The
030     * static methods of this class calls the same methods of the service utility.
031     * However, the signatures are different because it requires an additional
032     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
033     * </p>
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       com.liferay.portal.security.auth.HttpPrincipal
053     * @see       com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil
054     * @generated
055     */
056    public class AnnouncementsEntryServiceHttp {
057            public static com.liferay.portlet.announcements.model.AnnouncementsEntry addEntry(
058                    HttpPrincipal httpPrincipal, long plid, long classNameId, long classPK,
059                    java.lang.String title, java.lang.String content, java.lang.String url,
060                    java.lang.String type, int displayDateMonth, int displayDateDay,
061                    int displayDateYear, int displayDateHour, int displayDateMinute,
062                    int expirationDateMonth, int expirationDateDay, int expirationDateYear,
063                    int expirationDateHour, int expirationDateMinute, int priority,
064                    boolean alert)
065                    throws com.liferay.portal.kernel.exception.PortalException,
066                            com.liferay.portal.kernel.exception.SystemException {
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, expirationDateMonth,
075                                            expirationDateDay, expirationDateYear, expirationDateHour,
076                                            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                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
089                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
090                                    }
091    
092                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
093                            }
094    
095                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
096                    }
097                    catch (com.liferay.portal.kernel.exception.SystemException se) {
098                            _log.error(se, se);
099    
100                            throw se;
101                    }
102            }
103    
104            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
105                    throws com.liferay.portal.kernel.exception.PortalException,
106                            com.liferay.portal.kernel.exception.SystemException {
107                    try {
108                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
109                                            "deleteEntry", _deleteEntryParameterTypes1);
110    
111                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
112    
113                            try {
114                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
115                            }
116                            catch (Exception e) {
117                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
118                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
119                                    }
120    
121                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
122                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
123                                    }
124    
125                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
126                            }
127                    }
128                    catch (com.liferay.portal.kernel.exception.SystemException se) {
129                            _log.error(se, se);
130    
131                            throw se;
132                    }
133            }
134    
135            public static com.liferay.portlet.announcements.model.AnnouncementsEntry getEntry(
136                    HttpPrincipal httpPrincipal, long entryId)
137                    throws com.liferay.portal.kernel.exception.PortalException,
138                            com.liferay.portal.kernel.exception.SystemException {
139                    try {
140                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
141                                            "getEntry", _getEntryParameterTypes2);
142    
143                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
144    
145                            Object returnObj = null;
146    
147                            try {
148                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
149                            }
150                            catch (Exception e) {
151                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
152                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
153                                    }
154    
155                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
156                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
157                                    }
158    
159                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
160                            }
161    
162                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
163                    }
164                    catch (com.liferay.portal.kernel.exception.SystemException se) {
165                            _log.error(se, se);
166    
167                            throw se;
168                    }
169            }
170    
171            public static com.liferay.portlet.announcements.model.AnnouncementsEntry updateEntry(
172                    HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
173                    java.lang.String content, java.lang.String url, java.lang.String type,
174                    int displayDateMonth, int displayDateDay, int displayDateYear,
175                    int displayDateHour, int displayDateMinute, int expirationDateMonth,
176                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
177                    int expirationDateMinute, int priority)
178                    throws com.liferay.portal.kernel.exception.PortalException,
179                            com.liferay.portal.kernel.exception.SystemException {
180                    try {
181                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class,
182                                            "updateEntry", _updateEntryParameterTypes3);
183    
184                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
185                                            title, content, url, type, displayDateMonth,
186                                            displayDateDay, displayDateYear, displayDateHour,
187                                            displayDateMinute, expirationDateMonth, expirationDateDay,
188                                            expirationDateYear, expirationDateHour,
189                                            expirationDateMinute, priority);
190    
191                            Object returnObj = null;
192    
193                            try {
194                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
195                            }
196                            catch (Exception e) {
197                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
198                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
199                                    }
200    
201                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
202                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
203                                    }
204    
205                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
206                            }
207    
208                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
209                    }
210                    catch (com.liferay.portal.kernel.exception.SystemException se) {
211                            _log.error(se, se);
212    
213                            throw se;
214                    }
215            }
216    
217            private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
218            private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
219                            long.class, long.class, long.class, java.lang.String.class,
220                            java.lang.String.class, java.lang.String.class,
221                            java.lang.String.class, int.class, int.class, int.class, int.class,
222                            int.class, int.class, int.class, int.class, int.class, int.class,
223                            int.class, boolean.class
224                    };
225            private static final Class<?>[] _deleteEntryParameterTypes1 = new Class[] {
226                            long.class
227                    };
228            private static final Class<?>[] _getEntryParameterTypes2 = new Class[] {
229                            long.class
230                    };
231            private static final Class<?>[] _updateEntryParameterTypes3 = new Class[] {
232                            long.class, java.lang.String.class, java.lang.String.class,
233                            java.lang.String.class, java.lang.String.class, int.class, int.class,
234                            int.class, int.class, int.class, int.class, int.class, int.class,
235                            int.class, int.class, int.class
236                    };
237    }