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.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.getName(),
069                                            "addEntry", long.class, long.class, long.class,
070                                            java.lang.String.class, java.lang.String.class,
071                                            java.lang.String.class, java.lang.String.class, int.class,
072                                            int.class, int.class, int.class, int.class, int.class,
073                                            int.class, int.class, int.class, int.class, int.class,
074                                            boolean.class);
075    
076                            MethodHandler methodHandler = new MethodHandler(methodKey, plid,
077                                            classNameId, classPK, title, content, url, type,
078                                            displayDateMonth, displayDateDay, displayDateYear,
079                                            displayDateHour, displayDateMinute, expirationDateMonth,
080                                            expirationDateDay, expirationDateYear, expirationDateHour,
081                                            expirationDateMinute, priority, alert);
082    
083                            Object returnObj = null;
084    
085                            try {
086                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
087                            }
088                            catch (Exception e) {
089                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
090                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
091                                    }
092    
093                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
094                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
095                                    }
096    
097                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
098                            }
099    
100                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
101                    }
102                    catch (com.liferay.portal.kernel.exception.SystemException se) {
103                            _log.error(se, se);
104    
105                            throw se;
106                    }
107            }
108    
109            public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
110                    throws com.liferay.portal.kernel.exception.PortalException,
111                            com.liferay.portal.kernel.exception.SystemException {
112                    try {
113                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class.getName(),
114                                            "deleteEntry", long.class);
115    
116                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
117    
118                            try {
119                                    TunnelUtil.invoke(httpPrincipal, methodHandler);
120                            }
121                            catch (Exception e) {
122                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
123                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
124                                    }
125    
126                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
127                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
128                                    }
129    
130                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
131                            }
132                    }
133                    catch (com.liferay.portal.kernel.exception.SystemException se) {
134                            _log.error(se, se);
135    
136                            throw se;
137                    }
138            }
139    
140            public static com.liferay.portlet.announcements.model.AnnouncementsEntry updateEntry(
141                    HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
142                    java.lang.String content, java.lang.String url, java.lang.String type,
143                    int displayDateMonth, int displayDateDay, int displayDateYear,
144                    int displayDateHour, int displayDateMinute, int expirationDateMonth,
145                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
146                    int expirationDateMinute, int priority)
147                    throws com.liferay.portal.kernel.exception.PortalException,
148                            com.liferay.portal.kernel.exception.SystemException {
149                    try {
150                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class.getName(),
151                                            "updateEntry", long.class, java.lang.String.class,
152                                            java.lang.String.class, java.lang.String.class,
153                                            java.lang.String.class, int.class, int.class, int.class,
154                                            int.class, int.class, int.class, int.class, int.class,
155                                            int.class, int.class, int.class);
156    
157                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
158                                            title, content, url, type, displayDateMonth,
159                                            displayDateDay, displayDateYear, displayDateHour,
160                                            displayDateMinute, expirationDateMonth, expirationDateDay,
161                                            expirationDateYear, expirationDateHour,
162                                            expirationDateMinute, priority);
163    
164                            Object returnObj = null;
165    
166                            try {
167                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
168                            }
169                            catch (Exception e) {
170                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
171                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
172                                    }
173    
174                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
175                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
176                                    }
177    
178                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
179                            }
180    
181                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
182                    }
183                    catch (com.liferay.portal.kernel.exception.SystemException se) {
184                            _log.error(se, se);
185    
186                            throw se;
187                    }
188            }
189    
190            private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
191    }