Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Storage Init Diagram #261

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ execution.

This can be seen in the sequence diagram below

<puml src="diagrams/StorageInitSequenceDiagram.puml" />
<puml src="diagrams/StorageInitSequenceDiagram.puml" width="600"/>
<puml src="diagrams/StorageInitUserPrefSequenceDiagram.puml" width="5500" />
<puml src="diagrams/StorageInitStorageManagerSequenceDiagram.puml" width="400"/>
<puml src="diagrams/StorageInitModulePlanSequenceDiagram.puml" />


<br>

Expand Down Expand Up @@ -541,7 +545,6 @@ The following activity diagrams show the logic of deleting a `Module` from the m

<puml src="diagrams/DeleteCommandActivityDiagram.puml" width="600" />

<puml src="diagrams/DeleteCommandActivityDiagram2.puml" width="600" />

<br>

Expand All @@ -559,6 +562,8 @@ The following sequence diagram shows how the `delete` command works:

<puml src="diagrams/DeleteCommandSequenceDiagram.puml" />

<puml src="diagrams/DeleteCommandSequenceDiagram2.puml" width="600" />

<br>

--------------------------------------------------------------------------------------------------------------------
Expand Down
70 changes: 70 additions & 0 deletions docs/diagrams/StorageInitModulePlanSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

mainframe sd Init Module Plan

box Main LOGIC_COLOR_T2
participant ":MainApp" as MainApp LOGIC_COLOR_T2

box Database DATABASE_COLOR_T1
participant "mp:ModulePlan" as ModulePlan DATABASE_COLOR
participant "jsonModulePlan:JsonSerializableModulePlan" as SerializableModulePlan DATABASE_COLOR
participant "mps:ModulePlanStorage" as ModulePlanStorage DATABASE_COLOR
end box


box Model MODEL_COLOR_T1
participant "plan:ModulePlan" as ModulePlan MODEL_COLOR_T1
end box

box Commons LOGIC_COLOR_T1
participant "<<class>>\nJsonutil" as JsonUtil LOGIC_COLOR_T2
end box

activate MainApp


MainApp -> MainApp : initModelManager()
activate MainApp

MainApp -> ModulePlanStorage : readModulePlan()
activate ModulePlanStorage

ModulePlanStorage -> JsonUtil : readJsonFile(filePath, ModulePlanStorage.class)
activate JsonUtil

create SerializableModulePlan
JsonUtil -> SerializableModulePlan
activate SerializableModulePlan



SerializableModulePlan --> JsonUtil : jsonModulePlan
deactivate SerializableModulePlan

JsonUtil --> ModulePlanStorage : jsonModulePlan
deactivate JsonUtil

ModulePlanStorage -> SerializableModulePlan : toModelType()
activate SerializableModulePlan

create ModulePlan
SerializableModulePlan -> ModulePlan
activate ModulePlan

ModulePlan --> SerializableModulePlan : mp
deactivate ModulePlan


SerializableModulePlan --> ModulePlanStorage : mp
deactivate SerializableModulePlan

ModulePlanStorage --> MainApp : mp
deactivate ModulePlanStorage

MainApp --> MainApp : model

deactivate MainApp

@enduml
129 changes: 4 additions & 125 deletions docs/diagrams/StorageInitSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ participant ":MainApp" as MainApp LOGIC_COLOR_T2

box Database DATABASE_COLOR_T1
participant "ups:UserPrefsStorage" as UserPrefsStorage DATABASE_COLOR
participant "up:UserPrefs" as UserPrefs DATABASE_COLOR
participant "mps:ModulePlanStorage" as ModulePlanStorage DATABASE_COLOR
participant "mp:ModulePlan" as ModulePlan DATABASE_COLOR
participant "jsonModulePlan:JsonSerializableModulePlan" as SerializableModulePlan DATABASE_COLOR
participant ":JsonAdaptedModule" as JsonAdaptedModule DATABASE_COLOR
end box

box Storage MODEL_COLOR_T2
participant "storage:StorageManager" as StorageManager MODEL_COLOR_T2


box Model MODEL_COLOR_T1
participant "m:Module" as Module MODEL_COLOR_T1
participant "plan:ModulePlan" as ModulePlan MODEL_COLOR_T1
end box

box Commons LOGIC_COLOR_T1
participant "<<class>>\nJsonutil" as JsonUtil LOGIC_COLOR_T2
Expand All @@ -30,127 +22,14 @@ end box
[-> MainApp :
activate MainApp

MainApp -> MainApp : initConfig(config)
activate MainApp
MainApp --> MainApp : config
deactivate MainApp

MainApp -> UserPrefsStorage : JsonUserPrefsStorage()
activate UserPrefsStorage

UserPrefsStorage --> MainApp : ups
deactivate UserPrefsStorage

MainApp -> MainApp : initPrefs(config)
activate MainApp

MainApp -> UserPrefsStorage : ups.readUserPrefs()
activate UserPrefsStorage

UserPrefsStorage -> JsonUtil : readJsonFile(filePath, SerializableModulePlan.class)
activate JsonUtil

JsonUtil -> UserPrefs
activate UserPrefs

UserPrefs --> JsonUtil : up
deactivate UserPrefs

JsonUtil --> UserPrefsStorage : up
deactivate JsonUtil

UserPrefsStorage --> MainApp : up
deactivate UserPrefsStorage

MainApp --> MainApp : up

MainApp -> ModulePlanStorage
activate ModulePlanStorage

ModulePlanStorage --> MainApp : mps
deactivate ModulePlanStorage

deactivate MainApp

MainApp -> StorageManager : StorageManager(ModulePlanStorage, UserPrefsStorage)
activate StorageManager

StorageManager --> MainApp : storage
deactivate StorageManager


MainApp -> MainApp : initModelManager()
activate MainApp

MainApp -> StorageManager : readModulePlan()
activate StorageManager

StorageManager -> ModulePlanStorage : readModulePlan(filePath)
deactivate StorageManager
activate ModulePlanStorage

ModulePlanStorage -> JsonUtil : readJsonFile(filePath, ModulePlanStorage.class)
activate JsonUtil

create SerializableModulePlan
JsonUtil -> SerializableModulePlan
activate SerializableModulePlan

loop for each module
create JsonAdaptedModule
SerializableModulePlan -> JsonAdaptedModule
activate JsonAdaptedModule

JsonAdaptedModule --> SerializableModulePlan
deactivate JsonAdaptedModule

end

SerializableModulePlan --> JsonUtil : jsonData
deactivate SerializableModulePlan

JsonUtil --> ModulePlanStorage : jsonModulePlan

ModulePlanStorage --> SerializableModulePlan : toModelType()
activate SerializableModulePlan

create ModulePlan
SerializableModulePlan -> ModulePlan
activate ModulePlan

ModulePlan -> SerializableModulePlan : plan
deactivate ModulePlan

loop for each module
SerializableModulePlan -> JsonAdaptedModule : toModelType()
activate JsonAdaptedModule

create Module
JsonAdaptedModule -> Module
activate Module

Module --> JsonAdaptedModule : m
deactivate module

JsonAdaptedModule --> SerializableModulePlan : m
deactivate JsonAdaptedModule

SerializableModulePlan -> ModulePlan : addModule(m)
activate ModulePlan

ModulePlan --> SerializableModulePlan
deactivate ModulePlan

end
ref over MainApp, UserPrefsStorage, JsonUtil : Init User Pref

SerializableModulePlan --> ModulePlanStorage : plan
deactivate SerializableModulePlan
ref over MainApp, ModulePlanStorage, StorageManager: Init Storage Manager

ModulePlanStorage -> MainApp : plan
deactivate ModulePlanStorage
ref over MainApp, ModulePlanStorage, JsonUtil : Init Module Plan

MainApp --> MainApp : model

[<-- MainApp :
deactivate MainApp

@enduml
33 changes: 33 additions & 0 deletions docs/diagrams/StorageInitStorageManagerSequanceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

mainframe sd Init Storage Manager

box Main LOGIC_COLOR_T2
participant ":MainApp" as MainApp LOGIC_COLOR_T2

box Database DATABASE_COLOR_T1
participant "mps:ModulePlanStorage" as ModulePlanStorage DATABASE_COLOR
end box

box Storage MODEL_COLOR_T2
participant "storage:StorageManager" as StorageManager MODEL_COLOR_T2

activate MainApp

MainApp -> ModulePlanStorage
activate ModulePlanStorage

ModulePlanStorage --> MainApp : mps
deactivate ModulePlanStorage


MainApp -> StorageManager : StorageManager(ModulePlanStorage, UserPrefsStorage)
activate StorageManager

StorageManager --> MainApp : storage
deactivate StorageManager


@enduml
58 changes: 58 additions & 0 deletions docs/diagrams/StorageInitiUserPrefSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

mainframe sd Init User Pref

box Main LOGIC_COLOR_T2
participant ":MainApp" as MainApp LOGIC_COLOR_T2

box Database DATABASE_COLOR_T1
participant "ups:UserPrefsStorage" as UserPrefsStorage DATABASE_COLOR
participant "up:UserPrefs" as UserPrefs DATABASE_COLOR
end box

box Commons LOGIC_COLOR_T1
participant "<<class>>\nJsonutil" as JsonUtil LOGIC_COLOR_T2
end box

activate MainApp

MainApp -> MainApp : initConfig(config)
activate MainApp
MainApp --> MainApp : config
deactivate MainApp

MainApp -> UserPrefsStorage : JsonUserPrefsStorage()
activate UserPrefsStorage

UserPrefsStorage --> MainApp : ups
deactivate UserPrefsStorage

MainApp -> MainApp : initPrefs(ups)
activate MainApp

MainApp -> UserPrefsStorage : ups.readUserPrefs()
activate UserPrefsStorage

UserPrefsStorage -> JsonUtil : readJsonFile(filePath, SerializableModulePlan.class)
activate JsonUtil

create UserPrefs
JsonUtil -> UserPrefs
activate UserPrefs

UserPrefs --> JsonUtil : up
deactivate UserPrefs

JsonUtil --> UserPrefsStorage : up
deactivate JsonUtil

UserPrefsStorage --> MainApp : up
deactivate UserPrefsStorage

MainApp --> MainApp : up
deactivate MainApp


@enduml
Loading