diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index ce0bcc3ef80..cfd04aabed8 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -13,9 +13,16 @@ title: Developer Guide 5. [Storage Component](#storage-component) 6. [Common Classes](#common-classes) 4. [Implementations](#implementation) - 1. [Editing a specific tag](#editing-tag) + 1. [Add new employee](#adding-new-employee) + 1. [Implementation](#implementation-add-new-employee) + 2. [Design considerations](#design-consideration-add-employee) + 2. [Editing a specific tag](#editing-tag) 1. [Design considerations](#design-consideration-edit-tag) 2. [Implementation](#implementation-edit-tag) + 3. [Deleting a specific employee](#deleting-employee) + 1. [Implementation](#implementation-delete-employee) + 4. [Finding a specific employee with name](#finding-employee-name) + 1. [Implementation](#implementation-fiding-employee-name) 5. [Documentation, logging, testing, configuration, dev-ops](#documentation) 6. [Appendix: Requirements](#requirements) 1. [Product scope](#product-scope) @@ -189,9 +196,9 @@ Classes used by multiple components are in the `seedu.address.commons` package. This section describes some noteworthy details on how certain features are implemented. -### \[Implemented\] Add new employee +### \[Implemented\] Add new employee -#### Implementation +#### Implementation The proposed implementation of adding a new employee is facilitated by `AddCommand` and `AddCommandParser`. The `AddCommand` class encapsulates the logic for adding a new employee, while the `AddCommandParser` class is responsible for parsing the arguments and returning an `AddCommand` object. @@ -228,7 +235,7 @@ The following activity diagram summarizes what happens when a user executes an ` The `AddCommand` class is designed to be easily extensible. For example, if a new field is added to the `Person` class, the `AddCommand` class can be easily modified to accommodate the new field. -#### Design considerations: +#### Design considerations: **Aspect: How `/add` executes:** @@ -240,7 +247,6 @@ The `AddCommand` class is designed to be easily extensible. For example, if a ne * Pros: Provides a more guided experience. * Cons: May be slower for users who are comfortable with the system. - ### Editing a specific tag #### Design considerations: @@ -297,6 +303,28 @@ The following activity diagram summarizes what happens when a user executes a `/ ![DeleteActivityDiagram](images/DeleteActivityDiagram.png) +### Finding a specific emplyoee + +#### Implementation + +Given below is an example usage scenario and how the `/find :name KEYWORD` mechanism behaves at each step. + +Step 1. The user launches the application for the first time. + +Step 2. The user executes `/add NAME; PHONE; EMAIL; ADDRESS; YEAR_JOINED[; TAG]…` command to add a new employee. + +Step 3: The user executes `/find :name KEYWORD` command to find the employee who contains the `KEYWORD`. + +Step 5: Show the updated employee panel list containing the employee who matches the `KEYWORD`. + +The following sequence diagram shows how find operation finds a specific employee: + +![FindEmployeeNameSequenceDiagram](images/FindEmployeeNameSequenceDiagram.png) + +The following activity diagram what happens when a user executes a `/find :name KEYWORD`. + +![FindEmployeeNameActivityDiagram](images/FindEmployeeNameActivityDiagram.png) + -------------------------------------------------------------------------------------------------------------------- ## **Documentation, logging, testing, configuration, dev-ops** diff --git a/docs/diagrams/FindEmployeeNameActivityDiagram.puml b/docs/diagrams/FindEmployeeNameActivityDiagram.puml new file mode 100644 index 00000000000..d546c2650ec --- /dev/null +++ b/docs/diagrams/FindEmployeeNameActivityDiagram.puml @@ -0,0 +1,17 @@ +@startuml +skin rose +skinparam ActivityFontSize 15 +skinparam ArrowFontSize 12 + +start +repeat + :User enters the /find command and the + :name with a keyword to find the employee.; + :PayBack reads user input; +repeat while () is (Incorrect [Command Format]) +->[else]; +:PayBack creates a NameContainsKeywordsPredicate object; +:PayBack updates filtered list of employees based on the predicate; +:PayBack displays updated list of employees; +stop +@enduml diff --git a/docs/diagrams/FindEmployeeNameSequenceDiagram.puml b/docs/diagrams/FindEmployeeNameSequenceDiagram.puml new file mode 100644 index 00000000000..d2c95385a21 --- /dev/null +++ b/docs/diagrams/FindEmployeeNameSequenceDiagram.puml @@ -0,0 +1,69 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":PayBackParser" as PayBackParser LOGIC_COLOR +participant ":FindCommandParser" as FindCommandParser LOGIC_COLOR +participant "f:FindCommand" as FindCommand LOGIC_COLOR +participant "r:CommandResult" as CommandResult LOGIC_COLOR +end box + +box Model MODEL_COLOR_T1 +participant "m:Model" as Model MODEL_COLOR +end box + +[-> LogicManager : execute("/find :name Patrick") +activate LogicManager + +LogicManager -> PayBackParser : parseCommand("/find :name Patrick") +activate PayBackParser + +create FindCommandParser +PayBackParser -> FindCommandParser +activate FindCommandParser + +FindCommandParser --> PayBackParser +deactivate FindCommandParser + +PayBackParser -> FindCommandParser : parse(":name Patrick") +activate FindCommandParser + +create FindCommand +FindCommandParser -> FindCommand +activate FindCommand + +FindCommand --> FindCommandParser : +deactivate FindCommand + +FindCommandParser --> PayBackParser : f +deactivate FindCommandParser + +PayBackParser -[hidden]-> PayBackParser +destroy FindCommandParser + +PayBackParser --> LogicManager : f +deactivate PayBackParser + +LogicManager -> FindCommand : execute(m) +activate FindCommand + +FindCommand -> Model : updateFilteredPersonList(predicate) +activate Model + +Model --> FindCommand +deactivate Model + +create CommandResult +FindCommand -> CommandResult +activate CommandResult + +CommandResult --> FindCommand +deactivate CommandResult + +FindCommand --> LogicManager : r +deactivate FindCommand + +[<--LogicManager +deactivate LogicManager +@enduml \ No newline at end of file diff --git a/docs/images/FindEmployeeNameActivityDiagram.png b/docs/images/FindEmployeeNameActivityDiagram.png new file mode 100644 index 00000000000..9aaa847d9e0 Binary files /dev/null and b/docs/images/FindEmployeeNameActivityDiagram.png differ diff --git a/docs/images/FindEmployeeNameSequenceDiagram.png b/docs/images/FindEmployeeNameSequenceDiagram.png new file mode 100644 index 00000000000..0ad0cb1c2b2 Binary files /dev/null and b/docs/images/FindEmployeeNameSequenceDiagram.png differ