001    /**
002     * Copyright (c) 2000-2013 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 aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.log.Log;
020    import com.liferay.portal.kernel.log.LogFactoryUtil;
021    import com.liferay.portal.kernel.util.LocalizationUtil;
022    import com.liferay.portal.service.RoleServiceUtil;
023    
024    import java.rmi.RemoteException;
025    
026    import java.util.Locale;
027    import java.util.Map;
028    
029    /**
030     * Provides the SOAP utility for the
031     * {@link com.liferay.portal.service.RoleServiceUtil} service utility. The
032     * static methods of this class calls the same methods of the service utility.
033     * However, the signatures are different because it is difficult for SOAP to
034     * support certain types.
035     *
036     * <p>
037     * ServiceBuilder follows certain rules in translating the methods. For example,
038     * if the method in the service utility returns a {@link java.util.List}, that
039     * is translated to an array of {@link com.liferay.portal.model.RoleSoap}.
040     * If the method in the service utility returns a
041     * {@link com.liferay.portal.model.Role}, that is translated to a
042     * {@link com.liferay.portal.model.RoleSoap}. Methods that SOAP cannot
043     * safely wire are skipped.
044     * </p>
045     *
046     * <p>
047     * The benefits of using the SOAP utility is that it is cross platform
048     * compatible. SOAP allows different languages like Java, .NET, C++, PHP, and
049     * even Perl, to call the generated services. One drawback of SOAP is that it is
050     * slow because it needs to serialize all calls into a text format (XML).
051     * </p>
052     *
053     * <p>
054     * You can see a list of services at http://localhost:8080/api/axis. Set the
055     * property <b>axis.servlet.hosts.allowed</b> in portal.properties to configure
056     * security.
057     * </p>
058     *
059     * <p>
060     * The SOAP utility is only generated for remote services.
061     * </p>
062     *
063     * @author Brian Wing Shun Chan
064     * @see RoleServiceHttp
065     * @see com.liferay.portal.model.RoleSoap
066     * @see com.liferay.portal.service.RoleServiceUtil
067     * @generated
068     */
069    @ProviderType
070    public class RoleServiceSoap {
071            /**
072            * Adds a role. The user is reindexed after role is added.
073            *
074            * @param className the name of the class for which the role is created
075            * @param classPK the primary key of the class for which the role is
076            created (optionally <code>0</code>)
077            * @param name the role's name
078            * @param titleMap the role's localized titles (optionally
079            <code>null</code>)
080            * @param descriptionMap the role's localized descriptions (optionally
081            <code>null</code>)
082            * @param type the role's type (optionally <code>0</code>)
083            * @param subtype the role's subtype (optionally <code>null</code>)
084            * @param serviceContext the service context to be applied (optionally
085            <code>null</code>). Can set the expando bridge attributes for the
086            role.
087            * @return the role
088            * @throws PortalException if a user with the primary key could not be
089            found, if the user did not have permission to add roles, if the
090            class name or the role name were invalid, or if the role is a
091            duplicate
092            * @throws SystemException if a system exception occurred
093            */
094            public static com.liferay.portal.model.RoleSoap addRole(
095                    java.lang.String className, long classPK, java.lang.String name,
096                    java.lang.String[] titleMapLanguageIds,
097                    java.lang.String[] titleMapValues,
098                    java.lang.String[] descriptionMapLanguageIds,
099                    java.lang.String[] descriptionMapValues, int type,
100                    java.lang.String subtype,
101                    com.liferay.portal.service.ServiceContext serviceContext)
102                    throws RemoteException {
103                    try {
104                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
105                                            titleMapValues);
106                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
107                                            descriptionMapValues);
108    
109                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.addRole(className,
110                                            classPK, name, titleMap, descriptionMap, type, subtype,
111                                            serviceContext);
112    
113                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
114                    }
115                    catch (Exception e) {
116                            _log.error(e, e);
117    
118                            throw new RemoteException(e.getMessage());
119                    }
120            }
121    
122            /**
123            * Adds a role. The user is reindexed after role is added.
124            *
125            * @param name the role's name
126            * @param titleMap the role's localized titles (optionally
127            <code>null</code>)
128            * @param descriptionMap the role's localized descriptions (optionally
129            <code>null</code>)
130            * @param type the role's type (optionally <code>0</code>)
131            * @return the role
132            * @throws PortalException if a user with the primary key could not be
133            found, if the user did not have permission to add roles, if
134            the class name or the role name were invalid, or if the role
135            is a duplicate
136            * @throws SystemException if a system exception occurred
137            * @deprecated As of 6.2.0, replaced by {@link #addRole(String, long,
138            String, Map, Map, int, String, ServiceContext)}
139            */
140            public static com.liferay.portal.model.RoleSoap addRole(
141                    java.lang.String name, java.lang.String[] titleMapLanguageIds,
142                    java.lang.String[] titleMapValues,
143                    java.lang.String[] descriptionMapLanguageIds,
144                    java.lang.String[] descriptionMapValues, int type)
145                    throws RemoteException {
146                    try {
147                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
148                                            titleMapValues);
149                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
150                                            descriptionMapValues);
151    
152                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.addRole(name,
153                                            titleMap, descriptionMap, type);
154    
155                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
156                    }
157                    catch (Exception e) {
158                            _log.error(e, e);
159    
160                            throw new RemoteException(e.getMessage());
161                    }
162            }
163    
164            /**
165            * Adds the roles to the user. The user is reindexed after the roles are
166            * added.
167            *
168            * @param userId the primary key of the user
169            * @param roleIds the primary keys of the roles
170            * @throws PortalException if a user with the primary key could not be found
171            or if the user did not have permission to assign members to one
172            of the roles
173            * @throws SystemException if a system exception occurred
174            */
175            public static void addUserRoles(long userId, long[] roleIds)
176                    throws RemoteException {
177                    try {
178                            RoleServiceUtil.addUserRoles(userId, roleIds);
179                    }
180                    catch (Exception e) {
181                            _log.error(e, e);
182    
183                            throw new RemoteException(e.getMessage());
184                    }
185            }
186    
187            /**
188            * Deletes the role with the primary key and its associated permissions.
189            *
190            * @param roleId the primary key of the role
191            * @throws PortalException if the user did not have permission to delete the
192            role, if a role with the primary key could not be found, if the
193            role is a default system role, or if the role's resource could
194            not be found
195            * @throws SystemException if a system exception occurred
196            */
197            public static void deleteRole(long roleId) throws RemoteException {
198                    try {
199                            RoleServiceUtil.deleteRole(roleId);
200                    }
201                    catch (Exception e) {
202                            _log.error(e, e);
203    
204                            throw new RemoteException(e.getMessage());
205                    }
206            }
207    
208            /**
209            * Returns all the roles associated with the group.
210            *
211            * @param groupId the primary key of the group
212            * @return the roles associated with the group
213            * @throws PortalException if a portal exception occurred
214            * @throws SystemException if a system exception occurred
215            */
216            public static com.liferay.portal.model.RoleSoap[] getGroupRoles(
217                    long groupId) throws RemoteException {
218                    try {
219                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getGroupRoles(groupId);
220    
221                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
222                    }
223                    catch (Exception e) {
224                            _log.error(e, e);
225    
226                            throw new RemoteException(e.getMessage());
227                    }
228            }
229    
230            /**
231            * Returns the role with the primary key.
232            *
233            * @param roleId the primary key of the role
234            * @return the role with the primary key
235            * @throws PortalException if a role with the primary key could not be found
236            or if the user did not have permission to view the role
237            * @throws SystemException if a system exception occurred
238            */
239            public static com.liferay.portal.model.RoleSoap getRole(long roleId)
240                    throws RemoteException {
241                    try {
242                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId);
243    
244                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
245                    }
246                    catch (Exception e) {
247                            _log.error(e, e);
248    
249                            throw new RemoteException(e.getMessage());
250                    }
251            }
252    
253            /**
254            * Returns the role with the name in the company.
255            *
256            * <p>
257            * The method searches the system roles map first for default roles. If a
258            * role with the name is not found, then the method will query the database.
259            * </p>
260            *
261            * @param companyId the primary key of the company
262            * @param name the role's name
263            * @return the role with the name
264            * @throws PortalException if a role with the name could not be found in the
265            company or if the user did not have permission to view the role
266            * @throws SystemException if a system exception occurred
267            */
268            public static com.liferay.portal.model.RoleSoap getRole(long companyId,
269                    java.lang.String name) throws RemoteException {
270                    try {
271                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId,
272                                            name);
273    
274                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
275                    }
276                    catch (Exception e) {
277                            _log.error(e, e);
278    
279                            throw new RemoteException(e.getMessage());
280                    }
281            }
282    
283            /**
284            * Returns all the user's roles within the user group.
285            *
286            * @param userId the primary key of the user
287            * @param groupId the primary key of the group
288            * @return the user's roles within the user group
289            * @throws PortalException if a portal exception occurred
290            * @throws SystemException if a system exception occurred
291            */
292            public static com.liferay.portal.model.RoleSoap[] getUserGroupGroupRoles(
293                    long userId, long groupId) throws RemoteException {
294                    try {
295                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupGroupRoles(userId,
296                                            groupId);
297    
298                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
299                    }
300                    catch (Exception e) {
301                            _log.error(e, e);
302    
303                            throw new RemoteException(e.getMessage());
304                    }
305            }
306    
307            /**
308            * Returns all the user's roles within the user group.
309            *
310            * @param userId the primary key of the user
311            * @param groupId the primary key of the group
312            * @return the user's roles within the user group
313            * @throws PortalException if a portal exception occurred
314            * @throws SystemException if a system exception occurred
315            */
316            public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles(
317                    long userId, long groupId) throws RemoteException {
318                    try {
319                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupRoles(userId,
320                                            groupId);
321    
322                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
323                    }
324                    catch (Exception e) {
325                            _log.error(e, e);
326    
327                            throw new RemoteException(e.getMessage());
328                    }
329            }
330    
331            /**
332            * Returns the union of all the user's roles within the groups.
333            *
334            * @param userId the primary key of the user
335            * @param groups the groups (optionally <code>null</code>)
336            * @return the union of all the user's roles within the groups
337            * @throws PortalException if a portal exception occurred
338            * @throws SystemException if a system exception occurred
339            */
340            public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
341                    long userId, com.liferay.portal.model.GroupSoap[] groups)
342                    throws RemoteException {
343                    try {
344                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRelatedRoles(userId,
345                                            com.liferay.portal.model.impl.GroupModelImpl.toModels(
346                                                    groups));
347    
348                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
349                    }
350                    catch (Exception e) {
351                            _log.error(e, e);
352    
353                            throw new RemoteException(e.getMessage());
354                    }
355            }
356    
357            /**
358            * Returns all the roles associated with the user.
359            *
360            * @param userId the primary key of the user
361            * @return the roles associated with the user
362            * @throws PortalException if a portal exception occurred
363            * @throws SystemException if a system exception occurred
364            */
365            public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId)
366                    throws RemoteException {
367                    try {
368                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRoles(userId);
369    
370                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
371                    }
372                    catch (Exception e) {
373                            _log.error(e, e);
374    
375                            throw new RemoteException(e.getMessage());
376                    }
377            }
378    
379            /**
380            * Returns <code>true</code> if the user is associated with the named
381            * regular role.
382            *
383            * @param userId the primary key of the user
384            * @param companyId the primary key of the company
385            * @param name the name of the role
386            * @param inherited whether to include the user's inherited roles in the
387            search
388            * @return <code>true</code> if the user is associated with the regular
389            role; <code>false</code> otherwise
390            * @throws PortalException if a role with the name could not be found in the
391            company or if a default user for the company could not be found
392            * @throws SystemException if a system exception occurred
393            */
394            public static boolean hasUserRole(long userId, long companyId,
395                    java.lang.String name, boolean inherited) throws RemoteException {
396                    try {
397                            boolean returnValue = RoleServiceUtil.hasUserRole(userId,
398                                            companyId, name, inherited);
399    
400                            return returnValue;
401                    }
402                    catch (Exception e) {
403                            _log.error(e, e);
404    
405                            throw new RemoteException(e.getMessage());
406                    }
407            }
408    
409            /**
410            * Returns <code>true</code> if the user has any one of the named regular
411            * roles.
412            *
413            * @param userId the primary key of the user
414            * @param companyId the primary key of the company
415            * @param names the names of the roles
416            * @param inherited whether to include the user's inherited roles in the
417            search
418            * @return <code>true</code> if the user has any one of the regular roles;
419            <code>false</code> otherwise
420            * @throws PortalException if any one of the roles with the names could not
421            be found in the company or if the default user for the company
422            could not be found
423            * @throws SystemException if a system exception occurred
424            */
425            public static boolean hasUserRoles(long userId, long companyId,
426                    java.lang.String[] names, boolean inherited) throws RemoteException {
427                    try {
428                            boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
429                                            companyId, names, inherited);
430    
431                            return returnValue;
432                    }
433                    catch (Exception e) {
434                            _log.error(e, e);
435    
436                            throw new RemoteException(e.getMessage());
437                    }
438            }
439    
440            /**
441            * Removes the matching roles associated with the user. The user is
442            * reindexed after the roles are removed.
443            *
444            * @param userId the primary key of the user
445            * @param roleIds the primary keys of the roles
446            * @throws PortalException if a user with the primary key could not be
447            found, if the user did not have permission to remove members from
448            a role, or if a role with any one of the primary keys could not
449            be found
450            * @throws SystemException if a system exception occurred
451            */
452            public static void unsetUserRoles(long userId, long[] roleIds)
453                    throws RemoteException {
454                    try {
455                            RoleServiceUtil.unsetUserRoles(userId, roleIds);
456                    }
457                    catch (Exception e) {
458                            _log.error(e, e);
459    
460                            throw new RemoteException(e.getMessage());
461                    }
462            }
463    
464            /**
465            * Updates the role with the primary key.
466            *
467            * @param roleId the primary key of the role
468            * @param name the role's new name
469            * @param titleMap the new localized titles (optionally <code>null</code>)
470            to replace those existing for the role
471            * @param descriptionMap the new localized descriptions (optionally
472            <code>null</code>) to replace those existing for the role
473            * @param subtype the role's new subtype (optionally <code>null</code>)
474            * @param serviceContext the service context to be applied (optionally
475            <code>null</code>). Can set the expando bridge attributes for the
476            role.
477            * @return the role with the primary key
478            * @throws PortalException if the user did not have permission to update the
479            role, if a role with the primary could not be found, or if the
480            role's name was invalid
481            * @throws SystemException if a system exception occurred
482            */
483            public static com.liferay.portal.model.RoleSoap updateRole(long roleId,
484                    java.lang.String name, java.lang.String[] titleMapLanguageIds,
485                    java.lang.String[] titleMapValues,
486                    java.lang.String[] descriptionMapLanguageIds,
487                    java.lang.String[] descriptionMapValues, java.lang.String subtype,
488                    com.liferay.portal.service.ServiceContext serviceContext)
489                    throws RemoteException {
490                    try {
491                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
492                                            titleMapValues);
493                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
494                                            descriptionMapValues);
495    
496                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.updateRole(roleId,
497                                            name, titleMap, descriptionMap, subtype, serviceContext);
498    
499                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
500                    }
501                    catch (Exception e) {
502                            _log.error(e, e);
503    
504                            throw new RemoteException(e.getMessage());
505                    }
506            }
507    
508            private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
509    }