001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.http;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    import com.liferay.portal.service.RoleServiceUtil;
020    
021    import java.rmi.RemoteException;
022    
023    /**
024     * <p>
025     * This class provides a SOAP utility for the
026     * {@link com.liferay.portal.service.RoleServiceUtil} service utility. The
027     * static methods of this class calls the same methods of the service utility.
028     * However, the signatures are different because it is difficult for SOAP to
029     * support certain types.
030     * </p>
031     *
032     * <p>
033     * ServiceBuilder follows certain rules in translating the methods. For example,
034     * if the method in the service utility returns a {@link java.util.List}, that
035     * is translated to an array of {@link com.liferay.portal.model.RoleSoap}.
036     * If the method in the service utility returns a
037     * {@link com.liferay.portal.model.Role}, that is translated to a
038     * {@link com.liferay.portal.model.RoleSoap}. Methods that SOAP cannot
039     * safely wire are skipped.
040     * </p>
041     *
042     * <p>
043     * The benefits of using the SOAP utility is that it is cross platform
044     * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
045     * even Perl, to call the generated services. One drawback of SOAP is that it is
046     * slow because it needs to serialize all calls into a text format (XML).
047     * </p>
048     *
049     * <p>
050     * You can see a list of services at
051     * http://localhost:8080/tunnel-web/secure/axis. Set the property
052     * <b>tunnel.servlet.hosts.allowed</b> in portal.properties to configure
053     * security.
054     * </p>
055     *
056     * <p>
057     * The SOAP utility is only generated for remote services.
058     * </p>
059     *
060     * @author    Brian Wing Shun Chan
061     * @see       RoleServiceHttp
062     * @see       com.liferay.portal.model.RoleSoap
063     * @see       com.liferay.portal.service.RoleServiceUtil
064     * @generated
065     */
066    public class RoleServiceSoap {
067            public static void addUserRoles(long userId, long[] roleIds)
068                    throws RemoteException {
069                    try {
070                            RoleServiceUtil.addUserRoles(userId, roleIds);
071                    }
072                    catch (Exception e) {
073                            _log.error(e, e);
074    
075                            throw new RemoteException(e.getMessage());
076                    }
077            }
078    
079            public static void deleteRole(long roleId) throws RemoteException {
080                    try {
081                            RoleServiceUtil.deleteRole(roleId);
082                    }
083                    catch (Exception e) {
084                            _log.error(e, e);
085    
086                            throw new RemoteException(e.getMessage());
087                    }
088            }
089    
090            public static com.liferay.portal.model.RoleSoap[] getGroupRoles(
091                    long groupId) throws RemoteException {
092                    try {
093                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getGroupRoles(groupId);
094    
095                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
096                    }
097                    catch (Exception e) {
098                            _log.error(e, e);
099    
100                            throw new RemoteException(e.getMessage());
101                    }
102            }
103    
104            public static com.liferay.portal.model.RoleSoap getRole(long roleId)
105                    throws RemoteException {
106                    try {
107                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId);
108    
109                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
110                    }
111                    catch (Exception e) {
112                            _log.error(e, e);
113    
114                            throw new RemoteException(e.getMessage());
115                    }
116            }
117    
118            public static com.liferay.portal.model.RoleSoap getRole(long companyId,
119                    java.lang.String name) throws RemoteException {
120                    try {
121                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId,
122                                            name);
123    
124                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
125                    }
126                    catch (Exception e) {
127                            _log.error(e, e);
128    
129                            throw new RemoteException(e.getMessage());
130                    }
131            }
132    
133            public static com.liferay.portal.model.RoleSoap[] getUserGroupGroupRoles(
134                    long userId, long groupId) throws RemoteException {
135                    try {
136                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupGroupRoles(userId,
137                                            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[] getUserGroupRoles(
149                    long userId, long groupId) throws RemoteException {
150                    try {
151                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupRoles(userId,
152                                            groupId);
153    
154                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
155                    }
156                    catch (Exception e) {
157                            _log.error(e, e);
158    
159                            throw new RemoteException(e.getMessage());
160                    }
161            }
162    
163            public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
164                    long userId, com.liferay.portal.model.GroupSoap[] groups)
165                    throws RemoteException {
166                    try {
167                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRelatedRoles(userId,
168                                            com.liferay.portal.model.impl.GroupModelImpl.toModels(
169                                                    groups));
170    
171                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
172                    }
173                    catch (Exception e) {
174                            _log.error(e, e);
175    
176                            throw new RemoteException(e.getMessage());
177                    }
178            }
179    
180            public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId)
181                    throws RemoteException {
182                    try {
183                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRoles(userId);
184    
185                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
186                    }
187                    catch (Exception e) {
188                            _log.error(e, e);
189    
190                            throw new RemoteException(e.getMessage());
191                    }
192            }
193    
194            public static boolean hasUserRole(long userId, long companyId,
195                    java.lang.String name, boolean inherited) throws RemoteException {
196                    try {
197                            boolean returnValue = RoleServiceUtil.hasUserRole(userId,
198                                            companyId, name, inherited);
199    
200                            return returnValue;
201                    }
202                    catch (Exception e) {
203                            _log.error(e, e);
204    
205                            throw new RemoteException(e.getMessage());
206                    }
207            }
208    
209            public static boolean hasUserRoles(long userId, long companyId,
210                    java.lang.String[] names, boolean inherited) throws RemoteException {
211                    try {
212                            boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
213                                            companyId, names, inherited);
214    
215                            return returnValue;
216                    }
217                    catch (Exception e) {
218                            _log.error(e, e);
219    
220                            throw new RemoteException(e.getMessage());
221                    }
222            }
223    
224            public static void unsetUserRoles(long userId, long[] roleIds)
225                    throws RemoteException {
226                    try {
227                            RoleServiceUtil.unsetUserRoles(userId, roleIds);
228                    }
229                    catch (Exception e) {
230                            _log.error(e, e);
231    
232                            throw new RemoteException(e.getMessage());
233                    }
234            }
235    
236            private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
237    }