Libraries used:
UI Design:
Refer to the guide Setting up and getting started.
The Architecture Diagram given above explains the high-level design of InsureBook.
Given below is a quick overview of main components and how they interact with each other.
Main components of the architecture
Main
(consisting of classes Main
and MainApp
) is in charge of the app launch and shut down.
The bulk of the app's work is done by the following four components:
UI
: The UI of InsureBook.Logic
: The command executor.Model
: Holds the data of InsureBook in memory.Storage
: Reads data from, and writes data to, the hard disk.Commons
represents a collection of classes used by multiple other components.
How the architecture components interact with each other
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command delete 1
.
Each of the four main components (also shown in the diagram above),
interface
with the same name as the Component.{Component Name}Manager
class (which follows the corresponding API interface
mentioned in the previous point.For example, the Logic
component defines its API in the Logic.java
interface and implements its functionality using the LogicManager.java
class which follows the Logic
interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component's being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.
The sections below give more details of each component.
The API of this component is specified in Ui.java
The UI consists of a MainWindow
that is made up of parts e.g.CommandBox
, ResultDisplay
, PersonListPanel
, RenewalsTable
, StatusBarFooter
etc. All these, including the MainWindow
, inherit from the abstract UiPart
class which captures the commonalities between classes that represent parts of the visible GUI.
The UI
component uses the 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,
Logic
component.Model
data so that the UI can be updated with the modified data.Logic
component, because the UI
relies on the Logic
to execute commands.Model
component, as it displays Person
and Policy
objects residing in the Model
.The person card UI is implemented using the following components:
PersonListCard.fxml
: Defines the layout of each person card, including:
PersonCard.java
: Controls the display of person information in the card:
PersonDetailPanel.fxml
: Defines the layout of the display for a person's details, including:
PersonDetailPanel.java
: Controls the display and updating of information of current selected person:
The person card provides a compact view of all essential client information, making it easy for insurance agents to quickly access client details and track policy renewals. The renewal date is prominently displayed with a clear label to help agents quickly identify when policies need to be renewed.
API : Logic.java
Here's a (partial) class diagram of the Logic
component:
The sequence diagram below illustrates the interactions within the Logic
component, taking execute("delete 1")
API call as an example.
Note: The lifeline for DeleteCommandParser
should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
How the Logic
component works:
Logic
is called upon to execute a command, it is passed to an AddressBookParser
object which in turn creates a parser that matches the command (e.g., DeleteCommandParser
) and uses it to parse the command.Command
object (more precisely, an object of one of its subclasses e.g., DeleteCommand
) which is executed by the LogicManager
.Model
when it is executed (e.g. to delete a person).Model
) to achieve.CommandResult
object which is returned back from Logic
.Here are the other classes in Logic
(omitted from the class diagram above) that are used for parsing a user command:
How the parsing works:
AddressBookParser
class creates an XYZCommandParser
(XYZ
is a placeholder for the specific command name e.g., AddCommandParser
) which uses the other classes shown above to parse the user command and create a XYZCommand
object (e.g., AddCommand
) which the AddressBookParser
returns back as a Command
object.XYZCommandParser
classes (e.g., AddCommandParser
, DeleteCommandParser
, ...) inherit from the Parser
interface so that they can be treated similarly where possible e.g, during testing.API : Model.java
The Model
component,
Person
objects (which are contained in a UniquePersonList
object).Person
objects (e.g., results of a search query) as a separate filtered list which is exposed to outsiders as 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.UserPref
object that represents the user's preferences. This is exposed to the outside as a ReadOnlyUserPref
objects.Model
represents data entities of the domain, they should make sense on their own without depending on other components)Note: An alternative (arguably, a more OOP) model is given below. It has a Tag
list in the AddressBook
, which Person
references. This allows AddressBook
to only require one Tag
object per unique tag, instead of each Person
needing their own Tag
objects.
API : Storage.java
The Storage
component,
AddressBookStorage
and UserPrefStorage
, which means it can be treated as either one (if only the functionality of only one is needed).Model
component (because the Storage
component's job is to save/retrieve objects that belong to the Model
)Classes used by multiple components are in the seedu.address.commons
package. These classes can be categorized into several groups:
Config
: Stores configuration values used by the app, including log levels and file paths.GuiSettings
: A serializable class containing GUI settings like window dimensions and coordinates.LogsCenter
: Configures and manages loggers and handlers, supporting file and console logging.Version
: Represents version information with major, minor, and patch numbers.AppUtil
: Contains app-specific utility functions for image loading and argument validation.CollectionUtil
: Provides utility methods for collection operations and null checking.FileUtil
: Handles file operations like reading, writing, and path validation.JsonUtil
: Manages JSON serialization/deserialization using Jackson library.StringUtil
: Offers string manipulation utilities including case-insensitive search and integer validation.ConfigUtil
: Provides access to configuration file operations.ToStringBuilder
: Helps build consistent string representations of objects.Index
: Represents a zero-based or one-based index, facilitating index conversions between components.DataLoadingException
: Represents errors during data loading from files.IllegalValueException
: Signals that given data does not fulfill certain constraints.These common classes provide essential functionality that is shared across different components of the application, promoting code reuse and maintaining consistency in how common operations are handled.
The classes are designed to be:
This organization helps maintain clean architecture by keeping common utilities separate from business logic while providing essential services to all components.
This section describes some noteworthy details on how certain features are implemented.
The policy renewal feature allows insurance agents to track and manage policy renewals for their clients. It is implemented using the following components:
The Policy
class represents an insurance policy and contains:
The ViewRenewalsCommand
allows users to view policies due for renewal within a specified number of days:
The renewal tracking mechanism is facilitated by the Policy
class and the ViewRenewalsCommand
. Here's how it works:
viewrenewals n/30
, the command is parsed by ViewRenewalsCommandParser
.ViewRenewalsCommand
is created with the validated parameters.The following sequence diagram shows how the viewrenewals operation works:
Aspect: How to calculate renewal due dates
Option 1 (Current Choice): Calculate days until renewal on demand
Option 2: Store days until renewal as a field
Aspect: Where to implement filtering logic
Option 1 (Current Choice): In the command
Option 2: In the Model
The renewal date update feature allows insurance agents to directly update a client's policy renewal date by specifying the policy number, without needing to find the client's index in the list. This feature streamlines the renewal date management process.
The renewal date update functionality is implemented through the RenewCommand
class, which follows the command pattern used throughout the application. The feature is primarily made up of the following components:
RenewCommand
- Executes the updating of a renewal date for a client with a specific policy numberRenewCommandParser
- Parses and validates the user input into a RenewCommand objectThe following class diagram shows the structure of the Renew Command:
The feature works through the following process flow:
renew pol/POLICY_NUMBER r/RENEWAL_DATE
.LogicManager
passes the command string to AddressBookParser
.AddressBookParser
identifies the command as a renew
command and delegates to RenewCommandParser
.RenewCommandParser
extracts and validates:
LogicManager
calls the execute()
method of the command object.RenewCommand
:
Person
with the updated renewal date while preserving other fields (including policy type)Person
objectCommandResult
with a success messageThe following sequence diagram shows how the renew operation works:
Aspect: How to identify the client to update:
Alternative 1 (current choice): Use policy number as identifier.
Alternative 2: Use client index in the displayed list.
edit
and delete
.Aspect: Error handling for duplicate policy numbers:
Alternative 1 (current choice): Show error and suggest using edit
command.
Alternative 2: Update all clients with matching policy numbers.
The FindCommand
allows users to search for persons in the address book by specifying various attributes. This feature is enhanced to support searching across all person attributes, providing a flexible and comprehensive search capability.
The FindCommand
enables users to search for persons based on any attribute, such as name, address, phone number, email, tags or policy number. It is implemented using the following components:
FindCommand
: Executes the search operation.FindCommandParser
: Parses and validates the user input into a FindCommand object.FindPersonPredicate
: A predicate that evaluates whether a person matches the search criteria.The FindPersonPredicate
class is responsible for evaluating whether a person matches the search criteria. It is implemented as follows:
Attributes: The predicate stores the search criteria for each attribute in their own predicate object. Evaluation:
test
method checks if a person matches the search criteria by evaluating each attribute.The following class diagram shows the structure of the FindPersonPredicate:
The following partial sequence diagram shows how the test operation works:
Aspect: How to handle multiple search criteria
Aspect: Case sensitivity and partial matches
The filter
command allows users to view policies due for renewal within a specified date range. This helps agents proactively manage upcoming renewals.
FilterDateCommand
: Executes the filtering and sorting of clients based on the provided date range and sort order.FilterDateCommandParser
: Parses and validates the user input into a FilterCommand object.The following class diagram shows how the filter command updates the UI:
The following sequence diagram shows how the filter command works:
Aspect: Sort Order Options
Current Choice: Accept only date or name as valid sort orders, case-insensitive. Defaults to date when not specified.
Alternative: Expand to include additional sort fields.
Aspect: Type for startDate and endDate
Current Choice: Uses LocalDate for variables startDate and endDate.
Alternative: Use RenewalDate class.
The policy type feature enhances the insurance management capabilities of the application by allowing users to categorize policies into specific types (Life, Health, Property, Vehicle, and Travel). This helps insurance agents quickly identify and manage different types of policies.
The implementation consists of the following key components:
PolicyType
Enum - Defines the available policy types and provides utilities for validation and conversion.
public enum PolicyType {
LIFE, HEALTH, PROPERTY, VEHICLE, TRAVEL;
public static PolicyType fromString(String type) { ... }
public static boolean isValidPolicyType(String test) { ... }
}
Policy
Class Extension - The existing Policy
class has been enhanced to include a PolicyType
field.
public class Policy {
// Existing fields
public final String policyNumber;
public final RenewalDate renewalDate;
// New field
private final PolicyType type;
// Constructors that handle policy type
public Policy(String policyNumber, String renewalDate, String type) { ... }
// Getter for policy type
public PolicyType getType() { ... }
}
Command Parsers - The parsers for AddCommand
, EditCommand
, and FindCommand
have been updated to recognize and process the policy type prefix (pt/
).
UI Components - The PersonCard
and RenewalsTable
UI components have been modified to display the policy type.
Predicate for Searching - A PolicyTypeContainsKeywordsPredicate
class has been added to support searching by policy type.
Aspect: Implementation of Policy Types
Alternative 1 (current choice): Use an enumeration to represent policy types.
Alternative 2: Use a string field without constraints.
Aspect: Storage of Policy Type
Alternative 1 (current choice): Store as part of the Policy object.
Alternative 2: Store as a separate field in the Person object.
The following sequence diagram shows how adding a person with a policy type works:
When the user adds a new person with a policy type:
AddCommandParser
parses the command including the policy type prefix.Policy
object is created with the specified policy type.Policy
is included in the new Person
object.CommandResult
is returned to indicate success.The UI components will automatically update to reflect the changes in the Model.
Target user profile:
Value proposition: It solves the issue of managing a large clientele by simplifying client tracking, automating follow-ups, and staying organized. By using InsureBook, insurance agents can focus more on growth and client retention, rather than spending more time on admin tasks and more time on sales.
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
* * * | Insurance Agent | add new clients | reach out to them when needed |
* * * | Insurance Agent | view a list of clients | quickly access current and potential clients |
* * * | Insurance Agent | update client information | ensure records remain accurate |
* * * | Insurance Agent | delete a client entry | remove outdated clients |
* * * | Insurance Agent | search for a client | quickly find them through their details |
* * * | Insurance Agent | filter clients by renewal date | prioritize follow-ups effectively |
* * * | Insurance Agent | tag clients for sorting & search | organize and categorize my clients |
* * * | Insurance Agent | set reminders for renewals | never miss important deadlines |
* * * | Insurance Agent | persist client data | ensure no data is lost |
* * * | Insurance Agent | filter and sort clients by tags | manage clients more efficiently |
* * | Insurance Agent | add notes to a client's profile | remember key details about them |
* * | Insurance Agent | sort my clients by tag | so that I can quickly rank my clients based on the number of tags they have. |
(For all use cases below, the System is the Client Management System
and the Actor is the Insurance Agent
, unless specified otherwise)
Use case: Add a new client
MSS
Insurance Agent inputs the add
command with client details.
System validates and saves the new client.
Use case ends.
Extensions
2a. The provided details are invalid.
2b. A duplicate client is detected.
2c. User adds duplicate tag.
Use case: View a list of clients
MSS
Insurance Agent inputs the list
command.
System displays all stored clients in alphabetical order.
Use case ends.
Use case: Update client information
MSS
Insurance Agent inputs the edit
command with the client index and new details.
System validates and updates the client information.
Use case ends.
Extensions
2a. Provided details are invalid.
2b. Client does not exist.
2c. Update would create a duplicate client.
2c. User adds duplicate tag.
Use case: Delete a client
MSS
Insurance Agent inputs the delete
command with the client identifier.
System deletes the specified client.
Use case ends.
Extensions
MSS
Use case ends.
Warning:
Use case: Find a client
MSS
Insurance Agent inputs the find
command with specific criteria.
System displays matching clients.
Use case ends.
Extensions
2a. No matching clients found.
2b. User searches for duplicate tag in 'find' command.
Use case: Filter and sort clients by tags
MSS
Insurance Agent inputs the filter
command with specific criteria and tags, and adds a sort by either name or tag.
System displays a list of clients with the matching tags.
Use case ends.
Extensions
2a. No clients match the specified tags.
2b. User searches for duplicate tag in 'find' command.
MSS
viewrenewals
command with an optional timeframe and sort order.Use case ends.
Extensions
2a. Provided period is not a valid positive integer.
2b. No policies match the specified period.
MSS
filter
command with start date, end date, and optional sort order.Use case ends.
Extensions
2a. Date range is invalid (end date is before start date).
2b. No policies match the provided date range.
MSS
renew
command with policy number and renewal date.Use case ends.
Extensions
2a. Provided policy number does not exist.
2b. Provided renewal date is invalid.
Use case: Persist client data
MSS
System automatically saves client data when changes are made.
Use case ends.
MSS
Insurance Agent inputs the help
command.
System opens a new window with a link to the User Guide.
Use case ends.
MSS
Insurance Agent inputs the exit
command.
System terminates the session safely.
Use case ends.
17
or above installed.renew
, viewrenewals
, and filter
.Life
, Health
, Property
, Vehicle
, and Travel
.t/vip
, t/family
, or t/lead
.add
, edit
, viewrenewals
) that tells InsureBook what action to perform.Given below are instructions to test the app manually.
Note: These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing.
Initial launch
Download the jar file and copy into an empty folder
Use the java -jar InsureBook.jar
command to run the application.
Note: The Application will default to full-screen mode.
Adding a person into InsureBook
Prerequisites: List all persons using the list
command. InsureBook default sample list used.
Test case: add n/John Doe p/98765432 e/johnd@example.com a/John street, block 123, #01-01 pol/999999 pt/Life r/31-12-2025 note/Basketball Player
Expected: Person added successfully into the end of the list, and their details are displayed in the status message.
Test case: add n/Betsy Crowe t/friend pol/654321 pt/Health e/betsycrowe@example.com a/Newgate Prison p/91234567 t/criminal
Expected: Person added successfully into the end of the list, and their details are displayed in the status message.
Incorrect add commands to try: add n/bobby
, ...
Expected: Person not added into the list, error details are displayed in the status message and command entered stays in the command box.
Adding a person with duplicate policy number into InsureBook
Prerequisites: There exist a person with the same policy number in the list as the person that is being added.
Test case: add n/Alan Lim p/98761234 e/alan@gmail.com a/alan drive pol/123456
Expected: Person not added into the list, error details are displayed in the status message and command entered stays in the command box.
Editing an existing person from InsureBook
Prerequisites: There is at least 1 person in the list.
Test case: edit 1 n/Alexander e/alexander@example.com
Expected: Person edited successfully, and their details are displayed in the status message.
Test case: edit 0
Expected: No person is edited. Error details are displayed in the status message and command entered stays in the command box.
Other incorrect edit commands to try: edit
, edit x
, ...
(where x is larger than the list size)
Expected: Similar to previous.
Editing an existing person's policy number to a number that is used already from InsureBook
Prerequisites: There exists a person in the list whose policy number match the policy number that is being edited into.
Test case: edit 2 pol/123456
Expected: No person is edited. Error details are displayed in the status message and command entered stays in the command box.
Deleting an existing person while all persons are being shown
Prerequisites: List all persons using the list
command. Multiple persons in the list.
Test case: delete 1
Expected: First person is deleted from the list. Details of the deleted person are displayed in the status message.
Test case: delete 0
Expected: No person is deleted. Error details are displayed in the status message and command entered stays in the command box.
Other incorrect delete commands to try: delete
, delete x
, ...
(where x is larger than the list size)
Expected: Similar to previous.
Updating a policy renewal date of a person
Prerequisites: There exist a person in the list with the policy number that is being tested and the rd/RENEWAL_DATE must be later than the current date e.g. 20-04-2025.
Test case: renew pol/234567 r/31-12-2025
Expected: Person policy renewal date updated successfully, and details are displayed in the status message.
Test case: renew pol/234567 r/2025-06-11
Expected: No person policy renewal date updated. Error details are displayed in the status message and command entered stays in the command box.
Other incorrect delete commands to try: renew
, ...
Expected: Similar to previous.
Updating a policy renewal date of a person whose policy number does not exist
Prerequisites: Every person in the list has a policy number that does not match what is being tested and the rd/RENEWAL_DATE must be later than the current date e.g. 20-04-2025.
Test case: renew pol/969696 r/06-11-2025
Expected: No person policy renewal date updated. No policy was found, details are displayed in the status message and command entered stays in the command box.
Viewing upcoming policy renewals from the list
Prerequisites: There is at least 1 person in the list.
Test case: viewrenewals
Expected: Shows persons with upcoming renewals in the next 30 days, sorted by date, and details are displayed in the status message.
Test case: viewrenewals n/300 s/name
Expected: Shows persons with upcoming renewals in next 300 days, sorted by name, and details are displayed in the status message.
Test case: viewrenewals n/0
Expected: No persons with upcoming renewals shown. Error details are displayed in the status message and command entered stays in the command box.
Other incorrect delete commands to try: viewrenewals n/366
, ...
Expected: Similar to previous.
Viewing upcoming policy renewals for policy that falls after the specified test day.
Prerequisites: Every person in the list has a policy renewal date that falls after the specified test day.
Test case: viewrenewals n/60 s/name
Expected: No persons with upcoming renewals shown, and details are displayed in the status message.
Viewing policy renewals in a filtered range from the list
Prerequisites: There is at least 1 person in the list with renewal date within the sd/START_DATE and ed/END_DATE.
Test case: filter sd/20-04-2025 ed/20-12-2026
Expected: Show a filtered list with persons with renewal dates within the provided range, sorted by date, and details are displayed in the status message.
Test case: filter sd/20-04-2025 ed/20-12-2026 s/name
Expected: Show a filtered list with persons with renewal dates within the provided range, sorted by name, and details are displayed in the status message.
Test case: filter sd/20-04-2025
Expected: list of person is not filtered. Error details are displayed in the status message and command entered stays in the command box.
Other incorrect delete commands to try: filter
, ...
Expected: Similar to previous.
Viewing policy renewals in a filtered range from the list for a policy that falls outside the specified test date range.
Prerequisites: Every person in the list has a policy renewal date that falls outside the specified test date range.
Test case: filter sd/20-04-2025 ed/20-05-2025
Expected: No persons shown, and details are displayed in the status message.
Viewing all persons in the list
Prerequisites: There is at least 1 person in the list.
Test case: list
Expected: Show a list of all person in InsureBook, and details are displayed in the status message.
Locating persons from the list by using keyword
Prerequisites: There is at least 1 person in the list which matches with the keyword that is being tested.
Test case: find n/John
Expected: Show the quantity and list of people who matches the keyword, sorted by name, partial matches is considered a success, and details are displayed in the status message.
Test case: find t/friends t/colleagues s/tag
Expected: Show the quantity and list of people who matches the keyword, sorted by number of tag, only exact matches is considered a success, and details are displayed in the status message.
Test case: find n/bernice n/david
Expected: Show the quantity and list of people who matches the keyword, sorted by name, partial matches is considered a success, and details are displayed in the status message.
Test case: find
Expected: list of person is not updated. Error details are displayed in the status bar and command entered stays in the command box.
Other incorrect delete commands to try: find 0
, ...
Expected: Similar to previous.
Locating persons from the list by using keyword that does not match
Prerequisites: All persons in the list does not match with the keyword that is being tested.
Test case: find n/bob
Expected: No one is listed, and details are displayed in the status message.
Show help
help
Clear existing list of person in InsureBook
clear
Exit InsureBook
exit