diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index e8809c30588..40aa7ab3148 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -175,9 +175,6 @@ During this execution process, the existing entity is first retrieved from the m A new customer or property is then created with the edited fields, and any fields that have not been edited will be copied over from the original entity. The new entity is then added to the model, and the original entity is removed from the model. The new customer or property is then added into the model, replacing the old one. The new entity will then be displayed to the user, and a success message is displayed. -The following sequence diagram shows how the `EditCustomerCommand` is executed. -![EditCustomerSequenceDiagram](images/EditCustomerSequenceDiagram.png) - #### Design Considerations **Aspect: How the edit commands should relate to each other:** @@ -196,6 +193,13 @@ The following sequence diagram shows how the `EditCustomerCommand` is executed. * We also decided for the edit commands to create a new entity, instead of editing the existing one. This allows us to not include any setters in the `Customer` and `Property` classes, which make the objects immutable, so there is less likelihood of unexpected changes to the object. This enables us to maintain the defensiveness of our code. By creating a new entity every time the property agent edits, we can easily add the new customer or property into the model, and remove the old one. This also allows us to easily undo the edit command in the future, by simply adding the old entity back into the model. +The following sequence diagram shows how the `EditCustomerCommand` is executed. + +![EditCustomerSequenceDiagram](images/EditCustomerSequenceDiagram.png) + +The following sequence diagram shows how the `EditPropertyCommand` is executed. + +![EditPropertySequenceDiagram](images/EditPropertySequenceDiagram.png) ### Deleting of customers and properties [Back to top](#table-of-contents) @@ -218,7 +222,14 @@ When these created command objects are executed by the `LogicManager`, the `Dele * **Alternative 2:** A single `DeleteCommand` class is used to edit both customer and property. * Cons: * Unnecessary complexity is introduced into the system. + +The following sequence diagram shows how the `DeleteCustomerCommand` is executed. + +![DeleteCustomerSequenceDiagram](images/DeleteCustomerSequenceDiagram.png) + +The following sequence diagram shows how the `DeletePropertyCommand` is executed. +![DeletePropertySequenceDiagram](images/DeletePropertySequenceDiagram.png) ### Finding of Customers and Properties [Back to top](#table-of-contents) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index f3676942a8e..a5deef2a21a 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -181,7 +181,31 @@ When command fails: * `Missing property index` for missing parameter * `No such property index` for wrong parameter or index beyond list size * `Invalid command` for misspelling of command - +### Editing a customer : `editcust` +Edits an existing customer. +Format: `editcust INDEX [n/NAME] [ph/PHONE] [e/EMAIL] [b/BUDGET] [c/CHARACTERISTIC]…​` +* Edits the customer at the specified `INDEX`. The index refers to the index number shown in the displayed customer list. The index **must be a positive integer** 1, 2, 3, …​ +* At least one of the optional fields must be provided. +* Existing values will be updated to the input values. +* When editing tags, the existing tags of the property will be removed i.e adding of tags is not cumulative. +* You can remove all the person’s tags by typing `c/` without + specifying any tags after it. + Examples: +* `editprop 1 ph/91234567 e/andrew@gmail.com` Edits the phone number and email of the 1st customer to be `91234567` and `andrew@gmail.com` respectively. +* `edit 2 n/Andrew c/` Edits the name of the 2nd customer to be `Andrew` and clears all existing tags. + +### Editing a property : `editprop` +Edits an existing property. +Format: `editprop INDEX [n/NAME] [ph/PHONE] [pr/PRICE] [a/ADDRESS] [c/CHARACTERISTIC]…​` +* Edits the property at the specified `INDEX`. The index refers to the index number shown in the displayed property list. The index **must be a positive integer** 1, 2, 3, …​ +* At least one of the optional fields must be provided. +* Existing values will be updated to the input values. +* When editing tags, the existing tags of the property will be removed i.e adding of tags is not cumulative. +* You can remove all the person’s tags by typing `c/` without + specifying any tags after it. + Examples: +* `editprop 1 ph/91234567 a/43 Clementi Avenue 3 #03-543` Edits the phone number and address of the 1st property to be `91234567` and `43 Clementi Avenue 3 #03-543` respectively. +* `edit 2 n/Skyview t/` Edits the name of the 2nd property to be `Skyview` and clears all existing tags. ### Finding a customer : `findcust` Finds and returns a customer or a list of customers whose name contains the substring inputted. diff --git a/docs/diagrams/DeleteCustomerSequenceDiagram.puml b/docs/diagrams/DeleteCustomerSequenceDiagram.puml new file mode 100644 index 00000000000..39e9ed1a69e --- /dev/null +++ b/docs/diagrams/DeleteCustomerSequenceDiagram.puml @@ -0,0 +1,70 @@ +@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 ":DeleteCustomerCommandParser" as DeleteCustomerCommandParser LOGIC_COLOR +participant "d:DeleteCustomerCommand" as DeleteCustomerCommand 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("delcust 1") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("delcust 1") +activate AddressBookParser + +create DeleteCustomerCommandParser +AddressBookParser -> DeleteCustomerCommandParser +activate DeleteCustomerCommandParser + +DeleteCustomerCommandParser --> AddressBookParser +deactivate DeleteCustomerCommandParser + +AddressBookParser -> DeleteCustomerCommandParser : parse("1") +activate DeleteCustomerCommandParser + +create DeleteCustomerCommand +DeleteCustomerCommandParser -> DeleteCustomerCommand +activate DeleteCustomerCommand + +DeleteCustomerCommand --> DeleteCustomerCommandParser : d +deactivate DeleteCustomerCommand + +DeleteCustomerCommandParser --> AddressBookParser : d +deactivate DeleteCustomerCommandParser +'Hidden arrow to position the destroy marker below the end of the activation bar. +DeleteCustomerCommandParser -[hidden]-> AddressBookParser +destroy DeleteCustomerCommandParser + +AddressBookParser --> LogicManager : d +deactivate AddressBookParser + +LogicManager -> DeleteCustomerCommand : execute() +activate DeleteCustomerCommand + +DeleteCustomerCommand -> Model : deleteCustomer(1) +activate Model + +Model --> DeleteCustomerCommand +deactivate Model + +create CommandResult +DeleteCustomerCommand -> CommandResult +activate CommandResult + +CommandResult --> DeleteCustomerCommand +deactivate CommandResult + +DeleteCustomerCommand --> LogicManager : result +deactivate DeleteCustomerCommand + +[<--LogicManager +deactivate LogicManager +@enduml diff --git a/docs/diagrams/DeletePropertySequenceDiagram.puml b/docs/diagrams/DeletePropertySequenceDiagram.puml new file mode 100644 index 00000000000..40ad1d55267 --- /dev/null +++ b/docs/diagrams/DeletePropertySequenceDiagram.puml @@ -0,0 +1,70 @@ +@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 ":DeletePropertyCommandParser" as DeletePropertyCommandParser LOGIC_COLOR +participant "d:DeletePropertyCommand" as DeletePropertyCommand 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("delprop 1") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("delprop 1") +activate AddressBookParser + +create DeletePropertyCommandParser +AddressBookParser -> DeletePropertyCommandParser +activate DeletePropertyCommandParser + +DeletePropertyCommandParser --> AddressBookParser +deactivate DeletePropertyCommandParser + +AddressBookParser -> DeletePropertyCommandParser : parse("1") +activate DeletePropertyCommandParser + +create DeletePropertyCommand +DeletePropertyCommandParser -> DeletePropertyCommand +activate DeletePropertyCommand + +DeletePropertyCommand --> DeletePropertyCommandParser : d +deactivate DeletePropertyCommand + +DeletePropertyCommandParser --> AddressBookParser : d +deactivate DeletePropertyCommandParser +'Hidden arrow to position the destroy marker below the end of the activation bar. +DeletePropertyCommandParser -[hidden]-> AddressBookParser +destroy DeletePropertyCommandParser + +AddressBookParser --> LogicManager : d +deactivate AddressBookParser + +LogicManager -> DeletePropertyCommand : execute() +activate DeletePropertyCommand + +DeletePropertyCommand -> Model : deleteProperty(1) +activate Model + +Model --> DeletePropertyCommand +deactivate Model + +create CommandResult +DeletePropertyCommand -> CommandResult +activate CommandResult + +CommandResult --> DeletePropertyCommand +deactivate CommandResult + +DeletePropertyCommand --> LogicManager : result +deactivate DeletePropertyCommand + +[<--LogicManager +deactivate LogicManager +@enduml diff --git a/docs/diagrams/DeleteSequenceDiagram.puml b/docs/diagrams/DeleteSequenceDiagram.puml index 40ea6c9dc4c..bf15acf38ab 100644 --- a/docs/diagrams/DeleteSequenceDiagram.puml +++ b/docs/diagrams/DeleteSequenceDiagram.puml @@ -49,7 +49,7 @@ deactivate AddressBookParser LogicManager -> DeleteCommand : execute() activate DeleteCommand -DeleteCommand -> Model : deletePerson(1) +DeleteCommand -> Model : delete(1) activate Model Model --> DeleteCommand diff --git a/docs/diagrams/EditPropertySequenceDiagram.puml b/docs/diagrams/EditPropertySequenceDiagram.puml new file mode 100644 index 00000000000..1c38292abf3 --- /dev/null +++ b/docs/diagrams/EditPropertySequenceDiagram.puml @@ -0,0 +1,72 @@ +@startuml +!include style.puml + +box Logic LOGIC_COLOR_T1 +participant ":LogicManager" as LogicManager LOGIC_COLOR +participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR +participant ":EditPropertyCommandParser" as EditPropertyCommandParser LOGIC_COLOR +participant "command:EditPropertyCommand" as EditPropertyCommand 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("editprop 1 n/Skyview") +activate LogicManager + +LogicManager -> AddressBookParser : parseCommand("editprop 1 n/Skyview") +activate AddressBookParser + +create EditPropertyCommandParser +AddressBookParser -> EditPropertyCommandParser : new EditPropertyCommandParser("1 n/Skyview") +activate EditPropertyCommandParser + +EditPropertyCommandParser --> AddressBookParser +deactivate EditPropertyCommandParser + +AddressBookParser -> EditPropertyCommandParser : parse("1 n/Skyview") +activate EditPropertyCommandParser + +create EditPropertyCommand +EditPropertyCommandParser -> EditPropertyCommand : new EditPropertyCommand(1, editPropertyDescriptor) +activate EditPropertyCommand + +EditPropertyCommand --> EditPropertyCommandParser : command +deactivate EditPropertyCommand + +EditPropertyCommandParser --> AddressBookParser : command +deactivate EditPropertyCommandParser +'Hidden arrow to position the destroy marker below the end of the activation bar. +EditPropertyCommandParser -[hidden]-> AddressBookParser +destroy EditPropertyCommandParser + +AddressBookParser --> LogicManager : command +deactivate AddressBookParser + +LogicManager -> EditPropertyCommand : execute() +activate EditPropertyCommand + +EditPropertyCommand -> EditPropertyCommand : createEditedProperty(propertyToEdit, editPropertyDescriptor) +activate EditPropertyCommand +EditPropertyCommand --> EditPropertyCommand : editedProperty +deactivate EditPropertyCommand + +EditPropertyCommand -> Model : setProperty(PropertyToEdit, editedProperty) + +EditPropertyCommand -> Model : updateFilteredPropertyList(PREDICATE_SHOW_ALL_PROPERTY) + +create CommandResult +EditPropertyCommand -> CommandResult : new CommandResult("Edited property: " + editedProperty) +activate CommandResult + +CommandResult --> EditPropertyCommand +deactivate CommandResult + +EditPropertyCommand --> LogicManager : commandResult +deactivate EditPropertyCommand + +[<--LogicManager : commandResult +deactivate LogicManager +@enduml diff --git a/docs/images/DeleteCustomerSequenceDiagram.png b/docs/images/DeleteCustomerSequenceDiagram.png new file mode 100644 index 00000000000..caca071d3e8 Binary files /dev/null and b/docs/images/DeleteCustomerSequenceDiagram.png differ diff --git a/docs/images/DeletePropertySequenceDiagram.png b/docs/images/DeletePropertySequenceDiagram.png new file mode 100644 index 00000000000..ca4a4aa6fe1 Binary files /dev/null and b/docs/images/DeletePropertySequenceDiagram.png differ diff --git a/docs/images/DeleteSequenceDiagram.png b/docs/images/DeleteSequenceDiagram.png index e186f7ba096..438cc620b82 100644 Binary files a/docs/images/DeleteSequenceDiagram.png and b/docs/images/DeleteSequenceDiagram.png differ diff --git a/docs/images/EditPropertySequenceDiagram.png b/docs/images/EditPropertySequenceDiagram.png new file mode 100644 index 00000000000..7485155d9eb Binary files /dev/null and b/docs/images/EditPropertySequenceDiagram.png differ