diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 92103bd4900..8e46c8da45d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -376,7 +376,11 @@ execution. This can be seen in the sequence diagram below - + + + + +
@@ -541,7 +545,6 @@ The following activity diagrams show the logic of deleting a `Module` from the m -
@@ -559,6 +562,8 @@ The following sequence diagram shows how the `delete` command works: + +
-------------------------------------------------------------------------------------------------------------------- diff --git a/docs/diagrams/StorageInitModulePlanSequenceDiagram.puml b/docs/diagrams/StorageInitModulePlanSequenceDiagram.puml new file mode 100644 index 00000000000..235103a7ad9 --- /dev/null +++ b/docs/diagrams/StorageInitModulePlanSequenceDiagram.puml @@ -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 "<>\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 diff --git a/docs/diagrams/StorageInitSequenceDiagram.puml b/docs/diagrams/StorageInitSequenceDiagram.puml index b9b6c0f8b58..6e661f1e241 100644 --- a/docs/diagrams/StorageInitSequenceDiagram.puml +++ b/docs/diagrams/StorageInitSequenceDiagram.puml @@ -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 "<>\nJsonutil" as JsonUtil LOGIC_COLOR_T2 @@ -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 diff --git a/docs/diagrams/StorageInitStorageManagerSequanceDiagram.puml b/docs/diagrams/StorageInitStorageManagerSequanceDiagram.puml new file mode 100644 index 00000000000..2fd98292236 --- /dev/null +++ b/docs/diagrams/StorageInitStorageManagerSequanceDiagram.puml @@ -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 diff --git a/docs/diagrams/StorageInitiUserPrefSequenceDiagram.puml b/docs/diagrams/StorageInitiUserPrefSequenceDiagram.puml new file mode 100644 index 00000000000..88348724ce8 --- /dev/null +++ b/docs/diagrams/StorageInitiUserPrefSequenceDiagram.puml @@ -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 "<>\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