1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.tasks.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.BooleanWrapper;
28  import com.liferay.portal.kernel.util.IntegerWrapper;
29  import com.liferay.portal.kernel.util.LongWrapper;
30  import com.liferay.portal.kernel.util.MethodWrapper;
31  import com.liferay.portal.kernel.util.NullWrapper;
32  import com.liferay.portal.security.auth.HttpPrincipal;
33  import com.liferay.portal.service.http.TunnelUtil;
34  
35  import com.liferay.portlet.tasks.service.TasksProposalServiceUtil;
36  
37  /**
38   * <a href="TasksProposalServiceHttp.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be
42   * overwritten the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class provides a HTTP utility for the
47   * {@link com.liferay.portlet.tasks.service.TasksProposalServiceUtil} service utility. The
48   * static methods of this class calls the same methods of the service utility.
49   * However, the signatures are different because it requires an additional
50   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
51   * </p>
52   *
53   * <p>
54   * The benefits of using the HTTP utility is that it is fast and allows for
55   * tunneling without the cost of serializing to text. The drawback is that it
56   * only works with Java.
57   * </p>
58   *
59   * <p>
60   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
61   * configure security.
62   * </p>
63   *
64   * <p>
65   * The HTTP utility is only generated for remote services.
66   * </p>
67   *
68   * @author    Brian Wing Shun Chan
69   * @see       TasksProposalServiceSoap
70   * @see       com.liferay.portal.security.auth.HttpPrincipal
71   * @see       com.liferay.portlet.tasks.service.TasksProposalServiceUtil
72   * @generated
73   */
74  public class TasksProposalServiceHttp {
75      public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
76          HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
77          java.lang.String classPK, java.lang.String name,
78          java.lang.String description, long reviewUserId,
79          boolean addCommunityPermissions, boolean addGuestPermissions)
80          throws com.liferay.portal.PortalException,
81              com.liferay.portal.SystemException {
82          try {
83              Object paramObj0 = new LongWrapper(groupId);
84  
85              Object paramObj1 = className;
86  
87              if (className == null) {
88                  paramObj1 = new NullWrapper("java.lang.String");
89              }
90  
91              Object paramObj2 = classPK;
92  
93              if (classPK == null) {
94                  paramObj2 = new NullWrapper("java.lang.String");
95              }
96  
97              Object paramObj3 = name;
98  
99              if (name == null) {
100                 paramObj3 = new NullWrapper("java.lang.String");
101             }
102 
103             Object paramObj4 = description;
104 
105             if (description == null) {
106                 paramObj4 = new NullWrapper("java.lang.String");
107             }
108 
109             Object paramObj5 = new LongWrapper(reviewUserId);
110 
111             Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
112 
113             Object paramObj7 = new BooleanWrapper(addGuestPermissions);
114 
115             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
116                     "addProposal",
117                     new Object[] {
118                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
119                         paramObj5, paramObj6, paramObj7
120                     });
121 
122             Object returnObj = null;
123 
124             try {
125                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
126             }
127             catch (Exception e) {
128                 if (e instanceof com.liferay.portal.PortalException) {
129                     throw (com.liferay.portal.PortalException)e;
130                 }
131 
132                 if (e instanceof com.liferay.portal.SystemException) {
133                     throw (com.liferay.portal.SystemException)e;
134                 }
135 
136                 throw new com.liferay.portal.SystemException(e);
137             }
138 
139             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
140         }
141         catch (com.liferay.portal.SystemException se) {
142             _log.error(se, se);
143 
144             throw se;
145         }
146     }
147 
148     public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
149         HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
150         java.lang.String classPK, java.lang.String name,
151         java.lang.String description, long reviewUserId,
152         java.lang.String[] communityPermissions,
153         java.lang.String[] guestPermissions)
154         throws com.liferay.portal.PortalException,
155             com.liferay.portal.SystemException {
156         try {
157             Object paramObj0 = new LongWrapper(groupId);
158 
159             Object paramObj1 = className;
160 
161             if (className == null) {
162                 paramObj1 = new NullWrapper("java.lang.String");
163             }
164 
165             Object paramObj2 = classPK;
166 
167             if (classPK == null) {
168                 paramObj2 = new NullWrapper("java.lang.String");
169             }
170 
171             Object paramObj3 = name;
172 
173             if (name == null) {
174                 paramObj3 = new NullWrapper("java.lang.String");
175             }
176 
177             Object paramObj4 = description;
178 
179             if (description == null) {
180                 paramObj4 = new NullWrapper("java.lang.String");
181             }
182 
183             Object paramObj5 = new LongWrapper(reviewUserId);
184 
185             Object paramObj6 = communityPermissions;
186 
187             if (communityPermissions == null) {
188                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
189             }
190 
191             Object paramObj7 = guestPermissions;
192 
193             if (guestPermissions == null) {
194                 paramObj7 = new NullWrapper("[Ljava.lang.String;");
195             }
196 
197             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
198                     "addProposal",
199                     new Object[] {
200                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
201                         paramObj5, paramObj6, paramObj7
202                     });
203 
204             Object returnObj = null;
205 
206             try {
207                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
208             }
209             catch (Exception e) {
210                 if (e instanceof com.liferay.portal.PortalException) {
211                     throw (com.liferay.portal.PortalException)e;
212                 }
213 
214                 if (e instanceof com.liferay.portal.SystemException) {
215                     throw (com.liferay.portal.SystemException)e;
216                 }
217 
218                 throw new com.liferay.portal.SystemException(e);
219             }
220 
221             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
222         }
223         catch (com.liferay.portal.SystemException se) {
224             _log.error(se, se);
225 
226             throw se;
227         }
228     }
229 
230     public static void deleteProposal(HttpPrincipal httpPrincipal,
231         long proposalId)
232         throws com.liferay.portal.PortalException,
233             com.liferay.portal.SystemException {
234         try {
235             Object paramObj0 = new LongWrapper(proposalId);
236 
237             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
238                     "deleteProposal", new Object[] { paramObj0 });
239 
240             try {
241                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
242             }
243             catch (Exception e) {
244                 if (e instanceof com.liferay.portal.PortalException) {
245                     throw (com.liferay.portal.PortalException)e;
246                 }
247 
248                 if (e instanceof com.liferay.portal.SystemException) {
249                     throw (com.liferay.portal.SystemException)e;
250                 }
251 
252                 throw new com.liferay.portal.SystemException(e);
253             }
254         }
255         catch (com.liferay.portal.SystemException se) {
256             _log.error(se, se);
257 
258             throw se;
259         }
260     }
261 
262     public static com.liferay.portlet.tasks.model.TasksProposal updateProposal(
263         HttpPrincipal httpPrincipal, long proposalId,
264         java.lang.String description, int dueDateMonth, int dueDateDay,
265         int dueDateYear, int dueDateHour, int dueDateMinute)
266         throws com.liferay.portal.PortalException,
267             com.liferay.portal.SystemException {
268         try {
269             Object paramObj0 = new LongWrapper(proposalId);
270 
271             Object paramObj1 = description;
272 
273             if (description == null) {
274                 paramObj1 = new NullWrapper("java.lang.String");
275             }
276 
277             Object paramObj2 = new IntegerWrapper(dueDateMonth);
278 
279             Object paramObj3 = new IntegerWrapper(dueDateDay);
280 
281             Object paramObj4 = new IntegerWrapper(dueDateYear);
282 
283             Object paramObj5 = new IntegerWrapper(dueDateHour);
284 
285             Object paramObj6 = new IntegerWrapper(dueDateMinute);
286 
287             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
288                     "updateProposal",
289                     new Object[] {
290                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
291                         paramObj5, paramObj6
292                     });
293 
294             Object returnObj = null;
295 
296             try {
297                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
298             }
299             catch (Exception e) {
300                 if (e instanceof com.liferay.portal.PortalException) {
301                     throw (com.liferay.portal.PortalException)e;
302                 }
303 
304                 if (e instanceof com.liferay.portal.SystemException) {
305                     throw (com.liferay.portal.SystemException)e;
306                 }
307 
308                 throw new com.liferay.portal.SystemException(e);
309             }
310 
311             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
312         }
313         catch (com.liferay.portal.SystemException se) {
314             _log.error(se, se);
315 
316             throw se;
317         }
318     }
319 
320     private static Log _log = LogFactoryUtil.getLog(TasksProposalServiceHttp.class);
321 }