Update staff docs

Co-authored-by: Denis Natusch <denis.natusch@mailbox.tu-dresden.de>
This commit is contained in:
Eren Asker 2024-01-15 22:03:30 +03:00 committed by Denis Natusch
parent 4fb63e1971
commit c94a4d4adb
No known key found for this signature in database
GPG key ID: 5E57BD8EDACFA985
3 changed files with 75 additions and 38 deletions

View file

@ -3,7 +3,7 @@
// SPDX-FileCopyrightText: 2015 Oliver Drotbohm // SPDX-FileCopyrightText: 2015 Oliver Drotbohm
// SPDX-FileCopyrightText: 2019 Daniel Schoenicke // SPDX-FileCopyrightText: 2019 Daniel Schoenicke
// SPDX-FileCopyrightText: 2023 Markus Hamann // SPDX-FileCopyrightText: 2023 Markus Hamann
// SPDX-FileCopyrightText: 2023 swt23w23 // SPDX-FileCopyrightText: 2023-2024 swt23w23
[options="header"] [options="header"]
[cols="1, 3, 3"] [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. |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. |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. |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 === Link between analysis and design

View file

@ -1,14 +1,29 @@
' SPDX-License-Identifier: AGPL-3.0-or-later ' SPDX-License-Identifier: AGPL-3.0-or-later
' SPDX-FileCopyrightText: 2023 swt23w23 ' SPDX-FileCopyrightText: 2023-2024 swt23w23
@startuml @startuml
skinparam linetype ortho skinparam linetype ortho
skinparam groupInheritance 2 skinparam groupInheritance 2
package javax.money { package salespoint {
class MonetaryAmount
class Money
class EURO 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 { package Spring {
@ -16,20 +31,24 @@ package Spring {
class Streamable class Streamable
class Errors class Errors
class Model class Model
class Pageable
} }
package catering.order { package catering.order {
class OrderManagement
class CustomOrder class CustomOrder
} }
package org.javamonay {
class moneta.Money
}
package catering.staff { package catering.staff {
class Employee { class Employee {
- name: String + name: String
- id: Long - id: Long
+ Employee() + Employee()
+ Employee(name: String, job: JobType, wage: MonetaryAmount) + Employee(name: String, job: JobType, wage: MonetaryAmount)
+ getId(): Long + getId(): Long
+ getName(): String + getName(): String
+ getJob(): JobType + getJob(): JobType
@ -37,10 +56,15 @@ package catering.staff {
+ setName(name: String): void + setName(name: String): void
+ setJob(job: JobType): void + setJob(job: JobType): void
+ setWage(wage: Double): void + setWage(wage: Double): void
+ hashCode(): int
+ equals(obj: Object): boolean
} }
Employee --> JobType : -job Employee --> JobType : -job
Employee --> MonetaryAmount : -wage Employee --> MonetaryAmount : -wage
Employee ..> Object
Employee ..> Money
Employee ..> Euro
enum JobType { enum JobType {
COOK COOK
@ -48,45 +72,56 @@ package catering.staff {
} }
class StaffController { class StaffController {
+ StaffController(staffRepository: StaffRepository) + StaffController(staffManagement: StaffManagement)
+ getStaff(model: Model, month:Optional<YearMonth>): String + getStaff(model: Model, month:Optional<YearMonth>): String
+ getStaff(model: Model, form: StaffForm, month:Optional<YearMonth>): String + getStaff(model: Model, form: StaffForm, month: YearMonth): String
+ removeEmployee(employee: Employee, model: Model): String + addEmployee(form:StaffForm, result:Errors, model: Model): String
+ addEmployee(form:StaffForm, result:Errors, model: Model): String + removeEmployee(employee: Employee, model: Model): String
+ editEmployee(employee: Employee, model Model): String + editEmployee(employee: Employee, model Model): String
+ editEmployee(model Model, form:StaffForm): String + editEmployee(model Model, form:StaffForm): String
+ updateEmployee(employee: Employee, form:StaffForm): String + updateEmployee(employee: Employee, form:StaffForm, result: Errors, model: Model): String
} }
StaffController --> StaffManagement : -staffManagement StaffController --> StaffManagement : -staffManagement
StaffController ..> Employee StaffController ..> Employee
StaffController ..> StaffForm StaffController ..> StaffForm
StaffController ..> Model StaffController ..> Model
StaffController ..> Errors StaffController ..> Errors
StaffController ..> Money StaffController ..> CustomOrder
StaffController ..> EURO StaffController ..> EURO
StaffController ..> Money
StaffController ..> Optional
class StaffManagement { class StaffManagement {
+ StaffManagement(staffRepository: StaffRepository, orderManagement:OrderManagement<CustomOrder>) + StaffManagement(staffRepository: StaffRepository, orderManagement:OrderManagement<CustomOrder>)
+ findById(id: Long): Optional<Employee> + findById(id: Long): Optional<Employee>
+ save(employee: Employee): Employee + save(employee: Employee): Employee
+ findAll(): Streamable<Employee> + findAll(): Streamable<Employee>
+ delete(id: Long): void + delete(id: Long): void
+ getAvailableStaffByJob(job: JobType, start:LocalDateTime, finish:LocalDateTime): Set<Employee> + getAvailableStaffByJob(job: JobType, start:LocalDateTime, finish:LocalDateTime): Set<Employee>
+ getWorkingHourseByemployee(e: Employee,month: YearMonth): double + getWorkingHourseByemployee(e: Employee,month: YearMonth): double
} }
StaffManagement --> StaffRepository : -staffRepository StaffManagement --> StaffRepository : -staffRepository
StaffManagement --> OrderManagement : -orderManagement StaffManagement --> OrderManagement : -orderManagement<CustomOrder>
StaffManagement ..> Set StaffManagement ..> JobType
StaffManagement ..> Employee
StaffManagement ..> Set
StaffManagement ..> Streamable
StaffManagement ..> LocalDateTime
StaffManagement ..> YearMonth
StaffManagement ..> Predicate
StaffManagement ..> Collectors
StaffManagement ..> Pageable
interface StaffRepository { interface StaffRepository {
+ findAll(): Streamable<Employee> + findAll(): Streamable<Employee>
} }
StaffRepository --|> CrudRepository : <<extends>> StaffRepository --|> CrudRepository : <<extends>>
StaffRepository ..|> Streamable StaffRepository ..|> Streamable
StaffRepository o-- Employee StaffRepository o-- Employee
class StaffForm { class StaffForm {
- name: String - name: String
- wage: Double
+ StaffForm(): void + StaffForm(): void
+ getName(): String + getName(): String
+ getJob(): JobType + getJob(): JobType
@ -97,6 +132,7 @@ package catering.staff {
+ validate(e:Errors): void + validate(e:Errors): void
} }
StaffForm ..> JobType : -job StaffForm ..> JobType : -job
StaffForm ..> Errors
} }
@enduml @enduml

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

Binary file not shown.