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:
Eren Asker 2023-11-23 17:15:43 +01:00 committed by Simon Bruder
parent 4f1ed1f134
commit 1b1aac5476
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
3 changed files with 44 additions and 53 deletions

View file

@ -295,10 +295,10 @@ image:models/design/staff.svg[class design diagram - Staff]
[options="header"] [options="header"]
|=== |===
|Class/Enumeration |Description |Class/Enumeration |Description
|Staff |A class that represents staff members. It includes personal details and job information. |Employee |A class that represents employees (staff members). It includes name, job type and an ID.
|StaffController |A Spring MVC Controller for managing staff-related operations such as adding, removing, and updating staff data. |StaffController |A Spring MVC Controller for handling staff-related operations such as adding, removing, and updating staff data. It interacts with StaffManagement.
|StaffDataInitializer |An Initalizer with primary purpose to create dummy data on application startup. |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' to perform add, save, count, remove, and find by id operations specific to staff objects. |StaffRepository |An extension of 'CrudRepository' that provides standard methods to perform CRUD operations on staff objects.
|=== |===
=== Link between analysis and design === Link between analysis and design

View file

@ -3,68 +3,59 @@
skinparam linetype ortho skinparam linetype ortho
skinparam groupInheritance 2 skinparam groupInheritance 2
package java.util { package Spring {
class ArrayList class CrudRepository
class Collection class Streamable
class HashSet
class Optional
class Set
} }
package catering { package catering.staff {
package staff {
class Staff { class Employee {
- id: int
- surname: String
- name: String - name: String
- job: String - id: Long
+ Staff(name: String, surname: String, job: String) + Employee()
+ getId(): int + Employee(name: String, job: JobType)
+ getSurname(): String + getId(): Long
+ getName(): String + getName(): String
+ getJob(): String + getJob(): JobType
+ setId(): void + setName(name: String): void
+ setSurname(): void + setJob(job: JobType): void
+ setName(): void }
+ setJob(): void
Employee --> JobType : -job
enum JobType {
COOK
SERVICE
} }
class StaffController { class StaffController {
+ StaffController(staffRepository: StaffRepository) + StaffController(staffRepository: StaffRepository)
+ getStaff(model Model): String + getStaff(model: Model): String
+ removeStaff(staffID: int, model Model): String + removeEmployee(employee: Employee, model: Model): String
+ addStaff(name: String, surname: String, job: String, model Model): String + addEmployee(name: String, job: JobType): String
+ editStaff(id: int, model Model): String + editEmployee(employee: Employee, model Model): String
+ updateStaff(staff: Staff): String + updateEmployee(employee: Employee, name: String, job: JobType): String
} }
StaffController --> StaffManagement : -staffManagement
StaffController ..> Employee
class StaffDataInitializer { class StaffManagement {
+ StaffDataInitializer(staffRepository: StaffRepository) + StaffManagement(staffRepository: StaffRepository)
+ initialize(): void + findById(id: Long): Optional<Employee>
+ save(employee: Employee): Employee
+ findAll(): Streamable<Employee>
+ delete(id: Long): void
} }
StaffManagement --> StaffRepository : -staffRepository
class StaffRepository { interface StaffRepository {
+ StaffRepository() + findAll(): Streamable<Employee>
+ addStaff(staff: Staff): boolean
+ save(staff: Staff): void
+ count(): long
+ removeStaff(staffID: int) boolean
+ getStaff(): Collection<Staff>
+ findById(id: int): Optional<Staff>
} }
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 @enduml

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

Binary file not shown.