private UserEntity ensureRolesFetched ( final UserEntity user ) { if ( user != null ) user . getRoles ( ) . stream ( ) . map ( r -> r . getId ( ) ) . collect ( Collectors . toList ( ) ) ; return user ; }
Make sure the roles have been fetched from the database