1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.tasks.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.BooleanWrapper;
20  import com.liferay.portal.kernel.util.IntegerWrapper;
21  import com.liferay.portal.kernel.util.LongWrapper;
22  import com.liferay.portal.kernel.util.MethodWrapper;
23  import com.liferay.portal.kernel.util.NullWrapper;
24  import com.liferay.portal.security.auth.HttpPrincipal;
25  import com.liferay.portal.service.http.TunnelUtil;
26  
27  import com.liferay.portlet.tasks.service.TasksProposalServiceUtil;
28  
29  /**
30   * <a href="TasksProposalServiceHttp.java.html"><b><i>View Source</i></b></a>
31   *
32   * <p>
33   * ServiceBuilder generated this class. Modifications in this class will be
34   * overwritten the next time is generated.
35   * </p>
36   *
37   * <p>
38   * This class provides a HTTP utility for the
39   * {@link com.liferay.portlet.tasks.service.TasksProposalServiceUtil} service utility. The
40   * static methods of this class calls the same methods of the service utility.
41   * However, the signatures are different because it requires an additional
42   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
43   * </p>
44   *
45   * <p>
46   * The benefits of using the HTTP utility is that it is fast and allows for
47   * tunneling without the cost of serializing to text. The drawback is that it
48   * only works with Java.
49   * </p>
50   *
51   * <p>
52   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
53   * configure security.
54   * </p>
55   *
56   * <p>
57   * The HTTP utility is only generated for remote services.
58   * </p>
59   *
60   * @author    Brian Wing Shun Chan
61   * @see       TasksProposalServiceSoap
62   * @see       com.liferay.portal.security.auth.HttpPrincipal
63   * @see       com.liferay.portlet.tasks.service.TasksProposalServiceUtil
64   * @generated
65   */
66  public class TasksProposalServiceHttp {
67      public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
68          HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
69          java.lang.String classPK, java.lang.String name,
70          java.lang.String description, long reviewUserId,
71          boolean addCommunityPermissions, boolean addGuestPermissions)
72          throws com.liferay.portal.kernel.exception.PortalException,
73              com.liferay.portal.kernel.exception.SystemException {
74          try {
75              Object paramObj0 = new LongWrapper(groupId);
76  
77              Object paramObj1 = className;
78  
79              if (className == null) {
80                  paramObj1 = new NullWrapper("java.lang.String");
81              }
82  
83              Object paramObj2 = classPK;
84  
85              if (classPK == null) {
86                  paramObj2 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj3 = name;
90  
91              if (name == null) {
92                  paramObj3 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj4 = description;
96  
97              if (description == null) {
98                  paramObj4 = new NullWrapper("java.lang.String");
99              }
100 
101             Object paramObj5 = new LongWrapper(reviewUserId);
102 
103             Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
104 
105             Object paramObj7 = new BooleanWrapper(addGuestPermissions);
106 
107             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
108                     "addProposal",
109                     new Object[] {
110                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
111                         paramObj5, paramObj6, paramObj7
112                     });
113 
114             Object returnObj = null;
115 
116             try {
117                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
118             }
119             catch (Exception e) {
120                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
121                     throw (com.liferay.portal.kernel.exception.PortalException)e;
122                 }
123 
124                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
125                     throw (com.liferay.portal.kernel.exception.SystemException)e;
126                 }
127 
128                 throw new com.liferay.portal.kernel.exception.SystemException(e);
129             }
130 
131             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
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.tasks.model.TasksProposal addProposal(
141         HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
142         java.lang.String classPK, java.lang.String name,
143         java.lang.String description, long reviewUserId,
144         java.lang.String[] communityPermissions,
145         java.lang.String[] guestPermissions)
146         throws com.liferay.portal.kernel.exception.PortalException,
147             com.liferay.portal.kernel.exception.SystemException {
148         try {
149             Object paramObj0 = new LongWrapper(groupId);
150 
151             Object paramObj1 = className;
152 
153             if (className == null) {
154                 paramObj1 = new NullWrapper("java.lang.String");
155             }
156 
157             Object paramObj2 = classPK;
158 
159             if (classPK == null) {
160                 paramObj2 = new NullWrapper("java.lang.String");
161             }
162 
163             Object paramObj3 = name;
164 
165             if (name == null) {
166                 paramObj3 = new NullWrapper("java.lang.String");
167             }
168 
169             Object paramObj4 = description;
170 
171             if (description == null) {
172                 paramObj4 = new NullWrapper("java.lang.String");
173             }
174 
175             Object paramObj5 = new LongWrapper(reviewUserId);
176 
177             Object paramObj6 = communityPermissions;
178 
179             if (communityPermissions == null) {
180                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
181             }
182 
183             Object paramObj7 = guestPermissions;
184 
185             if (guestPermissions == null) {
186                 paramObj7 = new NullWrapper("[Ljava.lang.String;");
187             }
188 
189             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
190                     "addProposal",
191                     new Object[] {
192                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
193                         paramObj5, paramObj6, paramObj7
194                     });
195 
196             Object returnObj = null;
197 
198             try {
199                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
200             }
201             catch (Exception e) {
202                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
203                     throw (com.liferay.portal.kernel.exception.PortalException)e;
204                 }
205 
206                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
207                     throw (com.liferay.portal.kernel.exception.SystemException)e;
208                 }
209 
210                 throw new com.liferay.portal.kernel.exception.SystemException(e);
211             }
212 
213             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
214         }
215         catch (com.liferay.portal.kernel.exception.SystemException se) {
216             _log.error(se, se);
217 
218             throw se;
219         }
220     }
221 
222     public static void deleteProposal(HttpPrincipal httpPrincipal,
223         long proposalId)
224         throws com.liferay.portal.kernel.exception.PortalException,
225             com.liferay.portal.kernel.exception.SystemException {
226         try {
227             Object paramObj0 = new LongWrapper(proposalId);
228 
229             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
230                     "deleteProposal", new Object[] { paramObj0 });
231 
232             try {
233                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
234             }
235             catch (Exception e) {
236                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
237                     throw (com.liferay.portal.kernel.exception.PortalException)e;
238                 }
239 
240                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
241                     throw (com.liferay.portal.kernel.exception.SystemException)e;
242                 }
243 
244                 throw new com.liferay.portal.kernel.exception.SystemException(e);
245             }
246         }
247         catch (com.liferay.portal.kernel.exception.SystemException se) {
248             _log.error(se, se);
249 
250             throw se;
251         }
252     }
253 
254     public static com.liferay.portlet.tasks.model.TasksProposal updateProposal(
255         HttpPrincipal httpPrincipal, long proposalId,
256         java.lang.String description, int dueDateMonth, int dueDateDay,
257         int dueDateYear, int dueDateHour, int dueDateMinute)
258         throws com.liferay.portal.kernel.exception.PortalException,
259             com.liferay.portal.kernel.exception.SystemException {
260         try {
261             Object paramObj0 = new LongWrapper(proposalId);
262 
263             Object paramObj1 = description;
264 
265             if (description == null) {
266                 paramObj1 = new NullWrapper("java.lang.String");
267             }
268 
269             Object paramObj2 = new IntegerWrapper(dueDateMonth);
270 
271             Object paramObj3 = new IntegerWrapper(dueDateDay);
272 
273             Object paramObj4 = new IntegerWrapper(dueDateYear);
274 
275             Object paramObj5 = new IntegerWrapper(dueDateHour);
276 
277             Object paramObj6 = new IntegerWrapper(dueDateMinute);
278 
279             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
280                     "updateProposal",
281                     new Object[] {
282                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
283                         paramObj5, paramObj6
284                     });
285 
286             Object returnObj = null;
287 
288             try {
289                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
290             }
291             catch (Exception e) {
292                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
293                     throw (com.liferay.portal.kernel.exception.PortalException)e;
294                 }
295 
296                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
297                     throw (com.liferay.portal.kernel.exception.SystemException)e;
298                 }
299 
300                 throw new com.liferay.portal.kernel.exception.SystemException(e);
301             }
302 
303             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
304         }
305         catch (com.liferay.portal.kernel.exception.SystemException se) {
306             _log.error(se, se);
307 
308             throw se;
309         }
310     }
311 
312     private static Log _log = LogFactoryUtil.getLog(TasksProposalServiceHttp.class);
313 }