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.IntegerWrapper;
20  import com.liferay.portal.kernel.util.LongWrapper;
21  import com.liferay.portal.kernel.util.MethodWrapper;
22  import com.liferay.portal.kernel.util.NullWrapper;
23  import com.liferay.portal.security.auth.HttpPrincipal;
24  import com.liferay.portal.service.http.TunnelUtil;
25  
26  import com.liferay.portlet.tasks.service.TasksReviewServiceUtil;
27  
28  /**
29   * <a href="TasksReviewServiceHttp.java.html"><b><i>View Source</i></b></a>
30   *
31   * <p>
32   * ServiceBuilder generated this class. Modifications in this class will be
33   * overwritten the next time is generated.
34   * </p>
35   *
36   * <p>
37   * This class provides a HTTP utility for the
38   * {@link com.liferay.portlet.tasks.service.TasksReviewServiceUtil} service utility. The
39   * static methods of this class calls the same methods of the service utility.
40   * However, the signatures are different because it requires an additional
41   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
42   * </p>
43   *
44   * <p>
45   * The benefits of using the HTTP utility is that it is fast and allows for
46   * tunneling without the cost of serializing to text. The drawback is that it
47   * only works with Java.
48   * </p>
49   *
50   * <p>
51   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
52   * configure security.
53   * </p>
54   *
55   * <p>
56   * The HTTP utility is only generated for remote services.
57   * </p>
58   *
59   * @author    Brian Wing Shun Chan
60   * @see       TasksReviewServiceSoap
61   * @see       com.liferay.portal.security.auth.HttpPrincipal
62   * @see       com.liferay.portlet.tasks.service.TasksReviewServiceUtil
63   * @generated
64   */
65  public class TasksReviewServiceHttp {
66      public static com.liferay.portlet.tasks.model.TasksReview approveReview(
67          HttpPrincipal httpPrincipal, long proposalId, int stage)
68          throws com.liferay.portal.kernel.exception.PortalException,
69              com.liferay.portal.kernel.exception.SystemException {
70          try {
71              Object paramObj0 = new LongWrapper(proposalId);
72  
73              Object paramObj1 = new IntegerWrapper(stage);
74  
75              MethodWrapper methodWrapper = new MethodWrapper(TasksReviewServiceUtil.class.getName(),
76                      "approveReview", new Object[] { paramObj0, paramObj1 });
77  
78              Object returnObj = null;
79  
80              try {
81                  returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
82              }
83              catch (Exception e) {
84                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
85                      throw (com.liferay.portal.kernel.exception.PortalException)e;
86                  }
87  
88                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
89                      throw (com.liferay.portal.kernel.exception.SystemException)e;
90                  }
91  
92                  throw new com.liferay.portal.kernel.exception.SystemException(e);
93              }
94  
95              return (com.liferay.portlet.tasks.model.TasksReview)returnObj;
96          }
97          catch (com.liferay.portal.kernel.exception.SystemException se) {
98              _log.error(se, se);
99  
100             throw se;
101         }
102     }
103 
104     public static com.liferay.portlet.tasks.model.TasksReview rejectReview(
105         HttpPrincipal httpPrincipal, long proposalId, int stage)
106         throws com.liferay.portal.kernel.exception.PortalException,
107             com.liferay.portal.kernel.exception.SystemException {
108         try {
109             Object paramObj0 = new LongWrapper(proposalId);
110 
111             Object paramObj1 = new IntegerWrapper(stage);
112 
113             MethodWrapper methodWrapper = new MethodWrapper(TasksReviewServiceUtil.class.getName(),
114                     "rejectReview", new Object[] { paramObj0, paramObj1 });
115 
116             Object returnObj = null;
117 
118             try {
119                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
120             }
121             catch (Exception e) {
122                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
123                     throw (com.liferay.portal.kernel.exception.PortalException)e;
124                 }
125 
126                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
127                     throw (com.liferay.portal.kernel.exception.SystemException)e;
128                 }
129 
130                 throw new com.liferay.portal.kernel.exception.SystemException(e);
131             }
132 
133             return (com.liferay.portlet.tasks.model.TasksReview)returnObj;
134         }
135         catch (com.liferay.portal.kernel.exception.SystemException se) {
136             _log.error(se, se);
137 
138             throw se;
139         }
140     }
141 
142     public static void updateReviews(HttpPrincipal httpPrincipal,
143         long proposalId, long[][] userIdsPerStage)
144         throws com.liferay.portal.kernel.exception.PortalException,
145             com.liferay.portal.kernel.exception.SystemException {
146         try {
147             Object paramObj0 = new LongWrapper(proposalId);
148 
149             Object paramObj1 = userIdsPerStage;
150 
151             if (userIdsPerStage == null) {
152                 paramObj1 = new NullWrapper("[[J");
153             }
154 
155             MethodWrapper methodWrapper = new MethodWrapper(TasksReviewServiceUtil.class.getName(),
156                     "updateReviews", new Object[] { paramObj0, paramObj1 });
157 
158             try {
159                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
160             }
161             catch (Exception e) {
162                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
163                     throw (com.liferay.portal.kernel.exception.PortalException)e;
164                 }
165 
166                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
167                     throw (com.liferay.portal.kernel.exception.SystemException)e;
168                 }
169 
170                 throw new com.liferay.portal.kernel.exception.SystemException(e);
171             }
172         }
173         catch (com.liferay.portal.kernel.exception.SystemException se) {
174             _log.error(se, se);
175 
176             throw se;
177         }
178     }
179 
180     private static Log _log = LogFactoryUtil.getLog(TasksReviewServiceHttp.class);
181 }