mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-19 21:04:36 +02:00
Update developer documentation for staff
Co-authored-by: Denis Natusch <denis.natusch@mailbox.tu-dresden.de> Co-authored-by: Simon Bruder <simon.bruder@mailbox.tu-dresden.de>
This commit is contained in:
parent
4f1ed1f134
commit
1b1aac5476
|
@ -295,10 +295,10 @@ image:models/design/staff.svg[class design diagram - Staff]
|
|||
[options="header"]
|
||||
|===
|
||||
|Class/Enumeration |Description
|
||||
|Staff |A class that represents staff members. It includes personal details and job information.
|
||||
|StaffController |A Spring MVC Controller for managing staff-related operations such as adding, removing, and updating staff data.
|
||||
|StaffDataInitializer |An Initalizer with primary purpose to create dummy data on application startup.
|
||||
|StaffRepository |An extension of 'CrudRepository' to perform add, save, count, remove, and find by id operations specific to staff objects.
|
||||
|Employee |A class that represents employees (staff members). It includes name, job type and an ID.
|
||||
|StaffController |A Spring MVC Controller for handling staff-related operations such as adding, removing, and updating staff data. It interacts with StaffManagement.
|
||||
|StaffManagement |A class that manages interactions and logic with StaffRepository. It provides methods to find, save/add, list, and delete staff members.
|
||||
|StaffRepository |An extension of 'CrudRepository' that provides standard methods to perform CRUD operations on staff objects.
|
||||
|===
|
||||
|
||||
=== Link between analysis and design
|
||||
|
|
|
@ -3,68 +3,59 @@
|
|||
skinparam linetype ortho
|
||||
skinparam groupInheritance 2
|
||||
|
||||
package java.util {
|
||||
class ArrayList
|
||||
class Collection
|
||||
class HashSet
|
||||
class Optional
|
||||
class Set
|
||||
package Spring {
|
||||
class CrudRepository
|
||||
class Streamable
|
||||
}
|
||||
|
||||
package catering {
|
||||
package staff {
|
||||
package catering.staff {
|
||||
|
||||
class Staff {
|
||||
- id: int
|
||||
- surname: String
|
||||
class Employee {
|
||||
- name: String
|
||||
- job: String
|
||||
+ Staff(name: String, surname: String, job: String)
|
||||
+ getId(): int
|
||||
+ getSurname(): String
|
||||
- id: Long
|
||||
+ Employee()
|
||||
+ Employee(name: String, job: JobType)
|
||||
+ getId(): Long
|
||||
+ getName(): String
|
||||
+ getJob(): String
|
||||
+ setId(): void
|
||||
+ setSurname(): void
|
||||
+ setName(): void
|
||||
+ setJob(): void
|
||||
+ getJob(): JobType
|
||||
+ setName(name: String): void
|
||||
+ setJob(job: JobType): void
|
||||
}
|
||||
|
||||
Employee --> JobType : -job
|
||||
|
||||
enum JobType {
|
||||
COOK
|
||||
SERVICE
|
||||
}
|
||||
|
||||
class StaffController {
|
||||
+ StaffController(staffRepository: StaffRepository)
|
||||
+ getStaff(model Model): String
|
||||
+ removeStaff(staffID: int, model Model): String
|
||||
+ addStaff(name: String, surname: String, job: String, model Model): String
|
||||
+ editStaff(id: int, model Model): String
|
||||
+ updateStaff(staff: Staff): String
|
||||
+ getStaff(model: Model): String
|
||||
+ removeEmployee(employee: Employee, model: Model): String
|
||||
+ addEmployee(name: String, job: JobType): String
|
||||
+ editEmployee(employee: Employee, model Model): String
|
||||
+ updateEmployee(employee: Employee, name: String, job: JobType): String
|
||||
}
|
||||
StaffController --> StaffManagement : -staffManagement
|
||||
StaffController ..> Employee
|
||||
|
||||
class StaffDataInitializer {
|
||||
+ StaffDataInitializer(staffRepository: StaffRepository)
|
||||
+ initialize(): void
|
||||
class StaffManagement {
|
||||
+ StaffManagement(staffRepository: StaffRepository)
|
||||
+ findById(id: Long): Optional<Employee>
|
||||
+ save(employee: Employee): Employee
|
||||
+ findAll(): Streamable<Employee>
|
||||
+ delete(id: Long): void
|
||||
}
|
||||
StaffManagement --> StaffRepository : -staffRepository
|
||||
|
||||
class StaffRepository {
|
||||
+ StaffRepository()
|
||||
+ addStaff(staff: Staff): boolean
|
||||
+ save(staff: Staff): void
|
||||
+ count(): long
|
||||
+ removeStaff(staffID: int) boolean
|
||||
+ getStaff(): Collection<Staff>
|
||||
+ findById(id: int): Optional<Staff>
|
||||
interface StaffRepository {
|
||||
+ findAll(): Streamable<Employee>
|
||||
}
|
||||
StaffRepository --|> CrudRepository : <<extends>>
|
||||
StaffRepository ..|> Streamable
|
||||
StaffRepository o-- Employee
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
StaffRepository o-- Staff : -staff
|
||||
StaffController --> StaffRepository : -staffRepository
|
||||
StaffDataInitializer --> StaffRepository : -staffRepository
|
||||
StaffRepository --> Set : -staff
|
||||
StaffRepository ..> HashSet
|
||||
StaffRepository ..> Collection
|
||||
StaffRepository ..> Optional
|
||||
StaffRepository ..> ArrayList
|
||||
Staff -[hidden]- StaffRepository
|
||||
|
||||
@enduml
|
||||
|
|
BIN
src/main/asciidoc/models/design/staff.svg
(Stored with Git LFS)
BIN
src/main/asciidoc/models/design/staff.svg
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue