001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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            public static com.liferay.portal.model.RoleSoap[] getGroupRolesAndTeamRoles(
231                    long companyId, java.lang.String keywords,
232                    java.util.List<java.lang.String> excludedNames, int[] types,
233                    long excludedTeamRoleId, long teamGroupId, int start, int end)
234                    throws RemoteException {
235                    try {
236                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getGroupRolesAndTeamRoles(companyId,
237                                            keywords, excludedNames, types, excludedTeamRoleId,
238                                            teamGroupId, start, end);
239    
240                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
241                    }
242                    catch (Exception e) {
243                            _log.error(e, e);
244    
245                            throw new RemoteException(e.getMessage());
246                    }
247            }
248    
249            public static int getGroupRolesAndTeamRolesCount(long companyId,
250                    java.lang.String keywords,
251                    java.util.List<java.lang.String> excludedNames, int[] types,
252                    long excludedTeamRoleId, long teamGroupId) throws RemoteException {
253                    try {
254                            int returnValue = RoleServiceUtil.getGroupRolesAndTeamRolesCount(companyId,
255                                            keywords, excludedNames, types, excludedTeamRoleId,
256                                            teamGroupId);
257    
258                            return returnValue;
259                    }
260                    catch (Exception e) {
261                            _log.error(e, e);
262    
263                            throw new RemoteException(e.getMessage());
264                    }
265            }
266    
267            /**
268            * Returns the role with the primary key.
269            *
270            * @param roleId the primary key of the role
271            * @return the role with the primary key
272            * @throws PortalException if a role with the primary key could not be found
273            or if the user did not have permission to view the role
274            * @throws SystemException if a system exception occurred
275            */
276            public static com.liferay.portal.model.RoleSoap getRole(long roleId)
277                    throws RemoteException {
278                    try {
279                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(roleId);
280    
281                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
282                    }
283                    catch (Exception e) {
284                            _log.error(e, e);
285    
286                            throw new RemoteException(e.getMessage());
287                    }
288            }
289    
290            /**
291            * Returns the role with the name in the company.
292            *
293            * <p>
294            * The method searches the system roles map first for default roles. If a
295            * role with the name is not found, then the method will query the database.
296            * </p>
297            *
298            * @param companyId the primary key of the company
299            * @param name the role's name
300            * @return the role with the name
301            * @throws PortalException if a role with the name could not be found in the
302            company or if the user did not have permission to view the role
303            * @throws SystemException if a system exception occurred
304            */
305            public static com.liferay.portal.model.RoleSoap getRole(long companyId,
306                    java.lang.String name) throws RemoteException {
307                    try {
308                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.getRole(companyId,
309                                            name);
310    
311                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
312                    }
313                    catch (Exception e) {
314                            _log.error(e, e);
315    
316                            throw new RemoteException(e.getMessage());
317                    }
318            }
319    
320            /**
321            * Returns all the user's roles within the user group.
322            *
323            * @param userId the primary key of the user
324            * @param groupId the primary key of the group
325            * @return the user's roles within the user group
326            * @throws PortalException if a portal exception occurred
327            * @throws SystemException if a system exception occurred
328            */
329            public static com.liferay.portal.model.RoleSoap[] getUserGroupGroupRoles(
330                    long userId, long groupId) throws RemoteException {
331                    try {
332                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupGroupRoles(userId,
333                                            groupId);
334    
335                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
336                    }
337                    catch (Exception e) {
338                            _log.error(e, e);
339    
340                            throw new RemoteException(e.getMessage());
341                    }
342            }
343    
344            /**
345            * Returns all the user's roles within the user group.
346            *
347            * @param userId the primary key of the user
348            * @param groupId the primary key of the group
349            * @return the user's roles within the user group
350            * @throws PortalException if a portal exception occurred
351            * @throws SystemException if a system exception occurred
352            */
353            public static com.liferay.portal.model.RoleSoap[] getUserGroupRoles(
354                    long userId, long groupId) throws RemoteException {
355                    try {
356                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserGroupRoles(userId,
357                                            groupId);
358    
359                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
360                    }
361                    catch (Exception e) {
362                            _log.error(e, e);
363    
364                            throw new RemoteException(e.getMessage());
365                    }
366            }
367    
368            /**
369            * Returns the union of all the user's roles within the groups.
370            *
371            * @param userId the primary key of the user
372            * @param groups the groups (optionally <code>null</code>)
373            * @return the union of all the user's roles within the groups
374            * @throws PortalException if a portal exception occurred
375            * @throws SystemException if a system exception occurred
376            */
377            public static com.liferay.portal.model.RoleSoap[] getUserRelatedRoles(
378                    long userId, com.liferay.portal.model.GroupSoap[] groups)
379                    throws RemoteException {
380                    try {
381                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRelatedRoles(userId,
382                                            com.liferay.portal.model.impl.GroupModelImpl.toModels(
383                                                    groups));
384    
385                            return com.liferay.portal.model.RoleSoap.toSoapModels(returnValue);
386                    }
387                    catch (Exception e) {
388                            _log.error(e, e);
389    
390                            throw new RemoteException(e.getMessage());
391                    }
392            }
393    
394            /**
395            * Returns all the roles associated with the user.
396            *
397            * @param userId the primary key of the user
398            * @return the roles associated with the user
399            * @throws PortalException if a portal exception occurred
400            * @throws SystemException if a system exception occurred
401            */
402            public static com.liferay.portal.model.RoleSoap[] getUserRoles(long userId)
403                    throws RemoteException {
404                    try {
405                            java.util.List<com.liferay.portal.model.Role> returnValue = RoleServiceUtil.getUserRoles(userId);
406    
407                            return com.liferay.portal.model.RoleSoap.toSoapModels(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 is associated with the named
418            * regular role.
419            *
420            * @param userId the primary key of the user
421            * @param companyId the primary key of the company
422            * @param name the name of the role
423            * @param inherited whether to include the user's inherited roles in the
424            search
425            * @return <code>true</code> if the user is associated with the regular
426            role; <code>false</code> otherwise
427            * @throws PortalException if a role with the name could not be found in the
428            company or if a default user for the company could not be found
429            * @throws SystemException if a system exception occurred
430            */
431            public static boolean hasUserRole(long userId, long companyId,
432                    java.lang.String name, boolean inherited) throws RemoteException {
433                    try {
434                            boolean returnValue = RoleServiceUtil.hasUserRole(userId,
435                                            companyId, name, inherited);
436    
437                            return returnValue;
438                    }
439                    catch (Exception e) {
440                            _log.error(e, e);
441    
442                            throw new RemoteException(e.getMessage());
443                    }
444            }
445    
446            /**
447            * Returns <code>true</code> if the user has any one of the named regular
448            * roles.
449            *
450            * @param userId the primary key of the user
451            * @param companyId the primary key of the company
452            * @param names the names of the roles
453            * @param inherited whether to include the user's inherited roles in the
454            search
455            * @return <code>true</code> if the user has any one of the regular roles;
456            <code>false</code> otherwise
457            * @throws PortalException if any one of the roles with the names could not
458            be found in the company or if the default user for the company
459            could not be found
460            * @throws SystemException if a system exception occurred
461            */
462            public static boolean hasUserRoles(long userId, long companyId,
463                    java.lang.String[] names, boolean inherited) throws RemoteException {
464                    try {
465                            boolean returnValue = RoleServiceUtil.hasUserRoles(userId,
466                                            companyId, names, inherited);
467    
468                            return returnValue;
469                    }
470                    catch (Exception e) {
471                            _log.error(e, e);
472    
473                            throw new RemoteException(e.getMessage());
474                    }
475            }
476    
477            /**
478            * Removes the matching roles associated with the user. The user is
479            * reindexed after the roles are removed.
480            *
481            * @param userId the primary key of the user
482            * @param roleIds the primary keys of the roles
483            * @throws PortalException if a user with the primary key could not be
484            found, if the user did not have permission to remove members from
485            a role, or if a role with any one of the primary keys could not
486            be found
487            * @throws SystemException if a system exception occurred
488            */
489            public static void unsetUserRoles(long userId, long[] roleIds)
490                    throws RemoteException {
491                    try {
492                            RoleServiceUtil.unsetUserRoles(userId, roleIds);
493                    }
494                    catch (Exception e) {
495                            _log.error(e, e);
496    
497                            throw new RemoteException(e.getMessage());
498                    }
499            }
500    
501            /**
502            * Updates the role with the primary key.
503            *
504            * @param roleId the primary key of the role
505            * @param name the role's new name
506            * @param titleMap the new localized titles (optionally <code>null</code>)
507            to replace those existing for the role
508            * @param descriptionMap the new localized descriptions (optionally
509            <code>null</code>) to replace those existing for the role
510            * @param subtype the role's new subtype (optionally <code>null</code>)
511            * @param serviceContext the service context to be applied (optionally
512            <code>null</code>). Can set the expando bridge attributes for the
513            role.
514            * @return the role with the primary key
515            * @throws PortalException if the user did not have permission to update the
516            role, if a role with the primary could not be found, or if the
517            role's name was invalid
518            * @throws SystemException if a system exception occurred
519            */
520            public static com.liferay.portal.model.RoleSoap updateRole(long roleId,
521                    java.lang.String name, java.lang.String[] titleMapLanguageIds,
522                    java.lang.String[] titleMapValues,
523                    java.lang.String[] descriptionMapLanguageIds,
524                    java.lang.String[] descriptionMapValues, java.lang.String subtype,
525                    com.liferay.portal.service.ServiceContext serviceContext)
526                    throws RemoteException {
527                    try {
528                            Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(titleMapLanguageIds,
529                                            titleMapValues);
530                            Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(descriptionMapLanguageIds,
531                                            descriptionMapValues);
532    
533                            com.liferay.portal.model.Role returnValue = RoleServiceUtil.updateRole(roleId,
534                                            name, titleMap, descriptionMap, subtype, serviceContext);
535    
536                            return com.liferay.portal.model.RoleSoap.toSoapModel(returnValue);
537                    }
538                    catch (Exception e) {
539                            _log.error(e, e);
540    
541                            throw new RemoteException(e.getMessage());
542                    }
543            }
544    
545            private static Log _log = LogFactoryUtil.getLog(RoleServiceSoap.class);
546    }