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   * <code>com.liferay.portlet.tasks.service.TasksProposalServiceUtil</code> service
48   * utility. The static methods of this class calls the same methods of the
49   * service utility. However, the signatures are different because it requires an
50   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
51   * parameter.
52   * </p>
53   *
54   * <p>
55   * The benefits of using the HTTP utility is that it is fast and allows for
56   * tunneling without the cost of serializing to text. The drawback is that it
57   * only works with Java.
58   * </p>
59   *
60   * <p>
61   * Set the property <code>tunnel.servlet.hosts.allowed</code> in
62   * portal.properties to configure security.
63   * </p>
64   *
65   * <p>
66   * The HTTP utility is only generated for remote services.
67   * </p>
68   *
69   * @author Brian Wing Shun Chan
70   *
71   * @see com.liferay.portal.security.auth.HttpPrincipal
72   * @see com.liferay.portlet.tasks.service.TasksProposalServiceUtil
73   * @see com.liferay.portlet.tasks.service.http.TasksProposalServiceSoap
74   *
75   */
76  public class TasksProposalServiceHttp {
77      public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
78          HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
79          java.lang.String classPK, java.lang.String name,
80          java.lang.String description, long reviewUserId,
81          boolean addCommunityPermissions, boolean addGuestPermissions)
82          throws com.liferay.portal.PortalException,
83              com.liferay.portal.SystemException {
84          try {
85              Object paramObj0 = new LongWrapper(groupId);
86  
87              Object paramObj1 = className;
88  
89              if (className == null) {
90                  paramObj1 = new NullWrapper("java.lang.String");
91              }
92  
93              Object paramObj2 = classPK;
94  
95              if (classPK == null) {
96                  paramObj2 = new NullWrapper("java.lang.String");
97              }
98  
99              Object paramObj3 = name;
100 
101             if (name == null) {
102                 paramObj3 = new NullWrapper("java.lang.String");
103             }
104 
105             Object paramObj4 = description;
106 
107             if (description == null) {
108                 paramObj4 = new NullWrapper("java.lang.String");
109             }
110 
111             Object paramObj5 = new LongWrapper(reviewUserId);
112 
113             Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
114 
115             Object paramObj7 = new BooleanWrapper(addGuestPermissions);
116 
117             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
118                     "addProposal",
119                     new Object[] {
120                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
121                         paramObj5, paramObj6, paramObj7
122                     });
123 
124             Object returnObj = null;
125 
126             try {
127                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
128             }
129             catch (Exception e) {
130                 if (e instanceof com.liferay.portal.PortalException) {
131                     throw (com.liferay.portal.PortalException)e;
132                 }
133 
134                 if (e instanceof com.liferay.portal.SystemException) {
135                     throw (com.liferay.portal.SystemException)e;
136                 }
137 
138                 throw new com.liferay.portal.SystemException(e);
139             }
140 
141             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
142         }
143         catch (com.liferay.portal.SystemException se) {
144             _log.error(se, se);
145 
146             throw se;
147         }
148     }
149 
150     public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
151         HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
152         java.lang.String classPK, java.lang.String name,
153         java.lang.String description, long reviewUserId,
154         java.lang.String[] communityPermissions,
155         java.lang.String[] guestPermissions)
156         throws com.liferay.portal.PortalException,
157             com.liferay.portal.SystemException {
158         try {
159             Object paramObj0 = new LongWrapper(groupId);
160 
161             Object paramObj1 = className;
162 
163             if (className == null) {
164                 paramObj1 = new NullWrapper("java.lang.String");
165             }
166 
167             Object paramObj2 = classPK;
168 
169             if (classPK == null) {
170                 paramObj2 = new NullWrapper("java.lang.String");
171             }
172 
173             Object paramObj3 = name;
174 
175             if (name == null) {
176                 paramObj3 = new NullWrapper("java.lang.String");
177             }
178 
179             Object paramObj4 = description;
180 
181             if (description == null) {
182                 paramObj4 = new NullWrapper("java.lang.String");
183             }
184 
185             Object paramObj5 = new LongWrapper(reviewUserId);
186 
187             Object paramObj6 = communityPermissions;
188 
189             if (communityPermissions == null) {
190                 paramObj6 = new NullWrapper("[Ljava.lang.String;");
191             }
192 
193             Object paramObj7 = guestPermissions;
194 
195             if (guestPermissions == null) {
196                 paramObj7 = new NullWrapper("[Ljava.lang.String;");
197             }
198 
199             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
200                     "addProposal",
201                     new Object[] {
202                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
203                         paramObj5, paramObj6, paramObj7
204                     });
205 
206             Object returnObj = null;
207 
208             try {
209                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
210             }
211             catch (Exception e) {
212                 if (e instanceof com.liferay.portal.PortalException) {
213                     throw (com.liferay.portal.PortalException)e;
214                 }
215 
216                 if (e instanceof com.liferay.portal.SystemException) {
217                     throw (com.liferay.portal.SystemException)e;
218                 }
219 
220                 throw new com.liferay.portal.SystemException(e);
221             }
222 
223             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
224         }
225         catch (com.liferay.portal.SystemException se) {
226             _log.error(se, se);
227 
228             throw se;
229         }
230     }
231 
232     public static void deleteProposal(HttpPrincipal httpPrincipal,
233         long proposalId)
234         throws com.liferay.portal.PortalException,
235             com.liferay.portal.SystemException {
236         try {
237             Object paramObj0 = new LongWrapper(proposalId);
238 
239             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
240                     "deleteProposal", new Object[] { paramObj0 });
241 
242             try {
243                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
244             }
245             catch (Exception e) {
246                 if (e instanceof com.liferay.portal.PortalException) {
247                     throw (com.liferay.portal.PortalException)e;
248                 }
249 
250                 if (e instanceof com.liferay.portal.SystemException) {
251                     throw (com.liferay.portal.SystemException)e;
252                 }
253 
254                 throw new com.liferay.portal.SystemException(e);
255             }
256         }
257         catch (com.liferay.portal.SystemException se) {
258             _log.error(se, se);
259 
260             throw se;
261         }
262     }
263 
264     public static com.liferay.portlet.tasks.model.TasksProposal updateProposal(
265         HttpPrincipal httpPrincipal, long proposalId,
266         java.lang.String description, int dueDateMonth, int dueDateDay,
267         int dueDateYear, int dueDateHour, int dueDateMinute)
268         throws com.liferay.portal.PortalException,
269             com.liferay.portal.SystemException {
270         try {
271             Object paramObj0 = new LongWrapper(proposalId);
272 
273             Object paramObj1 = description;
274 
275             if (description == null) {
276                 paramObj1 = new NullWrapper("java.lang.String");
277             }
278 
279             Object paramObj2 = new IntegerWrapper(dueDateMonth);
280 
281             Object paramObj3 = new IntegerWrapper(dueDateDay);
282 
283             Object paramObj4 = new IntegerWrapper(dueDateYear);
284 
285             Object paramObj5 = new IntegerWrapper(dueDateHour);
286 
287             Object paramObj6 = new IntegerWrapper(dueDateMinute);
288 
289             MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
290                     "updateProposal",
291                     new Object[] {
292                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
293                         paramObj5, paramObj6
294                     });
295 
296             Object returnObj = null;
297 
298             try {
299                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
300             }
301             catch (Exception e) {
302                 if (e instanceof com.liferay.portal.PortalException) {
303                     throw (com.liferay.portal.PortalException)e;
304                 }
305 
306                 if (e instanceof com.liferay.portal.SystemException) {
307                     throw (com.liferay.portal.SystemException)e;
308                 }
309 
310                 throw new com.liferay.portal.SystemException(e);
311             }
312 
313             return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
314         }
315         catch (com.liferay.portal.SystemException se) {
316             _log.error(se, se);
317 
318             throw se;
319         }
320     }
321 
322     private static Log _log = LogFactoryUtil.getLog(TasksProposalServiceHttp.class);
323 }