forked from iluwatar/java-design-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice-layer.urm.puml
155 lines (155 loc) · 4.38 KB
/
service-layer.urm.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
@startuml
package com.iluwatar.servicelayer.hibernate {
class HibernateUtil {
- LOGGER : Logger {static}
- sessionFactory : SessionFactory {static}
- HibernateUtil()
+ dropSession() {static}
+ getSessionFactory() : SessionFactory {static}
}
}
package com.iluwatar.servicelayer.common {
abstract class BaseEntity {
+ BaseEntity()
+ getId() : Long {abstract}
+ getName() : String {abstract}
+ setId(Long) {abstract}
+ setName(String) {abstract}
}
interface Dao<E extends BaseEntity> {
+ delete(E extends BaseEntity) {abstract}
+ find(Long) : E extends BaseEntity {abstract}
+ findAll() : List<E extends BaseEntity> {abstract}
+ merge(E extends BaseEntity) : E extends BaseEntity {abstract}
+ persist(E extends BaseEntity) {abstract}
+ findByName(String) : E extends BaseEntity {abstract}
}
abstract class DaoBaseImpl<E extends BaseEntity> {
# persistentClass : Class<E extends BaseEntity>
+ DaoBaseImpl<E extends BaseEntity>()
+ delete(entity : E extends BaseEntity)
+ find(id : Long) : E extends BaseEntity
+ findAll() : List<E extends BaseEntity>
+ findByName(name : String) : E extends BaseEntity
# getSessionFactory() : SessionFactory
+ merge(entity : E extends BaseEntity) : E extends BaseEntity
+ persist(entity : E extends BaseEntity)
}
}
package com.iluwatar.servicelayer.magic {
interface MagicService {
+ findAllSpellbooks() : List<Spellbook> {abstract}
+ findAllSpells() : List<Spell> {abstract}
+ findAllWizards() : List<Wizard> {abstract}
+ findWizardsWithSpell(String) : List<Wizard> {abstract}
+ findWizardsWithSpellbook(String) : List<Wizard> {abstract}
}
class MagicServiceImpl {
- spellDao : SpellDao
- spellbookDao : SpellbookDao
- wizardDao : WizardDao
+ MagicServiceImpl(wizardDao : WizardDao, spellbookDao : SpellbookDao, spellDao : SpellDao)
+ findAllSpellbooks() : List<Spellbook>
+ findAllSpells() : List<Spell>
+ findAllWizards() : List<Wizard>
+ findWizardsWithSpell(name : String) : List<Wizard>
+ findWizardsWithSpellbook(name : String) : List<Wizard>
}
}
package com.iluwatar.servicelayer.wizard {
class Wizard {
- id : Long
- name : String
- spellbooks : Set<Spellbook>
+ Wizard()
+ Wizard(name : String)
+ addSpellbook(spellbook : Spellbook)
+ getId() : Long
+ getName() : String
+ getSpellbooks() : Set<Spellbook>
+ setId(id : Long)
+ setName(name : String)
+ setSpellbooks(spellbooks : Set<Spellbook>)
+ toString() : String
}
interface WizardDao {
}
class WizardDaoImpl {
+ WizardDaoImpl()
}
}
package com.iluwatar.servicelayer.spellbook {
class Spellbook {
- id : Long
- name : String
- spells : Set<Spell>
- wizards : Set<Wizard>
+ Spellbook()
+ Spellbook(name : String)
+ addSpell(spell : Spell)
+ getId() : Long
+ getName() : String
+ getSpells() : Set<Spell>
+ getWizards() : Set<Wizard>
+ setId(id : Long)
+ setName(name : String)
+ setSpells(spells : Set<Spell>)
+ setWizards(wizards : Set<Wizard>)
+ toString() : String
}
interface SpellbookDao {
}
class SpellbookDaoImpl {
+ SpellbookDaoImpl()
}
}
package com.iluwatar.servicelayer.spell {
class Spell {
- id : Long
- name : String
- spellbook : Spellbook
+ Spell()
+ Spell(name : String)
+ getId() : Long
+ getName() : String
+ getSpellbook() : Spellbook
+ setId(id : Long)
+ setName(name : String)
+ setSpellbook(spellbook : Spellbook)
+ toString() : String
}
interface SpellDao {
}
class SpellDaoImpl {
+ SpellDaoImpl()
}
}
package com.iluwatar.servicelayer.app {
class App {
- LOGGER : Logger {static}
+ App()
+ initData() {static}
+ main(args : String[]) {static}
+ queryData() {static}
}
}
MagicServiceImpl --> "-wizardDao" WizardDao
MagicServiceImpl --> "-spellbookDao" SpellbookDao
MagicServiceImpl --> "-spellDao" SpellDao
Spellbook --> "-spells" Spell
Spellbook --> "-wizards" Wizard
DaoBaseImpl ..|> Dao
MagicServiceImpl ..|> MagicService
Spell --|> BaseEntity
SpellDao --|> Dao
SpellDaoImpl ..|> SpellDao
SpellDaoImpl --|> DaoBaseImpl
Spellbook --|> BaseEntity
SpellbookDao --|> Dao
SpellbookDaoImpl ..|> SpellbookDao
SpellbookDaoImpl --|> DaoBaseImpl
Wizard --|> BaseEntity
WizardDao --|> Dao
WizardDaoImpl ..|> WizardDao
WizardDaoImpl --|> DaoBaseImpl
@enduml