001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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", _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.getName(),
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 updateEntry(
136                    HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
137                    java.lang.String content, java.lang.String url, java.lang.String type,
138                    int displayDateMonth, int displayDateDay, int displayDateYear,
139                    int displayDateHour, int displayDateMinute, int expirationDateMonth,
140                    int expirationDateDay, int expirationDateYear, int expirationDateHour,
141                    int expirationDateMinute, int priority)
142                    throws com.liferay.portal.kernel.exception.PortalException,
143                            com.liferay.portal.kernel.exception.SystemException {
144                    try {
145                            MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class.getName(),
146                                            "updateEntry", _updateEntryParameterTypes2);
147    
148                            MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
149                                            title, content, url, type, displayDateMonth,
150                                            displayDateDay, displayDateYear, displayDateHour,
151                                            displayDateMinute, expirationDateMonth, expirationDateDay,
152                                            expirationDateYear, expirationDateHour,
153                                            expirationDateMinute, priority);
154    
155                            Object returnObj = null;
156    
157                            try {
158                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
159                            }
160                            catch (Exception e) {
161                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
162                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
163                                    }
164    
165                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
166                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
167                                    }
168    
169                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
170                            }
171    
172                            return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
173                    }
174                    catch (com.liferay.portal.kernel.exception.SystemException se) {
175                            _log.error(se, se);
176    
177                            throw se;
178                    }
179            }
180    
181            private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
182            private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
183                            long.class, long.class, long.class, java.lang.String.class,
184                            java.lang.String.class, java.lang.String.class,
185                            java.lang.String.class, int.class, int.class, int.class, int.class,
186                            int.class, int.class, int.class, int.class, int.class, int.class,
187                            int.class, boolean.class
188                    };
189            private static final Class<?>[] _deleteEntryParameterTypes1 = new Class[] {
190                            long.class
191                    };
192            private static final Class<?>[] _updateEntryParameterTypes2 = new Class[] {
193                            long.class, java.lang.String.class, java.lang.String.class,
194                            java.lang.String.class, java.lang.String.class, int.class, int.class,
195                            int.class, int.class, int.class, int.class, int.class, int.class,
196                            int.class, int.class, int.class
197                    };
198    }