diff --git a/src/main/asciidoc/developer_documentation.adoc b/src/main/asciidoc/developer_documentation.adoc index c54d1cf..b0627c7 100644 --- a/src/main/asciidoc/developer_documentation.adoc +++ b/src/main/asciidoc/developer_documentation.adoc @@ -3,7 +3,7 @@ // SPDX-FileCopyrightText: 2015 Oliver Drotbohm // SPDX-FileCopyrightText: 2019 Daniel Schoenicke // SPDX-FileCopyrightText: 2023 Markus Hamann -// SPDX-FileCopyrightText: 2023 swt23w23 +// SPDX-FileCopyrightText: 2023-2024 swt23w23 [options="header"] [cols="1, 3, 3"] |=== @@ -313,6 +313,7 @@ image:models/design/staff.svg[class design diagram - Staff] |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. |StaffForm |A Form to cache a user input that was made during registration or updating an Employee. +|JobType | A list of all professions that an employee can have. |=== === Link between analysis and design diff --git a/src/main/asciidoc/models/design/staff.puml b/src/main/asciidoc/models/design/staff.puml index a84b678..76dcb8c 100644 --- a/src/main/asciidoc/models/design/staff.puml +++ b/src/main/asciidoc/models/design/staff.puml @@ -1,14 +1,29 @@ ' SPDX-License-Identifier: AGPL-3.0-or-later -' SPDX-FileCopyrightText: 2023 swt23w23 +' SPDX-FileCopyrightText: 2023-2024 swt23w23 @startuml skinparam linetype ortho skinparam groupInheritance 2 -package javax.money { - class MonetaryAmount - class Money +package salespoint { class EURO + class OrderManagement +} + +package java.util { + class Object + class Set + class function.Predicate + class stream.Collectors +} + +package javax.money { + class MonetaryAmount +} + +package java.time { + class LocalDateTime + class YearMonth } package Spring { @@ -16,20 +31,24 @@ package Spring { class Streamable class Errors class Model + class Pageable } package catering.order { - class OrderManagement class CustomOrder } +package org.javamonay { + class moneta.Money +} + package catering.staff { - class Employee { - - name: String + class Employee { + + name: String - id: Long - + Employee() - + Employee(name: String, job: JobType, wage: MonetaryAmount) + + Employee() + + Employee(name: String, job: JobType, wage: MonetaryAmount) + getId(): Long + getName(): String + getJob(): JobType @@ -37,10 +56,15 @@ package catering.staff { + setName(name: String): void + setJob(job: JobType): void + setWage(wage: Double): void + + hashCode(): int + + equals(obj: Object): boolean } - Employee --> JobType : -job - Employee --> MonetaryAmount : -wage + Employee --> JobType : -job + Employee --> MonetaryAmount : -wage + Employee ..> Object + Employee ..> Money + Employee ..> Euro enum JobType { COOK @@ -48,45 +72,56 @@ package catering.staff { } class StaffController { - + StaffController(staffRepository: StaffRepository) - + getStaff(model: Model, month:Optional): String - + getStaff(model: Model, form: StaffForm, month:Optional): String - + removeEmployee(employee: Employee, model: Model): String - + addEmployee(form:StaffForm, result:Errors, model: Model): String - + editEmployee(employee: Employee, model Model): String - + editEmployee(model Model, form:StaffForm): String - + updateEmployee(employee: Employee, form:StaffForm): String + + StaffController(staffManagement: StaffManagement) + + getStaff(model: Model, month:Optional): String + + getStaff(model: Model, form: StaffForm, month: YearMonth): String + + addEmployee(form:StaffForm, result:Errors, model: Model): String + + removeEmployee(employee: Employee, model: Model): String + + editEmployee(employee: Employee, model Model): String + + editEmployee(model Model, form:StaffForm): String + + updateEmployee(employee: Employee, form:StaffForm, result: Errors, model: Model): String } - StaffController --> StaffManagement : -staffManagement - StaffController ..> Employee + StaffController --> StaffManagement : -staffManagement + StaffController ..> Employee StaffController ..> StaffForm StaffController ..> Model StaffController ..> Errors - StaffController ..> Money + StaffController ..> CustomOrder StaffController ..> EURO + StaffController ..> Money + StaffController ..> Optional class StaffManagement { + StaffManagement(staffRepository: StaffRepository, orderManagement:OrderManagement) - + findById(id: Long): Optional - + save(employee: Employee): Employee - + findAll(): Streamable - + delete(id: Long): void - + getAvailableStaffByJob(job: JobType, start:LocalDateTime, finish:LocalDateTime): Set - + getWorkingHourseByemployee(e: Employee,month: YearMonth): double + + findById(id: Long): Optional + + save(employee: Employee): Employee + + findAll(): Streamable + + delete(id: Long): void + + getAvailableStaffByJob(job: JobType, start:LocalDateTime, finish:LocalDateTime): Set + + getWorkingHourseByemployee(e: Employee,month: YearMonth): double } - StaffManagement --> StaffRepository : -staffRepository - StaffManagement --> OrderManagement : -orderManagement - StaffManagement ..> Set + StaffManagement --> StaffRepository : -staffRepository + StaffManagement --> OrderManagement : -orderManagement + StaffManagement ..> JobType + StaffManagement ..> Employee + StaffManagement ..> Set + StaffManagement ..> Streamable + StaffManagement ..> LocalDateTime + StaffManagement ..> YearMonth + StaffManagement ..> Predicate + StaffManagement ..> Collectors + StaffManagement ..> Pageable interface StaffRepository { - + findAll(): Streamable + + findAll(): Streamable } - StaffRepository --|> CrudRepository : <> - StaffRepository ..|> Streamable - StaffRepository o-- Employee + StaffRepository --|> CrudRepository : <> + StaffRepository ..|> Streamable + StaffRepository o-- Employee class StaffForm { - name: String + - wage: Double + StaffForm(): void + getName(): String + getJob(): JobType @@ -97,6 +132,7 @@ package catering.staff { + validate(e:Errors): void } StaffForm ..> JobType : -job + StaffForm ..> Errors } @enduml diff --git a/src/main/asciidoc/models/design/staff.svg b/src/main/asciidoc/models/design/staff.svg index 7e12223..568150a 100644 --- a/src/main/asciidoc/models/design/staff.svg +++ b/src/main/asciidoc/models/design/staff.svg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d05c92a10c3f72cc28a0a5a00eaf629d0de440deac20622caa8eadde13259cb2 -size 42634 +oid sha256:16814d625a6dacdd03cb4443ed229b68febf39276c356564cbc90231767e6e9a +size 71745