Update docs for the user package

This commit is contained in:
Denis Natusch 2024-01-14 12:13:18 +01:00
parent de900d2eeb
commit c5653f85e6
No known key found for this signature in database
GPG key ID: 5E57BD8EDACFA985
4 changed files with 142 additions and 139 deletions

View file

@ -1,32 +1,28 @@
' SPDX-License-Identifier: AGPL-3.0-or-later ' SPDX-License-Identifier: AGPL-3.0-or-later
' SPDX-FileCopyrightText: 2023 swt23w23 ' SPDX-FileCopyrightText: 2023-2024 swt23w23
@startuml @startuml
participant User participant User
participant "User:customer" as User_customer
participant "User:admin" as User_admin
participant "UserAccount:userAccount" as userAccount
participant UserController
participant UserManagement
participant UserRepository
participant UserDataInitializier participant UserDataInitializier
participant Spring participant UserController
participant UserRepository
participant UserAccount
participant UserManagement
participant RegistrationForm participant RegistrationForm
participant Spring
== Create Admin == == Create Admin ==
UserDataInitializier -> UserManagement : createAdmin() UserDataInitializier -> UserManagement : createAdmin()
activate UserDataInitializier activate UserDataInitializier
activate UserManagement activate UserManagement
UserManagement -> UserRepository : "save(User:admin)" UserManagement -> UserRepository : "save(admin:User)"
activate User_admin
activate UserRepository activate UserRepository
UserManagement <-- UserRepository : User_admin UserManagement <-- UserRepository : User
deactivate UserRepository deactivate UserRepository
UserDataInitializier <-- UserManagement : User UserDataInitializier <-- UserManagement : User
deactivate UserManagement deactivate UserManagement
deactivate UserDataInitializier deactivate UserDataInitializier
deactivate User_admin
== Register Customer == == Register Customer ==
@ -36,16 +32,21 @@ activate RegistrationForm
activate Spring activate Spring
UserController -> RegistrationForm : getUsername() UserController -> RegistrationForm : getUsername()
UserController <-- RegistrationForm : String UserController <-- RegistrationForm : String
UserController -> RegistrationForm : getPassword() UserController -> UserManagement : getUsernameByName(username:String)
activate UserManagement
UserController <-- UserManagement : boolean
deactivate UserManagement
UserController -> RegistrationForm : getUsername()
UserController <-- RegistrationForm : String UserController <-- RegistrationForm : String
UserController -> RegistrationForm : getAddress() UserController -> RegistrationForm : getAddress()
UserController <-- RegistrationForm : String UserController <-- RegistrationForm : String
UserController -> RegistrationForm : getPassword()
UserController <-- RegistrationForm : String
UserController -> RegistrationForm : getFullName() UserController -> RegistrationForm : getFullName()
UserController <-- RegistrationForm : String UserController <-- RegistrationForm : String
UserController -> UserManagement : createCustomer(String,String,String,String) UserController -> UserManagement : createCustomer(username:String, address:String, password:String, fullname:String)
activate UserManagement activate UserManagement
UserManagement -> UserRepository : "save(User:customer)" UserManagement -> UserRepository : "save(customer:User)"
activate User_customer
activate UserRepository activate UserRepository
UserManagement <-- UserRepository : User UserManagement <-- UserRepository : User
deactivate UserRepository deactivate UserRepository
@ -53,23 +54,21 @@ UserController <-- UserManagement : User
deactivate UserManagement deactivate UserManagement
Spring <-- UserController : "redirect:/login" Spring <-- UserController : "redirect:/login"
deactivate UserController deactivate UserController
deactivate User_customer
deactivate RegistrationForm deactivate RegistrationForm
deactivate Spring deactivate Spring
== Disable Customer by Customer == == Disable Customer by Customer ==
Spring -> UserController : disableUser(UserAccount:userAccount) Spring -> UserController : disableUser(userAccount:UserAccount)
activate User_customer
activate Spring activate Spring
activate UserController activate UserController
UserController -> UserManagement : disableUserAccount(UserAccount:userAccount) UserController -> UserManagement : disableUserAccount(userAccount:UserAccount)
activate UserManagement activate UserManagement
UserManagement -> userAccount : getId() UserManagement -> UserAccount : getId()
activate userAccount activate UserAccount
UserManagement -> userAccount : UserIdentifier UserManagement <-- UserAccount : Long
deactivate userAccount deactivate UserAccount
UserManagement -> UserRepository : disable(UserIdentifier) UserManagement -> UserRepository : disable(id:Long)
activate UserRepository activate UserRepository
UserManagement <-- UserRepository UserManagement <-- UserRepository
deactivate UserRepository deactivate UserRepository
@ -78,65 +77,37 @@ deactivate UserManagement
UserController <-- Spring: "redirect:/" UserController <-- Spring: "redirect:/"
deactivate UserController deactivate UserController
deactivate Spring deactivate Spring
deactivate User_customer
== View Profile == == View Profile ==
Spring -> UserController : viewProfile(Model:model,UserAccount:userAccount) Spring -> UserController : viewProfile(model:Model, userAccount:UserAccount)
activate User
activate Spring activate Spring
activate UserController activate UserController
UserController -> UserManagement : getUserByAccount(UserAccount:userAccount) UserController -> UserManagement : getUserByAccount(userAccount:UserAccount)
activate UserManagement activate UserManagement
UserManagement -> UserRepository : findAll() UserManagement -> UserRepository : findAll()
activate UserRepository activate UserRepository
UserManagement <-- UserRepository : Streamble UserManagement <-- UserRepository : Streamble
deactivate UserRepository deactivate UserRepository
UserManagement -> User : getUserAccount()
activate User
UserManagement <-- User : UserAccount
deactivate User
... Several similar operations ...
UserController <-- UserManagement : Optional<User> UserController <-- UserManagement : Optional<User>
UserController -> User : getUsername() UserController -> User : getUsername()
activate User
UserController <-- User : String UserController <-- User : String
UserController -> User : getFullName() UserController -> User : getFullName()
UserController <-- User : String UserController <-- User : String
UserController -> User : getAddress() UserController -> User : getAddress()
UserController <-- User : String UserController <-- User : String
deactivate User
deactivate UserManagement deactivate UserManagement
UserController -> Spring : model.addAttribute("profileForm",ProfileForm) UserController -> Spring : model.addAttribute("profileForm",ProfileForm)
UserController <-- Spring : Model UserController <-- Spring : Model
Spring <-- UserController : "profile" Spring <-- UserController : "profile"
deactivate Spring deactivate Spring
deactivate UserController deactivate UserController
deactivate User
== Edit Profile ==
Spring -> UserController : editProfile(UserAccount:LoggedIn,ProfileForm:form,Erros:result,Model:model)
activate User
activate Spring
activate UserController
UserController -> UserManagement : getUserByAccount(UserAccount:LoggedIn)
activate UserManagement
UserManagement -> UserRepository : findAll()
activate UserRepository
UserManagement <-- UserRepository : Streamble
deactivate UserRepository
UserController <-- UserManagement : Optional<User:user>
deactivate UserManagement
UserController -> User : setUsername(String:username)
UserController <-- User : boolean
UserController -> User : setAddress(String:address)
UserController <-- User : boolean
UserController -> User : [!form.getUsername().equals(user.getUsername())] setPassword(String:password)
UserController <-- User : boolean
UserController -> UserManagement : save(User:LoggedIn)
activate UserManagement
UserManagement -> UserRepository : save(User:LoggedIn)
activate UserRepository
UserManagement <-- UserRepository : User
deactivate UserRepository
UserController <-- UserManagement : User
deactivate UserManagement
deactivate Spring
deactivate UserController
deactivate User
@enduml @enduml

Binary file not shown.

View file

@ -1,7 +1,6 @@
' SPDX-License-Identifier: AGPL-3.0-or-later ' SPDX-License-Identifier: AGPL-3.0-or-later
' SPDX-FileCopyrightText: 2023 swt23w23 ' SPDX-FileCopyrightText: 2023-2024 swt23w23
@startuml @startuml
'maybe for sneidc since he did videoshop:cahnge-password'
skinparam linetype ortho skinparam linetype ortho
skinparam groupInheritance 2 skinparam groupInheritance 2
@ -9,48 +8,50 @@ package Salespoint {
interface UserAccountManagement interface UserAccountManagement
interface DataInitalizer interface DataInitalizer
class UserAccount class UserAccount
class AbstractAggregateRoot
class Role class Role
class Errors
} }
package Spring { package Spring {
interface Validator
class CrudRepository class CrudRepository
class Streamable class Streamable
class WebDataBinder class WebDataBinder
class Errors class Errors
interface Validator class ValidationUtils
}
package slf4j {
class Logger
} }
package catering.users { package catering.users {
class User { class User {
- id : Long
- address : String - address : String
- fullName : String - fullName : String
+ User(userAccount : UserAccount, address : String, fullName : String)
+ User() + User()
+ User(userAccount:UserAccount, address:String, fullName:String)
+ getAddress() : String + getAddress() : String
+ setAddress(address:String) : String + setAddress(address:String) : boolean
+ getFullName() : String + getFullName() : String
+ setFullName(fullName:String) : String + setFullName(fullName:String) : boolean
+ getUsername() : String + getUsername() : String
+ setUsername(username:String) : boolean + setUsername(username:String) : boolean
+ getUserAccount() : UserAccount + getUserAccount() : UserAccount
+ getId() : UserIdentifier + getId() : Long
+ isEnabled() : boolean + isEnabled() : boolean
+ hasRole(role:String) : boolean + hasRole(role:String) : boolean
+ equals(obj:Object) : boolean
+ hashCode() : int + hashCode() : int
+ equals(obj:Object) : boolean
} }
User ..> WebDataBinder
User --> UserAccount : "-userAccount" User --> UserAccount : "-userAccount"
User --|> AbstractAggregateRoot : <<extends>>
class UserController { class UserController {
+ UserController(userManagement:UserManagement) + UserController(userManagement:UserManagement)
- initProfileBinder(binder:WebDataBinder) : void - initProfileBinder(binder:WebDataBinder) : void
- initRegistrationBinder(binder:WebDataBinder) : void - initRegistrationBinder(binder:WebDataBinder) : void
- initAdminBinder(binder:WebDataBinder) : void
+ unauthorized() : String + unauthorized() : String
+ register() : String + register(model:Model) : String
+ register(form:RegistrationForm, result:Errors) : String + register(form:RegistrationForm, result:Errors) : String
+ loginPage() : String + loginPage() : String
+ viewProfile(model:Model, userAccount:UserAccount) : String + viewProfile(model:Model, userAccount:UserAccount) : String
@ -59,57 +60,88 @@ package catering.users {
+ getCustomer(model:Model) : String + getCustomer(model:Model) : String
+ removeCustomer(user:User) : String + removeCustomer(user:User) : String
+ editCustomer(user:User, model:Model) : String + editCustomer(user:User, model:Model) : String
+ updateCustomer(user:User,username:String,address:String) + updateCustomer(user:User, form:AdminForm, result:Errors) : String
} }
UserController --> UserManagement : "-userManagement" UserController --> UserManagement : "-userManagement"
UserController ..> User UserController ..> User
UserController ..> UserAccount UserController ..> UserAccount
UserController ..> Role UserController ..> Role
UserController ..> UserForm UserController ..> ProfileForm
UserController ..> RegistrationForm
UserController ..> AdminForm
UserController ..> FormValidator UserController ..> FormValidator
UserController ..> WebDataBinder UserController ..> WebDataBinder
class UserManagement { class UserManagement {
+ UserManagement(users:UserRepository, userAccounts:UserAccountManagement) + UserManagement(users:UserRepository, userAccounts:UserAccountManagement)
+ createCustomer(name:String, password:String, address:String) : User + createCustomer(username:String, address:String, password:String, fullName:String) : User
+ createAdmin(name:String, password:String, address:String,fullName:String) : User + createAdmin(name:String, password:String, address:String,fullName:String) : User
+ save(user:User) : User + save(user:User) : User
+ setPassword(password:String, userAccount:UserAccount): boolean
+ getUsers() : UserRepository + getUsers() : UserRepository
+ disableUserAccount(userAccount:UserAccount) : void + disableUserAccount(userAccount:UserAccount) : void
+ getUserByAccount(userAccount:UserAccount) : Optional<User> + getUserByAccount(userAccount:UserAccount) : Optional<User>
+ getUserByName(username:String) : Optional<User>
} }
UserManagement --> UserAccountManagement : "-userAccounts" UserManagement --> UserAccountManagement : "-userAccounts"
UserManagement --> UserRepository : "-users" UserManagement --> UserRepository : "-users"
UserManagement ..> User UserManagement ..> User
UserManagement ..> UserAccount
class UserDataInitalizer { class UserDataInitalizer {
- userManagement : UserManagement - userManagement : UserManagement
+ UserDataInitalizer(userManagement : UserManagement) + UserDataInitalizer(userManagement : UserManagement)
+ initalize() : void + initalize() : void
} }
UserDataInitalizer --> UserManagement : "-userManagement" UserDataInitalizer --> UserManagement : "-userManagement"
UserDataInitalizer --> UserAccountManagement : "-userAccountManagement"
UserDataInitalizer --> Logger : "-LOG"
UserDataInitalizer ..|> DataInitalizer UserDataInitalizer ..|> DataInitalizer
class UserRepository { class UserRepository {
+ findAll() : Streamable<User> + findAll() : Streamable<User>
} }
UserRepository --|> CrudRepository : <<extends>>
UserRepository ..|> Streamable UserRepository ..|> Streamable
UserRepository o-- User UserRepository o-- User
UserRepository --|> CrudRepository
class UserForm { class UserForm {
- username : String - username : String
- password: String
- address : String - address : String
- password: String - fullName : String
+ UserForm(username:String,address:String,fullName:String,password:String) + UserForm(username:String, address:String, fullName:String)
+ getUsername() : String + getUsername() : String
+ getAddress() : String + getAddress() : String
+ getFullName() : String + getFullName() : String
+ getPassword() : String
} }
class FormValidator { abstract class UserFormWithPassword <<static>> {
- password: String
+ UserFormWithPassword(username:String, address:String, fullName:String, password:String)
+ getPassword() : String
+ validatePassword(e:Errors) : void
+ {abstract} validatePasswordGeneric(e:Errors) : void
}
UserFormWithPassword --> Errors
UserFormWithPassword --> ValidationUtils
UserFormWithPassword ----+ UserForm
UserFormWithPassword --|> UserForm
class RegistrationForm extends UserFormWithPassword {
+ RegistrationForm(username:String, address:String, fullName:String, password:String)
+ {static} empty() : RegistrationForm
}
RegistrationForm --+ UserFormWithPassword
class ProfileForm {
+ ProfileForm(username:String, address:String, fullName:String, password:String)
}
ProfileForm --+ UserFormWithPassword
ProfileForm --|> UserFormWithPassword
class AdminForm {
+ AdminForm(username:String, address:String, fullName:String)
}
AdminForm --+ UserForm
AdminForm --|> UserForm
class FormValidator<F extends UserForm> {
supports(c:Class<?>) : boolean supports(c:Class<?>) : boolean
validate(o:Object, e:Errors) : void validate(o:Object, e:Errors) : void
} }
FormValidator ..> Validator FormValidator ..|> Validator
FormValidator --> Errors FormValidator ..> Errors
FormValidator ..> ValidationUtils
} }
@enduml @enduml

BIN
src/main/asciidoc/models/design/user.svg (Stored with Git LFS)

Binary file not shown.