1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.service.RoleServiceUtil;
28  
29  import java.rmi.RemoteException;
30  
31  /**
32   * <a href="RoleServiceSoap.java.html"><b><i>View Source</i></b></a>
33   *
34   * <p>
35   * ServiceBuilder generated this class. Modifications in this class will be overwritten
36   * the next time is generated.
37   * </p>
38   *
39   * <p>
40   * This class provides a SOAP utility for the <code>com.liferay.portal.service.RoleServiceUtil</code>
41   * service utility. The static methods of this class calls the same methods of the
42   * service utility. However, the signatures are different because it is difficult
43   * for SOAP to support certain types.
44   * </p>
45   *
46   * <p>
47   * ServiceBuilder follows certain rules in translating the methods. For example,
48   * if the method in the service utility returns a <code>java.util.List</code>, that
49   * is translated to an array of <code>com.liferay.portal.model.RoleSoap</code>.
50   * If the method in the service utility returns a <code>com.liferay.portal.model.Role</code>,
51   * that is translated to a <code>com.liferay.portal.model.RoleSoap</code>. Methods
52   * that SOAP cannot safely wire are skipped.
53   * </p>
54   *
55   * <p>
56   * The benefits of using the SOAP utility is that it is cross platform compatible.
57   * SOAP allows different languages like Java, .NET, C++, PHP, and even Perl, to
58   * call the generated services. One drawback of SOAP is that it is slow because
59   * it needs to serialize all calls into a text format (XML).
60   * </p>
61   *
62   * <p>
63   * You can see a list of services at http://localhost:8080/tunnel-web/secure/axis.
64   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
65   * to configure 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.service.RoleServiceUtil
75   * @see com.liferay.portal.service.http.RoleServiceHttp
76   * @see com.liferay.portal.service.model.RoleSoap
77   *
78   */
79  public class RoleServiceSoap {
80      public static com.liferay.portal.model.RoleSoap addRole(
81          java.lang.String name, int type) throws RemoteException {
82          try {
83              com.liferay.portal.model.Role returnValue = RoleServiceUtil.addRole(name,
84                      type);
85  
86              return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
87          }
88          catch (Exception e) {
89              _log.error(e, e);
90              throw new RemoteException(e.getMessage());
91          }
92      }
93  
94      public static void deleteRole(long roleId) throws RemoteException {
95          try {
96              RoleServiceUtil.deleteRole(roleId);
97          }
98          catch (Exception e) {
99              _log.error(e, e);
100             throw new RemoteException(e.getMessage());
101         }
102     }
103 
104     public static com.liferay.portal.model.RoleSoap getGroupRole(
105         long companyId, long groupId) throws RemoteException {
106         try {
107             com.liferay.portal.model.Role returnValue = RoleServiceUtil.getGroupRole(companyId,
108                     groupId);
109 
110             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
111         }
112         catch (Exception e) {
113             _log.error(e, e);
114             throw new RemoteException(e.getMessage());
115         }
116     }
117 
118     public static com.liferay.portal.model.RoleSoap[] getGroupRoles(
119         long groupId) throws RemoteException {
120         try {
121             java.util.List returnValue = RoleServiceUtil.getGroupRoles(groupId);
122 
123             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
124         }
125         catch (Exception e) {
126             _log.error(e, e);
127             throw new RemoteException(e.getMessage());
128         }
129     }
130 
131     public static com.liferay.portal.model.RoleSoap getRole(long roleId)
132         throws RemoteException {
133         try {
134             com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId);
135 
136             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
137         }
138         catch (Exception e) {
139             _log.error(e, e);
140             throw new RemoteException(e.getMessage());
141         }
142     }
143 
144     public static com.liferay.portal.model.RoleSoap getRole(long companyId,
145         java.lang.String name) throws RemoteException {
146         try {
147             com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId,
148                     name);
149 
150             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
151         }
152         catch (Exception e) {
153             _log.error(e, e);
154             throw new RemoteException(e.getMessage());
155         }
156     }
157 
158     public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles(
159         long userId, long groupId) throws RemoteException {
160         try {
161             java.util.List returnValue = RoleServiceUtil.getUserGroupRoles(userId,
162                     groupId);
163 
164             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
165         }
166         catch (Exception e) {
167             _log.error(e, e);
168             throw new RemoteException(e.getMessage());
169         }
170     }
171 
172     public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
173         long userId, java.util.List groups) throws RemoteException {
174         try {
175             java.util.List returnValue = RoleServiceUtil.getUserRelatedRoles(userId,
176                     groups);
177 
178             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
179         }
180         catch (Exception e) {
181             _log.error(e, e);
182             throw new RemoteException(e.getMessage());
183         }
184     }
185 
186     public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId)
187         throws RemoteException {
188         try {
189             java.util.List returnValue = RoleServiceUtil.getUserRoles(userId);
190 
191             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
192         }
193         catch (Exception e) {
194             _log.error(e, e);
195             throw new RemoteException(e.getMessage());
196         }
197     }
198 
199     public static boolean hasUserRole(long userId, long companyId,
200         java.lang.String name, boolean inherited) throws RemoteException {
201         try {
202             boolean returnValue = RoleServiceUtil.hasUserRole(userId,
203                     companyId, name, inherited);
204 
205             return returnValue;
206         }
207         catch (Exception e) {
208             _log.error(e, e);
209             throw new RemoteException(e.getMessage());
210         }
211     }
212 
213     public static boolean hasUserRoles(long userId, long companyId,
214         java.lang.String[] names, boolean inherited) throws RemoteException {
215         try {
216             boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
217                     companyId, names, inherited);
218 
219             return returnValue;
220         }
221         catch (Exception e) {
222             _log.error(e, e);
223             throw new RemoteException(e.getMessage());
224         }
225     }
226 
227     public static com.liferay.portal.model.RoleSoap updateRole(long roleId,
228         java.lang.String name) throws RemoteException {
229         try {
230             com.liferay.portal.model.Role returnValue = RoleServiceUtil.updateRole(roleId,
231                     name);
232 
233             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
234         }
235         catch (Exception e) {
236             _log.error(e, e);
237             throw new RemoteException(e.getMessage());
238         }
239     }
240 
241     private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
242 }