1 | package org.hplr.user.core.usecases.service; | |
2 | ||
3 | import lombok.RequiredArgsConstructor; | |
4 | import lombok.extern.slf4j.Slf4j; | |
5 | import org.hplr.user.core.model.Player; | |
6 | import org.hplr.user.core.model.PlayerSnapshot; | |
7 | import org.hplr.user.core.usecases.port.dto.PlayerSelectDto; | |
8 | import org.hplr.user.core.usecases.port.in.GetAllPlayerListUseCaseInterface; | |
9 | import org.hplr.user.core.usecases.port.out.query.SelectAllPlayerListQueryInterface; | |
10 | import org.hplr.library.exception.HPLRValidationException; | |
11 | import org.springframework.stereotype.Service; | |
12 | ||
13 | import java.util.List; | |
14 | import java.util.NoSuchElementException; | |
15 | import java.util.Objects; | |
16 | ||
17 | @Service | |
18 | @Slf4j | |
19 | @RequiredArgsConstructor | |
20 | public class GetAllPlayerListUseCaseService implements GetAllPlayerListUseCaseInterface { | |
21 | ||
22 | final SelectAllPlayerListQueryInterface selectAllPlayerListQueryInterface; | |
23 | ||
24 | ||
25 | @Override | |
26 | public List<PlayerSnapshot> getAllPlayerList() { | |
27 | List<PlayerSelectDto> playerSelectDtoList = | |
28 | selectAllPlayerListQueryInterface.selectAllPlayerList(); | |
29 | ||
30 | List<Player> playerList = playerSelectDtoList.stream().map(player -> { | |
31 | try{ | |
32 |
1
1. lambda$getAllPlayerList$0 : replaced return value with null for org/hplr/user/core/usecases/service/GetAllPlayerListUseCaseService::lambda$getAllPlayerList$0 → KILLED |
return Player.fromDto(player); |
33 | } catch (HPLRValidationException | NoSuchElementException e){ | |
34 | log.error("Could not map player: {}",player.playerId()); | |
35 | return null; | |
36 | } | |
37 | }).filter(Objects::nonNull).toList(); | |
38 | ||
39 |
1
1. getAllPlayerList : replaced return value with Collections.emptyList for org/hplr/user/core/usecases/service/GetAllPlayerListUseCaseService::getAllPlayerList → KILLED |
return playerList.stream().map(Player::toSnapshot).toList(); |
40 | } | |
41 | } | |
Mutations | ||
32 |
1.1 |
|
39 |
1.1 |