2017-09-16 18:11:00 +05:30
|
|
|
@startuml
|
|
|
|
package com.iluwatar.unitofwork {
|
2017-09-23 00:53:45 +05:30
|
|
|
class App {
|
|
|
|
+ App()
|
|
|
|
+ main(args : String[]) {static}
|
|
|
|
}
|
2017-09-19 22:49:09 +05:30
|
|
|
interface IUnitOfWork<T> {
|
|
|
|
+ DELETE : String {static}
|
|
|
|
+ INSERT : String {static}
|
|
|
|
+ MODIFY : String {static}
|
|
|
|
+ commit() {abstract}
|
|
|
|
+ registerDeleted(T) {abstract}
|
|
|
|
+ registerModified(T) {abstract}
|
|
|
|
+ registerNew(T) {abstract}
|
|
|
|
}
|
2017-09-16 18:11:00 +05:30
|
|
|
class Student {
|
|
|
|
- address : String
|
|
|
|
- id : Integer
|
|
|
|
- name : String
|
|
|
|
+ Student(id : Integer, name : String, address : String)
|
2017-09-19 22:49:09 +05:30
|
|
|
+ getAddress() : String
|
|
|
|
+ getId() : Integer
|
|
|
|
+ getName() : String
|
|
|
|
}
|
|
|
|
class StudentDatabase {
|
|
|
|
+ StudentDatabase()
|
|
|
|
+ delete(student : Student)
|
|
|
|
+ insert(student : Student)
|
|
|
|
+ modify(student : Student)
|
|
|
|
}
|
|
|
|
class StudentRepository {
|
|
|
|
- LOGGER : Logger {static}
|
|
|
|
- context : Map<String, List<Student>>
|
|
|
|
- studentDatabase : StudentDatabase
|
|
|
|
+ StudentRepository(context : Map<String, List<Student>>, studentDatabase : StudentDatabase)
|
|
|
|
+ commit()
|
|
|
|
- commitDelete()
|
|
|
|
- commitInsert()
|
|
|
|
- commitModify()
|
|
|
|
- register(student : Student, operation : String)
|
|
|
|
+ registerDeleted(student : Student)
|
|
|
|
+ registerModified(student : Student)
|
|
|
|
+ registerNew(student : Student)
|
2017-09-16 18:11:00 +05:30
|
|
|
}
|
|
|
|
}
|
2017-09-19 22:49:09 +05:30
|
|
|
StudentRepository --> "-studentDatabase" StudentDatabase
|
|
|
|
StudentRepository ..|> IUnitOfWork
|
2017-09-16 18:11:00 +05:30
|
|
|
@enduml
|