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.IntegerWrapper;
020    import com.liferay.portal.kernel.util.LongWrapper;
021    import com.liferay.portal.kernel.util.MethodWrapper;
022    import com.liferay.portal.kernel.util.NullWrapper;
023    import com.liferay.portal.security.auth.HttpPrincipal;
024    import com.liferay.portal.service.http.TunnelUtil;
025    
026    import com.liferay.portlet.tasks.service.TasksReviewServiceUtil;
027    
028    /**
029     * <p>
030     * This class provides a HTTP utility for the
031     * {@link com.liferay.portlet.tasks.service.TasksReviewServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it requires an additional
034     * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
035     * </p>
036     *
037     * <p>
038     * The benefits of using the HTTP utility is that it is fast and allows for
039     * tunneling without the cost of serializing to text. The drawback is that it
040     * only works with Java.
041     * </p>
042     *
043     * <p>
044     * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
045     * configure security.
046     * </p>
047     *
048     * <p>
049     * The HTTP utility is only generated for remote services.
050     * </p>
051     *
052     * @author    Brian Wing Shun Chan
053     * @see       TasksReviewServiceSoap
054     * @see       com.liferay.portal.security.auth.HttpPrincipal
055     * @see       com.liferay.portlet.tasks.service.TasksReviewServiceUtil
056     * @generated
057     */
058    public class TasksReviewServiceHttp {
059            public static com.liferay.portlet.tasks.model.TasksReview approveReview(
060                    HttpPrincipal httpPrincipal, long proposalId, int stage)
061                    throws com.liferay.portal.kernel.exception.PortalException,
062                            com.liferay.portal.kernel.exception.SystemException {
063                    try {
064                            Object paramObj0 = new LongWrapper(proposalId);
065    
066                            Object paramObj1 = new IntegerWrapper(stage);
067    
068                            MethodWrapper methodWrapper = new MethodWrapper(TasksReviewServiceUtil.class.getName(),
069                                            "approveReview", new Object[] { paramObj0, paramObj1 });
070    
071                            Object returnObj = null;
072    
073                            try {
074                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
075                            }
076                            catch (Exception e) {
077                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
078                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
079                                    }
080    
081                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
082                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
083                                    }
084    
085                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
086                            }
087    
088                            return (com.liferay.portlet.tasks.model.TasksReview)returnObj;
089                    }
090                    catch (com.liferay.portal.kernel.exception.SystemException se) {
091                            _log.error(se, se);
092    
093                            throw se;
094                    }
095            }
096    
097            public static com.liferay.portlet.tasks.model.TasksReview rejectReview(
098                    HttpPrincipal httpPrincipal, long proposalId, int stage)
099                    throws com.liferay.portal.kernel.exception.PortalException,
100                            com.liferay.portal.kernel.exception.SystemException {
101                    try {
102                            Object paramObj0 = new LongWrapper(proposalId);
103    
104                            Object paramObj1 = new IntegerWrapper(stage);
105    
106                            MethodWrapper methodWrapper = new MethodWrapper(TasksReviewServiceUtil.class.getName(),
107                                            "rejectReview", new Object[] { paramObj0, paramObj1 });
108    
109                            Object returnObj = null;
110    
111                            try {
112                                    returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
113                            }
114                            catch (Exception e) {
115                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
116                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
117                                    }
118    
119                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
120                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
121                                    }
122    
123                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
124                            }
125    
126                            return (com.liferay.portlet.tasks.model.TasksReview)returnObj;
127                    }
128                    catch (com.liferay.portal.kernel.exception.SystemException se) {
129                            _log.error(se, se);
130    
131                            throw se;
132                    }
133            }
134    
135            public static void updateReviews(HttpPrincipal httpPrincipal,
136                    long proposalId, long[][] userIdsPerStage)
137                    throws com.liferay.portal.kernel.exception.PortalException,
138                            com.liferay.portal.kernel.exception.SystemException {
139                    try {
140                            Object paramObj0 = new LongWrapper(proposalId);
141    
142                            Object paramObj1 = userIdsPerStage;
143    
144                            if (userIdsPerStage == null) {
145                                    paramObj1 = new NullWrapper("[[J");
146                            }
147    
148                            MethodWrapper methodWrapper = new MethodWrapper(TasksReviewServiceUtil.class.getName(),
149                                            "updateReviews", new Object[] { paramObj0, paramObj1 });
150    
151                            try {
152                                    TunnelUtil.invoke(httpPrincipal, methodWrapper);
153                            }
154                            catch (Exception e) {
155                                    if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
156                                            throw (com.liferay.portal.kernel.exception.PortalException)e;
157                                    }
158    
159                                    if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
160                                            throw (com.liferay.portal.kernel.exception.SystemException)e;
161                                    }
162    
163                                    throw new com.liferay.portal.kernel.exception.SystemException(e);
164                            }
165                    }
166                    catch (com.liferay.portal.kernel.exception.SystemException se) {
167                            _log.error(se, se);
168    
169                            throw se;
170                    }
171            }
172    
173            private static Log _log = LogFactoryUtil.getLog(TasksReviewServiceHttp.class);
174    }