CollabSync is built upon AddressBook-Level3, a project developed by the SE-EDU initiative.
We also acknowledge the use of the following third-party libraries: JavaFX, JUnit5
Refer to the guide Setting up and getting started.
The Architecture Diagram given above explains the high-level design of the App.
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 the App.Logic: The command executor.Model: Holds the data of the App in memory.Storage: Reads data from, and writes data to, the hard disk.Setup: Responsible for the initial configuration and launching of the AddressBook applicationCommons 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, 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 object residing in the Model.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 student).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)The Setup component,
Main.java , MainApp.java & AppParameters.java in AB3.setup for better coding standards.Classes used by multiple components are in the seedu.address.commons package.
This section describes some noteworthy details on how certain features are implemented.
The sequence diagram below illustrates the interactions between different components when corrupted data is detected and backupAndDeleteFile(filePath) is called.
Here's the workflow:
MainApp's initialization, MainApp will set the Logic component to contain information about whether there is an initial error.MainApp.start() is called, it will invoke UI.start() and pass the Logic component to it.UI will then check with Logic whether an initial error exists.UI will display a prompt to the user and wait for user interaction.UI will call the backupAndDeleteFile() method from FileUtil.backupAndDeleteFile() will gather and prepare all necessary information for the backup and delete.copy() method from Files to complete the backup process.Note: The prompt and the backup process are invoked concurrently.
The AddCommand is part of the AddressBookParser layer in the application and handles the action of adding the contact.
Here's the workflow:
AddCommand is invoked when the user types the command add. This is handled in the execute(Model model) method of the AddCommand class. The Model object, which represents the application's data layer, is passed into the method.AddCommand will query Model object with hasPerson() to ensure no duplicate student before adding.hasPerson() return false, AddCommand will call addPerson() of Model object to add the new student.The EditCommand is part of the AddressBookParser layer in the application and handles the action of adding the contact.
Here's the workflow:
EditCommand is invoked when the user types the command edit. This is handled in the execute(Model model) method of the EditCommand class. The Model object, which represents the application's data layer, is passed into the method.EditCommand requests the Model to retrieve the filtered list of Person objects via the method call model.getFilteredPersonList(). This call is made to fetch all the students that the user has in the current view (filtered according to certain criteria).INDEX paramter is valid, EditCommand will call createEditedPerson() to create a new student with updated details.EditCommand then invoke setPerson() and updateFilteredPersonList() methods of Model object to update the student.The DeleteCommand is part of the AddressBookParser layer in the application and handles the action of deleting the contact(s).
Here's the workflow:
DeleteCommand is invoked when the user types the command delete. This is handled in the execute(Model model) method of the DeleteCommand class. The Model object, which represents the application's data layer, is passed into the method.DeleteCommand requests the Model to retrieve the filtered list of Person objects via the method call model.getFilteredPersonList(). This call is made to fetch all the students that the user has in the current view (filtered according to certain criteria).DeleteCommand continues it's execution, DeleteCommand will first check the format of the parameters to determine user wants to delete with tags or index.DeleteCommand will prompt user for confirmation before proceed with deletion.delete INDEX, the system invokes deleteWithIndex(). This method retrieves the target Person object based on the provided index, then calls deletePerson() from the Model object to remove the student.delete t/TAG [ ,t/TAGS], the system invokes deleteWithTag(). This method filters the List<Person> to find entries matching any of the specified tags (using hasTags()). Deletes all matched students by calling deletePerson() from the Model object.The HideCommand is part of the AddressBookParser layer in the application and handles the action of hiding the details of a contact.
This operation is executed when the user triggers the hide command in the system.
Here's the workflow:
HideCommand is invoked when the user types the command hide. This is handled in the execute(Model model) method of the HideCommand class. The Model object, which represents the application's data layer, is passed into the method.HideCommand requests the Model to retrieve the filtered list of Person objects via the method call model.getFilteredPersonList(). This call is made to fetch all the students that the user has in the current view (filtered according to certain criteria).filteredPersonList is retrieved, the HideCommand iterates over each Person object in the list and calls the method person.hideDetails(). This hides the details of each student in the list. The hideDetails() method, which is part of the Person class, modifies the internal state of the Person object, essentially "hiding" the contact's details from the user interface.HideCommand returns a CommandResult indicating the success of the operation. The message "Contact details hidden." is passed to the CommandResult constructor, along with additional flags that help the UI decide how to update (whether to show a success message or not).CommandResult object to display feedback to the user. If successful, the system will notify the user that the contact's details have been hidden.Note: UnhideCommand also follows a similar workflow, but instead of calling hideDetails(), the method invoked is showDetails()
Below is the frontend update process:
Model State Update:
After hideDetails() is called on each Person, the internal areDetailsVisible property is set to false.
Automatic UI Refresh via Data Binding:
In the PersonCard component, the UI elements (such as phone, email, address, and major) are bound to the person's detailsVisibleProperty(). For example:
phone.visibleProperty().bind(person.detailsVisibleProperty());
phone.managedProperty().bind(person.detailsVisibleProperty());
address.visibleProperty().bind(person.detailsVisibleProperty());
address.managedProperty().bind(person.detailsVisibleProperty());
email.visibleProperty().bind(person.detailsVisibleProperty());
email.managedProperty().bind(person.detailsVisibleProperty());
major.visibleProperty().bind(person.detailsVisibleProperty());
major.managedProperty().bind(person.detailsVisibleProperty());
With these bindings in place, when areDetailsVisible is set to false, these labels automatically become invisible and are excluded from layout calculations.
UI Outcome:
As a result, once the HideCommand is executed:
The UI refreshes automatically.
The student’s detailed information (phone, email, address, major) is hidden.
Only the basic details (such as the name and tags) remain visible.
If the user issues an unhide command, the showDetails() method is invoked, setting areDetailsVisible back to true and causing the UI to re-render the full details.
The FindCommand is part of the AddressBookParser layer and handles searching for students based on keywords.
This operation is executed when the user triggers the find command in the system.
Here's the workflow:
find KEYWORD.... This is handled in the execute(Model model) method of the FindCommand class.FindCommand creates a PersonContainsKeywordsPredicate object with the specified keywords.FindCommand calls model.updateFilteredPersonList(Predicate<Person>) to update the filtered list of Person objects. This filters out any students whose names do not match the given keywords.FindCommand calls model.getFilteredPersonList() to get the size of the list displayed.CommandResult is returned, containing a success message that indicates how many students were found (e.g., "X persons listed!").CommandResult and refreshes the display to show only those students who match the keywords.Note:
ListCommand works similar to the above, but the Predicate<Person> is always set to true, which makes it display all the contacts by default.The SortCommand is part of the AddressBookParser layer and handles searching for students based on keywords.
This operation is executed when the user triggers the sort command in the system.
If identical names are in the contact, the contacts will be sorted using their phone numbers.
Here's the workflow:
sort asc or sort desc.execute(Model model) method of SortCommand, the following steps occur:
model.getFilteredPersonList().CommandResult with the message "No contacts to sort."Comparator<Person> comparator = Comparator.comparing(Person::getName)
.thenComparing(Person::getPhone);
isAscending is false), the comparator is reversed.model.sortFilteredPersonList(comparator), which reorders the filtered list.CommandResult is created with a message indicating the sort order, e.g., "Contacts sorted in ascending order." or "Contacts sorted in descending order."Note: The sort operation does not modify the underlying data permanently; it only reorders the displayed filtered list in the UI.
Target user profile:
Value proposition: manage contacts for NUS students faster than a typical mouse/GUI driven app
Priorities: High (must have) - * * *, Medium (nice to have) - * *, Low (unlikely to have) - *
| Priority | As a … | I want to … | So that I can… |
|---|---|---|---|
* * * | user | add a new student | store and retrieve essential information easily |
* * * | user | delete a student | remove outdated or irrelevant entries |
* * * | user | find a student by name | quickly locate specific student |
* * | user | data save automatically | so that I never lose my contacts even if the app crashes |
* * | user | find students by course | quickly locate students with a specific course |
* * | user | clear all contacts at once | reset the app for a new semester |
* * | user | delete students by course | remove related entries after a course ended |
* * | user | edit student details | keep their details up-to-date |
* * | user | sort student details | keep their details in an orderly manner |
* * | user | list all students | see all my saved contacts at once |
* * | new user | view a help menu | quickly learn how to use the application |
* | user | remember my last search | don't need to type it again |
* | privacy-conscious user | hide students' information | hide sensitive details when others view my screen |
* | privacy-conscious user | unhide students' information | access full contact details when needed |
* | user with many students in the address book | search for contacts fuzzily | find a student even if I do not correctly know their names |
* | user with many students in the address book | the application to load quickly | access my information without delay |
(For all use cases below, the System is the CollabSync and the Actor is the user, unless specified otherwise)
MSS
User requests to add a new student by specifying Name, Phone, Email, Address, Major and Tags(if any)
(e.g., using add n/NAME p/PHONE e/EMAIL a/ADDRESS m/MAJOR t/[TAGS]).
CollabSync validates the details (e.g., checks phone format, email format, etc.).
CollabSync saves the new student to the address book.
Use case ends.
Extensions
2a. User provides incomplete or invalid details. (e.g., phone number format is invalid)
2a1. CollabSync shows an error message.
Use case ends.
2b. User tries to add a contact that already exists (e.g., same Name and Phone).
2b1. CollabSync rejects the duplicate entry and shows an error message.
Use case ends.
MSS
User requests to list students (e.g., using the list command).
CollabSync shows a list of students with their Name, Phone, Email, Address, Major and Tags(if any) in an indexed format.
User requests to delete a specific student in the list by index (e.g., delete 3).
CollabSync prompts a popup box to request user to confirm their deletion.
User enters the confirm button.
CollabSync deletes the student with the given index.
Use case ends.
Extensions
2a. The list is empty.
2a1. CollabSync informs the user that there are no contacts to delete.
Use case ends.
3a. The given index is invalid.
3a1. CollabSync shows an error message.
Use case resumes at step 2.
4a. Cancel button or x was pressed.
4a1. Contact is not deleted. Deletion canceled.
Use case resumes at step 2.
MSS
User requests to list students (e.g., using the list command).
CollabSync shows a list of students with their Name, Phone, Email, Address, Major and Tags(if any) in an indexed format.
User requests to delete a specific student in the list by the tags (e.g., delete t/HSA1000).
CollabSync prompts a popup box to request user to confirm their deletion.
User enters the confirm button.
CollabSync deletes the student with the given index.
Use case ends.
Extensions
2a. The list is empty.
2a1. CollabSync informs the user that there are no contacts to delete.
Use case ends.
3a. The given index is invalid.
3a1. CollabSync shows an error message.
Use case resumes at step 2.
4a. Cancel button or x was pressed.
4a1. Contact is not deleted. Deletion canceled.
Use case resumes at step 2.
MSS
User requests to list students (e.g., using the list command).
CollabSync shows a list of students.
User requests to edit a specific student.
CollabSync updates the details of the student.
Use case ends.
Extensions
2a. The list is empty. Use case ends.
3a. The given index is invalid.
3b. The new tags entered by user are of invalid format.
MSS
User enters the list command.
CollabSync displays a list of all students with their Name, Phone, Email, Address, Major, and Tags (if any) in an indexed format.
Use case ends.
Extensions
2a1. CollabSync informs the user that the list is empty.
Use case ends.
MSS
User enters a sort command with a specified order (e.g., using 'sort asc' or 'sort desc').
Sorts the contact list in the specified order based on Name, followed by Phone Number if names are identical.
CollabSync displays the sorted contact list.
Use case ends.
Extensions
2a. No contacts found in the list.
2a1. CollabSync informs the user that there are no contacts to sort.
Use case ends.
2b. User enters an invalid sorting order.
2b1. CollabSync informs the user of the invalid input and provides the correct format.
Use case ends.
MSS
User enters the hide command.
CollabSync automatically hides the contact details of all students currently shown in the application, except for Name and Tags (if they were displayed previously).
Use case ends.
Extensions
2a1. The information of the contacts in the current window currently will remain hidden.
Use case ends.
MSS
User enters the unhide command.
CollabSync automatically reveals all the hidden information of the students currently in the application.
Use case ends.
Extensions
1a1. The information of the contacts in the current window will remain revealed.
Use case ends.
MSS
User enters a search term. (e.g., using find KEYWORD).
CollabSync searches for any matching students based on the search term in their Name, Phone, Email, Major and Tags.
Use case ends.
Extensions
2a1. CollabSync informs the user that no results match the search.
Use case ends.
MSS
User performs an action that modifies the data (e.g., adding, editing, or deleting a contact).
CollabSync automatically saves the updated data to a local file (e.g., data/addressbook.json).
Use case ends.
Extensions
2a. Saving data fails (e.g., permission issues or disk is full).
2a1. CollabSync shows an error message indicating that the save failed.
Use case ends.
2b. Data file is corrupted or unreadable.
2b1. CollabSync shows an error message about the corrupted file.
Use case ends.
MSS
User enters the clear command.
CollabSync clears all entries from the address book.
Use case ends.
Extensions
2a1. CollabSync still clears the contact.
Use case ends.
17 or above installed.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
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.
Displaying help window
Test case: help
Expected: A help window popped out. List of commands and their format in the help window.
Test case: help aaaaaaa
Expected: A help window popped out. List of commands and their format in the help window.
Adding a student
Test case: add n/Li Shi Rei p/98765432 e/shireiHG@u.nes.edu a/21 Lower Kent Ridge Road m/Prompt Engineering t/genius:trivial
Expected: Student is successfully added to the list. All details are displayed correctly. The contact list updates to show the new student.
Test case: add n/Saitama p/23456789 e/atama@u.nos.edu a/21 Lower Kent Ridge Road m/Sport Science t/friends:trivial t/HDM1000:module (different tags)
Expected: Student is successfully added to the list. All details are displayed correctly. The contact list updates to show the new student.
Test case: add n/Saitama p/23456789 e/atama@u.nos.edu a/21 Lower Kent Ridge Road m/Sport Science t/friends:trivial t/HDM1000:module (same as previous test case)
Expected: Student not added to the list. UI displays "This student already exists in the address book".
Test case: add John Doe
Expected: Student not added to the list. Error details shown in the status message.
Test case: add n/ t/ p/
Expected: Student not added to the list. Error details shown in the status message.
Listing all students
Test case: list
Expected: All students are display correctly.
Test case: list abcdefg
Expected: All students are display correctly.
Hiding information
Test case: hide
Expected: All students' details is hidden, with only their names and tags shown.
Test case: hide (same as previous test case)
Expected: All students' details remain hidden, with only their names and tags shown.
Unhiding information
Test case: unhide
Expected: All students' hidden details are displayed.
Test case: unhide (same as previous test case)
Expected: All students' details remain displayed.
Sorting students in ascending order (A → Z)
sort asc Sorting students in descending order (Z → A)
sort desc Sorting students in other order
sort xyz Editing a student while all students are being shown
Prerequisites:
list command.Test case: edit 1 n/John Doe p/91234567 e/johndoe@example.com a/123 Main Street m/Computer Science t/friend
Expected:
Test case: edit 2 p/98765432 a/456 New Road
Expected:
Test case: edit 1 n/ p/
Expected:
Test case: edit 100 n/Jane Doe
Expected:
Test case: edit 1 e/invalidEmailFormat p/abcde
Expected:
Prerequisites:
list command.Test case: delete 1
Expected: First student entry is deleted from the list. Details of the deleted students shown in the status message.
Test case: delete t/friends:trivial
Expected: Students with same tag and priority are deleted. Details of the deleted students shown in the status message.
Test case: delete 0
Expected: No student 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.
Dealing with missing data files
Close the app
Delete addressbook.json in the data folder
Re-launch the app
Expected: Shows the GUI with a set of sample contacts.
Dealing with corrupted data files
Close the app
Modify addressbook.json in the data folder by inserting random data at either the start or end of the file
Re-launch the app
Expected: A pop-up appears showing a warning message. The corrupted addressbook.json is backed up to addressbook_old.json. The app will continue with an empty list after pressing the 'OK' button.
CollabSync was significantly more difficult than the AB3 application. We incorporated new commands and functionalities to suit better our target audience, which were university students. Incorporating newer, but more relevant features such as the refinement of tags with their various levels of priorities, as well as including a new field: "Major" made our project much harder as we had to modify all the other relevant classes, as well as test classes to support these critical features.
The AB3 application is now refined through the addition of new features, as well as refinement of existing features. University students are more able to effectively and efficiently manage their contacts using CollabSync.
edit 100000000000000 , the warning message does not show At least one field to edit must be provided. due to buffer overflow errors. Instead, it shows
Invalid command format! [More error message ....]. It would be good to fix this in future.help 12345, will trigger a clear warning message that indicates the correct usage. This enhancement ensures that users receive immediate feedback, guiding them to use commands as intended and reducing potential confusion.help add allows users to seek help on the add command specifically. This refinement offers users a more detailed, feature-specific guidance on the respective commands. This will make it easier for users to understand and effectively utilize each command, thereby enhancing overall usability and user experience.