1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.service.http;
21  
22  import com.liferay.portal.kernel.log.Log;
23  import com.liferay.portal.kernel.log.LogFactoryUtil;
24  import com.liferay.portal.service.PermissionServiceUtil;
25  
26  import java.rmi.RemoteException;
27  
28  /**
29   * <a href="PermissionServiceSoap.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 SOAP utility for the
38   * <code>com.liferay.portal.service.PermissionServiceUtil</code> service
39   * utility. The static methods of this class calls the same methods of the
40   * service utility. However, the signatures are different because it is
41   * difficult for SOAP to support certain types.
42   * </p>
43   *
44   * <p>
45   * ServiceBuilder follows certain rules in translating the methods. For example,
46   * if the method in the service utility returns a <code>java.util.List</code>,
47   * that is translated to an array of
48   * <code>com.liferay.portal.model.PermissionSoap</code>. If the method in the
49   * service utility returns a <code>com.liferay.portal.model.Permission</code>,
50   * that is translated to a <code>com.liferay.portal.model.PermissionSoap</code>.
51   * Methods that SOAP cannot safely wire are skipped.
52   * </p>
53   *
54   * <p>
55   * The benefits of using the SOAP utility is that it is cross platform
56   * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
57   * even Perl, to call the generated services. One drawback of SOAP is that it is
58   * slow because it needs to serialize all calls into a text format (XML).
59   * </p>
60   *
61   * <p>
62   * You can see a list of services at
63   * http://localhost:8080/tunnel-web/secure/axis. Set the property
64   * <code>tunnel.servlet.hosts.allowed</code> in portal.properties to configure
65   * security.
66   * </p>
67   *
68   * <p>
69   * The SOAP utility is only generated for remote services.
70   * </p>
71   *
72   * @author Brian Wing Shun Chan
73   *
74   * @see com.liferay.portal.model.PermissionSoap
75   * @see com.liferay.portal.service.PermissionServiceUtil
76   * @see com.liferay.portal.service.http.PermissionServiceHttp
77   *
78   */
79  public class PermissionServiceSoap {
80      public static void checkPermission(long groupId, long resourceId)
81          throws RemoteException {
82          try {
83              PermissionServiceUtil.checkPermission(groupId, resourceId);
84          }
85          catch (Exception e) {
86              _log.error(e, e);
87  
88              throw new RemoteException(e.getMessage());
89          }
90      }
91  
92      public static void checkPermission(long groupId, java.lang.String name,
93          long primKey) throws RemoteException {
94          try {
95              PermissionServiceUtil.checkPermission(groupId, name, primKey);
96          }
97          catch (Exception e) {
98              _log.error(e, e);
99  
100             throw new RemoteException(e.getMessage());
101         }
102     }
103 
104     public static void checkPermission(long groupId, java.lang.String name,
105         java.lang.String primKey) throws RemoteException {
106         try {
107             PermissionServiceUtil.checkPermission(groupId, name, primKey);
108         }
109         catch (Exception e) {
110             _log.error(e, e);
111 
112             throw new RemoteException(e.getMessage());
113         }
114     }
115 
116     public static boolean hasGroupPermission(long groupId,
117         java.lang.String actionId, long resourceId) throws RemoteException {
118         try {
119             boolean returnValue = PermissionServiceUtil.hasGroupPermission(groupId,
120                     actionId, resourceId);
121 
122             return returnValue;
123         }
124         catch (Exception e) {
125             _log.error(e, e);
126 
127             throw new RemoteException(e.getMessage());
128         }
129     }
130 
131     public static boolean hasUserPermission(long userId,
132         java.lang.String actionId, long resourceId) throws RemoteException {
133         try {
134             boolean returnValue = PermissionServiceUtil.hasUserPermission(userId,
135                     actionId, resourceId);
136 
137             return returnValue;
138         }
139         catch (Exception e) {
140             _log.error(e, e);
141 
142             throw new RemoteException(e.getMessage());
143         }
144     }
145 
146     public static boolean hasUserPermissions(long userId, long groupId,
147         com.liferay.portal.model.ResourceSoap[] resources,
148         java.lang.String actionId,
149         com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
150         throws RemoteException {
151         try {
152             boolean returnValue = PermissionServiceUtil.hasUserPermissions(userId,
153                     groupId,
154                     com.liferay.portal.model.impl.ResourceModelImpl.toModels(
155                         resources), actionId, permissionCheckerBag);
156 
157             return returnValue;
158         }
159         catch (Exception e) {
160             _log.error(e, e);
161 
162             throw new RemoteException(e.getMessage());
163         }
164     }
165 
166     public static void setGroupPermissions(long groupId,
167         java.lang.String[] actionIds, long resourceId)
168         throws RemoteException {
169         try {
170             PermissionServiceUtil.setGroupPermissions(groupId, actionIds,
171                 resourceId);
172         }
173         catch (Exception e) {
174             _log.error(e, e);
175 
176             throw new RemoteException(e.getMessage());
177         }
178     }
179 
180     public static void setGroupPermissions(java.lang.String className,
181         java.lang.String classPK, long groupId, java.lang.String[] actionIds,
182         long resourceId) throws RemoteException {
183         try {
184             PermissionServiceUtil.setGroupPermissions(className, classPK,
185                 groupId, actionIds, resourceId);
186         }
187         catch (Exception e) {
188             _log.error(e, e);
189 
190             throw new RemoteException(e.getMessage());
191         }
192     }
193 
194     public static void setOrgGroupPermissions(long organizationId,
195         long groupId, java.lang.String[] actionIds, long resourceId)
196         throws RemoteException {
197         try {
198             PermissionServiceUtil.setOrgGroupPermissions(organizationId,
199                 groupId, actionIds, resourceId);
200         }
201         catch (Exception e) {
202             _log.error(e, e);
203 
204             throw new RemoteException(e.getMessage());
205         }
206     }
207 
208     public static void setRolePermission(long roleId, long groupId,
209         java.lang.String name, int scope, java.lang.String primKey,
210         java.lang.String actionId) throws RemoteException {
211         try {
212             PermissionServiceUtil.setRolePermission(roleId, groupId, name,
213                 scope, primKey, actionId);
214         }
215         catch (Exception e) {
216             _log.error(e, e);
217 
218             throw new RemoteException(e.getMessage());
219         }
220     }
221 
222     public static void setRolePermissions(long roleId, long groupId,
223         java.lang.String[] actionIds, long resourceId)
224         throws RemoteException {
225         try {
226             PermissionServiceUtil.setRolePermissions(roleId, groupId,
227                 actionIds, resourceId);
228         }
229         catch (Exception e) {
230             _log.error(e, e);
231 
232             throw new RemoteException(e.getMessage());
233         }
234     }
235 
236     public static void setUserPermissions(long userId, long groupId,
237         java.lang.String[] actionIds, long resourceId)
238         throws RemoteException {
239         try {
240             PermissionServiceUtil.setUserPermissions(userId, groupId,
241                 actionIds, resourceId);
242         }
243         catch (Exception e) {
244             _log.error(e, e);
245 
246             throw new RemoteException(e.getMessage());
247         }
248     }
249 
250     public static void unsetRolePermission(long roleId, long groupId,
251         long permissionId) throws RemoteException {
252         try {
253             PermissionServiceUtil.unsetRolePermission(roleId, groupId,
254                 permissionId);
255         }
256         catch (Exception e) {
257             _log.error(e, e);
258 
259             throw new RemoteException(e.getMessage());
260         }
261     }
262 
263     public static void unsetRolePermission(long roleId, long groupId,
264         java.lang.String name, int scope, java.lang.String primKey,
265         java.lang.String actionId) throws RemoteException {
266         try {
267             PermissionServiceUtil.unsetRolePermission(roleId, groupId, name,
268                 scope, primKey, actionId);
269         }
270         catch (Exception e) {
271             _log.error(e, e);
272 
273             throw new RemoteException(e.getMessage());
274         }
275     }
276 
277     public static void unsetRolePermissions(long roleId, long groupId,
278         java.lang.String name, int scope, java.lang.String actionId)
279         throws RemoteException {
280         try {
281             PermissionServiceUtil.unsetRolePermissions(roleId, groupId, name,
282                 scope, actionId);
283         }
284         catch (Exception e) {
285             _log.error(e, e);
286 
287             throw new RemoteException(e.getMessage());
288         }
289     }
290 
291     public static void unsetUserPermissions(long userId, long groupId,
292         java.lang.String[] actionIds, long resourceId)
293         throws RemoteException {
294         try {
295             PermissionServiceUtil.unsetUserPermissions(userId, groupId,
296                 actionIds, resourceId);
297         }
298         catch (Exception e) {
299             _log.error(e, e);
300 
301             throw new RemoteException(e.getMessage());
302         }
303     }
304 
305     private static Log _log = LogFactoryUtil.getLog(PermissionServiceSoap.class);
306 }