PROJECT: SAVEE - Financial Planner

Overview:

The NUS CS2113T - Software Engineering and Object Oriented Programming module provided a valuable hands-on experience in developing desktop applications. In groups of 4 - 5 students, guidelines were given out periodically over 10 weeks to shape a user-group-focused application. The objective of the project was to modify a pre-existing general source code AddressBook Level 4 into a useful program. Desktop application Savee aims to help its users manage their financial status with the motto Savvy the money. It is currently designed for students. The User and Developer Guides were also written to emulate some of the actual work schedules involved in the public release of an official product.

This application enables users to organize data with the command line interface (CLI). Name, date, money flow, and optional tag can be recorded. Each record must consists of name, date, money flow. The date component refers to the actual date when the financial activity was performed and the money flow component refers to the income or expenditure. Users will have the opportunity to consider their expenses and possibly become more aware of their financial status. Users will also be able to insert a command into the system using the text box located at the topmost of the Savee application. A Graphic User Interface (GUI), created by JavaFX, will be used to display output of the system so as to create an instinctive and engaging user experience.

When you read User guide and Developer guide, you might be confused as our application has 2 names, Financial Planner and Savee. Both names refers to the app. Savee is the official name of the app when it is marketed for the users. FinancialPlanner is the name used when referring to the app in the developer guide and code.

Summary of contributions:

Milestones were set every fortnight. Each member was expected to contribute to the project in every milestone and work as a team. A summary of my contributions are given below.

Major enhancements : Morphed the AddressBook4 to Savee.

  • Reason for enhancement: To enable Savee to keep track of the daily financial activities of the user..

  • Highlights: A long time was required to read through all 10 kLoc to understand and modify the code.

  • My contributions: I re-factored functions together with variables across classes to make the components compatible and consistent for the application. I also re-structured the code.

Major enhancements : Added the feature that allows the user delete all the record whose date is same as date entered.

  • Reason for enhancement:The application is designed for daily expense/income management. In case the user types in a wrong date at the beginning. This feature allows user to delete multiple records at the same time, compared to the original delete one record at the time.

  • Highlights: This major enhancement was simple to code but unexpectedly difficult to debug as it requires a in-depth knowledge for the Internal List structure building up the list of records, and pointer when looping through the list and deleting records.

  • My contributions: I wrote the code for the command, parser, and tests, and modify other classes and codes to adjust when a new command is added.

Major enhancements : Added the feature that allows the user archive the record data from Savee to the Excel file.

  • Reason for enhancement: The feature lessens the memory burden of the computer by enabling users to store large amounts of data out of the computer. Users will also be able to share record data with their friends and family members.

  • Highlights: This major enhancement requires significant effort and time, as initially, the library is not included in Java 10 library, I have to read the documentation as well as learn how to utilize the library in the short time. Therefore, it is reasonable to consider this feature as advanced feature. Effort was also spent on designing a user-friendly Excel file.

  • My contributions: This feature can take in 6 different input modes. This complexity also opens many different routes of errors and much time was spent on testing and debugging.

  • Credits: Apache Poi Library and its inner class were used and modified to fit into the feature.

Major enhancements : Added the feature that allows the user import the record data from the Excel file to the Savee.

  • Reason for enhancement: To enable users to import data back into Savee. There will be unlimited number of sheets that can be imported.

  • Highlights: Similar to the archive feature, a significant effort and time was spent to read and utilize the required documentation. The existence of the directory path of the Excel file was also examined.

  • My contributions: This feature takes in 2 different input modes. I have set up the pre-conditions for the Excel file to be successfully imported [refer to the User guide].

  • Credits: Apache Poi Library and its inner class were used and modified to fit into the feature.

Major enhancements : Added the feature that allows the user export the record data from Savee to the Excel file.

  • Reason for enhancement: Users will also be able to share record data with their friends and family members through Excel file.

  • Highlights: Similar to the archive feature, a significant effort and time was spent to read and utilize the required documentation. Effort was also spent on designing a user-friendly Excel file.

  • My contributions: This feature takes in 6 different input modes. This complexity also opens many different routes of errors and much time was spent on testing and debugging.

  • Credits: Apache Poi Library and its inner class were used and modified to fit into the feature.

Minor enhancement : Added the feature that automatically draw a line chart in the Excel file.

  • Reason for enhancement: A line chart into Excel file will be drawn next to the summary data after executing the exportexcel or archive command. This line chart will offer the user a visual display of income, outcome and net financial status based on date.

  • Highlights: : This major enhancement requires significant effort and time, as initially, the library is not included in Java 10 library, I have to read the documentation as well as learn how to utilize the library in the short time. Therefore, it is reasonable to consider this feature as advanced feature.

  • My contributions: This feature does not take in any input, as it will be automatically drawn after the Excel file is created, meaning that user enter the exportexcel command or archive command.

  • Credits: Apache Poi Library and its inner class were used and modified to fit into the feature.

Code contributed :

  • Project management :

    • Raised milestones and organized the group to complete each milestones before deadline.

    • Ensured that milestone objectives were met and submitted to relevant PRs to module repo

    • Managed releases for 1 milestone (v1.3)

  • Enhancements to existing features :

    • Wrote additional tests for existing or new features to increase coverage

  • Documentation :

    • Did cosmetic tweaks to existing contents of the User Guide and Developer Guide.

    • Proof-read, organised documentation to maintain its coherence.

  • Tools :

    • Integrated a third party library (Apache Poi) to the project and the team repo

  • Debugging team members code :

    • Debugged other team member’s code and offer suggestions when they are stuck

    • Provided ideas for possible implementation for other team member’s features

  • Team Management :

    • Coordinated some team meetings

    • Ensured that team members meet feature deadlines set within the team

Contributions to the User Guide:

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

Delete all the record whose date is required: deletedate

Deletes the records with a specified date from the Savee.
Format: deletedate DATE

  • Deletes records with the specified DATE.

  • Date refers to the date of the expected records to be deleted.

Date should follow the same configurations as date parameters required when adding records. It is in the form of dd-mm-yyyy where dd represents day, mm represents month and yyyy represents the year. dd and mm both require 1 to 2 digits while yyyy requires exactly 4 digits.

Examples:

  • deletedate 31-7-2018

Auto-Completion:

  • Input text can be completed to dates that already exist in records in Savee.

  • Text can also be completed to today or ytd.

  • There will be no suggestions on parameters that come after the second.

Export the record data from Savee to the Excel file: exportexcel

Exports the records into an Excel file.

There are 6 modes, default mode, single argument mode and dual argument mode (for Date) and single argument mode (Directory Path).

Format:

  • Default mode exportexcel will list down all records in Savee and exports all of them to an Excel file and store the file in the default Working Directory, it will detect automatically user’s Working Directory.

  • Single argument Date mode exportexcel d/DATE will list down all records with the specified date and exports all shown records to an Excel file and store the file in the default Working Directory, it will detect automatically user’s Working Directory.

  • Dual argument Date mode exportexcel d/START_DATE END_DATE will list down all records with the date that fall on either dates or between both dates and exports all shown records to an Excel file and store the file in the default Working Directory, it will detect automatically user’s Working Directory.

  • Single argument Directory Path mode exportexcel dir/DIRECTORY_PATH will list down all records in Savee and exports all of them to an Excel file and store the file in the chosen Directory Path.

  • Single argument Date mode + Single argument Directory path mode exportexcel d/DATE dir/DIRECTORY_PATH will list down all records with the specified date and exports all shown records to an Excel file and store the file in the chosen Directory Path.

  • Dual argument Date mode + Single argument Directory path mode exportexcel d/START_DATE END_DATE dir/DIRECTORY_PATH will list down all records with the date that fall on either dates or between both dates and exports all shown records to an Excel file and store the file in the chosen Directory Path.

If the command is in Dual argument Date mode, START_DATE (the first Date) should be earlier than or equal to the END_DATE (the second Date).
Date should follow the same configurations as date parameters required when adding records. It is in the form of dd-mm-yyyy where dd represents day, mm represents month and yyyy represents the year. dd and mm both require 1 to 2 digits while yyyy requires exactly 4 digits.

The Excel file name will be named based on the command, relating to Date:

  • Default mode: The Excel file will be named Financial_Planner_ALL.xlsx

  • Single argument Date mode: The Excel file will be named Financial_Planner_dd-mm-yyyy.xlsx

  • Dual argument Date: The Excel file will be named Financial_Planner_dd-mm-yyyy_dd-mm-yyyy.xlsx

If the Excel file with the same name and stored in same Directory exists, it will be overwritten. However, it must be closed before we enter the command.

After you enter the exportexcel command, you should wait for few minutes for the Excel file to be written.

Please note that undo and redo command can only affect Savee but the not the Excel file created, meaning that when you enter undo command after you enter the export command, the Savee will inform the user that No more command to undo, the records remain the same and the Excel file created will not be deleted.

Examples:

  • exportexcel

  • exportexcel d/31-3-1999

  • exportexcel dir/C:\

  • exportexcel d/31-3-1999 31-03-2019

  • exportexcel d/31-3-1999 dir/C:\

  • exportexcel d/31-3-1999 31-3-2019 dir/C:\

There will be two sheets in the Excel file, namely RECORD DATA and SUMMARY DATA.

  • RECORD DATA stores all the data of record the user want to export, there are 4 columns: Name, date, money and tags, the tags names will be separated by …​, for visual benefit.

  • SUMMARY DATA stored the summary statistics for the period you exported, and there is a Line Chart next to the table for visual statistic [refer to Draw a line chart automatically inside the Excel sheet part in User guide for more information].

  • As the size of the Chart is fixed initially. Sometimes, when user exports too many dates, the distance between each date on the chart might be tight. It is suggesting that the user justify the size of the chart by himself/herself.

width:800

Import the record data from the Excel file to the Savee: import

There are 2 modes, single argument File Path mode and (single argument Directory Path + single argument File Name) mode

Format:

  • Single argument File Path mode import dir/FILE_PATH will open the Excel file using the given File Path, import all records in Savee and check if these records exist in the Savee, then exports all of non-existent records to Savee.

  • Single argument File Path + single argument File name mode import dir/DIRECTORY_PATH n/NAME_FILE will open the Excel file using the given Directory path and given file name, import all records in Savee and check if these records exist in Savee, then exports all of non-existent records to Savee.

Examples:

  • import dir/C:\Financial_Planner_ALL.xlsx

  • import dir/C:\ n/Financial_Planner_All.xlsx

  • import dir/C:\ n/Financial_Planner_ALL

Please note that User have to add the post-fix .xlsx at the end to indicate this is a Excel file (in first and second example).

The file user want to import must be closed before entering the command.

Please note that the undo and redo command can only affect the Savee but the not the Excel file created, meaning that when you enter undo command after you enter the import command, the records imported will be deleted.

When performing import command to import all the records data from the Excel file to Savee, user should take note that there are some constraints which may help the import command performs smoothly.

  • The excel file can have multiple sheets, containing records data. The starting row of the table does not have to be first row of the sheet. This also applies to the column. There can be blank row blending in the table, but there must be no blank column.

  • The First row of the table should have 4 cells, namely NAME, DATE, MONEY, TAGS. These 4 cells can be case-insensitive. The sheet with records data but does not have the first row, NAME, DATE, MONEY, TAGS will not be read. The information of NAME, DATE, MONEY columns should be fully filled, while the TAGS columns is optionally filled. Each tag should be separated by …​ (3 consecutive dots). Beside …​ , numbers and alphabet character, there should be no other character.

The picture below shows a good example for the Excel Sheet.

Export Capture1 LinhChi

Archive the record data from Savee to the Excel file: archive

Archives the records into an Excel file.

There are 6 modes, default mode, single argument mode and dual argument mode (for Date) and single argument mode (Directory Path).

Format:

  • Default mode archive will list down all records in Savee and archives all of them to an Excel file and store the file in the default Working Directory, it will detect automatically user’s Working Directory. Then, the records stored in the Excel file will be deleted automatically in Savee.

  • Single argument Date mode archive d/DATE will list down all records with the specified date and archives all shown records to an Excel file and store the file in the default Working Directory, it will detect automatically user’s Working Directory.Then, the records stored in the Excel file will be deleted automatically in the Savee.

  • Dual argument Date mode archive d/START_DATE END_DATE will list down all records with the date that fall on either dates or between both dates and archives all shown records to an Excel file and store the file in the default Working Directory, it will detect automatically user’s Working Directory.Then, the records stored in the Excel file will be deleted automatically in the Savee.

  • Single argument Directory Path mode archive dir/DIRECTORY_PATH will list down all records in Savee and archives all of them to an Excel file and store the file in the chosen Directory Path.Then, the records stored in the Excel file will be deleted automatically in Savee.

  • Single argument Date mode + Single argument Directory path mode archive d/DATE dir/DIRECTORY_PATH will list down all records with the specified date and archives all shown records to an Excel file and store the file in the chosen Directory Path.Then, the records stored in the Excel file will be deleted automatically in Savee.

  • Dual argument Date mode + Single argument Directory path mode archive d/START_DATE END_DATE dir/DIRECTORY_PATH will list down all records with the date that fall on either dates or between both dates and archives all shown records to an Excel file and store the file in the chosen Directory Path.Then, the records stored in the Excel file will be deleted automatically in Savee.

If the command is in Dual argument Date mode, START_DATE (the first Date) should be earlier than or equal to the END_DATE (the second Date).
Date follow the same configurations as date parameters required when adding records. It is in the form of dd-mm-yyyy where dd represents day, mm represents month and yyyy represents the year. dd and mm both require 1 to 2 digits while yyyy requires exactly 4 digits.

The Excel file name will be named based on the command, relating to Date:

  • Default mode: The Excel file will be named Financial_Planner_ALL.xlsx

  • Single argument Date mode: The Excel file will be named Financial_Planner_dd-mm-yyyy.xlsx

  • Dual argument Date: The Excel file will be named Financial_Planner_dd-mm-yyyy_dd-mm-yyyy.xlsx

    If the Excel file with the same name and stored in same Directory exists, it will be overwritten. However, it must be closed before we enter the command.

After you enter the archive command, you should wait for few minutes for the Excel file to be written.

Please note that the undo and redo command can only affect the Savee but the not the Excel file created, meaning that when you enter undo command after you enter the archive command, the records archived will be added again back to Savee but the Excel file created will not be deleted.

Examples:

  • archive

  • archive d/31-3-1999

  • archive dir/C:\

  • archive d/31-3-1999 31-03-2019

  • archive d/31-3-1999 dir/C:\

  • archive d/31-3-1999 31-3-2019 dir/C:\

There will be two sheets in the Excel file, namely RECORD DATA and SUMMARY DATA.

  • RECORD DATA stores all the data of record the user want to archive, there are 4 columns: Name, date, money and tags, the tags names will be separated by …​, for visual benefit.

  • SUMMARY DATA stored the summary statistics for the period you archived, and there is a Line Chart next to the table for visual statistic [refer to Draw a line chart automatically inside the Excel sheet part in User guide for more information].

  • As the size of the Chart is fixed initially. Sometimes, when user archive too many dates, the distance between each date on the chart might be tight. It is suggesting that the user justify the size of the chart by himself/herself.

width:800

Draw a line chart automatically inside the Excel sheet : NO COMMAND REQUIRED TO BE TYPED

Automatically uses the the summary data from the SUMMARY DATA sheet in the Excel sheet after the command archive or exportexcel is called.

As you can see the screenshot below, in the SUMMARY DATA sheet, next to the summary table:

Export Capture2 LinhChi
  • On the top left of the chart, the legend shows 3 lines, namely Income, Outcome, and Net.

    • The first blue line shows the Income based on Date.

    • The second orange line shows the Outcome based on Date

    • The third grey line shows the Net (total of income and outcome) based on Date.

Contributions to the Developer Guide:

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

Delete all the record whose date is required

Current implementation

The delete by date entry mechanism is facilitated by ModelManager. It represents an in-memory model of Savee and is the component which manages the interactions between the commands and the VersionedFinancialPlanner. DeleteByDateEntryCommand calls ModelManager#getFilteredRecordList to retrieve the list of all current records in the Savee. Then, it will loop through the list of records and call ModelManger#deleteRecord(Record record) to delete the record whose date is required. If there exists target records, ModelManager#commitFinancialPlanner will be called to update the current version of Savee and the message, which states records have been deleted. Then, ModelManager#autoLimitCheck will be called to check the current change in limit as we delete some records exceeds the limit or not. This feature has only one keyword deletedate and implements only 1 argument mode. The three argument modes are as listed below:

  • Single Argument mode — Requires only one date. It deletes all records whose date is required. The date must follow the format: dd-mm-yyyy, error will be thrown if the format is not correct or the date entered is not real.

The following sequence diagram shows how the list operation works:

width:800

Export the records from Savee to the Excel file.

Current implementation

The export into excel file mechanism is facilitated by ModelManager with the help of ExcelUtil, the utility created to handle all methods relating to Excel. It represents an in-memory model of the Savee and is the component which manages the interactions between the commands, ExcelUtil and the VersionedFinancialPlanner. ExportExcelCommand calls ModelManager#updateFilteredRecords and passes in different predicates depending on the argument mode. The List<Record> is retrieved by calling ModelManager#getFilteredRecordList. Meanwhile, it also called ModelManager#getFinancialPlanner to get the ReadOnlyFinancialPlanner. The SummaryByDateList is constructed after the ReadOnlyFinancialPlanner together with the predicate are passed into the construction of SummaryByDateList. The List<SummaryEntry> is easily retrieved from SummaryByDateList by calling SummaryByDateList#getSummaryList. ExcelUtil#setNameExcelFile is called to make the Excel name based on the condition of startDate and endDate. After that, ExcelUtil#setPathFile is called to set the Path file, which is the location of the Excel file stored in future. The Path file is constructed based on the name of the Excel file we retrieve above and the directory Path, it can be either optionally entered by the user or the default User’s Working Directory. With the sufficient information, List<Record> records, List<SummaryByDateEntry> summaryList, file path, ExportExcelCommand#exportDataIntoExcelSheetWithGivenRecords is called to start the processing of producing Excel file.

There are 6 modes for this feature [refer to Export the record data from Savee to the Excel file part in User Guide]. The mechanism that facilitates these modes can be found in the ExportExcelCommandParser#parse. Below is a overview of the mechanism:

  1. Method ExportExcelCommandParser#createExportExcelCommand takes the input argument and further analyse it.

  2. The input given by the user is passed to ArgumentTokeniser#tokenise to split the input separated by prefixes.

  3. This returns a ArgumentMultiMap which contains a map with prefixes as keys and their associated input arguments as the value.

  4. The string associated with d/

    1. It is then passed into ExportExcelCommandParser#splitByWhitespace for further processing and returns an array. This string will be split into sub-strings and each of them will be construct as a date type variable. The the size of the array exceed 2, error wil be thrown to inform invalid command format. If the size of the string equals 1, it is constructed as a date type variable after being passed to ParseUtil#parseDate, it must follow the format dd-mm-yyyy. Error will be thrown if the format is not correct or the date entered is not real. If the size of the string equals 2, each sub-string is constructed as a date type variable after being passed to ParseUtil#parseDate, and an additional check is conducted to check if the first date entered, known as Start date is smaller than or equal to the second date entered, known as End Date.

  5. The String associated with dir/

    1. It is then passed into ParseUtil#parseDirectoryString to check if the Directory path given is existing. If the Directory path is unreal, an error is thrown to inform the user.

  6. Please take note that:

    1. If the prefix d/ is not entered in the input, meaning that all the records will be included in the Excel sheet.

    2. If the prefix dir/ is not entered in the input, meaning that the Directory Path is default as the User’s Working Directory.

The ExportExcelCommand has four constructors which makes use of overloading to reduce code complexity.

  • One constructor has no arguments and assigns default predicate for the FilteredList in ModelManager, PREDICATE_SHOW_ALL_RECORDS which will show all items in the list and the Directory path is User’s Working Directory.

  • The second constructor takes in 2 Date arguments and assigns the predicate DateIsWithinDateIntervalPredicate which will only show items within the date interval and the Directory path is User’s Working Directory.

  • The third constructor takes in 1 Directory Path argument and assigns the predicate as PREDICATE_SHOW_ALL_RECORDS, which will show all items in the list and the Directory path is the entered directory path.

  • The fourth constructor takes in 1 Directory Path and 2 Date arguments and assigns the predicate as DateIsWithinDateIntervalPredicate which will only show items within the date interval and the Directory path is the entered Directory Path.

The following sequence diagram shows how the list operation works:

width:800

If the Excel file with the same name and stored in same Directory exists, it will be overwritten. However, it must be closed before we enter the command.

Please note that undo and redo command can only affect Savee but the not the Excel file created, meaning that when you enter undo command after you enter the export command, Savee will inform the user that No more command to undo, the records remain the same and the Excel file created will not be deleted.

Import the record data from the Excel file to Savee

Current implementation

The import from Excel file mechanism is facilitated by ExcelUtil, the utility created to handle all method relating to Excel. ImportExcelCommand calls ExcelUtil#readExcelSheet to read the Excel file and retrieve data of records from them to create a list of record List<Record>. In ExcelUtil#readExcelSheet, by using method XSSFWorkbook#setMissingCellPolicy, every missing cell will be considered as Null cell, quite useful when you export or archive the record data if the record does not have tag. If blank row is found, the ExcelUtil#readExcelSheet will ignore and read the next line, until the last line is read. This concept also applies to read multiple sheets until all sheets have been read. However, please take note that in order to prevent errors, there are certain constraints of Excel file list in User Guide with Import the record data from the Excel file to the Savee part. After that, ModelManager#addListUniqueRecord is called to add the records in the List<Record>. If the record has already existed in the Savee, it will be ignored and not added into the Savee. Eventually, when all the records are added in the Savee, ModelManager#commitFinancialPlanner will be called to update the current version of Savee and the message, which states records have been added.

This feature has 2 different modes [refer to in Import the record data from the Excel file to the Savee part in User Guide]. The mechanism that facilitates these modes can be found in the ImportExcelCommandParser#parse. Below is a overview of the mechanism:

  1. Method ImportExcelCommandParser#createArchiveCommand takes the input argument and further analyse it.

  2. The input given by the user is passed to ArgumentTokeniser#tokenise to split the input separated by prefixes.

  3. This returns a ArgumentMultiMap which contains a map with prefixes as keys and their associated input arguments as the value.

  4. The String associated with dir/

    1. It is then passed into ParseUtil#parseDirectoryString to check if the Directory path given is existing. If the Directory is unreal, an error is thrown to inform the user.

  5. The String associated with n/

    1. It is then passed into ExcelUtil#getPathFile together with the String associated with dir/ to create the File Path. The File Path is then passed into ParseUtil#parseFilePathString to check if the File path given is existing. If the File Path is unreal, an error is thrown to inform the user.

  6. Please take note that:

    1. The String associated with dir/ must be entered.

    2. The String associated with n/ is optionally entered.

    3. Please note that User have to add the post-fix .xlsx at the end to indicate this is a Excel file.

  7. If the string associated with n/, method ExcelUtil#setPathFile is called to combine the name of the Excel file to the string associated with dir/.

The ImportExcelCommand has only one constructor.

  • The constructor takes in file path argument and read the Excel file using that file path. After that, all the record data in the Excel file is retrieved and transform into Record object. The list of records are then added into the Model by using ModelManager#addListUniqueRecord

The following sequence diagram shows how the list operation works:

width:800

The file user want to import must be closed before entering the command.

Please note that the undo and redo command can only affect the Savee but the not the Excel file created, meaning that when you enter undo command after you enter the import command, the records imported will be deleted.

Archive the record data from Savee to the Excel file

Current implementation

The archive into excel file mechanism is facilitated by ModelManager with the help of ExcelUtil, the utility created to handle all methods relating to Excel. It represents an in-memory model of Savee and is the component which manages the interactions between the commands, ExcelUtil and the VersionedFinancialPlanner. ArchiveCommand calls ModelManager#updateFilteredRecords and passes in different predicates depending on the argument mode. The List<Record> is retrieved by calling ModelManager#getFilteredRecordList. Meanwhile, it also called ModelManager#getFinancialPlanner to get the ReadOnlyFinancialPlanner. The SummaryByDateList is constructed after the ReadOnlyFinancialPlanner together with the predicate are passed into the construction of SummaryByDateList. The List<SummaryEntry> is easily retrieved from SummaryByDateList by calling SummaryByDateList#getSummaryList. ExcelUtil#setNameExcelFile is called to make the Excel name based on the condition of startDate and endDate. After that, ExcelUtil#setPathFile is called to set the Path file, which is the location of the Excel file stored in future. The Path file is constructed based on the name of the Excel file we retrieve above and the directory Path, it can be either optionally entered by the user or the default User’s Working Directory. With the sufficient information, List<Record> records, List<SummaryByDateEntry> summaryList, file path, ArchiveCommand#archiveDataIntoExcelSheetWithGivenRecords is called to start the processing of producing Excel file. After records are archived to Excel file, ModelManager#deleteListRecord is called to delete the archived records.If there exists target records, ModelManager#commitFinancialPlanner will be called to update the current version of Savee and the message, which states records have been deleted.

This feature has 6 different modes [refer to Archive the record data from Savee to the Excel file in User Guide]The mechanism that facilitates these modes can be found in the ArchiveCommandParser#parse. Below is a overview of the mechanism:

  1. Method ArchiveCommandParser#createArchiveCommand takes the input argument and further analyse it.

  2. The input given by the user is passed to ArgumentTokeniser#tokenise to split the input separated by prefixes.

  3. This returns a ArgumentMultiMap which contains a map with prefixes as keys and their associated input arguments as the value.

  4. The string associated with d/

    1. It is then passed into ArchiveCommandParser#splitByWhitespace for further processing and returns an array. This string will be split into sub-strings and each of them will be construct as a date type variable. The the size of the array exceed 2, error wil be thrown to inform invalid command format. If the size of the string equals 1, it is constructed as a date type variable after being passed to ParseUtil#parseDate, it must follow the format dd-mm-yyyy. Error will be thrown if the format is not correct or the date entered is not real. If the size of the string equals 2, each sub-string is constructed as a date type variable after being passed to ParseUtil#parseDate, and an additional check is conducted to check if the first date entered, known as Start date is smaller than or equal to the second date entered, known as End Date.

  5. The String associated with dir/

    1. It is then passed into ParseUtil#parseDirectoryString to check if the Directory path given is existing. If the Directory path is unreal, an error is thrown to inform the user.

  6. Please take note that:

    1. If the prefix d/ is not entered in the input, meaning that all the records will be included in the Excel sheet.

    2. If the prefix dir/ is not entered in the input, meaning that the Directory Path is default as the User’s Working Directory.

The ArchiveCommand has four constructors which makes use of overloading to reduce code complexity.

  • One constructor has no arguments and assigns default predicate for the FilteredList in ModelManager, PREDICATE_SHOW_ALL_RECORDS which will show all items in the list and the Directory path is User’s Working Directory.

  • The second constructor takes in 2 Date arguments and assigns the predicate DateIsWithinDateIntervalPredicate which will only show items within the date interval and the Directory path is User’s Working Directory.

  • The third constructor takes in 1 Directory Path argument and assigns the predicate as PREDICATE_SHOW_ALL_RECORDS, which will show all items in the list and the Directory path is the entered directory path.

  • The fourth constructor takes in 1 Directory Path and 2 Date arguments and assigns the predicate as DateIsWithinDateIntervalPredicate which will only show items within the date interval and the Directory path is the entered Directory Path.

The following sequence diagram shows how the list operation works:

width:800

If the Excel file with the same name and stored in same Directory exists, it will be overwritten. However, it must be closed before we enter the command.

Please note that the undo and redo command can only affect the Savee but the not the Excel file created, meaning that when you enter undo command after you enter the archive command, the records archived will be added again back to the Savee but the Excel file created will not be deleted.

Draw a line chart automatically inside the Excel sheet

Current implementation

This feature will automatically uses the the summary data from the SUMMARY DATA sheet in the Excel sheet after the command archive or export_excel is called. The feature mechanism is facilitated by ExcelUtil, the utility created to handle all methods relating to Excel. It is the component which manages the interactions between the ExportExcelCommand or the ArchiveCommand with ExcelUtil#drawChart.