diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index a154ed7dfb1..d6673171639 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -158,6 +158,32 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa This section describes some noteworthy details on how certain features are implemented. +### 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. + +#### Implementation + +The add policy command mechanism is facilitated by the `AddPolicyCommandParser` class which is created by the `AddressBookParser`. + +The `AddPolicyCommandParser` class is responsible for parsing the user input and creating an `AddPolicyCommand` object. + +The `AddPolicyCommandParser#parse()` overrides `Parser#parse()` in the `Parser` interface. +- `AddPolicyCommandParser#parse()` - Parses the input arguments by storing the prefixes of it respective values in a `ArgumentMultimap` object, and creates a new `AddPolicyCommand` object with the parsed policy name and policy ID. + +The `AddPolicyCommand` object is then executed by the `Logic` component. + +The `AddPolicyCommand` object then communicates with the `Model` component to add the policy to the client. The `Model` component then updates the `Person` object with the new policy. +- `Model#setPerson(Person, Person)` - Sets the client in the existing client list to the new `Person` object which has been edited by the `AddPolicyCommand#execute()` which contains the new policy. +- `Model#setDisplayClient(Person)` - Updates the displayed client in the UI to the client that has been edited with the new policy. + +The method `AddPolicyCommand#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 addpolicy operation: + + ### \[Proposed\] Undo/redo feature #### Proposed Implementation diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 3aba6af7111..4c7b04d5354 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -62,12 +62,12 @@ You might encounter these call-outs while reading through the guide, which conta -**Tip:** Tip call-outs like this contain helpful pointers for using ClientCare! +**Tip:** Tip call-outs like this contain helpful pointers for using ClientCare! -**Note:** Information call-outs like this contain information about ClientCare you should take note of! +**Note:** Information call-outs like this contain information about ClientCare you should take note of! @@ -80,7 +80,7 @@ You might encounter these call-outs while reading through the guide, which conta ## Introduction -Made for insurance agents and clients, by insurance agents and clients. +Made for insurance agents and clients, by insurance agents and clients. ClientCare is the easiest way to manage your clients and schedules, all in one place. Powerful features and intuitive design, all packaged into one neat desktop app. ClientCare is supported on all major platforms (Windows, macOS). @@ -88,16 +88,16 @@ major platforms (Windows, macOS). #### Let ClientCare assist you in... -1. [**Managing your clients**](#client-related-commands) +1. [**Managing your clients**](#client-related-commands) ClientCare lets you store, edit and delete your client's information. Keep all your clients' details in one place and save time! -2. [**Planning your schedule**](#schedule-related-commands) +2. [**Planning your schedule**](#schedule-related-commands) Meeting clients are part of the job. Not sure when to meet your next client? ClientCare reminds you of clients that you may have missed out! -3. [**Keeping track of policies**](#policy-related-commands) +3. [**Keeping track of policies**](#policy-related-commands) Too many policies from different companies? Why not track all of them in one place! ClientCare allows you to attach policies to all your clients, regardless of companies and product type. @@ -238,7 +238,7 @@ Alternatively, [Command Summary](#command-summary) has all of them under one pag
## Quick Tutorial -Excited to play around with ClientCare? +Excited to play around with ClientCare? Let’s run you through some simple commands to get you warmed up before you dive right into ClientCare’s full feature list! @@ -263,7 +263,7 @@ Type the following into the Command Input: ![addclient](images/ug/addclient.png =600x) -2. We have now added James Wee to our Client List! ClientCare shows a success message in the Feedback Display too. +2. We have now added James Wee to our Client List! ClientCare shows a success message in the Feedback Display too. @@ -450,7 +450,7 @@ Examples: -**Tip:** You can use `find` to more easily find the client you want for commands that require a client `INDEX`! +**Tip:** You can use `find` to more easily find the client you want for commands that require a client `INDEX`!
@@ -476,7 +476,7 @@ ClientCare offers the following commands to help you manage your schedule: * [Updating last met: `met`](#updating-last-met-met) * [Scheduling an appointment: `schedule`](#scheduling-appointments-schedule) * [Marking an appointment: `mark`](#marking-appointments-mark) - +

diff --git a/docs/diagrams/AddPolicyObjectDiagram.puml b/docs/diagrams/AddPolicyObjectDiagram.puml new file mode 100644 index 00000000000..5a6eea3ec63 --- /dev/null +++ b/docs/diagrams/AddPolicyObjectDiagram.puml @@ -0,0 +1,26 @@ +@startuml +!include style.puml +skinparam objectFontColor white + +object ":AddPolicyCommand" as AddPolicyCommand LOGIC_COLOR +object ":AddPolicyCommandParser" as AddPolicyCommandParser LOGIC_COLOR +object ":AddressBookParser" as AddressBookParser LOGIC_COLOR +object ":Model" as Model MODEL_COLOR +object ":CommandResult" as CommandResult LOGIC_COLOR +object "policyAddedPerson:Person" as Person1 LOGIC_COLOR +object "personToAddPolicy:Person" as Person2 LOGIC_COLOR +object ":ArgumentMultimap" as ArgumentMultimap LOGIC_COLOR +object ":ParserUtil" as ParserUtil LOGIC_COLOR + +AddressBookParser --> AddPolicyCommandParser : calls +AddressBookParser --> AddPolicyCommand +AddPolicyCommandParser -> AddPolicyCommand +AddPolicyCommandParser --> ArgumentMultimap : instantiates +ParserUtil --> ArgumentMultimap : parses +AddPolicyCommand --> Person1 +AddPolicyCommand --> Person2 +AddPolicyCommand --> Model +AddPolicyCommand -right-> CommandResult : outputs +Model --> Person2 : Removes +Model --> Person1 : Updates +@enduml diff --git a/docs/diagrams/AddPolicySequenceDiagram.puml b/docs/diagrams/AddPolicySequenceDiagram.puml new file mode 100644 index 00000000000..3fa152b3fea --- /dev/null +++ b/docs/diagrams/AddPolicySequenceDiagram.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:AddPolicyCommand" as AddPolicyCommand 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("addpolicy 1 n/Travel i/1") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("addpolicy 1 n/Travel i/1") +activate AddressBookParser + +create AddPolicyCommand +AddressBookParser -> AddPolicyCommand : AddPolicyCommand(1, newPolicy) +activate AddPolicyCommand + +AddPolicyCommand --> AddressBookParser +deactivate AddPolicyCommand + +AddressBookParser --> LogicManager : a +deactivate AddressBookParser + +LogicManager -> AddPolicyCommand : execute() +activate AddPolicyCommand + +AddPolicyCommand -> Model : setPerson(personToAddPolicy, policyAddedPerson) +activate Model + +Model --> AddPolicyCommand +deactivate Model + +AddPolicyCommand -> Model : setDisplayClient(policyAddedPerson) +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