001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service;
022:
023: /**
024: * <a href="RoleServiceUtil.java.html"><b><i>View Source</i></b></a>
025: *
026: * <p>
027: * ServiceBuilder generated this class. Modifications in this class will be
028: * overwritten the next time is generated.
029: * </p>
030: *
031: * <p>
032: * This class provides static methods for the
033: * <code>com.liferay.portal.service.RoleService</code>
034: * bean. The static methods of this class calls the same methods of the bean
035: * instance. It's convenient to be able to just write one line to call a method
036: * on a bean instead of writing a lookup call and a method call.
037: * </p>
038: *
039: * <p>
040: * <code>com.liferay.portal.service.RoleServiceFactory</code>
041: * is responsible for the lookup of the bean.
042: * </p>
043: *
044: * @author Brian Wing Shun Chan
045: *
046: * @see com.liferay.portal.service.RoleService
047: * @see com.liferay.portal.service.RoleServiceFactory
048: *
049: */
050: public class RoleServiceUtil {
051: public static com.liferay.portal.model.Role addRole(
052: java.lang.String name, java.lang.String description,
053: int type) throws com.liferay.portal.PortalException,
054: com.liferay.portal.SystemException,
055: java.rmi.RemoteException {
056: RoleService roleService = RoleServiceFactory.getService();
057:
058: return roleService.addRole(name, description, type);
059: }
060:
061: public static void addUserRoles(long userId, long[] roleIds)
062: throws com.liferay.portal.PortalException,
063: com.liferay.portal.SystemException,
064: java.rmi.RemoteException {
065: RoleService roleService = RoleServiceFactory.getService();
066:
067: roleService.addUserRoles(userId, roleIds);
068: }
069:
070: public static void deleteRole(long roleId)
071: throws com.liferay.portal.PortalException,
072: com.liferay.portal.SystemException,
073: java.rmi.RemoteException {
074: RoleService roleService = RoleServiceFactory.getService();
075:
076: roleService.deleteRole(roleId);
077: }
078:
079: public static com.liferay.portal.model.Role getGroupRole(
080: long companyId, long groupId)
081: throws com.liferay.portal.PortalException,
082: com.liferay.portal.SystemException,
083: java.rmi.RemoteException {
084: RoleService roleService = RoleServiceFactory.getService();
085:
086: return roleService.getGroupRole(companyId, groupId);
087: }
088:
089: public static java.util.List getGroupRoles(long groupId)
090: throws com.liferay.portal.PortalException,
091: com.liferay.portal.SystemException,
092: java.rmi.RemoteException {
093: RoleService roleService = RoleServiceFactory.getService();
094:
095: return roleService.getGroupRoles(groupId);
096: }
097:
098: public static com.liferay.portal.model.Role getRole(long roleId)
099: throws com.liferay.portal.PortalException,
100: com.liferay.portal.SystemException,
101: java.rmi.RemoteException {
102: RoleService roleService = RoleServiceFactory.getService();
103:
104: return roleService.getRole(roleId);
105: }
106:
107: public static com.liferay.portal.model.Role getRole(long companyId,
108: java.lang.String name)
109: throws com.liferay.portal.PortalException,
110: com.liferay.portal.SystemException,
111: java.rmi.RemoteException {
112: RoleService roleService = RoleServiceFactory.getService();
113:
114: return roleService.getRole(companyId, name);
115: }
116:
117: public static java.util.List getUserGroupRoles(long userId,
118: long groupId) throws com.liferay.portal.PortalException,
119: com.liferay.portal.SystemException,
120: java.rmi.RemoteException {
121: RoleService roleService = RoleServiceFactory.getService();
122:
123: return roleService.getUserGroupRoles(userId, groupId);
124: }
125:
126: public static java.util.List getUserRelatedRoles(long userId,
127: java.util.List groups)
128: throws com.liferay.portal.PortalException,
129: com.liferay.portal.SystemException,
130: java.rmi.RemoteException {
131: RoleService roleService = RoleServiceFactory.getService();
132:
133: return roleService.getUserRelatedRoles(userId, groups);
134: }
135:
136: public static java.util.List getUserRoles(long userId)
137: throws com.liferay.portal.PortalException,
138: com.liferay.portal.SystemException,
139: java.rmi.RemoteException {
140: RoleService roleService = RoleServiceFactory.getService();
141:
142: return roleService.getUserRoles(userId);
143: }
144:
145: public static boolean hasUserRole(long userId, long companyId,
146: java.lang.String name, boolean inherited)
147: throws com.liferay.portal.PortalException,
148: com.liferay.portal.SystemException,
149: java.rmi.RemoteException {
150: RoleService roleService = RoleServiceFactory.getService();
151:
152: return roleService.hasUserRole(userId, companyId, name,
153: inherited);
154: }
155:
156: public static boolean hasUserRoles(long userId, long companyId,
157: java.lang.String[] names, boolean inherited)
158: throws com.liferay.portal.PortalException,
159: com.liferay.portal.SystemException,
160: java.rmi.RemoteException {
161: RoleService roleService = RoleServiceFactory.getService();
162:
163: return roleService.hasUserRoles(userId, companyId, names,
164: inherited);
165: }
166:
167: public static void unsetUserRoles(long userId, long[] roleIds)
168: throws com.liferay.portal.PortalException,
169: com.liferay.portal.SystemException,
170: java.rmi.RemoteException {
171: RoleService roleService = RoleServiceFactory.getService();
172:
173: roleService.unsetUserRoles(userId, roleIds);
174: }
175:
176: public static com.liferay.portal.model.Role updateRole(long roleId,
177: java.lang.String name, java.lang.String description)
178: throws com.liferay.portal.PortalException,
179: com.liferay.portal.SystemException,
180: java.rmi.RemoteException {
181: RoleService roleService = RoleServiceFactory.getService();
182:
183: return roleService.updateRole(roleId, name, description);
184: }
185: }
|