-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.puml
108 lines (95 loc) · 3.08 KB
/
controller.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
@startuml
package controller {
class Rate{
+{static} final double BONUS_PERCENTAGE = 0.025;
+{static} final double PENSION_PERCENTAGE = 0.01;
}
class EmployeeController{
- EmployeeValidator employeeValidator
- PersistenceService persistenceService
- EmployeeServiceFactory employeeServiceFactory
- EmployeeFormatter employeeFormatter
+ EmployeeController(EmployeeValidator employeeValidator, PersistenceService persistenceService, EmployeeServiceFactory employeeServiceFactory, EmployeeFormatter employeeFormatter)
+ processEmployee(Employee employee):String
}
class EmployeeFormatter{
+ formatString(Employee employee):void
+ {static} trim(String str):String
}
class EmployeeValidator{
+ boolean isValidEmployee(Employee employee)
- boolean isPresent(String value)
- boolean isValidAlphaNumeric(String value)
- boolean isValidEmail(String value)
- boolean isNoSalary(double salary)
- boolean isNoCompensation(double compensation)
- boolean isNoServiceYear(int serviceYear)
}
class Main{
+ {static} main(String[] args):void
}
}
package employee {
class Employee{
- String name
- String email
- String address
- double salary
+ Employee()
+ Employee(String name, String email, String address, double salary)
+ String getName()
+ void setName(String name)
+ String getEmail()
+ void setEmail(String email)
+ String getAddress()
+ void setAddress(String address)
+ double getSalary()
+ void setSalary(double salary)
+ String toString()
}
class EmployeeServiceFactory{
+ createService(employee:Employee):EmployeeService
}
interface EmployeeService{
+ void populateEmployee(Employee employee)
}
interface PermanentEmployeeService{
+ double calculateTotalCompensation(Employee employee)
+ double pensionContribution(Employee employee)
+ double calculateBonus(Employee employee)
}
class PermanentEmployeeServiceImpl{
+ double calculateTotalCompensation(Employee employee)
+ double pensionContribution(Employee employee)
+ double calculateBonus(Employee employee)
+ void populateEmployee(Employee employee)
}
}
package persistence {
interface Formatter{
+ String format(Employee employee)
}
class PersistenceService{
+ void saveEmployee(Employee person, String filename, Formatter formatter)
}
}
' Relationship in persistence
PersistenceService ..> Formatter
' Relationship in employee
EmployeeServiceFactory ..> EmployeeService
'Employee <.. EmployeeServiceFactory
Employee <. EmployeeServiceFactory
Employee <. EmployeeService
PermanentEmployeeService -|> EmployeeService
PermanentEmployeeServiceImpl ..|> PermanentEmployeeService
' Relationship in controller
Main ..> EmployeeController
EmployeeController ..> EmployeeValidator
EmployeeController ..> EmployeeFormatter
EmployeeController ..> EmployeeServiceFactory
EmployeeController ..> Employee
EmployeeValidator ..> Employee
EmployeeFormatter ..> Employee
EmployeeController ..> PersistenceService
Rate <-- PermanentEmployeeServiceImpl
@enduml