001 /** 002 * Copyright (c) 2000-2012 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/api/secure/axis. Set the property 052 * <b>axis.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 /** 068 * Adds the roles to the user. The user is reindexed after the roles are 069 * added. 070 * 071 * @param userId the primary key of the user 072 * @param roleIds the primary keys of the roles 073 * @throws PortalException if a user with the primary key could not be found 074 or if the user did not have permission to assign members to one 075 of the roles 076 * @throws SystemException if a system exception occurred 077 */ 078 public static void addUserRoles(long userId, long[] roleIds) 079 throws RemoteException { 080 try { 081 RoleServiceUtil.addUserRoles(userId, roleIds); 082 } 083 catch (Exception e) { 084 _log.error(e, e); 085 086 throw new RemoteException(e.getMessage()); 087 } 088 } 089 090 /** 091 * Deletes the role with the primary key and its associated permissions. 092 * 093 * @param roleId the primary key of the role 094 * @throws PortalException if the user did not have permission to delete the 095 role, if a role with the primary key could not be found, if the 096 role is a default system role, or if the role's resource could 097 not be found 098 * @throws SystemException if a system exception occurred 099 */ 100 public static void deleteRole(long roleId) throws RemoteException { 101 try { 102 RoleServiceUtil.deleteRole(roleId); 103 } 104 catch (Exception e) { 105 _log.error(e, e); 106 107 throw new RemoteException(e.getMessage()); 108 } 109 } 110 111 /** 112 * Returns all the roles associated with the group. 113 * 114 * @param groupId the primary key of the group 115 * @return the roles associated with the group 116 * @throws PortalException if a portal exception occurred 117 * @throws SystemException if a system exception occurred 118 */ 119 public static com.liferay.portal.model.RoleSoap[] getGroupRoles( 120 long groupId) throws RemoteException { 121 try { 122 java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getGroupRoles(groupId); 123 124 return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue); 125 } 126 catch (Exception e) { 127 _log.error(e, e); 128 129 throw new RemoteException(e.getMessage()); 130 } 131 } 132 133 /** 134 * Returns the role with the primary key. 135 * 136 * @param roleId the primary key of the role 137 * @return the role with the primary key 138 * @throws PortalException if a role with the primary key could not be found 139 or if the user did not have permission to view the role 140 * @throws SystemException if a system exception occurred 141 */ 142 public static com.liferay.portal.model.RoleSoap getRole(long roleId) 143 throws RemoteException { 144 try { 145 com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId); 146 147 return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue); 148 } 149 catch (Exception e) { 150 _log.error(e, e); 151 152 throw new RemoteException(e.getMessage()); 153 } 154 } 155 156 /** 157 * Returns the role with the name in the company. 158 * 159 * <p> 160 * The method searches the system roles map first for default roles. If a 161 * role with the name is not found, then the method will query the database. 162 * </p> 163 * 164 * @param companyId the primary key of the company 165 * @param name the role's name 166 * @return the role with the name 167 * @throws PortalException if a role with the name could not be found in the 168 company or if the user did not have permission to view the role 169 * @throws SystemException if a system exception occurred 170 */ 171 public static com.liferay.portal.model.RoleSoap getRole(long companyId, 172 java.lang.String name) throws RemoteException { 173 try { 174 com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId, 175 name); 176 177 return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue); 178 } 179 catch (Exception e) { 180 _log.error(e, e); 181 182 throw new RemoteException(e.getMessage()); 183 } 184 } 185 186 /** 187 * Returns all the user's roles within the user group. 188 * 189 * @param userId the primary key of the user 190 * @param groupId the primary key of the group 191 * @return the user's roles within the user group 192 * @throws PortalException if a portal exception occurred 193 * @throws SystemException if a system exception occurred 194 */ 195 public static com.liferay.portal.model.RoleSoap[] getUserGroupGroupRoles( 196 long userId, long groupId) throws RemoteException { 197 try { 198 java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupGroupRoles(userId, 199 groupId); 200 201 return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue); 202 } 203 catch (Exception e) { 204 _log.error(e, e); 205 206 throw new RemoteException(e.getMessage()); 207 } 208 } 209 210 /** 211 * Returns all the user's roles within the user group. 212 * 213 * @param userId the primary key of the user 214 * @param groupId the primary key of the group 215 * @return the user's roles within the user group 216 * @throws PortalException if a portal exception occurred 217 * @throws SystemException if a system exception occurred 218 */ 219 public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles( 220 long userId, long groupId) throws RemoteException { 221 try { 222 java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupRoles(userId, 223 groupId); 224 225 return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue); 226 } 227 catch (Exception e) { 228 _log.error(e, e); 229 230 throw new RemoteException(e.getMessage()); 231 } 232 } 233 234 /** 235 * Returns the union of all the user's roles within the groups. 236 * 237 * @param userId the primary key of the user 238 * @param groups the groups (optionally <code>null</code>) 239 * @return the union of all the user's roles within the groups 240 * @throws PortalException if a portal exception occurred 241 * @throws SystemException if a system exception occurred 242 */ 243 public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles( 244 long userId, com.liferay.portal.model.GroupSoap[] groups) 245 throws RemoteException { 246 try { 247 java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRelatedRoles(userId, 248 com.liferay.portal.model.impl.GroupModelImpl.toModels( 249 groups)); 250 251 return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue); 252 } 253 catch (Exception e) { 254 _log.error(e, e); 255 256 throw new RemoteException(e.getMessage()); 257 } 258 } 259 260 /** 261 * Returns all the roles associated with the user. 262 * 263 * @param userId the primary key of the user 264 * @return the roles associated with the user 265 * @throws PortalException if a portal exception occurred 266 * @throws SystemException if a system exception occurred 267 */ 268 public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId) 269 throws RemoteException { 270 try { 271 java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRoles(userId); 272 273 return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue); 274 } 275 catch (Exception e) { 276 _log.error(e, e); 277 278 throw new RemoteException(e.getMessage()); 279 } 280 } 281 282 /** 283 * Returns <code>true</code> if the user is associated with the named 284 * regular role. 285 * 286 * @param userId the primary key of the user 287 * @param companyId the primary key of the company 288 * @param name the name of the role 289 * @param inherited whether to include the user's inherited roles in the 290 search 291 * @return <code>true</code> if the user is associated with the regular 292 role; <code>false</code> otherwise 293 * @throws PortalException if a role with the name could not be found in the 294 company or if a default user for the company could not be found 295 * @throws SystemException if a system exception occurred 296 */ 297 public static boolean hasUserRole(long userId, long companyId, 298 java.lang.String name, boolean inherited) throws RemoteException { 299 try { 300 boolean returnValue = RoleServiceUtil.hasUserRole(userId, 301 companyId, name, inherited); 302 303 return returnValue; 304 } 305 catch (Exception e) { 306 _log.error(e, e); 307 308 throw new RemoteException(e.getMessage()); 309 } 310 } 311 312 /** 313 * Returns <code>true</code> if the user has any one of the named regular 314 * roles. 315 * 316 * @param userId the primary key of the user 317 * @param companyId the primary key of the company 318 * @param names the names of the roles 319 * @param inherited whether to include the user's inherited roles in the 320 search 321 * @return <code>true</code> if the user has any one of the regular roles; 322 <code>false</code> otherwise 323 * @throws PortalException if any one of the roles with the names could not 324 be found in the company or if the default user for the company 325 could not be found 326 * @throws SystemException if a system exception occurred 327 */ 328 public static boolean hasUserRoles(long userId, long companyId, 329 java.lang.String[] names, boolean inherited) throws RemoteException { 330 try { 331 boolean returnValue = RoleServiceUtil.hasUserRoles(userId, 332 companyId, names, inherited); 333 334 return returnValue; 335 } 336 catch (Exception e) { 337 _log.error(e, e); 338 339 throw new RemoteException(e.getMessage()); 340 } 341 } 342 343 /** 344 * Removes the matching roles associated with the user. The user is 345 * reindexed after the roles are removed. 346 * 347 * @param userId the primary key of the user 348 * @param roleIds the primary keys of the roles 349 * @throws PortalException if a user with the primary key could not be 350 found, if the user did not have permission to remove members from 351 a role, or if a role with any one of the primary keys could not 352 be found 353 * @throws SystemException if a system exception occurred 354 */ 355 public static void unsetUserRoles(long userId, long[] roleIds) 356 throws RemoteException { 357 try { 358 RoleServiceUtil.unsetUserRoles(userId, roleIds); 359 } 360 catch (Exception e) { 361 _log.error(e, e); 362 363 throw new RemoteException(e.getMessage()); 364 } 365 } 366 367 private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class); 368 }