1
14
15 package com.liferay.portal.service;
16
17 import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
18 import com.liferay.portal.kernel.util.MethodCache;
19 import com.liferay.portal.kernel.util.ReferenceRegistry;
20
21
41 public class RoleServiceUtil {
42 public static com.liferay.portal.model.Role addRole(java.lang.String name,
43 java.lang.String description, int type)
44 throws com.liferay.portal.PortalException,
45 com.liferay.portal.SystemException {
46 return getService().addRole(name, description, type);
47 }
48
49 public static void addUserRoles(long userId, long[] roleIds)
50 throws com.liferay.portal.PortalException,
51 com.liferay.portal.SystemException {
52 getService().addUserRoles(userId, roleIds);
53 }
54
55 public static void deleteRole(long roleId)
56 throws com.liferay.portal.PortalException,
57 com.liferay.portal.SystemException {
58 getService().deleteRole(roleId);
59 }
60
61 public static com.liferay.portal.model.Role getGroupRole(long companyId,
62 long groupId)
63 throws com.liferay.portal.PortalException,
64 com.liferay.portal.SystemException {
65 return getService().getGroupRole(companyId, groupId);
66 }
67
68 public static java.util.List<com.liferay.portal.model.Role> getGroupRoles(
69 long groupId) throws com.liferay.portal.SystemException {
70 return getService().getGroupRoles(groupId);
71 }
72
73 public static com.liferay.portal.model.Role getRole(long roleId)
74 throws com.liferay.portal.PortalException,
75 com.liferay.portal.SystemException {
76 return getService().getRole(roleId);
77 }
78
79 public static com.liferay.portal.model.Role getRole(long companyId,
80 java.lang.String name)
81 throws com.liferay.portal.PortalException,
82 com.liferay.portal.SystemException {
83 return getService().getRole(companyId, name);
84 }
85
86 public static java.util.List<com.liferay.portal.model.Role> getUserGroupGroupRoles(
87 long userId, long groupId) throws com.liferay.portal.SystemException {
88 return getService().getUserGroupGroupRoles(userId, groupId);
89 }
90
91 public static java.util.List<com.liferay.portal.model.Role> getUserGroupRoles(
92 long userId, long groupId) throws com.liferay.portal.SystemException {
93 return getService().getUserGroupRoles(userId, groupId);
94 }
95
96 public static java.util.List<com.liferay.portal.model.Role> getUserRelatedRoles(
97 long userId, java.util.List<com.liferay.portal.model.Group> groups)
98 throws com.liferay.portal.SystemException {
99 return getService().getUserRelatedRoles(userId, groups);
100 }
101
102 public static java.util.List<com.liferay.portal.model.Role> getUserRoles(
103 long userId) throws com.liferay.portal.SystemException {
104 return getService().getUserRoles(userId);
105 }
106
107 public static boolean hasUserRole(long userId, long companyId,
108 java.lang.String name, boolean inherited)
109 throws com.liferay.portal.PortalException,
110 com.liferay.portal.SystemException {
111 return getService().hasUserRole(userId, companyId, name, inherited);
112 }
113
114 public static boolean hasUserRoles(long userId, long companyId,
115 java.lang.String[] names, boolean inherited)
116 throws com.liferay.portal.PortalException,
117 com.liferay.portal.SystemException {
118 return getService().hasUserRoles(userId, companyId, names, inherited);
119 }
120
121 public static void unsetUserRoles(long userId, long[] roleIds)
122 throws com.liferay.portal.PortalException,
123 com.liferay.portal.SystemException {
124 getService().unsetUserRoles(userId, roleIds);
125 }
126
127 public static com.liferay.portal.model.Role updateRole(long roleId,
128 java.lang.String name,
129 java.util.Map<java.util.Locale, java.lang.String> localeTitlesMap,
130 java.lang.String description, java.lang.String subtype)
131 throws com.liferay.portal.PortalException,
132 com.liferay.portal.SystemException {
133 return getService()
134 .updateRole(roleId, name, localeTitlesMap, description,
135 subtype);
136 }
137
138 public static RoleService getService() {
139 if (_service == null) {
140 _service = (RoleService)PortalBeanLocatorUtil.locate(RoleService.class.getName());
141
142 ReferenceRegistry.registerReference(RoleServiceUtil.class,
143 "_service");
144 MethodCache.remove(RoleService.class);
145 }
146
147 return _service;
148 }
149
150 public void setService(RoleService service) {
151 MethodCache.remove(RoleService.class);
152
153 _service = service;
154
155 ReferenceRegistry.registerReference(RoleServiceUtil.class, "_service");
156 MethodCache.remove(RoleService.class);
157 }
158
159 private static RoleService _service;
160 }