SudokuFX
Loading...
Searching...
No Matches
fr.softsf.sudokufx.service.business.PlayerService Class Reference

Service for managing Player entities. More...

+ Collaboration diagram for fr.softsf.sudokufx.service.business.PlayerService:

Public Member Functions

 PlayerService (PlayerRepository playerRepository, PlayerLanguageRepository playerLanguageRepository, OptionsRepository optionsRepository, MenuRepository menuRepository, GameRepository gameRepository, IPlayerMapper playerMapper, JakartaValidator jakartaValidator)
 
PlayerDto getPlayer ()
 Retrieves and validates the first player with a selected game.
 
PlayerDto updatePlayer (PlayerDto dto)
 Updates an existing player and its associated entities (Game, GameLevel, Grid) in the database based on the provided PlayerDto.
 

Private Attributes

final GameRepository gameRepository
 
final JakartaValidator jakartaValidator
 
final MenuRepository menuRepository
 
final OptionsRepository optionsRepository
 
final PlayerLanguageRepository playerLanguageRepository
 
final IPlayerMapper playerMapper
 
final PlayerRepository playerRepository
 

Detailed Description

Service for managing Player entities.

Provides retrieval and update operations on players, mapping entities to PlayerDto and validating DTOs with JakartaValidator before and after persistence.

Methods:

  • getPlayer(): retrieves the first selected player with a selected game, read-only transactional.
  • updatePlayer(PlayerDto): updates an existing player, validates input and output DTOs, fully transactional.

Throws NullPointerException for null DTOs, IllegalArgumentException if entities are missing, and jakarta.validation.ConstraintViolationException on validation failures.

Constructor & Destructor Documentation

◆ PlayerService()

fr.softsf.sudokufx.service.business.PlayerService.PlayerService ( PlayerRepository playerRepository,
PlayerLanguageRepository playerLanguageRepository,
OptionsRepository optionsRepository,
MenuRepository menuRepository,
GameRepository gameRepository,
IPlayerMapper playerMapper,
JakartaValidator jakartaValidator )

Member Function Documentation

◆ getPlayer()

PlayerDto fr.softsf.sudokufx.service.business.PlayerService.getPlayer ( )

Retrieves and validates the first player with a selected game.

The player must have a non-null selected game and pass all Jakarta Bean Validation constraints.

Returns
a validated PlayerDto
Exceptions
IllegalArgumentExceptionif no matching player is found
ConstraintViolationExceptionif validation fails on the mapped PlayerDto
+ Here is the call graph for this function:

◆ updatePlayer()

PlayerDto fr.softsf.sudokufx.service.business.PlayerService.updatePlayer ( PlayerDto dto)

Updates an existing player and its associated entities (Game, GameLevel, Grid) in the database based on the provided PlayerDto.

All updates are transactional and validated before and after persistence.

Parameters
dtothe player data to update; must not be null
Returns
the updated and validated PlayerDto
Exceptions
NullPointerExceptionif dto is null
IllegalArgumentExceptionif any referenced entity does not exist
ConstraintViolationExceptionif validation fails on the DTO
+ Here is the call graph for this function:

Member Data Documentation

◆ gameRepository

final GameRepository fr.softsf.sudokufx.service.business.PlayerService.gameRepository
private

◆ jakartaValidator

final JakartaValidator fr.softsf.sudokufx.service.business.PlayerService.jakartaValidator
private

◆ menuRepository

final MenuRepository fr.softsf.sudokufx.service.business.PlayerService.menuRepository
private

◆ optionsRepository

final OptionsRepository fr.softsf.sudokufx.service.business.PlayerService.optionsRepository
private

◆ playerLanguageRepository

final PlayerLanguageRepository fr.softsf.sudokufx.service.business.PlayerService.playerLanguageRepository
private

◆ playerMapper

final IPlayerMapper fr.softsf.sudokufx.service.business.PlayerService.playerMapper
private

◆ playerRepository

final PlayerRepository fr.softsf.sudokufx.service.business.PlayerService.playerRepository
private

The documentation for this class was generated from the following file: