Skip to content

Commit

Permalink
[EDP-DDM-28658] github: issue 18, fixed puml files, added partials, r…
Browse files Browse the repository at this point in the history
…eviewed and added updates to document /admin-portal/data-model/admin-portal-data-model-management.adoc

Change-Id: I9cf9fb2c94abf321a00c3ee3bf8abeb0bca4c3a6
(cherry picked from commit 5856e7060470bf10569c785791fbfb65dbad6680)
  • Loading branch information
[email protected] committed Sep 25, 2023
1 parent 062a41c commit bb3d386
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 40 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,80 +9,59 @@ include::admin-portal-data-model-scenarious.adoc[]

== Out of scope
- Working with data types
//- Робота з типами даних
- Working with analytical representations
//- Робота з аналітичними представленнями
- Resolving conflicts using the administrative portal of the registry regulations management
//- Вирішення конфліктів з використанням адмінпорталу менеджменту регламенту реєстру
- Resolving conflicts using the administrative portal's regulations management

== Principles of working with changes in the database
//== Принципи роботи зі змінами в БД

=== Existing mechanism for working with changes in the database
//=== Існуючий механізм роботи зі змінами в БД

The existing mechanism for working with changes in the database is based on two principles:
//Існуючий механізм роботи зі змінами в БД базуєтсья на двух принципах:

- Creation of liquibase changeset
//- Cтворення liquibase changeset
- Saving liquibase changeset in git
//- Збереження liquibase changeset в git
- Creating the Liquibase changeset
- Saving the Liquibase changeset in git

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-luqibase-current-flow.svg[]

=== Advanced mechanism for working with changes in the database
//=== Розширений механізм роботи зі змінами в БД
It is suggested to extend the existing mechanism for working with database changes by adding a DataModelSnapshot document to the git repository, which will reflect the state of the data model.
//Пропонується розширити існуючий механізм роботи зі змінами БД шляхом додавання DataModelSnapshot документу в git репозиторій, котрий буде відображати стан моделі даних.

It is suggested to extend the existing mechanism for working with database changes by adding a _DataModelSnapshot_ document to the git repository, which will reflect the data model's state.

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-luqibase-extended-flow.svg[]

=== Basic concepts
//=== Основні концепції
- DataModelSnapshot model: JSON documents reflecting the state of the registry regulations data model.
//- DataModelSnapshot model - JSON документи, що відображають стан моделі даних регламенту реєстру

- _DataModelSnapshot_ model: JSON documents reflecting the state of the registry regulations data model.
- Diff Document: The document showing the difference between the two states of the registry regulations data model.
//- Diff Document - документ, що відображає різницю між двома станами моделі даних регламенту реєстру
- History Document: The document reflecting the history of changes made to the master version or the candidate version of the registry regulations.
//- History Document - документ, що відображає історію змін мастер версії або версії- кандидату регламенту реєстру
- History Document: The document reflects the history of changes made to the master or candidate versions of the registry regulations.

=== DataModelSnapshot structure description
//=== Описання структури DataModelSnapshot

[NOTE]
The above data model was obtained as the result of the analysis of the existing state of lqiuibase changelogs (including the functionality analysis of the custom liquibase tags).
//Вищенаведена модель даних була отримана в результаті аналізу існуючого стану lqiuibase changelogs (включно з аналізом функціональності custom liquibase тегів)
The above data model was obtained from analyzing the existing state of liquibase changelogs (including the functionality analysis of the custom liquibase tags).

[plantuml, db-tables-management-er, svg]
----
include::partial$architecture/registry/administrative/regulation-management/admin-portal/db-tables-management-er.puml[]
----


=== Description of the file structure in the file system
//=== Опис структури файлів на файловій системі

The DataModelSnapshot model has the following file structure in the file system:
//DataModelSnapshot model має наступну структуру файлів на файловій системі
The _DataModelSnapshot_ model has the following file structure in the file system:

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-datamodel-filestructure.svg[]

- The list of tables is determined by the list of files in the file system.
//- Перелік таблиць визначається переліком файлів на файловій системі
- The name of the table file matches the name of the table and is `<table-name>.json`.
//- Ім'я файлу таблиць відповідає назві таблиці та має наступний вигляд: `<table-name>.json`
- The name of the role permission file corresponds to the name id role permission and is the following: `<role-id>.json`.
//- Ім'я файлу role permission відповідає назві id role permission та має наступний вигляд: `<role-id>.json`

==== Temporary file structure in the file system (first iteration)
//==== Тимчасова структура файлів на файловій системі (first iteration)

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-datamodel-filestructure-simple.svg[]

=== Description of the DataModelSnapshot data format
//=== Опис DataModelSnapshot формату даних
The Json format is used as a technical tool for describing the data structure of DataModelSnapshot. As a description of the contract document, https://json-schema.org/ [JsonSchema] is used.
//В якості технічного інструменту опису структури даних DataModelSnapshot використовується Json формат. В якості опису контракту документу використовується https://json-schema.org/[JsonSchema]

We use the JSON format as a technical tool for describing the data structure of _DataModelSnapshot_. As a description of the contract document, https://json-schema.org/ [JsonSchema] is used.

xref:arch:architecture/registry/administrative/regulation-management/admin-portal/data-model/admin-portal-data-model-json-schema-description.adoc[DataModelSnapshotSchema]

Expand All @@ -91,26 +70,27 @@ include::domain-attributes-description.adoc[]

include::admin-portal-data-model-principles.adoc[]

== Description of the technical solution
//== Опис технічного рішення
== Technical solution description

=== Container

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-c4-container.svg[]

=== Admin portal API container

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-c4-apiContainer.svg[]

=== CICD container

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-c4-cicd-container.svg[]

== System component interaction scenario when editing the structure of the registry tables
//== Сценарій взаємодії компонентів системи під час редагування структури таблиць регламенту реєстру

[plantuml, db-tables-management-sequence, svg]
----
include::partial$architecture/registry/administrative/regulation-management/admin-portal/db-tables-management-sequence.puml[]
----

== General diagram of the system components interaction when editing the data model of the registry regulations
//== Загальна діаграма взаємодії компонентів системи під час редагування моделі даних регламенту реєстру
== General diagram of the system components' interaction when editing the data model of the registry regulations

image::architecture/registry/administrative/regulation-management/admin-portal/data-model/tables-management-component-structure.svg[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@startuml
' hide the spot
hide circle

' avoid problems with angled crows feet
skinparam linetype ortho

entity "Table" as table {
*id : UUID
--
name: string
historicalFlag: boolean
objectReference:
description: String
}

entity "Index" as index {
*id : UUID
--
name: string
columns: array[Index.Column]
}

entity "Index.Column" as index_column {
name: string
sorting: enum[ASC, DESC, NONE]
}

entity "UniqueConstraint" as unique_constraint extends index

entity "PrimaryKeyConstraint" as primary_key_constraint extends unique_constraint

entity "Column" as column {
*id : UUID
--
name: string
description: string
type: enum[clarify types]
defaultValue: object
notNull: boolean
}

entity "ForeignKey" as foreign_key {
*id : UUID
--
name: string
targetTable: string
columnPairs: array[ForeignKey.ColumnPair]
}

entity "ForeignKey.ColumnPair" as foreign_key_column_pair {
sourceColumnName: string
targetColumnName: string
}

entity "DdmRolePermission" as ddm_role_permission {
*permissionId : UUID
--
roleName : string
objectName : string // it's table name
columnName : string
operation: enum[INSERT, SELECT, UPDATE, DELETE]
}


table ||..o{ index
table ||..o{ column
table ||..o{ foreign_key
table ||..o{ unique_constraint
table ||..o{ primary_key_constraint

foreign_key +-- foreign_key_column_pair
index +-- index_column
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@startuml

autonumber
skinparam responseMessageBelowArrow true

actor "Regulations\n administrator" as User
actor "Regulations\n inspector" as Reviewer

participant "Administrative portal" as FrontEnd
participant "Registry regulations\n management service" as BackendService
participant "Change inspection service" as Gerrit
participant "Registry regulations\n publishing service" as Jenkins

activate User
User -> FrontEnd: Create candidate version of the regulations
FrontEnd -> BackendService: Create candidate version of the regulations
activate BackendService
BackendService -> Gerrit: Create a separate branch
activate Gerrit
BackendService -> Gerrit: Get updated version of DataModelSnapshot
BackendService <-- Gerrit: DataModelSnapshot

BackendService -> Gerrit: Get change history of DataModelSnapshot
FrontEnd <-- BackendService: DataModelSnapshot

BackendService -> BackendService: Processing change history
FrontEnd <-- BackendService: History
User <-- FrontEnd: Regulations candidate version

User -> FrontEnd: Request to save changes of\n regulations candidate version
FrontEnd -> BackendService: New version of DataModelSnapshot

User -> FrontEnd: Request for change inspection of\n regulations candidate version
FrontEnd -> BackendService: Send the candidate version for review

deactivate User

BackendService -> Gerrit: Get DataModelSnapshot of the document\n that is up-to-date when creating the change branch
BackendService <-- Gerrit: DataModelSnapshot

BackendService -> Gerrit: Get changed DataModelSnapshot
BackendService <-- Gerrit: DataModelSnapshot
BackendService -> BackendService: build Diff document
BackendService -> BackendService: conversion of Diif document\n in liquibase changeset

BackendService -> BackendService: Add information to liquibase сhangelog\n from liquibase changeset
BackendService -> Gerrit: Save liquibase changeset
deactivate BackendService

activate Reviewer
Reviewer -> FrontEnd: Request for version inspection
FrontEnd -> BackendService: Request for version inspection

activate BackendService
BackendService -> Gerrit: Get candidate version status
BackendService <-- Gerrit: Condition status (conflicts and tests)
BackendService -> Gerrit: Get DataModelSnapshot\n from the candidate version change branch

'Add diff here

BackendService -> Gerrit: Get document with change history
BackendService <-- Gerrit: History
FrontEnd <-- BackendService: Candidate version
Reviewer <-- FrontEnd: Candidate version

Reviewer -> FrontEnd: Request to apply changes
deactivate Reviewer

FrontEnd -> BackendService: Request to apply changes

BackendService -> Gerrit: Merge PR
deactivate BackendService

Gerrit --> Jenkins: Send event to start RegistryRegulationJob

activate Jenkins
Jenkins -> Jenkins: Create DB structure\n and informing metadata table\n using liquibase changelog
Jenkins -> Jenkins: Create DataModelSnapshot\n using DB

Jenkins -> Gerrit: Save updated DataModelSnapshot
deactivate Jenkins
Gerrit -> Gerrit: merge changes to master
deactivate Gerrit

@enduml

0 comments on commit bb3d386

Please sign in to comment.