001    /**
002     * Copyright (c) 2000-present 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 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 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            */
089            public static com.liferay.portal.model.RoleSoap addRole(
090                    java.lang.String className, long classPK, java.lang.String name,
091                    java.lang.String[] titleMapLanguageIds,
092                    java.lang.String[] titleMapValues,
093                    java.lang.String[] descriptionMapLanguageIds,
094                    java.lang.String[] descriptionMapValues, int type,
095                    java.lang.String subtype,
096                    com.liferay.portal.service.ServiceContext serviceContext)
097                    throws RemoteException {
098                    try {
099                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
100                                            titleMapValues);
101                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
102                                            descriptionMapValues);
103    
104                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.addRole(className,
105                                            classPK, name, titleMap, descriptionMap, type, subtype,
106                                            serviceContext);
107    
108                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
109                    }
110                    catch (Exception e) {
111                            _log.error(e, e);
112    
113                            throw new RemoteException(e.getMessage());
114                    }
115            }
116    
117            /**
118            * Adds a role. The user is reindexed after role is added.
119            *
120            * @param name the role's name
121            * @param titleMap the role's localized titles (optionally
122            <code>null</code>)
123            * @param descriptionMap the role's localized descriptions (optionally
124            <code>null</code>)
125            * @param type the role's type (optionally <code>0</code>)
126            * @return the role
127            * @deprecated As of 6.2.0, replaced by {@link #addRole(String, long,
128            String, Map, Map, int, String, ServiceContext)}
129            */
130            @Deprecated
131            public static com.liferay.portal.model.RoleSoap addRole(
132                    java.lang.String name, java.lang.String[] titleMapLanguageIds,
133                    java.lang.String[] titleMapValues,
134                    java.lang.String[] descriptionMapLanguageIds,
135                    java.lang.String[] descriptionMapValues, int type)
136                    throws RemoteException {
137                    try {
138                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
139                                            titleMapValues);
140                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
141                                            descriptionMapValues);
142    
143                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.addRole(name,
144                                            titleMap, descriptionMap, type);
145    
146                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
147                    }
148                    catch (Exception e) {
149                            _log.error(e, e);
150    
151                            throw new RemoteException(e.getMessage());
152                    }
153            }
154    
155            /**
156            * Adds the roles to the user. The user is reindexed after the roles are
157            * added.
158            *
159            * @param userId the primary key of the user
160            * @param roleIds the primary keys of the roles
161            */
162            public static void addUserRoles(long userId, long[] roleIds)
163                    throws RemoteException {
164                    try {
165                            RoleServiceUtil.addUserRoles(userId, roleIds);
166                    }
167                    catch (Exception e) {
168                            _log.error(e, e);
169    
170                            throw new RemoteException(e.getMessage());
171                    }
172            }
173    
174            /**
175            * Deletes the role with the primary key and its associated permissions.
176            *
177            * @param roleId the primary key of the role
178            */
179            public static void deleteRole(long roleId) throws RemoteException {
180                    try {
181                            RoleServiceUtil.deleteRole(roleId);
182                    }
183                    catch (Exception e) {
184                            _log.error(e, e);
185    
186                            throw new RemoteException(e.getMessage());
187                    }
188            }
189    
190            public static com.liferay.portal.model.RoleSoap fetchRole(long roleId)
191                    throws RemoteException {
192                    try {
193                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.fetchRole(roleId);
194    
195                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
196                    }
197                    catch (Exception e) {
198                            _log.error(e, e);
199    
200                            throw new RemoteException(e.getMessage());
201                    }
202            }
203    
204            /**
205            * Returns all the roles associated with the group.
206            *
207            * @param groupId the primary key of the group
208            * @return the roles associated with the group
209            */
210            public static com.liferay.portal.model.RoleSoap[] getGroupRoles(
211                    long groupId) throws RemoteException {
212                    try {
213                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getGroupRoles(groupId);
214    
215                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
216                    }
217                    catch (Exception e) {
218                            _log.error(e, e);
219    
220                            throw new RemoteException(e.getMessage());
221                    }
222            }
223    
224            /**
225            * Returns the role with the primary key.
226            *
227            * @param roleId the primary key of the role
228            * @return the role with the primary key
229            */
230            public static com.liferay.portal.model.RoleSoap getRole(long roleId)
231                    throws RemoteException {
232                    try {
233                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId);
234    
235                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
236                    }
237                    catch (Exception e) {
238                            _log.error(e, e);
239    
240                            throw new RemoteException(e.getMessage());
241                    }
242            }
243    
244            /**
245            * Returns the role with the name in the company.
246            *
247            * <p>
248            * The method searches the system roles map first for default roles. If a
249            * role with the name is not found, then the method will query the database.
250            * </p>
251            *
252            * @param companyId the primary key of the company
253            * @param name the role's name
254            * @return the role with the name
255            */
256            public static com.liferay.portal.model.RoleSoap getRole(long companyId,
257                    java.lang.String name) throws RemoteException {
258                    try {
259                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId,
260                                            name);
261    
262                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
263                    }
264                    catch (Exception e) {
265                            _log.error(e, e);
266    
267                            throw new RemoteException(e.getMessage());
268                    }
269            }
270    
271            public static com.liferay.portal.model.RoleSoap[] getRoles(int type,
272                    java.lang.String subtype) throws RemoteException {
273                    try {
274                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getRoles(type,
275                                            subtype);
276    
277                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
278                    }
279                    catch (Exception e) {
280                            _log.error(e, e);
281    
282                            throw new RemoteException(e.getMessage());
283                    }
284            }
285    
286            public static com.liferay.portal.model.RoleSoap[] getRoles(long companyId,
287                    int[] types) throws RemoteException {
288                    try {
289                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getRoles(companyId,
290                                            types);
291    
292                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
293                    }
294                    catch (Exception e) {
295                            _log.error(e, e);
296    
297                            throw new RemoteException(e.getMessage());
298                    }
299            }
300    
301            /**
302            * Returns all the user's roles within the user group.
303            *
304            * @param userId the primary key of the user
305            * @param groupId the primary key of the group
306            * @return the user's roles within the user group
307            */
308            public static com.liferay.portal.model.RoleSoap[] getUserGroupGroupRoles(
309                    long userId, long groupId) throws RemoteException {
310                    try {
311                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupGroupRoles(userId,
312                                            groupId);
313    
314                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
315                    }
316                    catch (Exception e) {
317                            _log.error(e, e);
318    
319                            throw new RemoteException(e.getMessage());
320                    }
321            }
322    
323            /**
324            * Returns all the user's roles within the user group.
325            *
326            * @param userId the primary key of the user
327            * @param groupId the primary key of the group
328            * @return the user's roles within the user group
329            */
330            public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles(
331                    long userId, long groupId) throws RemoteException {
332                    try {
333                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupRoles(userId,
334                                            groupId);
335    
336                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
337                    }
338                    catch (Exception e) {
339                            _log.error(e, e);
340    
341                            throw new RemoteException(e.getMessage());
342                    }
343            }
344    
345            /**
346            * Returns the union of all the user's roles within the groups.
347            *
348            * @param userId the primary key of the user
349            * @param groups the groups (optionally <code>null</code>)
350            * @return the union of all the user's roles within the groups
351            */
352            public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
353                    long userId, com.liferay.portal.model.GroupSoap[] groups)
354                    throws RemoteException {
355                    try {
356                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRelatedRoles(userId,
357                                            com.liferay.portal.model.impl.GroupModelImpl.toModels(
358                                                    groups));
359    
360                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
361                    }
362                    catch (Exception e) {
363                            _log.error(e, e);
364    
365                            throw new RemoteException(e.getMessage());
366                    }
367            }
368    
369            /**
370            * Returns all the roles associated with the user.
371            *
372            * @param userId the primary key of the user
373            * @return the roles associated with the user
374            */
375            public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId)
376                    throws RemoteException {
377                    try {
378                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRoles(userId);
379    
380                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
381                    }
382                    catch (Exception e) {
383                            _log.error(e, e);
384    
385                            throw new RemoteException(e.getMessage());
386                    }
387            }
388    
389            /**
390            * Returns <code>true</code> if the user is associated with the named
391            * regular role.
392            *
393            * @param userId the primary key of the user
394            * @param companyId the primary key of the company
395            * @param name the name of the role
396            * @param inherited whether to include the user's inherited roles in the
397            search
398            * @return <code>true</code> if the user is associated with the regular
399            role; <code>false</code> otherwise
400            */
401            public static boolean hasUserRole(long userId, long companyId,
402                    java.lang.String name, boolean inherited) throws RemoteException {
403                    try {
404                            boolean returnValue = RoleServiceUtil.hasUserRole(userId,
405                                            companyId, name, inherited);
406    
407                            return returnValue;
408                    }
409                    catch (Exception e) {
410                            _log.error(e, e);
411    
412                            throw new RemoteException(e.getMessage());
413                    }
414            }
415    
416            /**
417            * Returns <code>true</code> if the user has any one of the named regular
418            * roles.
419            *
420            * @param userId the primary key of the user
421            * @param companyId the primary key of the company
422            * @param names the names of the roles
423            * @param inherited whether to include the user's inherited roles in the
424            search
425            * @return <code>true</code> if the user has any one of the regular roles;
426            <code>false</code> otherwise
427            */
428            public static boolean hasUserRoles(long userId, long companyId,
429                    java.lang.String[] names, boolean inherited) throws RemoteException {
430                    try {
431                            boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
432                                            companyId, names, inherited);
433    
434                            return returnValue;
435                    }
436                    catch (Exception e) {
437                            _log.error(e, e);
438    
439                            throw new RemoteException(e.getMessage());
440                    }
441            }
442    
443            /**
444            * Removes the matching roles associated with the user. The user is
445            * reindexed after the roles are removed.
446            *
447            * @param userId the primary key of the user
448            * @param roleIds the primary keys of the roles
449            */
450            public static void unsetUserRoles(long userId, long[] roleIds)
451                    throws RemoteException {
452                    try {
453                            RoleServiceUtil.unsetUserRoles(userId, roleIds);
454                    }
455                    catch (Exception e) {
456                            _log.error(e, e);
457    
458                            throw new RemoteException(e.getMessage());
459                    }
460            }
461    
462            /**
463            * Updates the role with the primary key.
464            *
465            * @param roleId the primary key of the role
466            * @param name the role's new name
467            * @param titleMap the new localized titles (optionally <code>null</code>)
468            to replace those existing for the role
469            * @param descriptionMap the new localized descriptions (optionally
470            <code>null</code>) to replace those existing for the role
471            * @param subtype the role's new subtype (optionally <code>null</code>)
472            * @param serviceContext the service context to be applied (optionally
473            <code>null</code>). Can set the expando bridge attributes for the
474            role.
475            * @return the role with the primary key
476            */
477            public static com.liferay.portal.model.RoleSoap updateRole(long roleId,
478                    java.lang.String name, java.lang.String[] titleMapLanguageIds,
479                    java.lang.String[] titleMapValues,
480                    java.lang.String[] descriptionMapLanguageIds,
481                    java.lang.String[] descriptionMapValues, java.lang.String subtype,
482                    com.liferay.portal.service.ServiceContext serviceContext)
483                    throws RemoteException {
484                    try {
485                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
486                                            titleMapValues);
487                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
488                                            descriptionMapValues);
489    
490                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.updateRole(roleId,
491                                            name, titleMap, descriptionMap, subtype, serviceContext);
492    
493                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
494                    }
495                    catch (Exception e) {
496                            _log.error(e, e);
497    
498                            throw new RemoteException(e.getMessage());
499                    }
500            }
501    
502            private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
503    }