By: CS2103-F11-B1
Since: Jan 2018
Licence: MIT
- 1. Setting up
- 2. Design
- 3. Implementation
- 3.1. Undo/Redo feature
- 3.2. Remark feature
- 3.3. Color Tag feature
- 3.4. Auto-Complete feature
- 3.5. Leads and Contacts feature
- 3.6. LinkedIn Login Feature
- 3.7. Share to LinkedIn Feature
- 3.8. Saving a location for Google Maps
- 3.9. View directions to a Client’s office
- 3.10. Bulk Import Feature
- 3.11. Logging
- 3.12. Configuration
- 3.13. Alias Commands feature
- 3.14. Identifying a Duplicate feature
- 3.15. Adding a Parent Company tag feature [Coming in v2.0]
- 3.16. Displaying Lead list and Contact list feature
- 3.17. Enhancement of Find Command feature
- 3.18. Change Theme feature
- 4. Documentation
- 5. Testing
- 6. Dev Ops
- Appendix A: Suggested Programming Tasks to Get Started
- Appendix B: Product Scope
- Appendix C: User Stories
- Appendix D: Use Cases
- D.1. Use case: User requests to import a CSV file to CRM Book
- D.2. Use case: User seeks Lead list or Contact list
- D.3. Use case: User seeks to add a company to a Lead or Contact [Coming in v2.0]
- D.4. Use case: User enters phone numbers and/or email addresses to find
- D.5. Use case: User posts to LinkedIn
- D.6. Use case: Auto-complete
- D.7. Use case: Convert a Lead to a Contact
- D.8. Use case: Color tag
- D.9. Use case: Change theme
- Appendix E: Non Functional Requirements
- Appendix F: Glossary
- Appendix G: Instructions for Manual Testing
- G.1. Launch and Shutdown
- G.2. Deleting a Lead or Contact
- G.3. Displaying Lead or Contact list
- G.4. Duplicate Detection
- G.5. Executing commands via alias
- G.6. Finding Lead(s) and Contact(s) via Phone Numbers and Email Addresses
- G.7. Sorting all people
- G.8. Adding/Editing/Removing a remark of a person
- G.9. Importing a CSV file
- G.10. Converting a Lead to a Contact
- G.11. Editing the non-essential details
- G.12. Adding an Account to a Contact
- G.13. Logging in to LinkedIn
- G.14. Sharing a Post to LinkedIn
- G.15. Setting your office location
- G.16. Getting directions to a client’s location
- G.17. Change color theme of CRM Book
1. Setting up
1.1. Prerequisites
-
JDK
1.8.0_60
or laterHaving any Java 8 version is not enough.
This app will not work with earlier versions of Java 8. -
IntelliJ IDE
IntelliJ by default has Gradle and JavaFx plugins installed.
Do not disable them. If you have disabled them, go toFile
>Settings
>Plugins
to re-enable them.
1.2. Setting up the project in your computer
-
Fork this repo, and clone the fork to your computer
-
Open IntelliJ (if you are not in the welcome screen, click
File
>Close Project
to close the existing project dialog first) -
Set up the correct JDK version for Gradle
-
Click
Configure
>Project Defaults
>Project Structure
-
Click
New…
and find the directory of the JDK
-
-
Click
Import Project
-
Locate the
build.gradle
file and select it. ClickOK
-
Click
Open as Project
-
Click
OK
to accept the default settings -
Open a console and run the command
gradlew processResources
(Mac/Linux:./gradlew processResources
). It should finish with theBUILD SUCCESSFUL
message.
This will generate all resources required by the application and tests.
1.3. Verifying the setup
-
Run the
seedu.address.MainApp
and try a few commands -
Run the tests to ensure they all pass.
1.4. Configurations to do before writing code
1.4.1. Configuring the coding style
This project follows oss-generic coding standards. IntelliJ’s default style is mostly compliant with ours but it uses a different import order from ours. To rectify,
-
Go to
File
>Settings…
(Windows/Linux), orIntelliJ IDEA
>Preferences…
(macOS) -
Select
Editor
>Code Style
>Java
-
Click on the
Imports
tab to set the order-
For
Class count to use import with '*'
andNames count to use static import with '*'
: Set to999
to prevent IntelliJ from contracting the import statements -
For
Import Layout
: The order isimport static all other imports
,import java.*
,import javax.*
,import org.*
,import com.*
,import all other imports
. Add a<blank line>
between eachimport
-
Optionally, you can follow the UsingCheckstyle.adoc document to configure Intellij to check style-compliance as you write code.
1.4.2. Updating documentation to match your fork
After forking the repo, links in the documentation will still point to the se-edu/addressbook-level4
repo. If you plan to develop this as a separate product (i.e. instead of contributing to the se-edu/addressbook-level4
) , you should replace the URL in the variable repoURL
in DeveloperGuide.adoc
and UserGuide.adoc
with the URL of your fork.
1.4.3. Setting up CI
Set up Travis to perform Continuous Integration (CI) for your fork. See UsingTravis.adoc to learn how to set it up.
After setting up Travis, you can optionally set up coverage reporting for your team fork (see UsingCoveralls.adoc).
Coverage reporting could be useful for a team repository that hosts the final version but it is not that useful for your personal fork. |
Optionally, you can set up AppVeyor as a second CI (see UsingAppVeyor.adoc).
Having both Travis and AppVeyor ensures your App works on both Unix-based platforms and Windows-based platforms (Travis is Unix-based and AppVeyor is Windows-based) |
1.4.4. Getting started with coding
When you are ready to start coding,
-
Get some sense of the overall design by reading Section 2.1, “Architecture”.
-
Take a look at Appendix A, Suggested Programming Tasks to Get Started.
2. Design
2.1. Architecture

The Architecture Diagram given above explains the high-level design of the App. Given below is a quick overview of each component.
The .pptx files used to create diagrams in this document can be found in the diagrams folder. To update a diagram, modify the diagram in the pptx file, select the objects of the diagram, and choose Save as picture .
|
Main
has only one class called MainApp
. It is responsible for,
-
At app launch: Initializes the components in the correct sequence, and connects them up with each other.
-
At shut down: Shuts down the components and invokes cleanup method where necessary.
Commons
represents a collection of classes used by multiple other components. Two of those classes play important roles at the architecture level.
-
EventsCenter
: This class (written using Google’s Event Bus library) is used by components to communicate with other components using events (i.e. a form of Event Driven design) -
LogsCenter
: Used by many classes to write log messages to the App’s log file.
The rest of the App consists of four components.
Each of the four components
-
Defines its API in an
interface
with the same name as the Component. -
Exposes its functionality using a
{Component Name}Manager
class.
For example, the Logic
component (see the class diagram given below) defines it’s API in the Logic.java
interface and exposes its functionality using the LogicManager.java
class.

Events-Driven nature of the design
The Sequence Diagram below shows how the components interact for the scenario where the user issues the command delete 1
.

delete 1
command (part 1)
Note how the Model simply raises a AddressBookChangedEvent when the CRM Book data are changed, instead of asking the Storage to save the updates to the hard disk.
|
The diagram below shows how the EventsCenter
reacts to that event, which eventually results in the updates being saved to the hard disk and the status bar of the UI being updated to reflect the 'Last Updated' time.

delete 1
command (part 2)
Note how the event is propagated through the EventsCenter to the Storage and UI without Model having to be coupled to either of them. This is an example of how this Event Driven approach helps us reduce direct coupling between components.
|
The sections below give more details of each component.
2.2. UI component

API : Ui.java
The UI consists of a MainWindow
that is made up of parts e.g.CommandBox
, ResultDisplay
, PersonListPanel
, StatusBarFooter
, BrowserPanel
etc. All these, including the MainWindow
, inherit from the abstract UiPart
class.
The UI
component uses JavaFx UI framework. The layout of these UI parts are defined in matching .fxml
files that are in the src/main/resources/view
folder. For example, the layout of the MainWindow
is specified in MainWindow.fxml
The UI
component,
-
Executes user commands using the
Logic
component. -
Binds itself to some data in the
Model
so that the UI can auto-update when data in theModel
change. -
Responds to events raised from various parts of the App and updates the UI accordingly.
2.3. Logic component


XYZCommand
and Command
in Figure 6, “Structure of the Logic Component”API :
Logic.java
-
Logic
uses theAddressBookParser
class to parse the user command. -
This results in a
Command
object which is executed by theLogicManager
. -
The command execution can affect the
Model
(e.g. adding a person) and/or raise events. -
The result of the command execution is encapsulated as a
CommandResult
object which is passed back to theUi
.
Given below is the Sequence Diagram for interactions within the Logic
component for the execute("delete 1")
API call.

delete 1
Command2.4. Model component

API : Model.java
The Model
,
-
stores a
UserPref
object that represents the user’s preferences. -
stores the CRM Book data.
-
exposes an unmodifiable
ObservableList<Person>
that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. -
does not depend on any of the other three components.
2.5. Storage component

API : Storage.java
The Storage
component,
-
can save
UserPref
objects in json format and read it back. -
can save the CRM Book data in xml format and read it back.
2.6. Common classes
Classes used by multiple components are in the seedu.addressbook.commons
package.
3. Implementation
This section describes some noteworthy details on how certain features are implemented.
3.1. Undo/Redo feature
3.1.1. Current Implementation
The undo/redo mechanism is facilitated by an UndoRedoStack
, which resides inside LogicManager
. It supports undoing and redoing of commands that modifies the state of the CRM Book (e.g. add
, edit
). Such commands will inherit from UndoableCommand
.
UndoRedoStack
only deals with UndoableCommands
. Commands that cannot be undone will inherit from Command
instead. The following diagram shows the inheritance diagram for commands:

As you can see from the diagram, UndoableCommand
adds an extra layer between the abstract Command
class and concrete commands that can be undone, such as the DeleteCommand
. Note that extra tasks need to be done when executing a command in an undoable way, such as saving the state of the CRM Book before execution. UndoableCommand
contains the high-level algorithm for those extra tasks while the child classes implements the details of how to execute the specific command. Note that this technique of putting the high-level algorithm in the parent class and lower-level steps of the algorithm in child classes is also known as the template pattern.
Commands that are not undoable are implemented this way:
public class ListCommand extends Command {
@Override
public CommandResult execute() {
// ... list logic ...
}
}
With the extra layer, the commands that are undoable are implemented this way:
public abstract class UndoableCommand extends Command {
@Override
public CommandResult execute() {
// ... undo logic ...
executeUndoableCommand();
}
}
public class DeleteCommand extends UndoableCommand {
@Override
public CommandResult executeUndoableCommand() {
// ... delete logic ...
}
}
Suppose that the user has just launched the application. The UndoRedoStack
will be empty at the beginning.
The user executes a new UndoableCommand
, delete 5
, to delete the 5th person in the CRM Book. The current state of the CRM Book is saved before the delete 5
command executes. The delete 5
command will then be pushed onto the undoStack
(the current state is saved together with the command).

As the user continues to use the program, more commands are added into the undoStack
. For example, the user may execute add n/David …
to add a new person.

If a command fails its execution, it will not be pushed to the UndoRedoStack at all.
|
The user now decides that adding the person was a mistake, and decides to undo that action using undo
.
We will pop the most recent command out of the undoStack
and push it back to the redoStack
. We will restore the CRM Book to the state before the add
command executed.

If the undoStack is empty, then there are no other commands left to be undone, and an Exception will be thrown when popping the undoStack .
|
The following sequence diagram shows how the undo operation works:

The redo does the exact opposite (pops from redoStack
, push to undoStack
, and restores the CRM Book to the state after the command is executed).
If the redoStack is empty, then there are no other commands left to be redone, and an Exception will be thrown when popping the redoStack .
|
The user now decides to execute a new command, clear
. As before, clear
will be pushed into the undoStack
. This time the redoStack
is no longer empty. It will be purged as it no longer make sense to redo the add n/David
command (this is the behavior that most modern desktop applications follow).

Commands that are not undoable are not added into the undoStack
. For example, list
, which inherits from Command
rather than UndoableCommand
, will not be added after execution:

The following activity diagram summarize what happens inside the UndoRedoStack
when a user executes a new command:

3.1.2. Design Considerations
Aspect: Implementation of UndoableCommand
-
Alternative 1 (current choice): Add a new abstract method
executeUndoableCommand()
-
Pros: We will not lose any undone/redone functionality as it is now part of the default behaviour. Classes that deal with
Command
do not have to know thatexecuteUndoableCommand()
exist. -
Cons: Hard for new developers to understand the template pattern.
-
-
Alternative 2: Just override
execute()
-
Pros: Does not involve the template pattern, easier for new developers to understand.
-
Cons: Classes that inherit from
UndoableCommand
must remember to callsuper.execute()
, or lose the ability to undo/redo.
-
Aspect: How undo & redo executes
-
Alternative 1 (current choice): Saves the entire CRM Book.
-
Pros: Easy to implement.
-
Cons: May have performance issues in terms of memory usage.
-
-
Alternative 2: Individual command knows how to undo/redo by itself.
-
Pros: Will use less memory (e.g. for
delete
, just save the person being deleted). -
Cons: We must ensure that the implementation of each individual command are correct.
-
Aspect: Type of commands that can be undone/redone
-
Alternative 1 (current choice): Only include commands that modifies the CRM Book (
add
,clear
,edit
).-
Pros: We only revert changes that are hard to change back (the view can easily be re-modified as no data are * lost).
-
Cons: User might think that undo also applies when the list is modified (undoing filtering for example), * only to realize that it does not do that, after executing
undo
.
-
-
Alternative 2: Include all commands.
-
Pros: Might be more intuitive for the user.
-
Cons: User have no way of skipping such commands if he or she just want to reset the state of the address * book and not the view. Additional Info: See our discussion here.
-
Aspect: Data structure to support the undo/redo commands
-
Alternative 1 (current choice): Use separate stack for undo and redo
-
Pros: Easy to understand for new Computer Science student undergraduates to understand, who are likely to be * the new incoming developers of our project.
-
Cons: Logic is duplicated twice. For example, when a new command is executed, we must remember to update * both
HistoryManager
andUndoRedoStack
.
-
-
Alternative 2: Use
HistoryManager
for undo/redo-
Pros: We do not need to maintain a separate stack, and just reuse what is already in the codebase.
-
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.
-
3.2. Remark feature
3.2.1. Current Implementation
To record more detailed information of a person, a new command RemarkCommand
is implemented.
The RemarkCommand
inherits from UndoableCommands
since it is reasonable to make remark command execute in an undoable way.
RemarkCommand
which is undoable is implemented this way:
public class RemarkCommand extends UndoableCommand {
@Override
public CommandResult executeUndoableCommand() {
// ... remark logic ...
}
}
The following diagram shows the inheritance diagram for RemarkCommand
.

The model Person
is modified to have a new field Remark
.
The default value of the remark field of a person is an empty string. A user is not able to assign a remark to a person when adding the person. Therefore, all people in the CRM Book is originally without any remark by default.
The implementation of this command is much like the EditCommand
.
For example, when a user type remark 2 r\Likes to swim
. Then the remark field of the 2nd person in the current list will be changed to Likes to swim
. It’s similar to editing a person’s phone number or address.
The sequence diagram is shown below:

3.2.2. Design Considerations
Aspect: Implementation of RemarkCommand
-
Alternative 1 (current choice): Add a new
remark
command-
Pros: Treat it as a command may be easy to understand. Only a few people needs a remark.
-
Cons: Cannot add a person with remark.
-
-
Alternative 2: Just make it a part of
EditCommand
andAddCommand
-
Pros: Only need to add remark field to every related class. We can add a person with remark.
-
Cons: We may have to type too many things when adding a person. Also, some people don’t have any remark.
-
3.3. Color Tag feature
3.3.1. Current Implementation
To allow easy identification of different tags, a color tag feature is introduced.
A string array is declared in PersonCard.java to include a set of colors for tags.
//In PersonCard.java
private static final String[] TAG_COLORS =
{ "blue", "cyan", "green", "magenta", "orange", "pink", "red", "yellow", "teal", "brown" };
These colors are defined, with their background color and text color spelled out, in the all the different theme CSS files.
A hash code of the tag name is used to select a color for the tag such that it would remain consistent between different runs of the software.
//In PersonCard.java
private String getTagColorFor(String tagName) {
return TAG_COLORS[Math.abs(tagName.hashCode()) % TAG_COLORS.length];
}
//In PersonCard.java
private void initTags(Person person) {
person.getTags().forEach(tag -> {
Label tagLabel = new Label(tag.tagName);
tagLabel.getStyleClass().add(getTagColorFor(tag.tagName));
tags.getChildren().add(tagLabel);
});
}
3.3.2. Design Considerations
Aspect: Implementation of color tags
-
Alternative 1 (current choice): Assign a color from a predefined list based on tag name
-
Pros: No additional commands are needed to generate a color for the tags.
-
Cons: User cannot choose a color for the tag.
-
-
Alternative 2: Allow user to set a color for the tag
-
Pros: Allows more freedom for user customization.
-
Cons: Takes more time to implement color tags.
-
3.4. Auto-Complete feature
3.4.1. Current Implementation
To allow fast typing of commands, auto-complete of commands is implemented.
Auto-complete is implemented through the TextFields feature of ControlsFX.
//In CommandBox.java
TextFields.bindAutoCompletion(commandTextField, Messages.AUTOCOMPLETE_FIELD);
All the command keywords are included in the AUTOCOMPLETE_FIELD string array.
//In Messages.java
public static final String[] AUTOCOMPLETE_FIELD = {
//all command keywords
};
In addition to all the command keywords, a COMMAND_AUTO_COMPLETE string, with both command word and prefixes, is also included for add command.
//In AddCommand.java
public static final String COMMAND_AUTO_COMPLETE = COMMAND_WORD + " " + PREFIX_NAME + " "
+ PREFIX_PHONE + " " + PREFIX_EMAIL + " " + PREFIX_ADDRESS + " " + PREFIX_TAG;
3.4.2. Design Considerations
Aspect: Implementation of Auto-complete
-
Alternative 1 (current choice): All the commands that contain the typed input are shown. ie. When "a" is typed, both "add" and "clear" will be shown.
-
Pros: Allow new user to quickly learn the different command words.
-
Cons: When there are a lot of commands, efficiency of auto-complete decreases as user would have too many options to choose from.
-
-
Alternative 2: Only commands with the same sequence as the typed input are shown. ie. When "a" is typed, only "add" will be shown.
-
Pros: Higher efficiency of auto-complete.
-
Cons: New user might find this difficult to use as they are unfamillar with the command words.
-
3.5. Leads and Contacts feature
3.5.1. Current Implementation
People in the CRM Book were stored under a single class with no options for differentiating between two types of classes.
To implement a CRM Book, Leads and Contacts must be differentiated so that they can each hold different fields like a proper CRM Book. To do so, they currently extend the Person class so that all existing functionality associated with Persons will work with both Leads an Contacts. Unique fields will be given their own classes like the original generic fields like Name and Address.
In a CRM Book, users start by adding Leads, who are people they have not sold to yet. As they begin selling, the people who they have sold to become Contacts.
Many existing commands like AddCommand
have been modified to fit the new paradigm so that it only adds Leads.
A new conversion command ConvertCommand
has been added to convert Leads into Contacts. The Sequence Diagram is shown:

The ConvertCommand
class calls the convertPerson method
in the ModelManager
class and the Sequence Diagram for the resulting steps are shown below.

When the user has selected a Contact instead of a Lead, an error is thrown with this code:
public class ConvertCommand extends UndoableCommand {
@Override
protected void preprocessUndoableCommand() throws CommandException {
// ... get list of Persons ...
try {
oldLead = (Lead) lastShownList.get(index.getZeroBased());
} catch (ClassCastException cce) {
throw new CommandException(MESSAGE_NOT_CONVERTED);
}
newContact = createContact(oldLead);
}
}
It keeps the name, phone, email, address, remarks and tags through the conversion. The company is converted if it exists into an Account. The converted date is set in the Contact.
3.5.2. Design Considerations
Aspect: Implementation of Leads and Contacts
-
Alternative 1 (current choice): Extend the existing Person class
-
Pros: We will not lose any functionality associated with the Person class.
-
Cons: Declarations of Person variables may confuse new developers even as a general class for Leads and Contacts.
-
-
Alternative 2: Create two new classes Leads and Contacts
-
Pros: Clearly differentiates Leads and Contacts throughout the codebase.
-
Cons: We would have to rewrite most objects to take into account the two new classes.
-
Aspect: How conversion will work
-
Alternative 1: Just convert the basic information. Let user fill in other fields themselves.
-
Pros: Easy to implement.
-
Cons: User must do extra work.
-
-
Alternative 2: Smartly detect which fields can be converted and then do so.
-
Pros: User will only need to fix some mistakes in the conversion.
-
Cons: Smart detection and conversion needs work to do.
-
3.6. LinkedIn Login Feature
3.6.1. Current Implementation
The linkedInLogin mechanism is handled largely by the oAuth2Client interacting with the browser window, which the user will interact with in order to give LinkedIn their username, password, as well as granting the application permission for use.
When the linkedIn_login
command is called, a ShowBrowserRequestEvent
will be fired by LinkedInLoginCommand(Class)
and picked up by the MainWindow.
@Override
public CommandResult execute() {
EventsCenter.getInstance().post(new ShowBrowserRequestEvent());
return new CommandResult(MESSAGE_SUCCESS);
}
The MainWindow in turn will call the OAuth2Client(Class)
which will fire up the browser awaiting an authorization code from LinkedIn that will be sent after the user has successfully logged in and granted the CRM Book permission.
@Subscribe
private void handleLinkedInAuthenticationEvent(ShowBrowserRequestEvent event) {
logger.info(LogsCenter.getEventHandlingLogMessage(event));
handleLinkedInAuthentication();
}
public void handleLinkedInAuthentication() {
try {
Oauth2Client.authenticateWithLinkedIn();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void authenticateWithLinkedIn() throws IOException {
...
String urlString = "https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id="
+ clientId + "&redirect_uri=" + redirectUri + "&state=...";
bWindow = new BrowserWindow(urlString);
bWindow.show();
}
Once this has happened, we fire a HideBrowserRequestEvent
in order to close the browser properly.
The Decrypter
will then be fired so that we do not store the app secret in plain text. This decision to use a Decrypter class is in the comments section of the Decrypter class, and duplicated here for convenience to the reader.
// Decrypts the s for use for OAuth
// While this is not an ideal situation, LinkedIn's OAuth API does not have a client-side authentication flow.
// This means that it will always require the app s for purposes of authentication.
// Because of this, building a native (desktop) app that authenticates with LinkedIn is not ideal.
// However, a number of sites have agreed that if you have to store the key in the code, then obscuring it to make
// it slightly more difficult for a potential hacker to get it is best. (They will need to run the app rather than
// just reading the plain text version)
// This is especially so because a LinkedIn S is not especially valuable, since anyone can create a LinkedIn app.
// Furthermore the chances of competitors abusing the secret to disable this application is minimal, since it is
// ultimately, a school project.
public void handleHideBrowser() {
Oauth2Client.closeBrowser();
Oauth2Client.getLinkedInS();
}
After the CRM Book has received the authorization code and the app secret from the decrypter, they are sent back to LinkedIn to request for an AccessToken. Once the AccessToken has been received, the user is considered to be successfully logged in, and the accessToken can be used by the CRM Book to make requests to LinkedIn on behalf of the user. The accessToken is also stored in the config.json file for future usage.
config.setAppSecret(accessToken);
ConfigUtil.saveConfig(config, config.DEFAULT_CONFIG_FILE);
The following sequence diagram shows how the linkedIn_login feature works. As seen, it is an events-driven design.

3.6.2. Design Considerations
Aspect: Storing the LinkedIn App Secret
-
Alternative 1 (current choice): Slightly encrypting the App Secret
-
Pros: Easy to implement, not trivial for attackers to get by scanning the source code.
-
Cons: App secret can be derived if the attacker runs the source code
-
-
Alternative 2: Store the App Secret in another server, and requesting it with an authentication code
-
Pros: Higher security, app secret not stored on GitHub
-
Cons: Significantly harder to implement. Requires user to have a username and password for the server not stored on GitHub.
-
-
Alternative 3: Store the App Secret in plain text
-
Pros: Much easier to code and implement
-
Cons: Bad security, secret will likely end up in a paste database somewhere in the internet
-
3.7. Share to LinkedIn Feature
3.7.1. Current Implementation
When the linkedin_share command is executed, it will call the Config class to get a current copy of the configurations used by the Application. It will also set the boolean value of postSuccess to false. This boolean value will be used to determine if we managed to successfully post to LinkedIn.
public static void postToLinkedIn() {
Config config = Config.setupConfig();
postSuccess = false;
Next, we create a JSON Object that LinkedIn requires, specifying the visibility (privacy) of the post, and the actual content of the post. By default, we set the visibility to be 'anyone', or in Facebook terms, 'Public'. An overview on LinkedIn’s share API can be found at https://developer.linkedin.com/docs/share-on-linkedin
With the JSON Object and the access_token taken from the user’s configuration file, we create a HttpPost Object and HttpClient Object, send it to LinkedIn, and analyze the response. In particular, if the response contains an updateUrl, it means that the post has been successfully posted, and we update the boolean value of postSuccess to true.
HttpPost httppost = getHttpPostObject(jsonToSend, accessToken);
HttpClient httpclient = getHttpClientObject();
JSONObject linkedInResponse = sendHttpRequestToLinkedIn(httppost, httpclient);
logger.info("LinkedIn Response is : " + linkedInResponse.toString());
if (linkedInResponse.has("updateUrl") || linkedInResponse.has("updateURL")) {
//if has updateURL then it successfully got posted
logger.info("Post has been successfully posted");
postSuccess = true;
}
Finally we use the postSuccess value to determine if we send a success or failed message to the user.
The following sequence diagram shows how the command works

3.7.2. Design Considerations
Aspect: Allowing salesperson to set privacy level of their post
-
Alternative 1 (current choice): Only option is 'anyone'
-
Pros: Salesperson always wants to share to as many people as possible. Reduces complexity of command and/or save on a command to set a default level of visibility.
-
Cons: Salesperson is limited to only posting public posts using CRM Book
-
-
Alternative 2: Allow salesperson to set a default visibility option using another command
-
Pros: Salesperson has greater flexibility in setting the visibility type of their post.
-
Cons: Have to write a new command that may not be used.
-
-
Alternative 3: Allow salesperson to specify visibility in share command
-
Pros: Salesperson has the greatest level flexibility in setting the visibility type of their post.
-
Cons: Increases complexity of the command
-
3.8. Saving a location for Google Maps
3.8.1. Current Implementation
To save a location in Google Maps, it does not matter whether CRM Book already has a pre-existing address. Rather, we always overwrite the config file to be updated with the latest address.
Config initializedConfig = Config.setupConfig();
initializedConfig.setUserLocation(address.toString());
The following sequence diagram shows how the command works

3.9. View directions to a Client’s office
3.9.1. Current Implementation
The current implementation of this feature is the same as when a person card is changed (Like the select command). The difference is that if the config file states that a user’s office location has been set, then load Google maps instead of doing a Google Search.
@Subscribe
private void handlePersonPanelSelectionChangedEvent(PersonPanelSelectionChangedEvent event) {
getConfig();
logger.info(LogsCenter.getEventHandlingLogMessage(event));
//if person has no home location set
if (config.getUserLocation() == null || config.getUserLocation().length() == 0) {
logger.info("No office location set, doing Google search");
loadPersonPage(event.getNewSelection().person);
} else {
String url = generateUrl(config.getUserLocation(), event.getNewSelection().person.getAddress().toString());
logger.info("Office location set, Load Google Maps. URL IS " + url);
loadPage(url);
}
}
The following sequence diagram shows how this feature works. The select command is used only if the user activated it via commandline. However, clicking on another person card without using the select command will work as well.

3.10. Bulk Import Feature
3.10.1. Current Implementation
To add a large number of persons to the CRM Book at the same time, a new command ImportCommand
is implemented.
The ImportCommand
inherits from Command
. It is implemented this way:
public class ImportCommand extends Command {
@Override
public CommandResult execute() {
// … import logic …
}
}
When an ImportCommand
is called, the corresponding CSV file will be processed. Then persons will be added to CRM Book automatically like what a AddCommand
can do but without manual typing.
The sequence diagram is shown below:

3.10.2. Design Considerations
Aspect: CSV file format
-
Alternative 1 (current choice): Requires the CSV file to follow the given format
-
Pros: Easy to implement. No need to analyze too much about the file.
-
Cons: More work for users.
-
-
Alternative 2: Allow attributes not in order and allow different names for attributes
-
Pros: Hard to detect and implement.
-
Cons: More flexible to users. Can help users save time.
-
3.11. Logging
We are using java.util.logging
package for logging. The LogsCenter
class is used to manage the logging levels and logging destinations.
-
The logging level can be controlled using the
logLevel
setting in the configuration file (See Section 3.12, “Configuration”) -
The
Logger
for a class can be obtained usingLogsCenter.getLogger(Class)
which will log messages according to the specified logging level -
Currently log messages are output through:
Console
and to a.log
file.
Logging Levels
-
SEVERE
: Critical problem detected which may possibly cause the termination of the application -
WARNING
: Can continue, but with caution -
INFO
: Information showing the noteworthy actions by the App -
FINE
: Details that is not usually noteworthy but may be useful in debugging e.g. print the actual list instead of just its size
3.12. Configuration
Certain properties of the application can be controlled (e.g App name, logging level) through the configuration file (default: config.json
).
3.13. Alias Commands feature
3.13.1. Current Implementation
A command can be performed by typing in its alias rather than the word.
The following is an example of implementing the alias command for the list command:
public class ListCommand extends Command {
public static final String COMMAND_WORD = "list";
//@@author Sheikh-Umar
public static final String COMMAND_ALIAS = "l";
//@@author
public static final String MESSAGE_SUCCESS = "Listed all Leads and Contacts";
@Override
public CommandResult execute() {
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
return new CommandResult(MESSAGE_SUCCESS);
}
}
The alias command for all other commands will follow a similar implementation.
3.13.2. Design Considerations
Aspect: How to implement the alias command for all commands
The feature is implemented by adding the alias of the command into its respective java document, and updating the AddressBookParser java document.
The feature is implemented this way to utilise the command java documents that are available as opposed to creating a new java document for a certain alias.
This feature is implemented to allow a user to enter a command without specifying the entire word of the command.
3.14. Identifying a Duplicate feature
3.14.1. Current Implementation
The CRM Book will ensure that every Lead and Contact stored is a non-duplicate.
The feature is implemented by checking the phone number and email address of a new Lead with all of the phone numbers and email addresses of all leads and contacts currently in the CRM-Book.
The feature will be implemented on the add command because the current application detects duplicates at the add command.
The following is how the feature will be implemented:
public boolean contains(Person toCheck) {
requireNonNull(toCheck);
for (int i = 0; i < internalList.size(); i++) {
Person current = internalList.get(i);
if (current.getPhone().equals(toCheck.getPhone())
|| current.getEmail().equals(toCheck.getEmail())) {
return true;
}
}
return false;
}
The phone number and email address of a Lead will be checked in the list of all Leads and Contacts. If either the phone number of email address of the Lead to be added is found in the list, the CRM application will display a message that the lead is a duplicate and will reject this lead.
The following activity diagram shows how the operation of identifying a duplicate lead works:

3.14.2. Design Considerations
Aspect: How to implement identifying a duplicate
-
Alternative 1 (current choice): Iterate through all Leads and Contacts in CRM-Book.
-
Pros: Search will be performed in linear time, and enhances an existing portion of code.
-
3.15. Adding a Parent Company tag feature [Coming in v2.0]
3.15.1. Current Implementation
It is possible that the user may want to keep track of the companies associated with the Leads and Contacts in the CRM Book. For example, Skype and Nokia are two different companies whose parent company is Microsoft. Hence, every Lead and Contact will have an additional tag named after the parent company if their company has a parent company. The following activity diagram illustrates how this will be implemented:

3.15.2. Design Considerations
Aspect: How adding a Parent Company tag feature works
-
Alternative 1 (current choice): If the user updated the Company of a Lead or Contact, the CRM Book determines if this company has a parent company using a Google search. If yes, it automatically adds a tag to this Lead or Contact labelled as the parent company of the company of the Lead or Contact.
3.16. Displaying Lead list and Contact list feature
3.16.1. Current Implementation
The CRM Book will be able to list out all Leads and Contacts separately.
The feature is implemented by checking on the type of the persons already stored in the CRM, and displaying all persons that match the keyword (either Lead or Contact) that the user enters.
The feature is implemented through the DisplayCommand, which is based on FindCommand.
Hence, the DisplayCommand will operate similarly as the FindCommand, with the only difference being the DisplayCommand searches for all Leads or Contacts already in the CRM Book.
The DisplayCommand
inherits from Command
. It is implemented this way:
public class DisplayCommand extends Command {
@Override
public CommandResult execute() {
// … import logic …
}
}
The following activity diagram shows how the operation of displaying the Leads or Contacts list works:

3.16.2. Design Considerations
Aspect: How displaying Lead list and Contact list works
-
Alternative 1 (current choice): Iterate through the CRM Book for persons that match the keyword that user entered just like the FindCommand.
-
Pros: Iteration will be performed in linear time, and utilises the functionality of the FindCommand.
-
3.17. Enhancement of Find Command feature
3.17.1. Reason for Implementation
The user may want to search for Leads and Contacts based on phone numbers and email addresses rather than names.
3.17.2. Current Implementation
The CRM Book currently searches for a Lead or Contact based on their name.
This command can be further improved by being able to find phone numbers and email addresses.
The following is how the feature will be implemented:
public boolean test(Person person) {
return keywords.stream().anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().fullName, keyword) .anyMatch(keyword -> StringUtil.containsWordIgnoreCase(person.getName().fullName, keyword)
|| StringUtil.containsWordIgnoreCase(person.getPhone().value, keyword)
|| StringUtil.containsWordIgnoreCase(person.getEmail().value, keyword));
}
}
The phone number and email address that the user entered will be checked in the list of all Leads and Contacts. If either the phone number of email address is found in the list, the CRM Book will display the Leads and/or Contacts that match the keywords entered. If not, the CRM Book will display zero Leads and Contacts found.
3.17.3. Design Considerations
Aspect: How to implement finding phone numbers and email addresses
-
Alternative 1 (current choice): Edit the current search implementation to include finding phone numbers and email addresses.
-
Pros: Search will be performed in linear time, and utilises an existing portion of code.
-
3.18. Change Theme feature
3.18.1. Reason for implementation
CRM Book users are expected to spent long period of time on the software and under different light settings. Change theme allows users to switch between light and dark theme. This would prevent eye fatigue.
3.18.2. Current implementation
The sequence diagram below shows the interactions of change theme command within the logic component.

The sequence diagram below shows the interactions between different components of CRM Book for change theme command.

Every change theme command will post a ChangeThemeRequestEvent to EventCenter. When this event is handled, the UI will be updated to display the chosen theme. In addition, the themeFilePath in user prefs is updated with the chosen theme file path. Currently, there are three themes, namely blue, light and dark. The CSS files of these themes are referenced in Theme class as strings. The following piece of code demonstrates how the CSS files are referenced in Theme class:
//in Theme.java public static final String DEFAULT_THEME_FILE_PATH = "/view/BlueTheme.css"; public static final String DARK_THEME_FILE_PATH = "/view/DarkTheme.css"; public static final String LIGHT_THEME_FILE_PATH = "/view/LightTheme.css";
There is a method in Theme class to convert theme name into theme file path.
//in Theme.java public String convertThemeToFilePath() { switch (this.theme) { case DARK_THEME: return DARK_THEME_FILE_PATH; //other cases } }
This method is used to check if the chosen theme is equals to the current theme by comparing the file path of the chosen theme with the file path in user prefs.
If the chosen theme is not equals to the current theme, the ChangeThemeRequestEvent will be handle in MainWindow class.
//in MainWindow.java public void handleChangeTheme(String theme) { String fullPath = getFullPath(this.themeFilePath); primaryStage.getScene().getStylesheets().remove(fullPath); switch (theme) { case Theme.LIGHT_THEME: this.themeFilePath = Theme.LIGHT_THEME_FILE_PATH; break; case Theme.DARK_THEME: this.themeFilePath = Theme.DARK_THEME_FILE_PATH; break; case Theme.BLUE_THEME: this.themeFilePath = Theme.BLUE_THEME_FILE_PATH; break; default: //this will not happen } prefs.getGuiSettings().setThemeFilePath(this.themeFilePath); fullPath = getFullPath(this.themeFilePath); primaryStage.getScene().getStylesheets().add(fullPath); }
This method updates the theme file path in the primary scene in 3 steps:
-
Removes the current theme file path from primary scene.
-
Updates the theme file path
-
Adds the new theme file path into primary scene.
In addition, the updated theme file path is written into user prefs.
A switch case statement is used to update the new theme file path. This implementation allows easy extension of the feature; i.e. when a new theme is created, it can be easily added as a case.
4. Documentation
We use asciidoc for writing documentation.
We chose asciidoc over Markdown because asciidoc, although a bit more complex than Markdown, provides more flexibility in formatting. |
4.1. Editing Documentation
See UsingGradle.adoc to learn how to render .adoc
files locally to preview the end result of your edits.
Alternatively, you can download the AsciiDoc plugin for IntelliJ, which allows you to preview the changes you have made to your .adoc
files in real-time.
4.2. Publishing Documentation
See UsingTravis.adoc to learn how to deploy GitHub Pages using Travis.
4.3. Converting Documentation to PDF format
We use Google Chrome for converting documentation to PDF format, as Chrome’s PDF engine preserves hyperlinks used in webpages.
Here are the steps to convert the project documentation files to PDF format.
-
Follow the instructions in UsingGradle.adoc to convert the AsciiDoc files in the
docs/
directory to HTML format. -
Go to your generated HTML files in the
build/docs
folder, right click on them and selectOpen with
→Google Chrome
. -
Within Chrome, click on the
Print
option in Chrome’s menu. -
Set the destination to
Save as PDF
, then clickSave
to save a copy of the file in PDF format. For best results, use the settings indicated in the screenshot below.

5. Testing
5.1. Running Tests
There are three ways to run tests.
The most reliable way to run tests is the 3rd one. The first two methods might fail some GUI tests due to platform/resolution-specific idiosyncrasies. |
Method 1: Using IntelliJ JUnit test runner
-
To run all tests, right-click on the
src/test/java
folder and chooseRun 'All Tests'
-
To run a subset of tests, you can right-click on a test package, test class, or a test and choose
Run 'ABC'
Method 2: Using Gradle
-
Open a console and run the command
gradlew clean allTests
(Mac/Linux:./gradlew clean allTests
)
See UsingGradle.adoc for more info on how to run tests using Gradle. |
Method 3: Using Gradle (headless)
Thanks to the TestFX library we use, our GUI tests can be run in the headless mode. In the headless mode, GUI tests do not show up on the screen. That means the developer can do other things on the Computer while the tests are running.
To run tests in headless mode, open a console and run the command gradlew clean headless allTests
(Mac/Linux: ./gradlew clean headless allTests
)
5.2. Types of tests
We have two types of tests:
-
GUI Tests - These are tests involving the GUI. They include,
-
System Tests that test the entire App by simulating user actions on the GUI. These are in the
systemtests
package. -
Unit tests that test the individual components. These are in
seedu.address.ui
package.
-
-
Non-GUI Tests - These are tests not involving the GUI. They include,
-
Unit tests targeting the lowest level methods/classes.
e.g.seedu.address.commons.StringUtilTest
-
Integration tests that are checking the integration of multiple code units (those code units are assumed to be working).
e.g.seedu.address.storage.StorageManagerTest
-
Hybrids of unit and integration tests. These test are checking multiple code units as well as how the are connected together.
e.g.seedu.address.logic.LogicManagerTest
-
5.3. Troubleshooting Testing
Problem: HelpWindowTest
fails with a NullPointerException
.
-
Reason: One of its dependencies,
UserGuide.html
insrc/main/resources/docs
is missing. -
Solution: Execute Gradle task
processResources
.
6. Dev Ops
6.1. Build Automation
See UsingGradle.adoc to learn how to use Gradle for build automation.
6.2. Continuous Integration
We use Travis CI and AppVeyor to perform Continuous Integration on our projects. See UsingTravis.adoc and UsingAppVeyor.adoc for more details.
6.3. Coverage Reporting
We use Coveralls to track the code coverage of our projects. See UsingCoveralls.adoc for more details.
6.4. Documentation Previews
When a pull request has changes to asciidoc files, you can use Netlify to see a preview of how the HTML version of those asciidoc files will look like when the pull request is merged. See UsingNetlify.adoc for more details.
6.5. Making a Release
Here are the steps to create a new release.
-
Update the version number in
MainApp.java
. -
Generate a JAR file using Gradle.
-
Tag the repo with the version number. e.g.
v0.1
-
Create a new release using GitHub and upload the JAR file you created.
6.6. Managing Dependencies
A project often depends on third-party libraries. For example, CRM Book depends on the Jackson library for XML parsing. Managing these dependencies can be automated using Gradle. For example, Gradle can download the dependencies automatically, which is better than these alternatives.
a. Include those libraries in the repo (this bloats the repo size)
b. Require developers to download those libraries manually (this creates extra work for developers)
Appendix A: Suggested Programming Tasks to Get Started
Suggested path for new programmers:
-
First, add small local-impact (i.e. the impact of the change does not go beyond the component) enhancements to one component at a time. Some suggestions are given in Section A.1, “Improving each component”.
-
Next, add a feature that touches multiple components to learn how to implement an end-to-end feature across all components. Section A.2, “Creating a new command:
remark
” explains how to go about adding such a feature.
A.1. Improving each component
Each individual exercise in this section is component-based (i.e. you would not need to modify the other components to get it to work).
Logic
component
Scenario: You are in charge of logic
. During dog-fooding, your team realize that it is troublesome for the user to type the whole command in order to execute a command. Your team devise some strategies to help cut down the amount of typing necessary, and one of the suggestions was to implement aliases for the command words. Your job is to implement such aliases.
Do take a look at Section 2.3, “Logic component” before attempting to modify the Logic component.
|
-
Add a shorthand equivalent alias for each of the individual commands. For example, besides typing
clear
, the user can also typec
to remove all persons in the list.
Model
component
Scenario: You are in charge of model
. One day, the logic
-in-charge approaches you for help. He wants to implement a command such that the user is able to remove a particular tag from everyone in the CRM Book, but the model API does not support such a functionality at the moment. Your job is to implement an API method, so that your teammate can use your API to implement his command.
Do take a look at Section 2.4, “Model component” before attempting to modify the Model component.
|
-
Add a
removeTag(Tag)
method. The specified tag will be removed from everyone in the CRM Book.
Ui
component
Scenario: You are in charge of ui
. During a beta testing session, your team is observing how the users use your CRM Book application. You realize that one of the users occasionally tries to delete non-existent tags from a contact, because the tags all look the same visually, and the user got confused. Another user made a typing mistake in his command, but did not realize he had done so because the error message wasn’t prominent enough. A third user keeps scrolling down the list, because he keeps forgetting the index of the last person in the list. Your job is to implement improvements to the UI to solve all these problems.
Do take a look at Section 2.2, “UI component” before attempting to modify the UI component.
|
-
Use different colors for different tags inside person cards. For example,
friends
tags can be all in brown, andcolleagues
tags can be all in yellow.Before
After
-
Modify
NewResultAvailableEvent
such thatResultDisplay
can show a different style on error (currently it shows the same regardless of errors).Before
After
-
Modify the
StatusBarFooter
to show the total number of people in the CRM Book.Before
After
Storage
component
Scenario: You are in charge of storage
. For your next project milestone, your team plans to implement a new feature of saving the CRM Book to the cloud. However, the current implementation of the application constantly saves the CRM Book after the execution of each command, which is not ideal if the user is working on limited internet connection. Your team decided that the application should instead save the changes to a temporary local backup file first, and only upload to the cloud after the user closes the application. Your job is to implement a backup API for the CRM Book storage.
Do take a look at Section 2.5, “Storage component” before attempting to modify the Storage component.
|
-
Add a new method
backupAddressBook(ReadOnlyAddressBook)
, so that the CRM Book can be saved in a fixed temporary location.
A.2. Creating a new command: remark
By creating this command, you will get a chance to learn how to implement a feature end-to-end, touching all major components of the app.
Scenario: You are a software maintainer for addressbook
, as the former developer team has moved on to new projects. The current users of your application have a list of new feature requests that they hope the software will eventually have. The most popular request is to allow adding additional comments/notes about a particular contact, by providing a flexible remark
field for each contact, rather than relying on tags alone. After designing the specification for the remark
command, you are convinced that this feature is worth implementing. Your job is to implement the remark
command.
A.2.1. Description
Edits the remark for a person specified in the INDEX
.
Format: remark INDEX r/[REMARK]
Examples:
-
remark 1 r/Likes to drink coffee.
Edits the remark for the first person toLikes to drink coffee.
-
remark 1 r/
Removes the remark for the first person.
A.2.2. Step-by-step Instructions
[Step 1] Logic: Teach the app to accept 'remark' which does nothing
Let’s start by teaching the application how to parse a remark
command. We will add the logic of remark
later.
Main:
-
Add a
RemarkCommand
that extendsUndoableCommand
. Upon execution, it should just throw anException
. -
Modify
AddressBookParser
to accept aRemarkCommand
.
Tests:
-
Add
RemarkCommandTest
that tests thatexecuteUndoableCommand()
throws an Exception. -
Add new test method to
AddressBookParserTest
, which tests that typing "remark" returns an instance ofRemarkCommand
.
[Step 2] Logic: Teach the app to accept 'remark' arguments
Let’s teach the application to parse arguments that our remark
command will accept. E.g. 1 r/Likes to drink coffee.
Main:
-
Modify
RemarkCommand
to take in anIndex
andString
and print those two parameters as the error message. -
Add
RemarkCommandParser
that knows how to parse two arguments, one index and one with prefix 'r/'. -
Modify
AddressBookParser
to use the newly implementedRemarkCommandParser
.
Tests:
-
Modify
RemarkCommandTest
to test theRemarkCommand#equals()
method. -
Add
RemarkCommandParserTest
that tests different boundary values forRemarkCommandParser
. -
Modify
AddressBookParserTest
to test that the correct command is generated according to the user input.
[Step 3] Ui: Add a placeholder for remark in PersonCard
Let’s add a placeholder on all our PersonCard
s to display a remark for each person later.
Main:
-
Add a
Label
with any random text insidePersonListCard.fxml
. -
Add FXML annotation in
PersonCard
to tie the variable to the actual label.
Tests:
-
Modify
PersonCardHandle
so that future tests can read the contents of the remark label.
[Step 4] Model: Add Remark
class
We have to properly encapsulate the remark in our Person
class. Instead of just using a String
, let’s follow the conventional class structure that the codebase already uses by adding a Remark
class.
Main:
-
Add
Remark
to model component (you can copy fromAddress
, remove the regex and change the names accordingly). -
Modify
RemarkCommand
to now take in aRemark
instead of aString
.
Tests:
-
Add test for
Remark
, to test theRemark#equals()
method.
[Step 5] Model: Modify Person
to support a Remark
field
Now we have the Remark
class, we need to actually use it inside Person
.
Main:
-
Add
getRemark()
inPerson
. -
You may assume that the user will not be able to use the
add
andedit
commands to modify the remarks field (i.e. the person will be created without a remark). -
Modify
SampleDataUtil
to add remarks for the sample data (delete youraddressBook.xml
so that the application will load the sample data when you launch it.)
[Step 6] Storage: Add Remark
field to XmlAdaptedPerson
class
We now have Remark
s for Person
s, but they will be gone when we exit the application. Let’s modify XmlAdaptedPerson
to include a Remark
field so that it will be saved.
Main:
-
Add a new Xml field for
Remark
.
Tests:
-
Fix
invalidAndValidPersonAddressBook.xml
,typicalPersonsAddressBook.xml
,validAddressBook.xml
etc., such that the XML tests will not fail due to a missing<remark>
element.
[Step 6b] Test: Add withRemark() for PersonBuilder
Since Person
can now have a Remark
, we should add a helper method to PersonBuilder
, so that users are able to create remarks when building a Person
.
Tests:
-
Add a new method
withRemark()
forPersonBuilder
. This method will create a newRemark
for the person that it is currently building. -
Try and use the method on any sample
Person
inTypicalPersons
.
[Step 7] Ui: Connect Remark
field to PersonCard
Our remark label in PersonCard
is still a placeholder. Let’s bring it to life by binding it with the actual remark
field.
Main:
-
Modify
PersonCard
's constructor to bind theRemark
field to thePerson
's remark.
Tests:
-
Modify
GuiTestAssert#assertCardDisplaysPerson(…)
so that it will compare the now-functioning remark label.
[Step 8] Logic: Implement RemarkCommand#execute()
logic
We now have everything set up… but we still can’t modify the remarks. Let’s finish it up by adding in actual logic for our remark
command.
Main:
-
Replace the logic in
RemarkCommand#execute()
(that currently just throws anException
), with the actual logic to modify the remarks of a person.
Tests:
-
Update
RemarkCommandTest
to test that theexecute()
logic works.
A.2.3. Full Solution
See this PR for the step-by-step solution.
Appendix B: Product Scope
Target user profile:
-
Salespeople
-
has a need to manage a significant number of people into either Leads or Contacts
-
prefer desktop apps over other types
-
can type fast
-
prefers typing over mouse input
-
is reasonably comfortable using CLI apps
B.1. Feature contributions:
David Ten:
Major Feature : LinkedIn Synchronize
-
Allows a Salesperson to connect his LinkedIn account to the application
-
Allows Contacts to be connected to their respective LinkedIn account
Major Feature : Alert for change of Account
-
Allows a Salesperson to be alerted when one of their Contacts move companies
-
This allows them to sell to a new account using their old Contact.
Umar:
Major feature : Added duplicate detection and display list of Leads and Contacts
-
Implement duplicate detection by verifying the whether the phone number or email address of a Lead to be entered matches any of the phone numbers or email addresses currently stored in the CRM Book.
-
Implement the display of Leads list and Contacts list separately at the salesperson’s request.
Minor feature : Command Alias
-
Ensures that commands can be performed using its alias.
-
In the sales industry, a person may type fast and would want to execute a command quickly. Hence, doing a command using its alias will ensure he/she can do a certain command quicker.
Minor feature : Enhanced Find Command
-
Made Find Command be able to search for phone numbers and email addresses.
-
A user may want to find a Lead/Contact based on phone numbers and email addresses.
ZHU Leyan:
Major Feature : Bulk Import of Leads
-
Allows a salesperson to import a CSV file into the CRM Book
-
Allows a salesperson to sort all persons by name.
Minor Feature : Remark Command
-
Allows a salesperson to add/remove/edit a remark of a person in the CRM Book
-
This allows them to record some special information of a customer.
Woody Lau:
Major Feature : Lead and Contact Creation
-
Breaks apart the Person class into Leads and Contacts
-
Each will have their own functions and fields
-
Conversion between Leads and Contacts will be supported.
Minor Feature : Account Creation
-
Allows Contacts to belong to Accounts.
Liu Yiming:
Major Feature : Change Theme
-
Allows user to change color theme
-
This allows user to read the CRM Book easily under different settings
Minor Feature : Auto Completion of commands
-
Allows user to key in commands more efficiently.
Minor feature : Color tags
*Each type of tag has a unique color
*Allows easy identification of different tags
Appendix C: User Stories
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
|
new salesperson |
see usage instructions |
refer to instructions when I forget how to use the App |
|
salesperson |
add a new Lead |
keep track of who I am selling to |
|
salesperson |
add a new Account |
keep track of my accounts |
|
salesperson |
convert a Lead to a Contact |
know who I have successfully sold to in the past |
|
salesperson |
determine if a lead to be added is already a contact |
not have redundant data in my CRM |
|
salesperson |
identify duplicates |
not have redundant data in my CRM |
|
salesperson |
share posts to my LinkedIn feed |
share more about my company’s product |
|
salesperson |
schedule appointments with Leads via Google Calendar |
sell to them |
|
busy salesperson |
autocomplete my commands |
use CRM Book more efficiently |
|
new salesperson |
bulk import leads |
quickly populate my CRM-Book |
|
salesperson |
obtain list solely on either Leads or Contacts |
identify who to promote an item to and who has bought an item from me |
|
salesperson |
view commute directions to appointment location |
know how to get there quickly |
|
salesperson |
send emails from a standard email template |
quickly cold-email for lead generation |
|
busy salesperson |
have different colors for my tags |
identify the tags easily |
|
salesperson |
execute a command with as few types as possible |
use my CRM Book quickly |
|
health-conscious salesperson |
change the color theme |
prevent eye fatigue |
|
salesperson |
analyze a CSV file |
know how much of that file is duplicated in my CRM |
|
salesperson |
export a CSV file of an account with related leads and contacts |
handover an account to a colleague |
|
new salesperson |
bulk import leads |
populate my CRM-Book |
|
salesperson |
find a lead or contact by name |
locate details of persons without having to go through the entire list |
|
salesperson |
find an account by name |
locate details of accounts without having to go through the entire list |
|
salesperson |
hide private contact details by default |
minimize chance of someone else seeing them by accident |
|
salesperson |
see my calendar |
schedule meetings without conflicting |
|
salesperson |
be reminded when a contract is expiring |
contact my contact for renewal |
|
salesperson |
add a remark to a Lead or Contact |
record detailed information about them |
|
salesperson with many entries in the CRM |
sort people by name |
search for them easily |
|
salesperson |
schedule a meeting using Google Hangouts |
meet my leads online more efficiently |
|
salesperson |
see the type of marketing materials an account is interacting with |
know what other materials to send to them |
Appendix D: Use Cases
(For all use cases below, the System is the CRM Book
and the Actor is the user
, unless specified otherwise)
Use case: Delete person
MSS
-
User requests to list of all Leads and Contacts
-
CRM Book shows a list of all Leads and Contacts
-
User requests to delete a specific Lead/Contact in the list
-
CRM Book deletes the person
Use case ends.
Extensions
-
2a. The list is empty.
Use case ends.
-
3a. The given index is invalid.
-
3a1. CRM Book shows an error message.
Use case resumes at step 2.
-
D.1. Use case: User requests to import a CSV file to CRM Book
MSS
-
User enters command for importing file.
-
CRM Book processes the corresponding CSV file and lists all persons including newly added ones.
-
User requests to sort all persons by name.
-
CRM sorts all persons and lists them.
Use case ends.
Extensions
-
1a. User enters an non-existent file.
-
1a1. CRM Book displays error message.
Use case ends.
-
-
1b. The file is not a CSV file.
-
1b1. CRM Book displays error message.
Use case ends.
-
-
3a. The CSV file is in wrong format.
-
3a1. CRM Book displays error message.
Use case ends.
-
D.2. Use case: User seeks Lead list or Contact list
MSS
-
User enters command for Lead list or Contact list.
-
CRM retrieves the Lead list or Contact list.
-
User sees the Lead list or Contact list.
Extensions
-
1a. User enters a keyword that is neither Lead nor Contact.
-
1a1. CRM Book displays an empty list.
Use case ends.
-
D.3. Use case: User seeks to add a company to a Lead or Contact [Coming in v2.0]
MSS
-
User enters command to update the company of Lead or Contact.
-
CRM updates company of the Lead or Contact.
-
User sees the updated company of the Lead or Contact.
Extensions
-
1a. User enters command incorrectly.
-
1a1. CRM Book displays an error message.
Use case ends.
-
-
1a. The keyword that user entered has a parent company.
-
1a1. CRM Book adds a tag named after the parent company to the Lead or Contact.
Use case ends.
-
-
1a. User enters a company (keyword) has no parent company.
-
1a1. CRM Book does not add any to the Lead or Contact.
Use case ends.
-
D.4. Use case: User enters phone numbers and/or email addresses to find
MSS
-
User enters keywords (phone numbers and/or email addresses) for find command.
-
CRM searches for Leads and/or Contacts that match with the keywords.
-
User sees the Leads and/or Contacts that match with the keywords.
Extensions
-
1a. User enters find command incorrectly.
-
1a1. CRM Book displays error message.
Use case ends.
-
-
2a. CRM Book is unable to find Leads and/or Contacts that match with the keywords.
-
2a1. User sees an empty list.
Use case ends.
-
D.5. Use case: User posts to LinkedIn
MSS
-
User enters command to login to LinkedIn
-
CRM book opens browser for LinkedIn login
-
User enters username and password
-
CRM book completes oAuth2 process and gets api key
-
User enters command to post to linkedIn
-
CRM book prompts user to enter a post
-
User enters post to share to LinkedIn
-
CRM book posts post to user’s LinkedIn
Use case ends.
Extensions
-
1a. User is already logged in.
-
1a1. CRM book tells user that he is already logged in
Use case resumes at step 5.
-
-
3a. User enters invalid credentials.
-
3a1. CRM book tells user to reenter credentials
Use case resumes at step 4.
-
D.6. Use case: Auto-complete
MSS
-
User enters a letter.
-
CRM book shows a drop down textfield with all the commands containing the typed letter.
-
User selects the command he desires.
Use case ends.
Extensions
-
2a. No commands contain the typed letter.
Use case ends.
D.7. Use case: Convert a Lead to a Contact
MSS
-
User requests a list of Leads and Contacts
-
CRM Book shows the requested list
-
User finds and selects the Lead to convert
-
CRM Book determines if Lead can be converted and converts if possible
Use case ends.
Extensions
-
2a. List is empty.
Use case ends.
-
3a. User selected a Contact, not a Lead.
-
3a1. CRM Book displays an error message.
Use case resumes at step 2.
-
-
3a. The given index is invalid.
-
3a1. CRM Book displays an error message.
Use case resumes at step 2.
-
D.8. Use case: Color tag
MSS
-
User request to add a lead with a tag.
-
CRM book assign a color to the tag.
Use case ends.
D.9. Use case: Change theme
MSS
-
User requests to change theme
-
CRM Book changes the theme setting to display the chosen theme
Use case ends.
Extensions
-
2a. The input theme is same as current theme.
-
2a1. CRM Book shows an error message.
Use case ends.
-
-
2b. The input theme is invalid.
-
2b1. CRM Book shows an error message.
Use case ends.
-
Appendix E: Non Functional Requirements
-
Should work on any mainstream OS as long as it has Java
1.8.0_60
or higher installed. -
Should be able to hold up to 1000 persons without a noticeable sluggishness in performance for typical usage.
-
A user with above average typing speed for regular English text (i.e. not code, not system admin commands) should be able to accomplish most of the tasks faster using commands than using the mouse.
-
Should process a query and respond within 3 seconds.
-
Should be compatible across Linux, Windows, and MacOS operating systems.
Appendix G: Instructions for Manual Testing
Given below are instructions to test the app manually.
These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing. |
G.1. Launch and Shutdown
-
Initial launch
-
Download the jar file and copy into an empty folder
-
Double-click the jar file
Expected: Shows the GUI with a set of sample contacts. The window size may not be optimum.
-
-
Saving window preferences
-
Resize the window to an optimum size. Move the window to a different location. Close the window.
-
Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
-
G.2. Deleting a Lead or Contact
-
Deleting a Lead or Contact while all Leads and Contacts are listed
-
Prerequisites: List all Leads and Contacts using the
list
command. Multiple persons in the list. -
Test case:
delete 1
Expected: First Lead/Contact is deleted from the list. Details of the deleted Lead/Contact shown in the status message. Timestamp in the status bar is updated. -
Test case:
delete 0
Expected: No Lead/Contact is deleted. Error details shown in the status message. Status bar remains the same. -
Other incorrect delete commands to try:
delete
,delete x
(where x is larger than the list size)
Expected: Similar to previous.
-
G.3. Displaying Lead or Contact list
-
Finding Lead(s) or Contacts(s) based on phone numbers and email addresses.
-
Prerequisites: Nil.
-
Test case:
disp Lead
,display Lead
Expected: All Leads in the CRM Book. Timestamp in the status bar is updated. -
Test case:
disp Contact
,display Contact
Expected: All Contacts in the CRM Book. Timestamp in the status bar is updated.
-
G.4. Duplicate Detection
-
Detecting a duplicate Lead or Contacts.
-
Prerequisites: There is at least 1 Lead or Contact.
-
Test case:
a n/John Tan p/99991234 e/johntan@gmail.com a/33, Eunos Street 7, #5-67
,add n/John Tan p/99991234 e/johntan@gmail.com a/33, Eunos Street 7, #5-67
Ensure the information entered has either a phone number or email address that is identical to any Lead or Contact in the CRM Book. Expected: Duplicate Lead/Contact message shown. Timestamp in the status bar is updated.
-
G.5. Executing commands via alias
-
Executing commands via its alias
-
Prerequisites: Read through the User Guide for commands that have aliases.
-
Test case:
disp Lead
,display Lead
Expected: All Leads in the CRM Book. Timestamp in the status bar is updated. -
Test case:
l
,list
Expected: List all Leads and Contacts in the CRM Book. Timestamp in the status bar is updated.
-
G.6. Finding Lead(s) and Contact(s) via Phone Numbers and Email Addresses
-
Finding Lead(s) or Contacts(s) based on phone numbers and email addresses.
-
Prerequisites: Nil.
-
Test case:
f 99991234
,find 99991234
Expected: Lead/Contact with the phone number99991234
is shown in the status message. Timestamp in the status bar is updated. -
Test case:
f johntan@gmail.com
,find johntan@gmail.com
Expected: Lead/Contact with the email addressjohntan@gmail.com
is shown in the status message. Timestamp in the status bar is updated.
-
G.7. Sorting all people
-
Sorting all people in list by name alphabetically
-
Test case:
sort
Expected: All people in list are sorted by name in alphabetical order. -
Test case:
s
Expected: All people in list are sorted by name in alphabetical order.
-
G.8. Adding/Editing/Removing a remark of a person
-
Adding/Editing/Removing a remark of person in list
-
Test case:
remark 2 r/Likes to swim
Expected: The remark "Likes to swim" is added to the second person in list. -
Test case:
remark 2 r/Likes to read
Expected: The remark of the second person in list is now changed to "Likes to read" -
Test case:
rem 2 r/
Expected: The remark of the second person in list is now removed. -
Test case:
remark 0 r/aaa
Expected: No person is added with remark. Error details show in the status message. Status bar remains the same. -
Test case:
remark 1 Likes to swim
Expected: No person is added with remark. Error details show in the status message. Status bar remains the same. -
Test case:
remark r/Likes to swim
Expected: Similar to previous.
-
G.9. Importing a CSV file
-
Importing a list of Leads to the CRM Book
-
Prerequisites: We provide two sample csv files. Please download them and put them in the same folder as the jar file. If you choose to put them somewhere else, then you need to change the file path in the command accordingly.
-
Test case:
import ./sample1.csv
Expected: The 200 Leads in the sample1.csv file are imported to the CRM Book. -
Test case:
import ./sample2.csv
Expected: Since the 16th person in this file has a wrong format of his phone, error details show in the status messages. Status bar remains the same. -
Test case:
import ./
Expected: It’s an invalid file path. Error details "invalid file path" show in the status message. Status bar remains the same. -
Test case:
import x
(where x is any valid file path but not in CSV)+ Expected: Error details "not a csv file" show in the status message. Status bar remains the same. -
Test case:
import
Expected: Wrong command format. Error details show in the status message. Status bar remains the same.
-
G.10. Converting a Lead to a Contact
-
Select a Lead to convert from the current list of people, and note their index number
-
If a Contact is chosen, an error will appear in the next step
-
-
In the command bar, type
convert INDEX
-
See that the person is now a Contact
-
Note that the fields Rating, and Website and Industry if they exist, disappear
-
Note that the field Department appears
-
Note that all other fields except the type remain the same
G.11. Editing the non-essential details
-
Select a Lead or Contact from the current list of people, and note their index number. If Lead, read the
a.
sections. If Contact, read theb.
sections. -
In the command bar, type
editdetails INDEX …
oradddetails INDEX …
, followed by type-specific data
At least one of the fields must be specified, or an error is given-
If a Lead, the fields are
c/COMPANY
,i/INDUSTRY
,r/RATING
,t/TITLE
, andw/WEBSITE
Company, industry and website are strings, and company must be alphanumeric
Rating is an integer from 1 to 5, and numbers that do not fall within this range will throw an error
Title is the honorific of the person, such asMr.
,Mrs.
,Dr.
, etc.
Note, company cannot be deleted, only changed, once it is provided -
If a Contact, the fields are
c/COMPANY
,d/DEPARTMENT
, andt/TITLE
Company and department are strings, and company must be alphanumeric
Title is the honorific of the person, such asMr.
,Mrs.
,Dr.
, etc.
Note, company cannot be deleted, only changed, once it is provided
-
-
See that the relevant changes are made
-
The rating will change to the provided number
Website and industry will appear if provided
-
G.12. Adding an Account to a Contact
-
Select a Contact from the current list of people, and note their index number
-
If a Lead is chosen, an error will appear in the next step
-
-
In the command bar, type
account INDEX an/COMPANY
-
Note that the Company field has changed to reflect the new company
G.13. Logging in to LinkedIn
-
In the command box, type linkedin_login
-
A browser window will appear. Enter your LinkedIn username and password, and accept the permissions requested
-
The browser window should close and say 'Successfully logged in to LinkedIn'
-
G.14. Sharing a Post to LinkedIn
-
In the command box, type linkedin_share [content] where [content] is what you want to share on your LinkedIn profile
-
If you are already logged in to LinkedIn and did not revoke the app’s permissions, CRM Book will say 'Post shared to your linkedIn account'
-
To check if the post is there, go to your LinkedIn account, click on your name at the top right corner, click Posts & Activity. If the post is not there yet, wait awhile and refresh, sometimes it takes a while before the post appears in the feed.
-
G.15. Setting your office location
-
In the command box, type set_office_address a/[address] where address is a valid address
-
CRM book will say 'Office address set!'
-
G.16. Getting directions to a client’s location
-
In the command box, type select [index] where index is the index of a currently unselected person card
-
For example, select 3
-
If you have already set your office location, instead of doing a Google search of the person, the CRM Book will instead show you directions to your client’s office, powered by Google Maps.
-
If Google Maps does not recognize the address, you may have to manually change the address in the Google Maps prompt
-
G.17. Change color theme of CRM Book
-
In the command box, type changetheme [theme] where theme can be one of the three themes available, namely light, dark, blue.
-
For example, changetheme light
-
If the current theme is not light, theme will be changed to light with a success message.
-
If the current theme is light, CRM Book will give a message to notify the user that the current theme is light.
-