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..1a82ed91e48 --- /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 "personToMeet:Person" as Person2 LOGIC_COLOR +object ":ArgumentMultimap" as ArgumentMultimap LOGIC_COLOR +object ":ParserUtil" as ParserUtil LOGIC_COLOR + +AddressBookParser --> LastMetCommandParser : calls +AddressBookParser --> LastMetCommand +LastMetCommandParser -> LastMetCommand +LastMetCommandParser --> ArgumentMultimap : instantiates +ParserUtil --> ArgumentMultimap : parses +LastMetCommand --> Person1 +LastMetCommand --> Person2 +LastMetCommand --> Model +LastMetCommand -right-> CommandResult : outputs +Model --> Person2 : Removes +Model --> Person1 : Updates +@enduml diff --git a/docs/diagrams/LastMetSequenceDiagram.puml b/docs/diagrams/LastMetSequenceDiagram.puml new file mode 100644 index 00000000000..4af7c954916 --- /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 + +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