Skip to content

Commit

Permalink
Merge pull request #102 from bernicechio/update-DG
Browse files Browse the repository at this point in the history
Update DG with design details
  • Loading branch information
bernicechio authored Oct 23, 2019
2 parents e731dfe + 95f2b59 commit e9b901a
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,57 @@ image::CommitActivityDiagram.png[]
** Cons: Requires dealing with commands that have already been undone: We must remember to skip these commands. Violates Single Responsibility Principle and Separation of Concerns as `HistoryManager` now needs to do two different things.
// end::undoredo[]

// tag::dataencryption[]
=== [Proposed] Data Encryption

_{Explain here how the data encryption feature will be implemented}_

// end::dataencryption[]

// tag::genpdf[]
=== Generate PDF feature
==== Implementation

The generate PDF feature is facilitated by `ReportGenerator`.
It extends `Mortago` with the ability to create a report, supported by iText external library.
Additionally, it implements the following operations:

* `ReportGenerator#generate(body)` -- Creates report in a PDF file for the specific body.
* `ReportGenerator#generateAll()` -- Creates report in a PDF file for all bodies registered in Mortago.

The following sequence diagram shows how the execute operation works:

image::GenReportSequenceDiagram.png[]

NOTE: The lifeline for `GenReportCommand` should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.

The `genReport <BODY_ID>` command calls `ReportGenerator#execute()`, which creates the document.

The following activity diagram summarizes what happens when a user executes a `genReport <BODY_ID>` command:

image::GenReportActivityDiagram.png[]

==== Design Considerations

===== Aspect: How generate report executes

* **Alternative 1 (current choice):** Creates a PDF file.
** Pros: Implementation is easy.
** Cons: Implementation must ensure that each individual body attribute is correct.
* **Alternative 2:** Creates a Word Document file.
** Pros: Implementation allows user to edit the contents of the report.
** Cons: Implementation defeats the purpose of being automated.

===== Aspect: How report is formatted

* **Alternative 1 (current choice):** Uses tables to organise related details in the report.
** Pros: Implementation allows report to be organised, increases readability for user.
** Cons: Implementation is tedious.
* **Alternative 2:** Lists all attributes in the report without any formatting.
** Pros: Implementation is easy.
** Cons: Implementation decreases readability for user.
// end::genpdf[]

=== Logging

We are using `java.util.logging` package for logging. The `LogsCenter` class is used to manage the logging levels and logging destinations.
Expand Down
14 changes: 14 additions & 0 deletions docs/diagrams/GenReportActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@startuml
start
:User executes command;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.

if () then ([command generates PDF])
:Execute Report Generator;
:Generate PDF Report;
else ([else])
endif
stop
@enduml
69 changes: 69 additions & 0 deletions docs/diagrams/GenReportSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@startuml
!include style.puml

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":GenReportCommandParser" as GenReportCommandParser LOGIC_COLOR
participant "g:GenReportCommand" as GenReportCommand LOGIC_COLOR
participant ":CommandResult" as CommandResult LOGIC_COLOR
end box

box Storage STORAGE_COLOR_T1
participant ":ReportGenerator" as Storage STORAGE_COLOR
end box

[-> LogicManager : execute("genReport B1")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("genReport B1")
activate AddressBookParser

create GenReportCommandParser
AddressBookParser -> GenReportCommandParser
activate GenReportCommandParser

GenReportCommandParser --> AddressBookParser
deactivate GenReportCommandParser

AddressBookParser -> GenReportCommandParser : parse("B1")
activate GenReportCommandParser

create GenReportCommand
GenReportCommandParser -> GenReportCommand
activate GenReportCommand

GenReportCommand --> GenReportCommandParser : g
deactivate GenReportCommand

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

AddressBookParser --> LogicManager : g
deactivate AddressBookParser

LogicManager -> GenReportCommand : execute()
activate GenReportCommand

GenReportCommand -> Storage : generate(body)
activate Storage

Storage --> GenReportCommand
deactivate Storage

create CommandResult
GenReportCommand -> CommandResult
activate CommandResult

CommandResult --> GenReportCommand
deactivate CommandResult

GenReportCommand --> LogicManager : result
deactivate GenReportCommand

[<--LogicManager
deactivate LogicManager
@enduml
Binary file added docs/images/GenReportActivityDiagram.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/GenReportSequenceDiagram.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 e9b901a

Please sign in to comment.