You can use the RoleLocalServiceUtil.getRole(companyId, name) method to get the role object (instance of RoleModel ). If you need an identifier, call role.getRoleId() .
The company identifier can be obtained by calling ThemeDisplay.getCompanyId() .
source share