From 7128d212861a582f8f12f33ffca4a7402af13586 Mon Sep 17 00:00:00 2001 From: uo287545 Date: Mon, 8 Apr 2024 22:41:28 +0200 Subject: [PATCH] Removed unnecessary content from the Domain model --- docs/src/08_concepts.adoc | 304 -------------------------------------- 1 file changed, 304 deletions(-) diff --git a/docs/src/08_concepts.adoc b/docs/src/08_concepts.adoc index 2aec4db4..a6b8a460 100644 --- a/docs/src/08_concepts.adoc +++ b/docs/src/08_concepts.adoc @@ -90,316 +90,12 @@ class RestApiAccessLog { - details: String } -interface JsonEntity { - + toJson(): JsonNode -} - -interface PlayerService { - + addNewPlayer(dto: PlayerDto): Player - + getUsers(): List - + getUser(id: Long): Optional - + getUserByEmail(email: String): Optional - + getUserByUsername(username: String): Optional - + getUsersByRole(role: String): List - + generateapiKey(player: Player): void -} - -interface RoleService { - + addRole(role: RoleDto): Role - + getRole(name: String): Role - + getRoles(): List -} - -interface AnswerService { - + addNewAnswer(answer: Answer): void - + getAnswerPerQuestion(question: Question): List - + getAnswer(id: Long): Optional -} - -interface ApiKeyService { - + createApiKey(forPlayer: Player): ApiKey - + getApiKey(apiKey: String): ApiKey -} - -interface CategoryService { - + addNewCategory(category: Category): void - + getAllCategories(): List - + getCategory(id: Long): Optional - + getCategoryByName(geography: String): Category -} - -interface QuestionService { - + addNewQuestion(question: Question): void - + getAllQuestions(): List - + getQuestion(id: Long): Optional -} - -interface RestApiService { - + getPlayers(params: Map): List - + logAccess(apiKey: ApiKey, path: String, params: Map): void - + getQuestions(params: Map): List -} - -class CustomUserDetailsService { - - playerRepository: PlayerRepository - + loadUserByUsername(username: String): UserDetails - + mapRolesToAuthorities(roles: Collection): Collection< ? extends GrantedAuthority> -} - -class InsertSampleDataService { - - playerService: PlayerService - - questionService: QuestionService - - categoryService: CategoryService - - questionRepository: QuestionRepository - - gameSessionRepository: GameSessionRepository - + insertSampleQuestions(): void -} - -class PlayerServiceImpl { - - playerRepository: PlayerRepository - - roleService: RoleService - - passwordEncoder: PasswordEncoder - + addNewPlayer(dto: PlayerDto): Player - + getUsers(): List - + getUser(id: Long): Optional - + getUserByEmail(email: String): Optional - + getUserByUsername(username: String): Optional - + getUsersByRole(role: String): List - + generateApiKey(player: Player): void -} - -class RoleServiceImpl { - - roleRepository: RoleRepository - + addRole(role: RoleDto): Role - + getRole(name: String): Role - + getRoles(): List -} - -class AnswerServiceImpl { - - answerRepository: AnswerRepository - + addNewAnswer(answer: Answer): void - + getAnswersPerQuestion(question: Question): List - + getAnswer(id: Long): Optional -} - -class ApiKeyServiceImpl { - - apiKeyRepository: ApiKeyRepository - + createApiKey(forPlayer: Player): ApiKey - + getApiKey(apiKey: String): ApiKey -} - -class CategoryServiceImpl { - - categoryRepository: CategoryRepository - + addNewCategory(category: Category): void - + getAllCategories(): List - + getCategory(id: Long): Optional - + getCategoryByName(name: String): Category - + init(): void -} - -class QuestionServiceImpl { - - questionRepository: QuestionRepository - + addNewQuestion(question: Question): void - + getAllQuestions(): List - + getQuestion(id: Long): Optional -} - -class RestApiServiceImpl { - - playerService: PlayerService - - restApiLogRepository: RestApiLogRepository - - questionService: QuestionService - + getPlayers(params: Map): List - + logAccess(apiKey: ApiKey, path: String, params: Map): void - + getQuestions(params: Map): List -} - -class PlayerDto { - - username: String - - email: String - - password: String - - passwordConfirm: String - - roles: String[] -} - -class RoleDto { - - name: String -} - -class AbstractGeographyGenerator { - + getCategory(): Category -} - -class BorderQuestionGenerator { - - usedCountries: Set - + getAllBorderingCountries(resultsNode: JsonNode, correctCountry: String): List - + selectRandomIncorrectBorderingCountries(allBorderingCountries: List, correctCountry: String, count: int): List - + generateOptions(results: JsonNode, result: JsonNode): List - + generateCorrectAnswer(result: JsonNode): String - + getQuestionSubject(result: JsonNode): String - + getQuery(): String -} - -class CapitalQuestionGenerator { - + getQuery(): String - + getAllCapitals(resultsNode: JsonNode, correctCapital: String): List - + selectRandomIncorrectCapitals(allCapitals: List, correctCapital: String, count: int): List - + generateOptions(results: JsonNode, result: JsonNode): List - + generateCorrectAnswer(result: JsonNode): String - + getQuestionSubject(result: JsonNode): String -} - -class ContinentQuestionGeneration { - + getAllContinents(resultsNode: JsonNode, correctContinent: String): List - + selectRandomIncorrectContinents(allContinents: List, correctContinent: String, count: int): List - + generateOptions(results: JsonNode, result: JsonNode): List - + generateCorrectAnswer(result: JsonNode): String - + getQuestionSubject(result: JsonNode): String - + getQuery(): String -} - -class AbstractQuestionGenerator { - - questions: List - - categoryService: CategoryService - - query: String - - statement: String - + questionGenerator(statement: String, options: List, correctAnswer: String, category: Category): void - + getQuestions(): List - + generateOptions(results: JsonNode, result: JsonNode): List - + generateCorrectAnswer(result: JsonNode): String - + getQuestionSubject(result: JsonNode): String -} - -interface QuestionGenerator { - + getQuery(): String - + getQuestions(): List - + getCategory(): Category -} - -class QuestionGeneratorTestController { - + qgen: CapitalQuestionGenerator - + test(): void -} - -class SignUpValidator { - - playerService: PlayerService - + supports(clazz: Class): boolean - + validate(target: Object, errors: Errors): void -} - -JsonEntity <|.. Answer -JsonEntity <|.. Category -JsonEntity <|.. GameSession -JsonEntity <|.. Player -JsonEntity <|.. Question -AnswerService <|.. AnswerServiceImpl -ApiKeyService <|.. ApiKeyServiceImpl -CategoryService <|.. CategoryServiceImpl -PlayerService <|.. PlayerServiceImpl -QuestionService <|.. QuestionServiceImpl -RestApiService <|.. RestApiServiceImpl -RoleService <|.. RoleServiceImpl -AbstractGeographyGenerator --|> AbstractQuestionGenerator -BorderQuestionGenerator --|> AbstractGeographyGenerator -CapitalQuestionGenerator --|> AbstractGeographyGenerator -ContinentQuestionGeneration --|> AbstractGeographyGenerator -QuestionGenerator <|.. AbstractQuestionGenerator -RoleService ..> RoleDto Role "*" - "*" Player -AnswerService ..> Answer -AnswerService ..> Question -ApiKeyService ..> Player -CategoryService ..> Category -PlayerService ..> PlayerDto -PlayerService ..> Player -QuestionService ..> Question -RestApiService ..> ApiKey -CustomUserDetailsService ..> Player -CustomUserDetailsService ..> Role -InsertSampleDataService "1" *- "1" PlayerService -InsertSampleDataService "1" *- "1" QuestionService -InsertSampleDataService "1" *- "1" CategoryService -InsertSampleDataService ..> PlayerDto -InsertSampleDataService ..> GameSession -InsertSampleDataService ..> QuestionGenerator -PlayerServiceImpl "1" *- "1" RoleService -PlayerServiceImpl "1" *- "1" PasswordEncoder -PlayerServiceImpl ..> Role -RestApiServiceImpl "1" *- "1" PlayerService -RestApiServiceImpl "1" *- "1" QuestionService -RestApiServiceImpl ..> Player -RestApiServiceImpl ..> Question -RestApiServiceImpl ..> Role Answer "*" - "1" Question ApiKey "1" - "1" Player ApiKey "1" - "*" RestApiAccessLog Category "1" - "*" Question Player "1" - "*" GameSession -QuestionGeneratorTestController "1" *- "1" CapitalQuestionGenerator -QuestionGeneratorTestController ..> Question -AbstractQuestionGenerator "1" - "*" Question -AbstractQuestionGenerator "1" - "1" CategoryService -AbstractQuestionGenerator ..> Category -Validator <|.. SignUpValidator -SignUpValidator "1" - "1" PlayerService -SignUpValidator ..> PlayerDto - -@enduml ----- - -[plantuml, domain-model-2, svg] ----- -@startuml - -class AnswerDto { - - id: Long - - text: String - - correct: boolean -} - -class CategoryDto { - - id: Long - - name: String - - description: String - - questions: List -} - -class QuestionDto { - - id: Long - - statement: String - - options: List - - correctAnswer: AnswerDto - - category: CategoryDto -} - -class SecurityConfig { - - userDetailsService: UserDetailsService - - customAuthenticationFailureHandler: CustomAuthenticationFailureHandler - + passwordEncoder(): PasswordEncoder - + filterChain(http: HttpSecurity): SecurityFilterChain - + configureGlobal(auth: AuthenticationManagerBuilder): void - + isAuthenticated(): boolean -} - -class CustomAuthenticationFailureHandler { - + onAuthenticationFailure(request: HttpServletRequest, responde: HttpServletResponse, exception: AuthenticationException): void -} - -class CustomConfiguration { - + localeResolver(): LocaleResolver - + localeChangeInterceptor(): LocaleChangeInterceptor - + addInterceptors(registry: InterceptorRegistry): void -} - -class WiqEs04bApplication { - + main(args: String[]): void -} - -CategoryDto "1" - "*" QuestionDto -QuestionDto "1" *- "*" AnswerDto -SecurityConfig "1" *- "1" UserDetailsService -SecurityConfig "1" *- "1" CustomAuthenticationFailureHandler -CustomAuthenticationFailureHandler --|> SimpleUrlAuthenticationFailureHandler -WebMvcConfigurer <|.. CustomConfiguration @enduml ----