1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.announcements.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.MethodHandler;
20  import com.liferay.portal.kernel.util.MethodKey;
21  import com.liferay.portal.security.auth.HttpPrincipal;
22  import com.liferay.portal.service.http.TunnelUtil;
23  
24  import com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil;
25  
26  /**
27   * <a href="AnnouncementsEntryServiceHttp.java.html"><b><i>View Source</i></b></a>
28   *
29   * <p>
30   * ServiceBuilder generated this class. Modifications in this class will be
31   * overwritten the next time is generated.
32   * </p>
33   *
34   * <p>
35   * This class provides a HTTP utility for the
36   * {@link com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil} service utility. The
37   * static methods of this class calls the same methods of the service utility.
38   * However, the signatures are different because it requires an additional
39   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
40   * </p>
41   *
42   * <p>
43   * The benefits of using the HTTP utility is that it is fast and allows for
44   * tunneling without the cost of serializing to text. The drawback is that it
45   * only works with Java.
46   * </p>
47   *
48   * <p>
49   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
50   * configure security.
51   * </p>
52   *
53   * <p>
54   * The HTTP utility is only generated for remote services.
55   * </p>
56   *
57   * @author    Brian Wing Shun Chan
58   * @see       AnnouncementsEntryServiceSoap
59   * @see       com.liferay.portal.security.auth.HttpPrincipal
60   * @see       com.liferay.portlet.announcements.service.AnnouncementsEntryServiceUtil
61   * @generated
62   */
63  public class AnnouncementsEntryServiceHttp {
64      public static com.liferay.portlet.announcements.model.AnnouncementsEntry addEntry(
65          HttpPrincipal httpPrincipal, long plid, long classNameId, long classPK,
66          java.lang.String title, java.lang.String content, java.lang.String url,
67          java.lang.String type, int displayDateMonth, int displayDateDay,
68          int displayDateYear, int displayDateHour, int displayDateMinute,
69          int expirationDateMonth, int expirationDateDay, int expirationDateYear,
70          int expirationDateHour, int expirationDateMinute, int priority,
71          boolean alert)
72          throws com.liferay.portal.PortalException,
73              com.liferay.portal.SystemException {
74          try {
75              MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class.getName(),
76                      "addEntry", _addEntryParameterTypes0);
77  
78              MethodHandler methodHandler = new MethodHandler(methodKey, plid,
79                      classNameId, classPK, title, content, url, type,
80                      displayDateMonth, displayDateDay, displayDateYear,
81                      displayDateHour, displayDateMinute, expirationDateMonth,
82                      expirationDateDay, expirationDateYear, expirationDateHour,
83                      expirationDateMinute, priority, alert);
84  
85              Object returnObj = null;
86  
87              try {
88                  returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
89              }
90              catch (Exception e) {
91                  if (e instanceof com.liferay.portal.PortalException) {
92                      throw (com.liferay.portal.PortalException)e;
93                  }
94  
95                  if (e instanceof com.liferay.portal.SystemException) {
96                      throw (com.liferay.portal.SystemException)e;
97                  }
98  
99                  throw new com.liferay.portal.SystemException(e);
100             }
101 
102             return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
103         }
104         catch (com.liferay.portal.SystemException se) {
105             _log.error(se, se);
106 
107             throw se;
108         }
109     }
110 
111     public static void deleteEntry(HttpPrincipal httpPrincipal, long entryId)
112         throws com.liferay.portal.PortalException,
113             com.liferay.portal.SystemException {
114         try {
115             MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class.getName(),
116                     "deleteEntry", _deleteEntryParameterTypes1);
117 
118             MethodHandler methodHandler = new MethodHandler(methodKey, entryId);
119 
120             try {
121                 TunnelUtil.invoke(httpPrincipal, methodHandler);
122             }
123             catch (Exception e) {
124                 if (e instanceof com.liferay.portal.PortalException) {
125                     throw (com.liferay.portal.PortalException)e;
126                 }
127 
128                 if (e instanceof com.liferay.portal.SystemException) {
129                     throw (com.liferay.portal.SystemException)e;
130                 }
131 
132                 throw new com.liferay.portal.SystemException(e);
133             }
134         }
135         catch (com.liferay.portal.SystemException se) {
136             _log.error(se, se);
137 
138             throw se;
139         }
140     }
141 
142     public static com.liferay.portlet.announcements.model.AnnouncementsEntry updateEntry(
143         HttpPrincipal httpPrincipal, long entryId, java.lang.String title,
144         java.lang.String content, java.lang.String url, java.lang.String type,
145         int displayDateMonth, int displayDateDay, int displayDateYear,
146         int displayDateHour, int displayDateMinute, int expirationDateMonth,
147         int expirationDateDay, int expirationDateYear, int expirationDateHour,
148         int expirationDateMinute, int priority)
149         throws com.liferay.portal.PortalException,
150             com.liferay.portal.SystemException {
151         try {
152             MethodKey methodKey = new MethodKey(AnnouncementsEntryServiceUtil.class.getName(),
153                     "updateEntry", _updateEntryParameterTypes2);
154 
155             MethodHandler methodHandler = new MethodHandler(methodKey, entryId,
156                     title, content, url, type, displayDateMonth,
157                     displayDateDay, displayDateYear, displayDateHour,
158                     displayDateMinute, expirationDateMonth, expirationDateDay,
159                     expirationDateYear, expirationDateHour,
160                     expirationDateMinute, priority);
161 
162             Object returnObj = null;
163 
164             try {
165                 returnObj = TunnelUtil.invoke(httpPrincipal, methodHandler);
166             }
167             catch (Exception e) {
168                 if (e instanceof com.liferay.portal.PortalException) {
169                     throw (com.liferay.portal.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.SystemException) {
173                     throw (com.liferay.portal.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.SystemException(e);
177             }
178 
179             return (com.liferay.portlet.announcements.model.AnnouncementsEntry)returnObj;
180         }
181         catch (com.liferay.portal.SystemException se) {
182             _log.error(se, se);
183 
184             throw se;
185         }
186     }
187 
188     private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryServiceHttp.class);
189     private static final Class<?>[] _addEntryParameterTypes0 = new Class[] {
190             long.class, long.class, long.class, java.lang.String.class,
191             java.lang.String.class, java.lang.String.class,
192             java.lang.String.class, int.class, int.class, int.class, int.class,
193             int.class, int.class, int.class, int.class, int.class, int.class,
194             int.class, boolean.class
195         };
196     private static final Class<?>[] _deleteEntryParameterTypes1 = new Class[] {
197             long.class
198         };
199     private static final Class<?>[] _updateEntryParameterTypes2 = new Class[] {
200             long.class, java.lang.String.class, java.lang.String.class,
201             java.lang.String.class, java.lang.String.class, int.class, int.class,
202             int.class, int.class, int.class, int.class, int.class, int.class,
203             int.class, int.class, int.class
204         };
205 }