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.RoleServiceUtil;
25  
26  import java.rmi.RemoteException;
27  
28  /**
29   * <a href="RoleServiceSoap.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.RoleServiceUtil</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.RoleSoap</code>. If the method in the
49   * service utility returns a <code>com.liferay.portal.model.Role</code>,
50   * that is translated to a <code>com.liferay.portal.model.RoleSoap</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.RoleSoap
75   * @see com.liferay.portal.service.RoleServiceUtil
76   * @see com.liferay.portal.service.http.RoleServiceHttp
77   *
78   */
79  public class RoleServiceSoap {
80      public static com.liferay.portal.model.RoleSoap addRole(
81          java.lang.String name, java.lang.String description, int type)
82          throws RemoteException {
83          try {
84              com.liferay.portal.model.Role returnValue = RoleServiceUtil.addRole(name,
85                      description, type);
86  
87              return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
88          }
89          catch (Exception e) {
90              _log.error(e, e);
91  
92              throw new RemoteException(e.getMessage());
93          }
94      }
95  
96      public static void addUserRoles(long userId, long[] roleIds)
97          throws RemoteException {
98          try {
99              RoleServiceUtil.addUserRoles(userId, roleIds);
100         }
101         catch (Exception e) {
102             _log.error(e, e);
103 
104             throw new RemoteException(e.getMessage());
105         }
106     }
107 
108     public static void deleteRole(long roleId) throws RemoteException {
109         try {
110             RoleServiceUtil.deleteRole(roleId);
111         }
112         catch (Exception e) {
113             _log.error(e, e);
114 
115             throw new RemoteException(e.getMessage());
116         }
117     }
118 
119     public static com.liferay.portal.model.RoleSoap getGroupRole(
120         long companyId, long groupId) throws RemoteException {
121         try {
122             com.liferay.portal.model.Role returnValue = RoleServiceUtil.getGroupRole(companyId,
123                     groupId);
124 
125             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
126         }
127         catch (Exception e) {
128             _log.error(e, e);
129 
130             throw new RemoteException(e.getMessage());
131         }
132     }
133 
134     public static com.liferay.portal.model.RoleSoap[] getGroupRoles(
135         long groupId) throws RemoteException {
136         try {
137             java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getGroupRoles(groupId);
138 
139             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
140         }
141         catch (Exception e) {
142             _log.error(e, e);
143 
144             throw new RemoteException(e.getMessage());
145         }
146     }
147 
148     public static com.liferay.portal.model.RoleSoap getRole(long roleId)
149         throws RemoteException {
150         try {
151             com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId);
152 
153             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
154         }
155         catch (Exception e) {
156             _log.error(e, e);
157 
158             throw new RemoteException(e.getMessage());
159         }
160     }
161 
162     public static com.liferay.portal.model.RoleSoap getRole(long companyId,
163         java.lang.String name) throws RemoteException {
164         try {
165             com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId,
166                     name);
167 
168             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
169         }
170         catch (Exception e) {
171             _log.error(e, e);
172 
173             throw new RemoteException(e.getMessage());
174         }
175     }
176 
177     public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles(
178         long userId, long groupId) throws RemoteException {
179         try {
180             java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupRoles(userId,
181                     groupId);
182 
183             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
184         }
185         catch (Exception e) {
186             _log.error(e, e);
187 
188             throw new RemoteException(e.getMessage());
189         }
190     }
191 
192     public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
193         long userId, com.liferay.portal.model.GroupSoap[] groups)
194         throws RemoteException {
195         try {
196             java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRelatedRoles(userId,
197                     com.liferay.portal.model.impl.GroupModelImpl.toModels(
198                         groups));
199 
200             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
201         }
202         catch (Exception e) {
203             _log.error(e, e);
204 
205             throw new RemoteException(e.getMessage());
206         }
207     }
208 
209     public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId)
210         throws RemoteException {
211         try {
212             java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRoles(userId);
213 
214             return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
215         }
216         catch (Exception e) {
217             _log.error(e, e);
218 
219             throw new RemoteException(e.getMessage());
220         }
221     }
222 
223     public static boolean hasUserRole(long userId, long companyId,
224         java.lang.String name, boolean inherited) throws RemoteException {
225         try {
226             boolean returnValue = RoleServiceUtil.hasUserRole(userId,
227                     companyId, name, inherited);
228 
229             return returnValue;
230         }
231         catch (Exception e) {
232             _log.error(e, e);
233 
234             throw new RemoteException(e.getMessage());
235         }
236     }
237 
238     public static boolean hasUserRoles(long userId, long companyId,
239         java.lang.String[] names, boolean inherited) throws RemoteException {
240         try {
241             boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
242                     companyId, names, inherited);
243 
244             return returnValue;
245         }
246         catch (Exception e) {
247             _log.error(e, e);
248 
249             throw new RemoteException(e.getMessage());
250         }
251     }
252 
253     public static void unsetUserRoles(long userId, long[] roleIds)
254         throws RemoteException {
255         try {
256             RoleServiceUtil.unsetUserRoles(userId, roleIds);
257         }
258         catch (Exception e) {
259             _log.error(e, e);
260 
261             throw new RemoteException(e.getMessage());
262         }
263     }
264 
265     public static com.liferay.portal.model.RoleSoap updateRole(long roleId,
266         java.lang.String name, java.lang.String description)
267         throws RemoteException {
268         try {
269             com.liferay.portal.model.Role returnValue = RoleServiceUtil.updateRole(roleId,
270                     name, description);
271 
272             return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
273         }
274         catch (Exception e) {
275             _log.error(e, e);
276 
277             throw new RemoteException(e.getMessage());
278         }
279     }
280 
281     private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
282 }