starproxima_library 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +69 -0
- data/diagrams/add_uthor_seq.png +0 -0
- data/diagrams/add_uthor_seq.puml +42 -0
- data/diagrams/author.png +0 -0
- data/diagrams/author.puml +118 -0
- data/diagrams/core.png +0 -0
- data/diagrams/core.puml +103 -0
- data/diagrams/delete_author.png +0 -0
- data/diagrams/delete_author.puml +25 -0
- data/diagrams/edit_author.png +0 -0
- data/diagrams/edit_author.puml +48 -0
- data/diagrams/er.png +0 -0
- data/diagrams/er.puml +30 -0
- data/diagrams/publisher.png +0 -0
- data/diagrams/publisher.puml +118 -0
- data/diagrams/requirements.docx +0 -0
- data/diagrams/start.png +0 -0
- data/diagrams/start.puml +74 -0
- data/lib/author/author_db_data_source.rb +90 -0
- data/lib/author/controllers/author_controller.rb +57 -0
- data/lib/author/controllers/author_input_form_controller_create.rb +44 -0
- data/lib/author/controllers/author_input_form_controller_edit.rb +53 -0
- data/lib/author/controllers/author_list_controller.rb +107 -0
- data/lib/author/ui/author_input_form.rb +69 -0
- data/lib/author/ui/author_list_view.rb +170 -0
- data/lib/controllers/tab_students_controller.rb +43 -0
- data/lib/data_sources/book_db_data_source.rb +43 -0
- data/lib/data_sources/db_client.rb +34 -0
- data/lib/db_config/config.yaml +5 -0
- data/lib/db_config/library_config.yaml +5 -0
- data/lib/db_config/migrations/create_db.sql +3 -0
- data/lib/db_config/migrations/create_tables.sql +27 -0
- data/lib/db_config/mock_data/mock_data.sql +49 -0
- data/lib/logger.rb +27 -0
- data/lib/main.rb +6 -0
- data/lib/models/author.rb +32 -0
- data/lib/models/book.rb +31 -0
- data/lib/models/publisher.rb +37 -0
- data/lib/models/student.rb +102 -0
- data/lib/models/student_base.rb +100 -0
- data/lib/models/student_short.rb +50 -0
- data/lib/publisher/controllers/publisher_input_form_controller_create.rb +44 -0
- data/lib/publisher/controllers/publisher_input_form_controller_edit.rb +52 -0
- data/lib/publisher/controllers/publisher_list_controller.rb +99 -0
- data/lib/publisher/publisher_db_data_source.rb +63 -0
- data/lib/publisher/ui/publisher_input_form.rb +69 -0
- data/lib/publisher/ui/publisher_list_view.rb +168 -0
- data/lib/repositories/adapters/db_source_adapter.rb +54 -0
- data/lib/repositories/adapters/file_source_adapter.rb +37 -0
- data/lib/repositories/containers/data_list.rb +74 -0
- data/lib/repositories/containers/data_list_student_short.rb +18 -0
- data/lib/repositories/containers/data_table.rb +35 -0
- data/lib/repositories/data_sources/db_data_source.rb +32 -0
- data/lib/repositories/data_sources/file_data_source.rb +75 -0
- data/lib/repositories/data_sources/transformers/data_transformer_base.rb +15 -0
- data/lib/repositories/data_sources/transformers/data_transformer_json.rb +16 -0
- data/lib/repositories/data_sources/transformers/data_transformer_yaml.rb +16 -0
- data/lib/repositories/student_repository.rb +32 -0
- data/lib/state_holders/list_state_notifier.rb +60 -0
- data/lib/views/main_window.rb +32 -0
- data/lib/views/tab_students.rb +148 -0
- data/starproxima_library.gemspec +15 -0
- data/test/author_test.rb +51 -0
- data/test/book_test.rb +33 -0
- data/test/publisher_test.rb +39 -0
- data/test/state_notifier_test.rb +80 -0
- metadata +123 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8e0482becdd96f5686269b12e189d7caefc695855e65369c1f773884f54e20af
|
4
|
+
data.tar.gz: '043708e140cfbd4bc64e136cad5edf3d5081bc801375929275e34fadc0c3106c'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 596c7d541ee529adc49b5195e7830e5862686bfc9e82471c8e91d4b28154625013f8e02544d95d2566e08b531f5b32d38041844ff3a9ac2560631f64cbb41dfd
|
7
|
+
data.tar.gz: fe863937eed29f397a70f63a52f0c9f72402806f245c82ab9acca91c51679fdadb7f044cad7f96af312590951218082160a879af3b74daebd5ef2a8ea13a1981
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
array_include_methods (1.4.0)
|
5
|
+
ast (2.4.2)
|
6
|
+
chunky_png (1.4.0)
|
7
|
+
color (1.8)
|
8
|
+
equalizer (0.0.11)
|
9
|
+
facets (3.1.0)
|
10
|
+
glimmer (2.7.3)
|
11
|
+
array_include_methods (~> 1.4.0)
|
12
|
+
facets (>= 3.1.0, < 4.0.0)
|
13
|
+
glimmer-dsl-libui (0.7.4)
|
14
|
+
chunky_png (~> 1.4.0)
|
15
|
+
color (~> 1.8)
|
16
|
+
equalizer (= 0.0.11)
|
17
|
+
glimmer (~> 2.7.3)
|
18
|
+
libui (~> 0.1.2.pre)
|
19
|
+
os (>= 1.0.0, < 2.0.0)
|
20
|
+
perfect-shape (~> 1.0.7)
|
21
|
+
rouge (>= 3.26.0, < 4.0.0)
|
22
|
+
super_module (~> 1.4.1)
|
23
|
+
json (2.6.3)
|
24
|
+
libui (0.1.2.pre-x64-mingw)
|
25
|
+
matrix (0.4.2)
|
26
|
+
method_source (1.0.0)
|
27
|
+
minitest (5.16.3)
|
28
|
+
mysql2 (0.5.5)
|
29
|
+
os (1.1.4)
|
30
|
+
parallel (1.22.1)
|
31
|
+
parser (3.2.2.0)
|
32
|
+
ast (~> 2.4.1)
|
33
|
+
perfect-shape (1.0.7)
|
34
|
+
equalizer (>= 0.0.11, < 1.1.0)
|
35
|
+
matrix (>= 0.4.2, < 1.1.0)
|
36
|
+
rainbow (3.1.1)
|
37
|
+
regexp_parser (2.7.0)
|
38
|
+
rexml (3.2.5)
|
39
|
+
rouge (3.30.0)
|
40
|
+
rubocop (1.50.1)
|
41
|
+
json (~> 2.3)
|
42
|
+
parallel (~> 1.10)
|
43
|
+
parser (>= 3.2.0.0)
|
44
|
+
rainbow (>= 2.2.2, < 4.0)
|
45
|
+
regexp_parser (>= 1.8, < 3.0)
|
46
|
+
rexml (>= 3.2.5, < 4.0)
|
47
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
48
|
+
ruby-progressbar (~> 1.7)
|
49
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
50
|
+
rubocop-ast (1.28.0)
|
51
|
+
parser (>= 3.2.1.0)
|
52
|
+
ruby-progressbar (1.13.0)
|
53
|
+
super_module (1.4.1)
|
54
|
+
method_source (>= 0.8.2, < 1.1.0)
|
55
|
+
unicode-display_width (2.4.2)
|
56
|
+
win32api (0.1.0)
|
57
|
+
|
58
|
+
PLATFORMS
|
59
|
+
x64-mingw-ucrt
|
60
|
+
|
61
|
+
DEPENDENCIES
|
62
|
+
glimmer-dsl-libui (~> 0.7.4)
|
63
|
+
minitest
|
64
|
+
mysql2
|
65
|
+
rubocop
|
66
|
+
win32api
|
67
|
+
|
68
|
+
BUNDLED WITH
|
69
|
+
2.4.10
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
@startuml
|
2
|
+
'https://plantuml.com/sequence-diagram
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
actor Пользователь as user
|
7
|
+
boundary "ts: AuthorListView" as ts
|
8
|
+
control "tsс: AuthorListController" as tsc
|
9
|
+
boundary "sif: AuthorInputForm" as sif
|
10
|
+
control "sifcc: AuthorInputFormControllerCreate" as sifcc
|
11
|
+
entity "srep: AuthorDBDataSource" as srep
|
12
|
+
|
13
|
+
user -> ts : Клик на <<Добавить>>
|
14
|
+
ts -> tsc : show_modal_add
|
15
|
+
tsc -> sifcc : <<new>>
|
16
|
+
sifcc --> tsc
|
17
|
+
tsc -> sif : <<new>>
|
18
|
+
sif --> tsc
|
19
|
+
tsc -> sifcc : set_view
|
20
|
+
sifcc --> tsc
|
21
|
+
tsc -> sif : create
|
22
|
+
sif -> sifcc : on_view_created
|
23
|
+
sifcc -> srep : <<new>>
|
24
|
+
srep --> sifcc
|
25
|
+
sifcc --> sif
|
26
|
+
sif --> tsc
|
27
|
+
tsc -> sif : show
|
28
|
+
sif --> tsc
|
29
|
+
tsc --> ts
|
30
|
+
ts --> user
|
31
|
+
|
32
|
+
user -> sif : Клик на <<Сохранить>>
|
33
|
+
sif -> sifcc : process_fields
|
34
|
+
sifcc -> srep : add_student
|
35
|
+
srep --> sifcc
|
36
|
+
sifcc -> sif : close
|
37
|
+
sif --> sifcc
|
38
|
+
sifcc --> sif
|
39
|
+
sif --> user
|
40
|
+
|
41
|
+
|
42
|
+
@enduml
|
data/diagrams/author.png
ADDED
Binary file
|
@@ -0,0 +1,118 @@
|
|
1
|
+
@startuml
|
2
|
+
|
3
|
+
AuthorListView *-- AuthorListController
|
4
|
+
AuthorListView --* AuthorListController
|
5
|
+
|
6
|
+
AuthorListView -> AuthorInputForm
|
7
|
+
AuthorListController o-- ListStateNotifier
|
8
|
+
AuthorListController o-- AuthorDBDataSource
|
9
|
+
|
10
|
+
AuthorInputFormControllerCreate o-- AuthorDBDataSource
|
11
|
+
AuthorInputFormControllerEdit o-- AuthorDBDataSource
|
12
|
+
|
13
|
+
AuthorInputForm *-- AuthorInputFormControllerCreate
|
14
|
+
AuthorInputForm *-- AuthorInputFormControllerEdit
|
15
|
+
AuthorInputForm --* AuthorInputFormControllerCreate
|
16
|
+
AuthorInputForm --* AuthorInputFormControllerEdit
|
17
|
+
AuthorDBDataSource o-- DBClient
|
18
|
+
|
19
|
+
class AuthorDBDataSource {
|
20
|
+
+ initialize()
|
21
|
+
+ add(author: Author): Author
|
22
|
+
+ change(author: Author): Author
|
23
|
+
+ delete(id: Integer): void
|
24
|
+
+ get(id: Integer): Author
|
25
|
+
+ get_list(page_size: Integer, page_num: Integer, sort_field: String, sort_direction: String, has_father_name: Boolean): List<Author>
|
26
|
+
+ count(): Integer
|
27
|
+
}
|
28
|
+
|
29
|
+
class DBClient {
|
30
|
+
+ self.instance(): DBClient
|
31
|
+
+ query(sql: String): Object
|
32
|
+
+ last_id(): Integer
|
33
|
+
}
|
34
|
+
|
35
|
+
class AuthorListController {
|
36
|
+
- view: Object
|
37
|
+
- state_notifier: ListStateNotifier
|
38
|
+
- author_rep: AuthorDBDataSource
|
39
|
+
- sort_columns: Array<String>
|
40
|
+
- sort_by: String
|
41
|
+
- father_name_filter_columns: Array<Boolean>
|
42
|
+
- father_name_filter: Boolean
|
43
|
+
+ on_view_created()
|
44
|
+
+ show_view()
|
45
|
+
+ show_modal_add()
|
46
|
+
+ show_modal_edit(current_page: int, per_page: int, selected_row: int)
|
47
|
+
+ delete_selected(current_page: int, per_page: int, selected_row: int)
|
48
|
+
+ refresh_data(page: int, per_page: int)
|
49
|
+
+ sort(page: int, per_page: int, sort_index: int)
|
50
|
+
+ filter_father_name(page: int, per_page: int, filter_index: int)
|
51
|
+
- on_db_conn_error()
|
52
|
+
}
|
53
|
+
class ListStateNotifier {
|
54
|
+
- items: Array
|
55
|
+
- listeners: Array
|
56
|
+
+ initialize()
|
57
|
+
+ set_all(objects: Array)
|
58
|
+
+ add(object: Object)
|
59
|
+
+ get(number: Integer): Object
|
60
|
+
+ delete(object: Object)
|
61
|
+
+ replace(object: Object, new_object: Object)
|
62
|
+
+ add_listener(listener: Object)
|
63
|
+
+ delete_listener(listener: Object)
|
64
|
+
- notify_listeners()
|
65
|
+
}
|
66
|
+
class AuthorDBDataSource {
|
67
|
+
+ get_list(limit: int, offset: int, sort_by: String, sort_order: String, father_name_filter: Boolean): Array<Author>
|
68
|
+
+ add(item: Author): Author
|
69
|
+
+ delete(id: int): void
|
70
|
+
+ count(): int
|
71
|
+
}
|
72
|
+
class AuthorInputFormControllerCreate {
|
73
|
+
- parent_controller: AuthorListController
|
74
|
+
- author_rep: AuthorDBDataSource
|
75
|
+
- view: Object
|
76
|
+
+ on_view_created()
|
77
|
+
+ set_view(view: Object)
|
78
|
+
+ process_fields(fields: Hash<String, String>): void
|
79
|
+
- on_db_conn_error()
|
80
|
+
}
|
81
|
+
class AuthorInputFormControllerEdit {
|
82
|
+
- parent_controller: AuthorListController
|
83
|
+
- item: Author
|
84
|
+
- author_rep: AuthorDBDataSource
|
85
|
+
- view: Object
|
86
|
+
+ on_view_created()
|
87
|
+
+ set_view(view: Object)
|
88
|
+
+ populate_fields(item: Author): void
|
89
|
+
- on_db_conn_error()
|
90
|
+
}
|
91
|
+
class AuthorListView {
|
92
|
+
- PAGE_SIZE: integer = 20
|
93
|
+
- controller: AuthorListController
|
94
|
+
- current_page: integer = 1
|
95
|
+
- total_count: integer = 0
|
96
|
+
- items: Struct[]
|
97
|
+
- table: refined_table
|
98
|
+
- page_label: label
|
99
|
+
+ initialize()
|
100
|
+
+ on_create()
|
101
|
+
+ update(authors: Author[])
|
102
|
+
+ update_student_count(new_cnt: integer)
|
103
|
+
+ create()
|
104
|
+
}
|
105
|
+
|
106
|
+
class AuthorInputForm {
|
107
|
+
- item: Hash
|
108
|
+
- controller: AuthorInputFormControllerCreate
|
109
|
+
- entries: Hash
|
110
|
+
+ initialize(controller: AuthorInputFormControllerCreate, existing_student: Author)
|
111
|
+
+ on_create()
|
112
|
+
+ create()
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
@enduml
|
data/diagrams/core.png
ADDED
Binary file
|
data/diagrams/core.puml
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
@startuml
|
2
|
+
@startuml
|
3
|
+
class AuthorDBDataSource {
|
4
|
+
- client: DBClient
|
5
|
+
+ initialize()
|
6
|
+
+ add(author: Author): Author
|
7
|
+
+ change(author: Author): Author
|
8
|
+
+ delete(id: int): void
|
9
|
+
+ get(id: int): Author
|
10
|
+
+ get_list(page_size: int, page_num: int, sort_field: string, sort_direction: string, has_father_name: bool = nil): Author[]
|
11
|
+
+ count(): int
|
12
|
+
}
|
13
|
+
|
14
|
+
class PublisherDBDataSource {
|
15
|
+
- client: DBClient
|
16
|
+
+ initialize()
|
17
|
+
+ add(publisher: Publisher): Publisher
|
18
|
+
+ change(publisher: Publisher): Publisher
|
19
|
+
+ delete(id: int): void
|
20
|
+
+ get(id: int): Publisher
|
21
|
+
+ get_list(page_size: int, page_num: int, sort_field: string, sort_direction: string, has_email: bool = nil): Publisher[]
|
22
|
+
+ count(): int
|
23
|
+
}
|
24
|
+
|
25
|
+
class BookDBDataSource {
|
26
|
+
- client: DBClient
|
27
|
+
+ initialize()
|
28
|
+
+ add(book: Book): Book
|
29
|
+
+ change(book: Book): Book
|
30
|
+
+ delete(id: int): void
|
31
|
+
+ get(id: int): Book
|
32
|
+
+ get_list(page_size: int, page_num: int, sort_field: string, sort_direction: string, author_id: int = nil, publisher_id: int = nil, min_year: int = nil, max_year: int = nil): Book[]
|
33
|
+
+ count(author_id: int = nil, publisher_id: int = nil, min_year: int = nil, max_year: int = nil): int
|
34
|
+
}
|
35
|
+
|
36
|
+
class DBClient {
|
37
|
+
- connection: Mysql2::Client
|
38
|
+
- last_id: int
|
39
|
+
- initialize()
|
40
|
+
+ query(query: string): Mysql2::Result
|
41
|
+
+ last_id(): int
|
42
|
+
}
|
43
|
+
|
44
|
+
class Author {
|
45
|
+
- author_id
|
46
|
+
- first_name
|
47
|
+
- last_name
|
48
|
+
- father_name
|
49
|
+
|
50
|
+
+ initialize(author_id, first_name, last_name, father_name = nil)
|
51
|
+
- validate_null(name, value)
|
52
|
+
- validate_name_length(first_name, last_name, father_name)
|
53
|
+
}
|
54
|
+
|
55
|
+
class Book {
|
56
|
+
- book_id
|
57
|
+
- title
|
58
|
+
- author_id
|
59
|
+
- publisher_id
|
60
|
+
|
61
|
+
+ initialize(book_id, title, author_id, publisher_id)
|
62
|
+
- validate_null(name, value)
|
63
|
+
- validate_title_length(title)
|
64
|
+
}
|
65
|
+
|
66
|
+
class Publisher {
|
67
|
+
EMAIL_REGEX
|
68
|
+
- publisher_id
|
69
|
+
- name
|
70
|
+
- email
|
71
|
+
|
72
|
+
+ initialize(publisher_id, name, email = nil)
|
73
|
+
- validate_null(name, value)
|
74
|
+
- validate_name_length(name)
|
75
|
+
- validate_email(email)
|
76
|
+
}
|
77
|
+
class ListStateNotifier {
|
78
|
+
- items: Array
|
79
|
+
- listeners: Array
|
80
|
+
+ initialize()
|
81
|
+
+ set_all(objects: Array)
|
82
|
+
+ add(object: Object)
|
83
|
+
+ get(number: Integer): Object
|
84
|
+
+ delete(object: Object)
|
85
|
+
+ replace(object: Object, new_object: Object)
|
86
|
+
+ add_listener(listener: Object)
|
87
|
+
+ delete_listener(listener: Object)
|
88
|
+
- notify_listeners()
|
89
|
+
}
|
90
|
+
|
91
|
+
Author --o Book
|
92
|
+
Book o-- Publisher
|
93
|
+
AuthorDBDataSource o-- DBClient
|
94
|
+
PublisherDBDataSource o-- DBClient
|
95
|
+
BookDBDataSource o-- DBClient
|
96
|
+
AuthorDBDataSource ..> Author
|
97
|
+
PublisherDBDataSource ..> Publisher
|
98
|
+
BookDBDataSource ..> Book
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
@enduml
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
@startuml
|
2
|
+
'https://plantuml.com/sequence-diagram
|
3
|
+
|
4
|
+
|
5
|
+
actor Пользователь as user
|
6
|
+
boundary "ts: AuthorListView" as ts
|
7
|
+
control "tsс: AuthorListController" as tsc
|
8
|
+
entity "srep: AuthorDBDataSource" as srep
|
9
|
+
|
10
|
+
user -> ts : Клик на <<Удалить>>
|
11
|
+
ts -> tsc : delete_selected
|
12
|
+
tsc -> srep : remove_student
|
13
|
+
srep --> tsc
|
14
|
+
tsc --> ts
|
15
|
+
ts -> tsc : refresh_data
|
16
|
+
tsc -> srep : paginated_short_students
|
17
|
+
srep --> tsc
|
18
|
+
tsc -> ts : update_student_count
|
19
|
+
ts --> tsc
|
20
|
+
tsc --> ts
|
21
|
+
ts --> user
|
22
|
+
|
23
|
+
@enduml
|
24
|
+
|
25
|
+
|
Binary file
|
@@ -0,0 +1,48 @@
|
|
1
|
+
@startuml
|
2
|
+
'https://plantuml.com/sequence-diagram
|
3
|
+
|
4
|
+
actor Пользователь as user
|
5
|
+
boundary "ts: AuthorListView" as ts
|
6
|
+
control "tsс: AuthorListController" as tsc
|
7
|
+
boundary "sif: AuthorInputForm" as sif
|
8
|
+
control "sifce: AuthorInputFormControllerEdit" as sifce
|
9
|
+
entity "srep: AuthorDBDataSource" as srep
|
10
|
+
|
11
|
+
user -> ts : Клик на <<Изменить>>
|
12
|
+
ts -> tsc : show_modal_edit
|
13
|
+
tsc -> sifce : <<new>>
|
14
|
+
sifce --> tsc
|
15
|
+
tsc -> sif : <<new>>
|
16
|
+
sif --> tsc
|
17
|
+
tsc -> sifce : set_view
|
18
|
+
sifce --> tsc
|
19
|
+
tsc -> sif : create
|
20
|
+
sif -> sifce : on_view_created
|
21
|
+
sifce -> srep : <<new>>
|
22
|
+
srep --> sifce
|
23
|
+
sifce -> srep : student_by_id
|
24
|
+
srep --> sifce
|
25
|
+
sifce -> sif : make_readonly
|
26
|
+
sif --> sifce
|
27
|
+
sifce -> sif : set_value
|
28
|
+
sif --> sifce
|
29
|
+
sifce --> sif
|
30
|
+
sif --> tsc
|
31
|
+
tsc -> sif : show
|
32
|
+
sif --> tsc
|
33
|
+
tsc --> ts
|
34
|
+
ts --> user
|
35
|
+
|
36
|
+
user -> sif : Клик на <<Сохранить>>
|
37
|
+
sif -> sifce : process_fields
|
38
|
+
sifce -> srep : replace_student
|
39
|
+
srep --> sifce
|
40
|
+
sifce -> sif : close
|
41
|
+
sif --> sifce
|
42
|
+
sifce --> sif
|
43
|
+
sif --> user
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
@enduml
|
48
|
+
|
data/diagrams/er.png
ADDED
Binary file
|
data/diagrams/er.puml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
@startuml
|
2
|
+
|
3
|
+
entity Author {
|
4
|
+
+AuthorID [PK]
|
5
|
+
--
|
6
|
+
FirstName
|
7
|
+
LastName
|
8
|
+
FatherName
|
9
|
+
}
|
10
|
+
|
11
|
+
entity Publisher {
|
12
|
+
+PublisherID [PK]
|
13
|
+
--
|
14
|
+
Name
|
15
|
+
Email
|
16
|
+
}
|
17
|
+
|
18
|
+
entity Book {
|
19
|
+
+BookID [PK]
|
20
|
+
--
|
21
|
+
Title
|
22
|
+
--
|
23
|
+
+AuthorID [FK]
|
24
|
+
+PublisherID [FK]
|
25
|
+
}
|
26
|
+
|
27
|
+
Author --{ Book
|
28
|
+
Publisher --{ Book
|
29
|
+
|
30
|
+
@enduml
|
Binary file
|
@@ -0,0 +1,118 @@
|
|
1
|
+
@startuml
|
2
|
+
|
3
|
+
PublisherListView *-- PublisherListController
|
4
|
+
PublisherListView --* PublisherListController
|
5
|
+
|
6
|
+
PublisherListView -> PublisherInputForm
|
7
|
+
PublisherListController o-- ListStateNotifier
|
8
|
+
PublisherListController o-- PublisherDBDataSource
|
9
|
+
|
10
|
+
PublisherInputFormControllerCreate o-- PublisherDBDataSource
|
11
|
+
PublisherInputFormControllerEdit o-- PublisherDBDataSource
|
12
|
+
|
13
|
+
PublisherInputForm *-- PublisherInputFormControllerCreate
|
14
|
+
PublisherInputForm *-- PublisherInputFormControllerEdit
|
15
|
+
PublisherInputForm --* PublisherInputFormControllerCreate
|
16
|
+
PublisherInputForm --* PublisherInputFormControllerEdit
|
17
|
+
PublisherDBDataSource o-- DBClient
|
18
|
+
|
19
|
+
class PublisherDBDataSource {
|
20
|
+
+ initialize()
|
21
|
+
+ add(publisher: Publisher): Publisher
|
22
|
+
+ change(publisher: Publisher): Publisher
|
23
|
+
+ delete(id: Integer): void
|
24
|
+
+ get(id: Integer): Publisher
|
25
|
+
+ get_list(page_size: Integer, page_num: Integer, sort_field: String, sort_direction: String, has_father_name: Boolean): List<Publisher>
|
26
|
+
+ count(): Integer
|
27
|
+
}
|
28
|
+
|
29
|
+
class DBClient {
|
30
|
+
+ self.instance(): DBClient
|
31
|
+
+ query(sql: String): Object
|
32
|
+
+ last_id(): Integer
|
33
|
+
}
|
34
|
+
|
35
|
+
class PublisherListController {
|
36
|
+
- view: Object
|
37
|
+
- state_notifier: ListStateNotifier
|
38
|
+
- publisher_rep: PublisherDBDataSource
|
39
|
+
- sort_columns: Array<String>
|
40
|
+
- sort_by: String
|
41
|
+
- father_name_filter_columns: Array<Boolean>
|
42
|
+
- father_name_filter: Boolean
|
43
|
+
+ on_view_created()
|
44
|
+
+ show_view()
|
45
|
+
+ show_modal_add()
|
46
|
+
+ show_modal_edit(current_page: int, per_page: int, selected_row: int)
|
47
|
+
+ delete_selected(current_page: int, per_page: int, selected_row: int)
|
48
|
+
+ refresh_data(page: int, per_page: int)
|
49
|
+
+ sort(page: int, per_page: int, sort_index: int)
|
50
|
+
+ filter_father_name(page: int, per_page: int, filter_index: int)
|
51
|
+
- on_db_conn_error()
|
52
|
+
}
|
53
|
+
class ListStateNotifier {
|
54
|
+
- items: Array
|
55
|
+
- listeners: Array
|
56
|
+
+ initialize()
|
57
|
+
+ set_all(objects: Array)
|
58
|
+
+ add(object: Object)
|
59
|
+
+ get(number: Integer): Object
|
60
|
+
+ delete(object: Object)
|
61
|
+
+ replace(object: Object, new_object: Object)
|
62
|
+
+ add_listener(listener: Object)
|
63
|
+
+ delete_listener(listener: Object)
|
64
|
+
- notify_listeners()
|
65
|
+
}
|
66
|
+
class PublisherDBDataSource {
|
67
|
+
+ get_list(limit: int, offset: int, sort_by: String, sort_order: String, father_name_filter: Boolean): Array<Publisher>
|
68
|
+
+ add(item: Publisher): Publisher
|
69
|
+
+ delete(id: int): void
|
70
|
+
+ count(): int
|
71
|
+
}
|
72
|
+
class PublisherInputFormControllerCreate {
|
73
|
+
- parent_controller: PublisherListController
|
74
|
+
- publisher_rep: PublisherDBDataSource
|
75
|
+
- view: Object
|
76
|
+
+ on_view_created()
|
77
|
+
+ set_view(view: Object)
|
78
|
+
+ process_fields(fields: Hash<String, String>): void
|
79
|
+
- on_db_conn_error()
|
80
|
+
}
|
81
|
+
class PublisherInputFormControllerEdit {
|
82
|
+
- parent_controller: PublisherListController
|
83
|
+
- item: Publisher
|
84
|
+
- publisher_rep: PublisherDBDataSource
|
85
|
+
- view: Object
|
86
|
+
+ on_view_created()
|
87
|
+
+ set_view(view: Object)
|
88
|
+
+ populate_fields(item: Publisher): void
|
89
|
+
- on_db_conn_error()
|
90
|
+
}
|
91
|
+
class PublisherListView {
|
92
|
+
- PAGE_SIZE: integer = 20
|
93
|
+
- controller: PublisherListController
|
94
|
+
- current_page: integer = 1
|
95
|
+
- total_count: integer = 0
|
96
|
+
- items: Struct[]
|
97
|
+
- table: refined_table
|
98
|
+
- page_label: label
|
99
|
+
+ initialize()
|
100
|
+
+ on_create()
|
101
|
+
+ update(publishers: Publisher[])
|
102
|
+
+ update_student_count(new_cnt: integer)
|
103
|
+
+ create()
|
104
|
+
}
|
105
|
+
|
106
|
+
class PublisherInputForm {
|
107
|
+
- item: Hash
|
108
|
+
- controller: PublisherInputFormControllerCreate
|
109
|
+
- entries: Hash
|
110
|
+
+ initialize(controller: PublisherInputFormControllerCreate, existing_student: Publisher)
|
111
|
+
+ on_create()
|
112
|
+
+ create()
|
113
|
+
}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
@enduml
|
Binary file
|
data/diagrams/start.png
ADDED
Binary file
|
data/diagrams/start.puml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
@startuml
|
2
|
+
participant "main.rb" as main
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
boundary "mw: MainWindow" as mw
|
8
|
+
boundary "ts: AuthorListView" as ts
|
9
|
+
control "tsc: AuthorListController" as tsc
|
10
|
+
entity "dlss: ListStateNotifier" as dlss
|
11
|
+
entity "srep: AuthorDBDataSource" as srep
|
12
|
+
entity "dbsa: DBSourceAdapter" as dbsa
|
13
|
+
entity "DBClient" as dbds
|
14
|
+
|
15
|
+
database DB as db
|
16
|
+
|
17
|
+
main -> mw : <<new>>
|
18
|
+
mw -> ts : <<new>>
|
19
|
+
ts -> tsc : <<new>>(self)
|
20
|
+
tsc -> dlss : <<new>>(Array)
|
21
|
+
dlss --> tsc
|
22
|
+
tsc -> dlss : add_listener(AuthorListView)
|
23
|
+
dlss --> tsc
|
24
|
+
tsc --> ts
|
25
|
+
ts --> mw
|
26
|
+
mw --> main
|
27
|
+
|
28
|
+
main -> mw : create()
|
29
|
+
mw -> ts : create()
|
30
|
+
ts -> tsc : on_view_created()
|
31
|
+
tsc -> dbsa : <<new>>
|
32
|
+
dbsa -> dbds : <<instance>>
|
33
|
+
dbds -> dbds : <<new>>
|
34
|
+
dbds -> db : [connect]
|
35
|
+
db --> dbds
|
36
|
+
dbds --> dbsa
|
37
|
+
dbsa --> tsc
|
38
|
+
tsc -> srep : <<new>>(DBSourceAdapter)
|
39
|
+
srep --> tsc
|
40
|
+
tsc --> ts
|
41
|
+
|
42
|
+
ts -> tsc : refresh_data(Integer, Integer)
|
43
|
+
tsc -> srep : get_list(Integer, Integer, ListStateNotifier)
|
44
|
+
srep -> dbsa : get_list(Integer, Integer, ListStateNotifier)
|
45
|
+
dbsa -> dbds : prepare_exec(String, Integer, Integer)
|
46
|
+
dbds -> db : [SELECT]
|
47
|
+
db --> dbds
|
48
|
+
dbds --> dbsa
|
49
|
+
dbsa -> dlss : <<new>>(Array)
|
50
|
+
dlss --> dbsa
|
51
|
+
dbsa -> dlss : replace_objects(Array)
|
52
|
+
dlss -> ts : update(ListStateNotifier)
|
53
|
+
ts --> dlss
|
54
|
+
dlss --> dbsa
|
55
|
+
dbsa --> srep
|
56
|
+
srep --> tsc
|
57
|
+
|
58
|
+
tsc -> srep : student_count()
|
59
|
+
srep -> dbsa : student_count()
|
60
|
+
dbsa -> dbds: query(String)
|
61
|
+
dbds -> db : [SELECT]
|
62
|
+
db --> dbds
|
63
|
+
dbds --> dbsa
|
64
|
+
dbsa --> srep
|
65
|
+
srep --> tsc
|
66
|
+
tsc -> ts : update_student_count(Integer)
|
67
|
+
ts --> tsc
|
68
|
+
tsc --> ts
|
69
|
+
ts --> mw
|
70
|
+
mw --> main
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
@enduml
|