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, java.lang.String name,
81          java.lang.String primKey) throws RemoteException {
82          try {
83              PermissionServiceUtil.checkPermission(groupId, name, primKey);
84          }
85          catch (Exception e) {
86              _log.error(e, e);
87  
88              throw new RemoteException(e.getMessage());
89          }
90      }
91  
92      public static boolean hasGroupPermission(long groupId,
93          java.lang.String actionId, long resourceId) throws RemoteException {
94          try {
95              boolean returnValue = PermissionServiceUtil.hasGroupPermission(groupId,
96                      actionId, resourceId);
97  
98              return returnValue;
99          }
100         catch (Exception e) {
101             _log.error(e, e);
102 
103             throw new RemoteException(e.getMessage());
104         }
105     }
106 
107     public static boolean hasUserPermission(long userId,
108         java.lang.String actionId, long resourceId) throws RemoteException {
109         try {
110             boolean returnValue = PermissionServiceUtil.hasUserPermission(userId,
111                     actionId, resourceId);
112 
113             return returnValue;
114         }
115         catch (Exception e) {
116             _log.error(e, e);
117 
118             throw new RemoteException(e.getMessage());
119         }
120     }
121 
122     public static boolean hasUserPermissions(long userId, long groupId,
123         java.lang.String actionId, long[] resourceIds,
124         com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
125         throws RemoteException {
126         try {
127             boolean returnValue = PermissionServiceUtil.hasUserPermissions(userId,
128                     groupId, actionId, resourceIds, permissionCheckerBag);
129 
130             return returnValue;
131         }
132         catch (Exception e) {
133             _log.error(e, e);
134 
135             throw new RemoteException(e.getMessage());
136         }
137     }
138 
139     public static void setGroupPermissions(long groupId,
140         java.lang.String[] actionIds, long resourceId)
141         throws RemoteException {
142         try {
143             PermissionServiceUtil.setGroupPermissions(groupId, actionIds,
144                 resourceId);
145         }
146         catch (Exception e) {
147             _log.error(e, e);
148 
149             throw new RemoteException(e.getMessage());
150         }
151     }
152 
153     public static void setGroupPermissions(java.lang.String className,
154         java.lang.String classPK, long groupId, java.lang.String[] actionIds,
155         long resourceId) throws RemoteException {
156         try {
157             PermissionServiceUtil.setGroupPermissions(className, classPK,
158                 groupId, actionIds, resourceId);
159         }
160         catch (Exception e) {
161             _log.error(e, e);
162 
163             throw new RemoteException(e.getMessage());
164         }
165     }
166 
167     public static void setOrgGroupPermissions(long organizationId,
168         long groupId, java.lang.String[] actionIds, long resourceId)
169         throws RemoteException {
170         try {
171             PermissionServiceUtil.setOrgGroupPermissions(organizationId,
172                 groupId, actionIds, resourceId);
173         }
174         catch (Exception e) {
175             _log.error(e, e);
176 
177             throw new RemoteException(e.getMessage());
178         }
179     }
180 
181     public static void setRolePermission(long roleId, long groupId,
182         java.lang.String name, int scope, java.lang.String primKey,
183         java.lang.String actionId) throws RemoteException {
184         try {
185             PermissionServiceUtil.setRolePermission(roleId, groupId, name,
186                 scope, primKey, actionId);
187         }
188         catch (Exception e) {
189             _log.error(e, e);
190 
191             throw new RemoteException(e.getMessage());
192         }
193     }
194 
195     public static void setRolePermissions(long roleId, long groupId,
196         java.lang.String[] actionIds, long resourceId)
197         throws RemoteException {
198         try {
199             PermissionServiceUtil.setRolePermissions(roleId, groupId,
200                 actionIds, resourceId);
201         }
202         catch (Exception e) {
203             _log.error(e, e);
204 
205             throw new RemoteException(e.getMessage());
206         }
207     }
208 
209     public static void setUserPermissions(long userId, long groupId,
210         java.lang.String[] actionIds, long resourceId)
211         throws RemoteException {
212         try {
213             PermissionServiceUtil.setUserPermissions(userId, groupId,
214                 actionIds, resourceId);
215         }
216         catch (Exception e) {
217             _log.error(e, e);
218 
219             throw new RemoteException(e.getMessage());
220         }
221     }
222 
223     public static void unsetRolePermission(long roleId, long groupId,
224         long permissionId) throws RemoteException {
225         try {
226             PermissionServiceUtil.unsetRolePermission(roleId, groupId,
227                 permissionId);
228         }
229         catch (Exception e) {
230             _log.error(e, e);
231 
232             throw new RemoteException(e.getMessage());
233         }
234     }
235 
236     public static void unsetRolePermission(long roleId, long groupId,
237         java.lang.String name, int scope, java.lang.String primKey,
238         java.lang.String actionId) throws RemoteException {
239         try {
240             PermissionServiceUtil.unsetRolePermission(roleId, groupId, name,
241                 scope, primKey, actionId);
242         }
243         catch (Exception e) {
244             _log.error(e, e);
245 
246             throw new RemoteException(e.getMessage());
247         }
248     }
249 
250     public static void unsetRolePermissions(long roleId, long groupId,
251         java.lang.String name, int scope, java.lang.String actionId)
252         throws RemoteException {
253         try {
254             PermissionServiceUtil.unsetRolePermissions(roleId, groupId, name,
255                 scope, actionId);
256         }
257         catch (Exception e) {
258             _log.error(e, e);
259 
260             throw new RemoteException(e.getMessage());
261         }
262     }
263 
264     public static void unsetUserPermissions(long userId, long groupId,
265         java.lang.String[] actionIds, long resourceId)
266         throws RemoteException {
267         try {
268             PermissionServiceUtil.unsetUserPermissions(userId, groupId,
269                 actionIds, resourceId);
270         }
271         catch (Exception e) {
272             _log.error(e, e);
273 
274             throw new RemoteException(e.getMessage());
275         }
276     }
277 
278     private static Log _log = LogFactoryUtil.getLog(PermissionServiceSoap.class);
279 }