@startuml 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 Spring participant RegistrationForm == Create Admin == UserDataInitializier -> UserManagement : createAdmin() activate UserDataInitializier activate UserManagement UserManagement -> UserRepository : "save(User:admin)" activate User_admin activate UserRepository UserManagement <-- UserRepository : User_admin deactivate UserRepository UserDataInitializier <-- UserManagement : User deactivate UserManagement deactivate UserDataInitializier deactivate User_admin == Register Customer == Spring -> UserController : register activate UserController activate RegistrationForm activate Spring UserController -> RegistrationForm : getUsername() UserController <-- RegistrationForm : String UserController -> RegistrationForm : getPassword() UserController <-- RegistrationForm : String UserController -> RegistrationForm : getAddress() UserController <-- RegistrationForm : String UserController -> UserManagement : createCustomer(String,String,String) activate UserManagement UserManagement -> UserRepository : "save(User:customer)" activate User_customer activate UserRepository UserManagement <-- UserRepository : User deactivate UserRepository UserController <-- UserManagement : User deactivate UserManagement Spring <-- UserController : "redirect:/login" deactivate UserController deactivate User_customer deactivate RegistrationForm deactivate Spring == Disable Customer by Customer == Spring -> UserController : disableUser() activate User_customer activate Spring activate UserController UserController -> UserManagement : disableUserAccount(UserAccount:userAccount) activate UserManagement UserManagement -> userAccount : getId() activate userAccount UserManagement -> userAccount : UserIdentifier deactivate userAccount UserManagement -> UserRepository : disable(UserIdentifier) activate UserRepository UserManagement <-- UserRepository deactivate UserRepository UserController <-- UserManagement deactivate UserManagement UserController <-- Spring: "redirect:/" deactivate UserController deactivate Spring deactivate User_customer == View Profile == Spring -> UserController : viewProfile(Model:model,UserAccount:userAccount) activate User activate Spring activate UserController UserController -> UserManagement : getUserByAccount(UserAccount:userAccount) activate UserManagement UserManagement -> UserRepository : findAll() activate UserRepository UserManagement <-- UserRepository : Streamble deactivate UserRepository UserController <-- UserManagement : Optional deactivate UserManagement UserController -> Spring : model.addAttribute("user",User:user) UserController <-- Spring : Model Spring <-- UserController : "profile" deactivate Spring deactivate UserController deactivate User == Edit Profile == Spring -> UserController : editProfile(UserAccount:LoggedIn,String:password,String:address,String:username) 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 deactivate UserManagement UserController -> User : [!String:username.isBlank()] setUsername(String:username) UserController <-- User : boolean UserController -> User : [!String:address.isBlank()] setAddress(String:address) UserController <-- User : boolean UserController -> User : [!String:password.isBlank()] setPassword(String:password) UserController <-- User : boolean UserController -> UserManagement : save(User:LoggedIn) UserManagement -> UserRepository : "save(User:LoggedIn)" activate UserRepository UserManagement <-- UserRepository : User deactivate UserRepository UserController <-- UserManagement : User activate UserManagement UserController <-- UserManagement : User deactivate UserManagement Spring <-- UserController : [!username.isBlank()] "redirect:/profile" Spring <-- UserController : "redirect:/profile" deactivate Spring deactivate UserController deactivate User @enduml