001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.tasks.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.BooleanWrapper;
020    import com.liferay.portal.kernel.util.IntegerWrapper;
021    import com.liferay.portal.kernel.util.LongWrapper;
022    import com.liferay.portal.kernel.util.MethodWrapper;
023    import com.liferay.portal.kernel.util.NullWrapper;
024    import com.liferay.portal.security.auth.HttpPrincipal;
025    import com.liferay.portal.service.http.TunnelUtil;
026    
027    import com.liferay.portlet.tasks.service.TasksProposalServiceUtil;
028    
029    /**
030     * <p>
031     * This class provides a HTTP utility for the
032     * {@link com.liferay.portlet.tasks.service.TasksProposalServiceUtil} service utility. The
033     * static methods of this class calls the same methods of the service utility.
034     * However, the signatures are different because it requires an additional
035     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
036     * </p>
037     *
038     * <p>
039     * The benefits of using the HTTP utility is that it is fast and allows for
040     * tunneling without the cost of serializing to text. The drawback is that it
041     * only works with Java.
042     * </p>
043     *
044     * <p>
045     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
046     * configure security.
047     * </p>
048     *
049     * <p>
050     * The HTTP utility is only generated for remote services.
051     * </p>
052     *
053     * @author    Brian Wing Shun Chan
054     * @see       TasksProposalServiceSoap
055     * @see       com.liferay.portal.security.auth.HttpPrincipal
056     * @see       com.liferay.portlet.tasks.service.TasksProposalServiceUtil
057     * @generated
058     */
059    public class TasksProposalServiceHttp {
060            public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
061                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
062                    java.lang.String classPK, java.lang.String name,
063                    java.lang.String description, long reviewUserId,
064                    boolean addCommunityPermissions, boolean addGuestPermissions)
065                    throws com.liferay.portal.kernel.exception.PortalException,
066                            com.liferay.portal.kernel.exception.SystemException {
067                    try {
068                            Object paramObj0 = new LongWrapper(groupId);
069    
070                            Object paramObj1 = className;
071    
072                            if (className == null) {
073                                    paramObj1 = new NullWrapper("java.lang.String");
074                            }
075    
076                            Object paramObj2 = classPK;
077    
078                            if (classPK == null) {
079                                    paramObj2 = new NullWrapper("java.lang.String");
080                            }
081    
082                            Object paramObj3 = name;
083    
084                            if (name == null) {
085                                    paramObj3 = new NullWrapper("java.lang.String");
086                            }
087    
088                            Object paramObj4 = description;
089    
090                            if (description == null) {
091                                    paramObj4 = new NullWrapper("java.lang.String");
092                            }
093    
094                            Object paramObj5 = new LongWrapper(reviewUserId);
095    
096                            Object paramObj6 = new BooleanWrapper(addCommunityPermissions);
097    
098                            Object paramObj7 = new BooleanWrapper(addGuestPermissions);
099    
100                            MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
101                                            "addProposal",
102                                            new Object[] {
103                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
104                                                    paramObj5, paramObj6, paramObj7
105                                            });
106    
107                            Object returnObj = null;
108    
109                            try {
110                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
111                            }
112                            catch (Exception e) {
113                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
114                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
115                                    }
116    
117                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
118                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
119                                    }
120    
121                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
122                            }
123    
124                            return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
125                    }
126                    catch (com.liferay.portal.kernel.exception.SystemException se) {
127                            _log.error(se, se);
128    
129                            throw se;
130                    }
131            }
132    
133            public static com.liferay.portlet.tasks.model.TasksProposal addProposal(
134                    HttpPrincipal httpPrincipal, long groupId, java.lang.String className,
135                    java.lang.String classPK, java.lang.String name,
136                    java.lang.String description, long reviewUserId,
137                    java.lang.String[] communityPermissions,
138                    java.lang.String[] guestPermissions)
139                    throws com.liferay.portal.kernel.exception.PortalException,
140                            com.liferay.portal.kernel.exception.SystemException {
141                    try {
142                            Object paramObj0 = new LongWrapper(groupId);
143    
144                            Object paramObj1 = className;
145    
146                            if (className == null) {
147                                    paramObj1 = new NullWrapper("java.lang.String");
148                            }
149    
150                            Object paramObj2 = classPK;
151    
152                            if (classPK == null) {
153                                    paramObj2 = new NullWrapper("java.lang.String");
154                            }
155    
156                            Object paramObj3 = name;
157    
158                            if (name == null) {
159                                    paramObj3 = new NullWrapper("java.lang.String");
160                            }
161    
162                            Object paramObj4 = description;
163    
164                            if (description == null) {
165                                    paramObj4 = new NullWrapper("java.lang.String");
166                            }
167    
168                            Object paramObj5 = new LongWrapper(reviewUserId);
169    
170                            Object paramObj6 = communityPermissions;
171    
172                            if (communityPermissions == null) {
173                                    paramObj6 = new NullWrapper("[Ljava.lang.String;");
174                            }
175    
176                            Object paramObj7 = guestPermissions;
177    
178                            if (guestPermissions == null) {
179                                    paramObj7 = new NullWrapper("[Ljava.lang.String;");
180                            }
181    
182                            MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
183                                            "addProposal",
184                                            new Object[] {
185                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
186                                                    paramObj5, paramObj6, paramObj7
187                                            });
188    
189                            Object returnObj = null;
190    
191                            try {
192                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
193                            }
194                            catch (Exception e) {
195                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
196                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
197                                    }
198    
199                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
200                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
201                                    }
202    
203                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
204                            }
205    
206                            return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
207                    }
208                    catch (com.liferay.portal.kernel.exception.SystemException se) {
209                            _log.error(se, se);
210    
211                            throw se;
212                    }
213            }
214    
215            public static void deleteProposal(HttpPrincipal httpPrincipal,
216                    long proposalId)
217                    throws com.liferay.portal.kernel.exception.PortalException,
218                            com.liferay.portal.kernel.exception.SystemException {
219                    try {
220                            Object paramObj0 = new LongWrapper(proposalId);
221    
222                            MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
223                                            "deleteProposal", new Object[] { paramObj0 });
224    
225                            try {
226                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
227                            }
228                            catch (Exception e) {
229                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
230                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
231                                    }
232    
233                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
234                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
235                                    }
236    
237                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
238                            }
239                    }
240                    catch (com.liferay.portal.kernel.exception.SystemException se) {
241                            _log.error(se, se);
242    
243                            throw se;
244                    }
245            }
246    
247            public static com.liferay.portlet.tasks.model.TasksProposal updateProposal(
248                    HttpPrincipal httpPrincipal, long proposalId,
249                    java.lang.String description, int dueDateMonth, int dueDateDay,
250                    int dueDateYear, int dueDateHour, int dueDateMinute)
251                    throws com.liferay.portal.kernel.exception.PortalException,
252                            com.liferay.portal.kernel.exception.SystemException {
253                    try {
254                            Object paramObj0 = new LongWrapper(proposalId);
255    
256                            Object paramObj1 = description;
257    
258                            if (description == null) {
259                                    paramObj1 = new NullWrapper("java.lang.String");
260                            }
261    
262                            Object paramObj2 = new IntegerWrapper(dueDateMonth);
263    
264                            Object paramObj3 = new IntegerWrapper(dueDateDay);
265    
266                            Object paramObj4 = new IntegerWrapper(dueDateYear);
267    
268                            Object paramObj5 = new IntegerWrapper(dueDateHour);
269    
270                            Object paramObj6 = new IntegerWrapper(dueDateMinute);
271    
272                            MethodWrapper methodWrapper = new MethodWrapper(TasksProposalServiceUtil.class.getName(),
273                                            "updateProposal",
274                                            new Object[] {
275                                                    paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
276                                                    paramObj5, paramObj6
277                                            });
278    
279                            Object returnObj = null;
280    
281                            try {
282                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
283                            }
284                            catch (Exception e) {
285                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
286                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
287                                    }
288    
289                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
290                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
291                                    }
292    
293                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
294                            }
295    
296                            return (com.liferay.portlet.tasks.model.TasksProposal)returnObj;
297                    }
298                    catch (com.liferay.portal.kernel.exception.SystemException se) {
299                            _log.error(se, se);
300    
301                            throw se;
302                    }
303            }
304    
305            private static Log _log = LogFactoryUtil.getLog(TasksProposalServiceHttp.class);
306    }