Skip to content

Commit

Permalink
Merge pull request #222 from 0liverkong/update-DG
Browse files Browse the repository at this point in the history
Add sequence diagram for add_app
  • Loading branch information
0liverkong authored Apr 14, 2024
2 parents 8165d6b + d730229 commit d556bb5
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ Step 3. `AddApplicationCommandParser#parse(String)` creates a new `AddApplicatio

Step 4.`AddApplicationCommand#execute(Model)` is then called in `LogicManager#execute(String)`, where the matching `Person` and `Job` are found, and an `Application` object containing the `Person` and the `Job` is created. `model#addApplication(Application)` is then called and the `Application` is added to the list of `Application`s in `model`.

The following sequence diagram shows how a add_app operation goes through the various components:

![AddApplicationSequenceDiagram](images/AddApplicationSequenceDiagram.png)

### Tag Command

Tag command adds one or more tags to a person. The person retains all tags it had before.
Expand All @@ -272,6 +276,10 @@ Step 3. `TagCommandParser#parse(String)` creates a new `TagCommand` object, whic

Step 4.`TagCommand#execute(Model)` is then called in `LogicManager#execute(String)`, where the matching `Person` is found and the union of tags present and tags to add is calculated. A new person is created using the tag union and the old person's data. Then, the old person is updated in the person list with `ModelManager#setPerson(Person, Person)`, the filtered person list in the model is updated with `ModelManager#updateFilteredPersonList(Predicate<Person>)`, and the applications in the application list are updated to contain the edited person with `ModelManager#replaceApplications(Person, Person)`.

The following sequence diagram shows how a add_app operation goes through the various components:

![TagSequenceDiagram](images/TagSequenceDiagram.png)

### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down
90 changes: 90 additions & 0 deletions docs/diagrams/AddApplicationSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@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 ":AddApplicationCommandParser" as AddApplicationCommandParser LOGIC_COLOR
participant "c:AddApplicationCommand" as AddApplicationCommand LOGIC_COLOR
participant "a:Application" as Application 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("add_app e/example@gmail.com ti/job")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("add_app e/example@gmail.com ti/job")
activate AddressBookParser

create AddApplicationCommandParser
AddressBookParser -> AddApplicationCommandParser
activate AddApplicationCommandParser

AddApplicationCommandParser --> AddressBookParser
deactivate AddApplicationCommandParser

AddressBookParser -> AddApplicationCommandParser : parse("e/example@gmail.com ti/job")
activate AddApplicationCommandParser

create AddApplicationCommand
AddApplicationCommandParser -> AddApplicationCommand
activate AddApplicationCommand

AddApplicationCommand --> AddApplicationCommandParser : c
deactivate AddApplicationCommand

AddApplicationCommandParser --> AddressBookParser : c
deactivate AddApplicationCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
AddApplicationCommandParser -[hidden]-> AddressBookParser
destroy AddApplicationCommandParser

AddressBookParser --> LogicManager : c
deactivate AddressBookParser

LogicManager -> AddApplicationCommand : execute(m)
activate AddApplicationCommand

AddApplicationCommand -> AddApplicationCommand : findPersonMatchingEmail()
activate AddApplicationCommand

AddApplicationCommand --> AddApplicationCommand : p
deactivate AddApplicationCommand

AddApplicationCommand -> AddApplicationCommand : findJobMatchingTitle()
activate AddApplicationCommand

AddApplicationCommand --> AddApplicationCommand : j
deactivate AddApplicationCommand

create Application
AddApplicationCommand -> Application : Application(p, j, PRESCREEN)
activate Application

Application --> AddApplicationCommand : a
deactivate Application

AddApplicationCommand -> Model : addApplication(a)
activate Model

Model --> AddApplicationCommand
deactivate Model

create CommandResult
AddApplicationCommand -> CommandResult
activate CommandResult

CommandResult --> AddApplicationCommand
deactivate CommandResult

AddApplicationCommand --> LogicManager : r
deactivate AddApplicationCommand

[<--LogicManager
deactivate LogicManager
@enduml
103 changes: 103 additions & 0 deletions docs/diagrams/TagSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
@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 ":TagCommandParser" as TagCommandParser LOGIC_COLOR
participant ":ParserUtil" as ParserUtil LOGIC_COLOR
participant "c:TagCommand" as TagCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant ":Person" as Person MODEL_COLOR
participant "m:Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("tag 1 t/INTERNAL")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("tag 1 t/INTERNAL")
activate AddressBookParser

create TagCommandParser
AddressBookParser -> TagCommandParser
activate TagCommandParser

TagCommandParser --> AddressBookParser
deactivate TagCommandParser

AddressBookParser -> TagCommandParser : parse("1 t/INTERNAL")
activate TagCommandParser

TagCommandParser -> ParserUtil : parseIndex("1")
activate ParserUtil

ParserUtil -> TagCommandParser : index
deactivate ParserUtil

TagCommandParser -> ParserUtil : parseTags("t/INTERNAL")
activate ParserUtil

ParserUtil -> TagCommandParser : tags
deactivate ParserUtil

create TagCommand
TagCommandParser -> TagCommand
activate TagCommand

TagCommand --> TagCommandParser : c
deactivate TagCommand

TagCommandParser --> AddressBookParser : c
deactivate TagCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
TagCommandParser -[hidden]-> AddressBookParser
destroy TagCommandParser

AddressBookParser --> LogicManager : c
deactivate AddressBookParser

LogicManager -> TagCommand : execute(m)
activate TagCommand

create Person
TagCommand -> Person
activate Person

Person --> TagCommand
deactivate Person

TagCommand -> Model : setPerson()
activate Model

Model --> TagCommand
deactivate Model

TagCommand -> Model : updateFilteredPersonList()
activate Model

Model --> TagCommand
deactivate Model

TagCommand -> Model : replaceApplications()
activate Model

Model --> TagCommand
deactivate Model

create CommandResult
TagCommand -> CommandResult
activate CommandResult

CommandResult --> TagCommand
deactivate CommandResult

TagCommand --> LogicManager : r
deactivate TagCommand

[<--LogicManager
deactivate LogicManager
@enduml
Binary file added docs/images/AddApplicationSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/TagSequenceDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d556bb5

Please sign in to comment.