mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-19 21:04:36 +02:00
Update docs for the user package
This commit is contained in:
parent
de900d2eeb
commit
c5653f85e6
|
@ -1,32 +1,28 @@
|
|||
' SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
' SPDX-FileCopyrightText: 2023 swt23w23
|
||||
' SPDX-FileCopyrightText: 2023-2024 swt23w23
|
||||
@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 UserController
|
||||
participant UserRepository
|
||||
participant UserAccount
|
||||
participant UserManagement
|
||||
participant RegistrationForm
|
||||
participant Spring
|
||||
|
||||
== Create Admin ==
|
||||
|
||||
UserDataInitializier -> UserManagement : createAdmin()
|
||||
activate UserDataInitializier
|
||||
activate UserManagement
|
||||
UserManagement -> UserRepository : "save(User:admin)"
|
||||
activate User_admin
|
||||
UserManagement -> UserRepository : "save(admin:User)"
|
||||
activate UserRepository
|
||||
UserManagement <-- UserRepository : User_admin
|
||||
UserManagement <-- UserRepository : User
|
||||
deactivate UserRepository
|
||||
UserDataInitializier <-- UserManagement : User
|
||||
deactivate UserManagement
|
||||
deactivate UserDataInitializier
|
||||
deactivate User_admin
|
||||
|
||||
== Register Customer ==
|
||||
|
||||
|
@ -36,16 +32,21 @@ activate RegistrationForm
|
|||
activate Spring
|
||||
UserController -> RegistrationForm : getUsername()
|
||||
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 : getAddress()
|
||||
UserController <-- RegistrationForm : String
|
||||
UserController -> RegistrationForm : getPassword()
|
||||
UserController <-- RegistrationForm : String
|
||||
UserController -> RegistrationForm : getFullName()
|
||||
UserController <-- RegistrationForm : String
|
||||
UserController -> UserManagement : createCustomer(String,String,String,String)
|
||||
UserController -> UserManagement : createCustomer(username:String, address:String, password:String, fullname:String)
|
||||
activate UserManagement
|
||||
UserManagement -> UserRepository : "save(User:customer)"
|
||||
activate User_customer
|
||||
UserManagement -> UserRepository : "save(customer:User)"
|
||||
activate UserRepository
|
||||
UserManagement <-- UserRepository : User
|
||||
deactivate UserRepository
|
||||
|
@ -53,23 +54,21 @@ 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(UserAccount:userAccount)
|
||||
activate User_customer
|
||||
Spring -> UserController : disableUser(userAccount:UserAccount)
|
||||
activate Spring
|
||||
activate UserController
|
||||
UserController -> UserManagement : disableUserAccount(UserAccount:userAccount)
|
||||
UserController -> UserManagement : disableUserAccount(userAccount:UserAccount)
|
||||
activate UserManagement
|
||||
UserManagement -> userAccount : getId()
|
||||
activate userAccount
|
||||
UserManagement -> userAccount : UserIdentifier
|
||||
deactivate userAccount
|
||||
UserManagement -> UserRepository : disable(UserIdentifier)
|
||||
UserManagement -> UserAccount : getId()
|
||||
activate UserAccount
|
||||
UserManagement <-- UserAccount : Long
|
||||
deactivate UserAccount
|
||||
UserManagement -> UserRepository : disable(id:Long)
|
||||
activate UserRepository
|
||||
UserManagement <-- UserRepository
|
||||
deactivate UserRepository
|
||||
|
@ -78,65 +77,37 @@ deactivate UserManagement
|
|||
UserController <-- Spring: "redirect:/"
|
||||
deactivate UserController
|
||||
deactivate Spring
|
||||
deactivate User_customer
|
||||
|
||||
== View Profile ==
|
||||
|
||||
Spring -> UserController : viewProfile(Model:model,UserAccount:userAccount)
|
||||
activate User
|
||||
Spring -> UserController : viewProfile(model:Model, userAccount:UserAccount)
|
||||
activate Spring
|
||||
activate UserController
|
||||
UserController -> UserManagement : getUserByAccount(UserAccount:userAccount)
|
||||
UserController -> UserManagement : getUserByAccount(userAccount:UserAccount)
|
||||
activate UserManagement
|
||||
UserManagement -> UserRepository : findAll()
|
||||
activate UserRepository
|
||||
UserManagement <-- UserRepository : Streamble
|
||||
deactivate UserRepository
|
||||
UserManagement -> User : getUserAccount()
|
||||
activate User
|
||||
UserManagement <-- User : UserAccount
|
||||
deactivate User
|
||||
... Several similar operations ...
|
||||
UserController <-- UserManagement : Optional<User>
|
||||
UserController -> User : getUsername()
|
||||
activate User
|
||||
UserController <-- User : String
|
||||
UserController -> User : getFullName()
|
||||
UserController <-- User : String
|
||||
UserController -> User : getAddress()
|
||||
UserController <-- User : String
|
||||
deactivate User
|
||||
deactivate UserManagement
|
||||
UserController -> Spring : model.addAttribute("profileForm",ProfileForm)
|
||||
UserController <-- Spring : Model
|
||||
Spring <-- UserController : "profile"
|
||||
deactivate Spring
|
||||
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
|
||||
|
|
BIN
src/main/asciidoc/models/design/seq_users.svg
(Stored with Git LFS)
BIN
src/main/asciidoc/models/design/seq_users.svg
(Stored with Git LFS)
Binary file not shown.
|
@ -1,115 +1,147 @@
|
|||
' SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
' SPDX-FileCopyrightText: 2023 swt23w23
|
||||
' SPDX-FileCopyrightText: 2023-2024 swt23w23
|
||||
@startuml
|
||||
'maybe for sneidc since he did videoshop:cahnge-password'
|
||||
skinparam linetype ortho
|
||||
skinparam groupInheritance 2
|
||||
|
||||
package Salespoint {
|
||||
interface UserAccountManagement
|
||||
interface DataInitalizer
|
||||
class UserAccount
|
||||
class AbstractAggregateRoot
|
||||
interface UserAccountManagement
|
||||
interface DataInitalizer
|
||||
class UserAccount
|
||||
class Role
|
||||
class Errors
|
||||
}
|
||||
|
||||
package Spring {
|
||||
interface Validator
|
||||
class CrudRepository
|
||||
class Streamable
|
||||
class WebDataBinder
|
||||
class Errors
|
||||
interface Validator
|
||||
class ValidationUtils
|
||||
}
|
||||
|
||||
package slf4j {
|
||||
class Logger
|
||||
}
|
||||
|
||||
package catering.users {
|
||||
class User {
|
||||
- address : String
|
||||
- fullName : String
|
||||
+ User(userAccount : UserAccount, address : String, fullName : String)
|
||||
+ User()
|
||||
+ getAddress() : String
|
||||
+ setAddress(address:String) : String
|
||||
+ getFullName() : String
|
||||
+ setFullName(fullName:String) : String
|
||||
+ getUsername() : String
|
||||
+ setUsername(username:String) : boolean
|
||||
+ getUserAccount() : UserAccount
|
||||
+ getId() : UserIdentifier
|
||||
class User {
|
||||
- id : Long
|
||||
- address : String
|
||||
- fullName : String
|
||||
+ User()
|
||||
+ User(userAccount:UserAccount, address:String, fullName:String)
|
||||
+ getAddress() : String
|
||||
+ setAddress(address:String) : boolean
|
||||
+ getFullName() : String
|
||||
+ setFullName(fullName:String) : boolean
|
||||
+ getUsername() : String
|
||||
+ setUsername(username:String) : boolean
|
||||
+ getUserAccount() : UserAccount
|
||||
+ getId() : Long
|
||||
+ isEnabled() : boolean
|
||||
+ hasRole(role:String) : boolean
|
||||
+ equals(obj:Object) : boolean
|
||||
+ hashCode() : int
|
||||
}
|
||||
User ..> WebDataBinder
|
||||
User --> UserAccount : "-userAccount"
|
||||
User --|> AbstractAggregateRoot : <<extends>>
|
||||
|
||||
class UserController {
|
||||
+ UserController(userManagement: UserManagement)
|
||||
- initProfileBinder(binder : WebDataBinder) : void
|
||||
- initRegistrationBinder(binder : WebDataBinder) : void
|
||||
+ equals(obj:Object) : boolean
|
||||
}
|
||||
User --> UserAccount : "-userAccount"
|
||||
class UserController {
|
||||
+ UserController(userManagement:UserManagement)
|
||||
- initProfileBinder(binder:WebDataBinder) : void
|
||||
- initRegistrationBinder(binder:WebDataBinder) : void
|
||||
- initAdminBinder(binder:WebDataBinder) : void
|
||||
+ unauthorized() : String
|
||||
+ register() : String
|
||||
+ register(form:RegistrationForm,result:Errors) : String
|
||||
+ register(model:Model) : String
|
||||
+ register(form:RegistrationForm, result:Errors) : String
|
||||
+ loginPage() : String
|
||||
+ viewProfile(model:Model,userAccount:UserAccount) : String
|
||||
+ editProfile(userAccount:UserAccount,form:ProfileForm,result:Errors,model:Model) : String
|
||||
+ viewProfile(model:Model, userAccount:UserAccount) : String
|
||||
+ editProfile(userAccount:UserAccount, form:ProfileForm, result:Errors, model:Model) : String
|
||||
+ disableUser(userAccount:UserAccount) : String
|
||||
+ getCustomer(model:Model) : String
|
||||
+ removeCustomer(user:User) : String
|
||||
+ editCustomer(user:User,model:Model) : String
|
||||
+ updateCustomer(user:User,username:String,address:String)
|
||||
}
|
||||
UserController --> UserManagement : "-userManagement"
|
||||
UserController ..> User
|
||||
UserController ..> UserAccount
|
||||
UserController ..> Role
|
||||
UserController ..> UserForm
|
||||
UserController ..> FormValidator
|
||||
UserController ..> WebDataBinder
|
||||
|
||||
class UserManagement {
|
||||
+ UserManagement(users:UserRepository,userAccounts:UserAccountManagement)
|
||||
+ createCustomer(name:String, password:String, address:String) : User
|
||||
+ createAdmin(name:String, password:String, address:String,fullName:String) : User
|
||||
+ save(user:User) : User
|
||||
+ editCustomer(user:User, model:Model) : String
|
||||
+ updateCustomer(user:User, form:AdminForm, result:Errors) : String
|
||||
}
|
||||
UserController --> UserManagement : "-userManagement"
|
||||
UserController ..> User
|
||||
UserController ..> UserAccount
|
||||
UserController ..> Role
|
||||
UserController ..> ProfileForm
|
||||
UserController ..> RegistrationForm
|
||||
UserController ..> AdminForm
|
||||
UserController ..> FormValidator
|
||||
UserController ..> WebDataBinder
|
||||
class UserManagement {
|
||||
+ UserManagement(users:UserRepository, userAccounts:UserAccountManagement)
|
||||
+ createCustomer(username:String, address:String, password:String, fullName:String) : User
|
||||
+ createAdmin(name:String, password:String, address:String,fullName:String) : User
|
||||
+ save(user:User) : User
|
||||
+ setPassword(password:String, userAccount:UserAccount): boolean
|
||||
+ getUsers() : UserRepository
|
||||
+ disableUserAccount(userAccount:UserAccount) : void
|
||||
+ getUserByAccount(userAccount:UserAccount) : Optional<User>
|
||||
}
|
||||
UserManagement --> UserAccountManagement : "-userAccounts"
|
||||
UserManagement --> UserRepository : "-users"
|
||||
UserManagement ..> User
|
||||
class UserDataInitalizer {
|
||||
+ getUserByName(username:String) : Optional<User>
|
||||
}
|
||||
UserManagement --> UserAccountManagement : "-userAccounts"
|
||||
UserManagement --> UserRepository : "-users"
|
||||
UserManagement ..> User
|
||||
UserManagement ..> UserAccount
|
||||
class UserDataInitalizer {
|
||||
- userManagement : UserManagement
|
||||
+ UserDataInitalizer(userManagement : UserManagement)
|
||||
+ initalize() : void
|
||||
}
|
||||
UserDataInitalizer --> UserManagement : "-userManagement"
|
||||
UserDataInitalizer ..|> DataInitalizer
|
||||
+ UserDataInitalizer(userManagement : UserManagement)
|
||||
+ initalize() : void
|
||||
}
|
||||
UserDataInitalizer --> UserManagement : "-userManagement"
|
||||
UserDataInitalizer --> UserAccountManagement : "-userAccountManagement"
|
||||
UserDataInitalizer --> Logger : "-LOG"
|
||||
UserDataInitalizer ..|> DataInitalizer
|
||||
class UserRepository {
|
||||
+ findAll() : Streamable<User>
|
||||
}
|
||||
UserRepository --|> CrudRepository : <<extends>>
|
||||
UserRepository ..|> Streamable
|
||||
UserRepository o-- User
|
||||
UserRepository ..|> Streamable
|
||||
UserRepository o-- User
|
||||
UserRepository --|> CrudRepository
|
||||
class UserForm {
|
||||
- username: String
|
||||
- password: String
|
||||
- address: String
|
||||
- password: String
|
||||
+ UserForm(username:String,address:String,fullName:String,password:String)
|
||||
- username : String
|
||||
- address : String
|
||||
- fullName : String
|
||||
+ UserForm(username:String, address:String, fullName:String)
|
||||
+ getUsername() : String
|
||||
+ getAddress() : String
|
||||
+ getFullName() : String
|
||||
}
|
||||
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
|
||||
}
|
||||
class FormValidator {
|
||||
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
|
||||
validate(o:Object,e:Errors) : void
|
||||
validate(o:Object, e:Errors) : void
|
||||
}
|
||||
FormValidator ..> Validator
|
||||
FormValidator --> Errors
|
||||
FormValidator ..|> Validator
|
||||
FormValidator ..> Errors
|
||||
FormValidator ..> ValidationUtils
|
||||
}
|
||||
@enduml
|
||||
|
|
BIN
src/main/asciidoc/models/design/user.svg
(Stored with Git LFS)
BIN
src/main/asciidoc/models/design/user.svg
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue