Skip to content

Commit

Permalink
manual reset
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhongherald committed Mar 21, 2018
1 parent fdbd2cc commit cc0fdf5
Show file tree
Hide file tree
Showing 97 changed files with 1,037 additions and 1,224 deletions.
100 changes: 100 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,56 @@ Classes used by multiple components are in the `seedu.addressbook.commons` packa

This section describes some noteworthy details on how certain features are implemented.

// tag::set[]
=== Set command feature
==== Current Implementation

Set command keeps 2 lists of command words, the default command words and the custom user command words, which are both managed by the class `CommandWords`.

The default command words are stored as a class level reference `COMMANDS`, while the custom command words are stored as a field `commands` in the object.

`CommandWords` is in the `Logic` component, under `Commands`, as it is required to parse commands in `AddressBookParser`.

`CommandWords` only deal with commands that have their default command word declared in the class level reference.

image::SetCommandLogicDiagram.png[width="800"]+
image::SetCommandModelDiagram.png[width="800"]+

As you can see from the diagram, AddressBookParser makes a reference to CommandWords. However, `CommandWords` resides in `UserPrefs` in the `Model` component.

This is to facilitate the saving of data.

==== Design Considerations

===== Aspect: Where to put CommandWords for storage

* **Alternative 1:** Place `CommandWords` in `UserPrefs`
** Pros: Single Responsibility Principle is maintained as custom command words in `CommandWords` is a user preference.
** Cons: More coupling is required for the AddressBook to retrieve the custom command words.
* **Alternative 2:** Place `CommandWords` in `AddressBook`
** Pros: Direct access to custom words in commands.
** Cons: Single Responsibility Principle will be violated.

===== Aspect: Access to CommandWords

* **Alternative 1:** `ModelManager` and member variables gets access and provides API to access `CommandWords`.
** Pros: Write protection.
** Cons: `CommandWords` is frequently accessed, many more APIs are required.
* **Alternative 2 (current choice):** Provide direct access to `CommandWords` when more details are needed and keep minimal API on `ModelManager`.
** Pros: Easy to implement, neat.
** Cons: Accidental modification can lead to bugs, so need to be careful.


===== Aspect: Storing the list of default command words

* **Alternative 1 (current choice):** Store the default list in `CommandWords`.
** Pros: Easier to maintain the Open-Closed Principle, also follows the Single Responsibility Principle.
** Cons: Increased coupling.
* **Alternative 2:** Store the default list in `Commands`.
** Pros: Reduced coupling.
** Cons: `Commands` is an abstract class, it is not appropriate to reference class variables.
// end::set[]

// tag::importexport[]
=== Import/Export feature #Coming in v2.0#
==== Current Implementation
Expand Down Expand Up @@ -448,6 +498,56 @@ image::UndoRedoActivityDiagram.png[width="650"]
** 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::sendemailtoemployee[]
=== Send Email to Employees about Job

==== Current Implementation

This feature is implemented using Gmail API.

The following dependencies are used:
* com.google.api-client:google-api-client:1.23.0
* com.google.oauth-client:google-oauth-client-jetty:1.23.0
* com.google.apis:google-api-services-gmail:v1-rev82-1.23.0

Suppose that the user typed the first email command.

image::EmailAuthorization.png[width="650"]

`GoogleAuthorizationCodeFlow` is used to build the authorization code flow and trigger user authorization request. It then manages and persists user `Credential`.

`Credential` are then saved into a `File` so that the user need not repeatedly key in his or her authorization information before sending each email.


To send an email, firstly, an empty `Properties` list is created, which is used to create an email `Session`. Next, a `MimeMessage`, a class in the `javax.mail.internet` package is created using that `Session`. Attributes `from`, `recipient`, `subject` and `text` of the `MimeMessage` are then set. The `Text` set contains information extracted from the particular `Job`.

Next, `MimeMessage` is encoded using base64url. A `Message` object is instantiated, and the value of the `raw` property of the `Message` is set to the encoded `MimeMessage`.

Lastly, make a call to `messages.send` to send the email.

==== Design Considerations

===== Aspect: Email content

* **Alternative 1 (current choice):** Email content contains job information extracted from the particular Job object only
** Pros: Easier to implement, and the email will be sent out very quickly, immediately after typing one line of command, making it more convenient for the user.
** Cons: User has no ability to change or add to the contents of the email if the user wishes to.
* **Alternative 2:** User gets to edit or add to the email content
** Pros: Provides flexibility as the user is allowed to change and add details to the email content.
** Cons: Need to direct user to an editor, thus more difficult to implement. User would also have to go through more steps than necessary if the user does not wish to change or add details to the email content.


===== Aspect: Authorization information

* **Alternative 1 (current choice):** Stored in file system so subsequent executions will not prompt for authorization
** Pros: More convenient for user as the user only needs to key in his or her authorization information once
** Cons: Unsafe
* **Alternative 2:** Prompt for authorization for every subsequent executions
** Pros: Safe
** Cons: Inconvenient for user as user needs to always key in authorization information before sending each email

// end::sendemailtoemployee[]

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

Expand Down
141 changes: 131 additions & 10 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ e.g. typing *`help`* and pressing kbd:[Enter] will open the help window.
* Words in `UPPER_CASE` are the parameters to be supplied by the user e.g. in `adde n/NAME`, `NAME` is a parameter which can be used as `adde n/John Doe`.
* Items in square brackets are optional e.g `n/NAME [t/TAG]` can be used as `n/John Doe t/mechanic` or as `n/John Doe`.
* Items with `…`​ after them can be used multiple times including zero times e.g. `[t/TAG]...` can be used as `{nbsp}` (i.e. 0 times), `t/mechanic`, `t/technician` etc.
* Items with `+` after them can be used multiple times but has to be used **at least once** e.g. `w/ASSIGNED_EMPLOYEE_INDEX+` can be used as `w/4`, `w/5` etc.
* Parameters can be in any order e.g. if the command specifies `n/NAME p/PHONE_NUMBER`, `p/PHONE_NUMBER n/NAME` is also acceptable.
====

Expand All @@ -63,12 +64,12 @@ Format: `help`
=== Adding an job entry: `addj`

Adds a job entry to CarviciM +
Format: `addj n/NAME p/PHONE_NUMBER e/EMAIL v/VEHICLE_NUMBER w/EMPLOYEE_INDEX`
Format: `addj n/NAME p/PHONE_NUMBER e/EMAIL v/VEHICLE_NUMBER w/ASSIGNED_EMPLOYEE_INDEX+`

Examples:

* `addj n/John Doe p/98765432 e/[email protected] v/bhj123 w/33`
* `addj n/Betsy Crowe p/93939393 e/[email protected] v/ss888 w/2`
* `addj n/John Doe p/98765432 e/[email protected] v/bhj123 w/3`
* `addj n/Betsy Crowe p/93939393 e/[email protected] v/ss888 w/2 w/3 w/5`

=== Closing a job entry: `closej`

Expand Down Expand Up @@ -151,23 +152,143 @@ Deletes the 2nd employee in CarviciM.
`deletee 1` +
Deletes the 1st employee in the results of the `findE` command.

// tag::set[]
=== Changing a command word : `set`

Selects the employee identified by the index number used in the last employee listing. +
You can set an easy to use word in place of a default command word. +
Format: `set OLD_COMMAND_WORD NEW_COMMAND_WORD`

****
* Sets the OLD_COMMAND_WORD to NEW_COMMAND_WORD
* The OLD_COMMAND_WORD must be in user preferences
[NOTE]
====
* The OLD_COMMAND_WORD can be either a default command word or one which user has set previously.
* The NEW_COMMAND_WORD must be 1 word, with no spacing.
****
* Any default words or words currently set by users are not allowed.
====

Examples:

* `set add a` +
Sets `add` command word to `a`
Sets `add` command word to `a` using default
* `set add s` +
Sets `add` command word to `s` using default
* `set set a` +
Sets `set` command word to `a` using default
* `set a s` +
Invalid command as s is already used by user.
* `set a add` +
Sets `a` command word back to `add`
Invalid command as add is a default command.
* `set a set` +
Sets `a` command word back to `set`, its default mapping.
// end::set[]

// tag::importexport[]
=== Importing jobs from an excel file #Coming in v2.0#
==== Importing a new excel file: import

You can load your excel file by filename or filepath.
Format: `import PATH_TO_FILE`

[NOTE]
====
* Filepath: A text representation of the location of the file used by the computer.
* CarviciM tries to read the file by rows:
** The first row specifies the type of detail in the column.
====

Examples:

* `import excel.xls` +
Imports file excel.xls.


==== Accepting and rejecting changes

You can use 4 commands when reviewing changes:
* accept INDEX
* reject INDEX
* acceptAll
* rejectAll

===== Accepting 1 job: accept

Accepts a job specified at position INDEX in imported list.
Format: `accept INDEX`

Examples:

* `accept 1` +
Accepts the first job entry and removes it from imported list.

===== Accepting all remaining imported jobs: acceptAll

Accepts all remaining jobs.
Format: `acceptAll`

Examples:

* `acceptAll` +
Accepts all remaining job entries and clears the imported list.

===== Rejecting 1 job: reject

Rejects a job specified at position INDEX in imported list.
Format: `reject INDEX`

Examples:

* `reject 1` +
Rejects the first job entry and removes it from imported list.

===== Rejecting all remaining imported jobs: rejectAll

Rejects all remaining jobs.
Format: `rejectAll`

Examples:

* `rejectAll` +
Rejects all remaining job entries and clears the imported list.

==== Writing comments to your reviews

While accepting or rejecting changes, you can enter your comments behind the command
[TIP]
====
You can type any alphanumeric sentence as a comment, as long as it is after the command.
====

Examples:

* `accept 1` good job` +
Accepts first job and attaches "good job" as a comment to the first job.
* `acceptAll well done` +
Accepts all remaining imported jobs and attaches "well done" as a comment to all the remaining imported jobs.
* `reject 1 Speak to you during tomorrow's meeting.` +
Rejects first job and attaches "Speak to you during tomorrow's meeting." as a comment to the first job.
* `rejectAll Please check the customer details.` +
Rejects all remaining imported jobs and attaches "Please check the customer details." as a comment to all the remaining imported jobs.

==== Sharing your feedback with your employees

If you want to share your feedback, you can export it as an excel file, reflecting accept/reject with comments.
Format: `export PATH_TO_FILE`

[TIP]
====
* You can type any filename supported by your computer's storage format
* If you forgot to export your feedback, you can find it under C:\User\Documents\CarviciM\feedback.xls
* The feedback file's format is support for future imports.
====
[NOTE]
====
Filepath: A text representation of the location of the file used by the computer.
====

Examples:

* `export summary report`
Exports the feedback to "summary report.xls"
// end::importexport[]

=== Setting a theme : `theme`

Expand Down
Binary file modified docs/diagrams/LogicComponentClassDiagram.pptx
Binary file not shown.
Binary file modified docs/diagrams/ModelComponentClassDiagram.pptx
Binary file not shown.
Binary file added docs/images/EmailAuthorization.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/SetCommandLogicDiagram.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/SetCommandModelDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 6 additions & 15 deletions docs/team/yuhongherald.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,32 @@ Coming in v2.0
* *Other contributions*:

** Project management:
*** Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub
*** Helped to edit PRs for merging for v1.2- (Pull requests https://github.com[#40], https://github.com[#48])
** Enhancements to existing features:
*** Updated the GUI color scheme (Pull requests https://github.com[#33], https://github.com[#34])
*** Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests https://github.com[#36], https://github.com[#38])
*** Added JobListPanel to support displaying jobs (Pull requests https://github.com[#53])
** Documentation:
*** Did cosmetic tweaks to existing contents of the User Guide: https://github.com[#14]
** Community:
*** PRs reviewed (with non-trivial review comments): https://github.com[#12], https://github.com[#32], https://github.com[#19], https://github.com[#42]
*** Contributed to forum discussions (examples: https://github.com[1], https://github.com[2], https://github.com[3], https://github.com[4])
*** Reported bugs and suggestions for other teams in the class (examples: https://github.com[1], https://github.com[2], https://github.com[3])
*** Some parts of the history feature I added was adopted by several other class mates (https://github.com[1], https://github.com[2])
** Tools:
*** Integrated a third party library (Natty) to the project (https://github.com[#42])
*** Integrated a new Github plugin (CircleCI) to the team repo

_{you can add/remove categories in the list above}_

== Contributions to the User Guide


|===
|_Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users._
|===

include::../UserGuide.adoc[tag=undoredo]
include::../UserGuide.adoc[tag=set]

include::../UserGuide.adoc[tag=dataencryption]
include::../UserGuide.adoc[tag=importexport]

== Contributions to the Developer Guide

|===
|_Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project._
|===

include::../DeveloperGuide.adoc[tag=undoredo]
include::../DeveloperGuide.adoc[tag=set]

include::../DeveloperGuide.adoc[tag=dataencryption]
include::../DeveloperGuide.adoc[tag=importexport]

4 changes: 4 additions & 0 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import seedu.address.model.ModelManager;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.UserPrefs;
import seedu.address.model.job.JobNumber;
import seedu.address.model.util.SampleDataUtil;
import seedu.address.storage.AddressBookStorage;
import seedu.address.storage.JsonUserPrefsStorage;
Expand Down Expand Up @@ -73,6 +74,9 @@ public void init() throws Exception {
ui = new UiManager(logic, config, userPrefs);

initEventsCenter();

//Initialize the job number
JobNumber.initialize("0");
}

private String getApplicationParameter(String parameterName) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public CommandResult execute(String commandText) throws CommandException, ParseE
}
}

@Override
public String appendCommandKeyToMessage(String message) {
@Override public String appendCommandKeyToMessage(String message) {
return model.appendCommandKeyToMessage(message);
}

Expand All @@ -56,7 +55,8 @@ public ObservableList<Employee> getFilteredPersonList() {
return model.getFilteredPersonList();
}

@Override public ObservableList<Job> getFilteredJobList() {
@Override
public ObservableList<Job> getFilteredJobList() {
return model.getFilteredJobList();
}

Expand Down
Loading

0 comments on commit cc0fdf5

Please sign in to comment.