From 89eeea6a40f66332453092bade214ff891e567d8 Mon Sep 17 00:00:00 2001 From: ReganChoy Date: Thu, 28 Mar 2024 12:36:38 +0800 Subject: [PATCH 1/4] Update DG for LastMet --- docs/DeveloperGuide.md | 25 ++++++++++ docs/diagrams/LastMetObjectDiagram.puml | 26 ++++++++++ docs/diagrams/LastMetSequenceDiagram.puml | 60 +++++++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 docs/diagrams/LastMetObjectDiagram.puml create mode 100644 docs/diagrams/LastMetSequenceDiagram.puml diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index d6673171639..8580729eb79 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -158,6 +158,31 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa This section describes some noteworthy details on how certain features are implemented. +### Updating last met feature +The last met feature allows users to keep track and update their last interaction with their clients. + +#### Implementation + +The updating of last met command is facilitated by the `LastMetCommandParser` class which is created by the `AddressBookParser`. + +The `LastMetCommandParser#parse()` overrides `Parser#parse()` in the `Parser` interface. +- `LastMetCommandParser#parse()` - Parses the input arguments by storing the prefixes of it respective values in a `ArgumentMultimap` object. +- It will then convert the String input into a Date object before creating a new `LastMetCommand` object with the formatted date. + +The `LastMetCommand` object is then executed by the `Logic` component. + +The `LastMetCommand` object then communicates with the `Model` component to update the LastMet to the client. The `Model` component then updates the `Person` object with the new LastMet. +- `Model#setPerson(Person, Person)` - Sets the client in the existing client list to the new `Person` object which has been edited by the `LastMetCommand#execute()` which contains the new LastMet. +- `Model#setDisplayClient(Person)` - Updates the displayed client in the UI to the client that has been edited with the new LastMet. + +The method `LastMetCommand#execute()` returns a CommandResult object which contains the success message to be displayed to the user. + +The following object diagram illustrates the above: + + +The following sequence diagram shows the lastmet operation: + + ### Add policy feature The add policy feature allows users to add a policy to a client. The policy is stored in the `Policy` class, which contains the policy details such as policy name, policy id. The `Policy` class is then added to the `PolicyList` object stored within the `Person` object in the `Model` component. diff --git a/docs/diagrams/LastMetObjectDiagram.puml b/docs/diagrams/LastMetObjectDiagram.puml new file mode 100644 index 00000000000..14a786c15ca --- /dev/null +++ b/docs/diagrams/LastMetObjectDiagram.puml @@ -0,0 +1,26 @@ +@startuml +!include style.puml +skinparam objectFontColor white + +object ":LastMetCommand" as LastMetCommand LOGIC_COLOR +object ":LastMetCommandParser" as LastMetCommandParser LOGIC_COLOR +object ":AddressBookParser" as AddressBookParser LOGIC_COLOR +object ":Model" as Model MODEL_COLOR +object ":CommandResult" as CommandResult LOGIC_COLOR +object "metPerson:Person" as Person1 LOGIC_COLOR +object "personToMeetPolicy:Person" as Person2 LOGIC_COLOR +object ":ArgumentMultimap" as ArgumentMultimap LOGIC_COLOR +object ":ParserUtil" as ParserUtil LOGIC_COLOR + +AddressBookParser --> LastMetCommandParser : calls +AddressBookParser --> LastMetCommand +LastMetCommandParser -> AddPolicyCommand +LastMetCommandParser --> ArgumentMultimap : instantiates +ParserUtil --> ArgumentMultimap : parses +LastMetCommand --> Person1 +LastMetCommand --> Person2 +LastMetCommand --> Model +LastMetCommand -right-> CommandResult : outputs +Model --> Person2 : Removes +Model --> Person1 : Updates +@enduml \ No newline at end of file diff --git a/docs/diagrams/LastMetSequenceDiagram.puml b/docs/diagrams/LastMetSequenceDiagram.puml new file mode 100644 index 00000000000..97aa556f3a4 --- /dev/null +++ b/docs/diagrams/LastMetSequenceDiagram.puml @@ -0,0 +1,60 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant "a:LastMetCommand" as LastMetCommand LOGIC_COLOR +participant ":CommandResult" as CommandResult LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant ":Model" as Model MODEL_COLOR +end box +[-> LogicManager : execute("met 1 d/2024-03-04") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("met 1 d/2024-03-04") +activate AddressBookParser + +create LastMetCommand +AddressBookParser -> LastMetCommand : LastMetCommand(1, newLastMet) +activate LastMetCommand + +LastMetCommand --> AddressBookParser +deactivate LastMetCommand + +AddressBookParser --> LogicManager : a +deactivate AddressBookParser + +LogicManager -> LastMetCommand : execute() +activate LastMetCommand + +LastMetCommand -> Model : setPerson(personToMeet, metPerson) +activate Model + +Model --> LastMetCommand +deactivate Model + +AddPolicyCommand -> Model : setDisplayClient(metPerson) +activate Model + +Model --> AddPolicyCommand +deactivate Model + +create CommandResult +AddPolicyCommand --> CommandResult +activate CommandResult + +CommandResult --> AddPolicyCommand +deactivate CommandResult + +AddPolicyCommand --> LogicManager : result +deactivate AddPolicyCommand +AddPolicyCommand -[hidden]-> LogicManager : result +destroy AddPolicyCommand + +[<--LogicManager +deactivate LogicManager +@enduml \ No newline at end of file From d7612561422e139668c5e61362ce5f88c48e2e39 Mon Sep 17 00:00:00 2001 From: ReganChoy Date: Thu, 28 Mar 2024 12:40:39 +0800 Subject: [PATCH 2/4] Fix spelling errors --- docs/diagrams/LastMetObjectDiagram.puml | 4 ++-- docs/diagrams/LastMetSequenceDiagram.puml | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/diagrams/LastMetObjectDiagram.puml b/docs/diagrams/LastMetObjectDiagram.puml index 14a786c15ca..5874deaea11 100644 --- a/docs/diagrams/LastMetObjectDiagram.puml +++ b/docs/diagrams/LastMetObjectDiagram.puml @@ -8,13 +8,13 @@ object ":AddressBookParser" as AddressBookParser LOGIC_COLOR object ":Model" as Model MODEL_COLOR object ":CommandResult" as CommandResult LOGIC_COLOR object "metPerson:Person" as Person1 LOGIC_COLOR -object "personToMeetPolicy:Person" as Person2 LOGIC_COLOR +object "personToMeet:Person" as Person2 LOGIC_COLOR object ":ArgumentMultimap" as ArgumentMultimap LOGIC_COLOR object ":ParserUtil" as ParserUtil LOGIC_COLOR AddressBookParser --> LastMetCommandParser : calls AddressBookParser --> LastMetCommand -LastMetCommandParser -> AddPolicyCommand +LastMetCommandParser -> LastMetCommand LastMetCommandParser --> ArgumentMultimap : instantiates ParserUtil --> ArgumentMultimap : parses LastMetCommand --> Person1 diff --git a/docs/diagrams/LastMetSequenceDiagram.puml b/docs/diagrams/LastMetSequenceDiagram.puml index 97aa556f3a4..d696fdbbd79 100644 --- a/docs/diagrams/LastMetSequenceDiagram.puml +++ b/docs/diagrams/LastMetSequenceDiagram.puml @@ -37,23 +37,23 @@ activate Model Model --> LastMetCommand deactivate Model -AddPolicyCommand -> Model : setDisplayClient(metPerson) +LastMetCommand -> Model : setDisplayClient(metPerson) activate Model -Model --> AddPolicyCommand +Model --> LastMetCommand deactivate Model create CommandResult -AddPolicyCommand --> CommandResult +LastMetCommand --> CommandResult activate CommandResult -CommandResult --> AddPolicyCommand +CommandResult --> LastMetCommand deactivate CommandResult -AddPolicyCommand --> LogicManager : result -deactivate AddPolicyCommand -AddPolicyCommand -[hidden]-> LogicManager : result -destroy AddPolicyCommand +LastMetCommand --> LogicManager : result +deactivate LastMetCommand +LastMetCommand -[hidden]-> LogicManager : result +destroy LastMetCommand [<--LogicManager deactivate LogicManager From c6f9a05d93e25f96d7b11bdbbb4691321ac64738 Mon Sep 17 00:00:00 2001 From: ReganChoy Date: Thu, 28 Mar 2024 12:44:13 +0800 Subject: [PATCH 3/4] Fix new line formatting --- docs/diagrams/LastMetSequenceDiagram.puml | 118 +++++++++++----------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/diagrams/LastMetSequenceDiagram.puml b/docs/diagrams/LastMetSequenceDiagram.puml index d696fdbbd79..a61d8c3afd3 100644 --- a/docs/diagrams/LastMetSequenceDiagram.puml +++ b/docs/diagrams/LastMetSequenceDiagram.puml @@ -1,60 +1,60 @@ -@startuml -!include style.puml -skinparam ArrowFontStyle plain - -box Logic LOGIC_COLOR_T1 -participant ":LogicManager" as LogicManager LOGIC_COLOR -participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR -participant "a:LastMetCommand" as LastMetCommand LOGIC_COLOR -participant ":CommandResult" as CommandResult LOGIC_COLOR -end box - -box Model MODEL_COLOR_T1 -participant ":Model" as Model MODEL_COLOR -end box -[-> LogicManager : execute("met 1 d/2024-03-04") -activate LogicManager - -LogicManager -> AddressBookParser : parseCommand("met 1 d/2024-03-04") -activate AddressBookParser - -create LastMetCommand -AddressBookParser -> LastMetCommand : LastMetCommand(1, newLastMet) -activate LastMetCommand - -LastMetCommand --> AddressBookParser -deactivate LastMetCommand - -AddressBookParser --> LogicManager : a -deactivate AddressBookParser - -LogicManager -> LastMetCommand : execute() -activate LastMetCommand - -LastMetCommand -> Model : setPerson(personToMeet, metPerson) -activate Model - -Model --> LastMetCommand -deactivate Model - -LastMetCommand -> Model : setDisplayClient(metPerson) -activate Model - -Model --> LastMetCommand -deactivate Model - -create CommandResult -LastMetCommand --> CommandResult -activate CommandResult - -CommandResult --> LastMetCommand -deactivate CommandResult - -LastMetCommand --> LogicManager : result -deactivate LastMetCommand -LastMetCommand -[hidden]-> LogicManager : result -destroy LastMetCommand - -[<--LogicManager -deactivate LogicManager +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant "a:LastMetCommand" as LastMetCommand LOGIC_COLOR +participant ":CommandResult" as CommandResult LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant ":Model" as Model MODEL_COLOR +end box +[-> LogicManager : execute("met 1 d/2024-03-04") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("met 1 d/2024-03-04") +activate AddressBookParser + +create LastMetCommand +AddressBookParser -> LastMetCommand : LastMetCommand(1, newLastMet) +activate LastMetCommand + +LastMetCommand --> AddressBookParser +deactivate LastMetCommand + +AddressBookParser --> LogicManager : a +deactivate AddressBookParser + +LogicManager -> LastMetCommand : execute() +activate LastMetCommand + +LastMetCommand -> Model : setPerson(personToMeet, metPerson) +activate Model + +Model --> LastMetCommand +deactivate Model + +LastMetCommand -> Model : setDisplayClient(metPerson) +activate Model + +Model --> LastMetCommand +deactivate Model + +create CommandResult +LastMetCommand --> CommandResult +activate CommandResult + +CommandResult --> LastMetCommand +deactivate CommandResult + +LastMetCommand --> LogicManager : result +deactivate LastMetCommand +LastMetCommand -[hidden]-> LogicManager : result +destroy LastMetCommand + +[<--LogicManager +deactivate LogicManager @enduml \ No newline at end of file From c8bff324ae8f97465fefcb88a0622299eaf07ef6 Mon Sep 17 00:00:00 2001 From: ReganChoy Date: Thu, 28 Mar 2024 12:48:29 +0800 Subject: [PATCH 4/4] Fix diagram EoF line --- docs/diagrams/LastMetObjectDiagram.puml | 2 +- docs/diagrams/LastMetSequenceDiagram.puml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/diagrams/LastMetObjectDiagram.puml b/docs/diagrams/LastMetObjectDiagram.puml index 5874deaea11..1a82ed91e48 100644 --- a/docs/diagrams/LastMetObjectDiagram.puml +++ b/docs/diagrams/LastMetObjectDiagram.puml @@ -23,4 +23,4 @@ LastMetCommand --> Model LastMetCommand -right-> CommandResult : outputs Model --> Person2 : Removes Model --> Person1 : Updates -@enduml \ No newline at end of file +@enduml diff --git a/docs/diagrams/LastMetSequenceDiagram.puml b/docs/diagrams/LastMetSequenceDiagram.puml index a61d8c3afd3..4af7c954916 100644 --- a/docs/diagrams/LastMetSequenceDiagram.puml +++ b/docs/diagrams/LastMetSequenceDiagram.puml @@ -57,4 +57,4 @@ destroy LastMetCommand [<--LogicManager deactivate LogicManager -@enduml \ No newline at end of file +@enduml