PROJECT: MINDEF Duty Planner


Overview

Duty Planner is a desktop address book application used foradding MINDEF personnel, and assigning and handling duties for the personnel involed. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10kLoC.

Summary of contributions

  • Major enhancement: added accounts for different users, and other user functionalities.

    • What it does: Different personnel stored in the Duty Planner can log in. Accounts have 2 types: General and Admin, which can act differently for some commands. Some commands target the specific user.

    • Justification: This feature allows for commands that target the specific user (like swap duty, or edit own details). It also allows for commands like delete to be allowed for admins but not general users.

    • Highlights: The enhancement affects the Person model, and existing and future commands that may be added in the future. Many design alternatives were considered, and the implementation was difficult since it affects current commands, models and test cases.

  • Minor enhancement: edited the edit command to allow user to edit his own information (except NRIC and account type).

  • Code contributed: [Code]

  • Other contributions: Added functionality to Command Tests to allow testing based on UserTypes. Create test cases based on UserTypes and accounts for all previous commands.

    • Project management:

      • Helped in creating JAR file for team for version 1.3

    • Enhancements to existing features:

      • Helped other members to write CalendarView.fxml and CalendarView.java

    • Community:

      • Helped group 15-3 in their UI component: Link

      • Some members of our team did cross-testing (not including PE and mock PE) with another team (W16-1). Reported bugs for the other team: [#223], [#224]

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.

Log in

  • For Practical Exam: You may use an administrator account with Username: Admin, and Password: Admin

  • If you close the login window, you are still able to view the personnel list and the calendar duty list. However, you will not be able to use any commands. You may simply close the window to exit the program.

Logging into a User account

NRIC and passwords are case-sensitive.
Enter in NRIC and password into the top and bottom text areas respectively, press enter.

  • Can only be done in the login box at the start of the program.

  • By default, if your password has not been changed by you or an Admin, the password is your NRIC.

  • Contact an administrator if you have trouble logging in.

  • If you need to change your account, exit the program, then log back into a different account.

  • There are 2 types of accounts: General type accounts, and Admin (or Administrator) type accounts.

  • Admin accounts have access to more commands, or more functionalities for some kind of commands. The commands for each type of account are listed in [Features for all users],[General User Features] and [Admin Features]

View all duties for current month: viewCurrent

Brings up calendar view, with all duties for the current month.
Format: viewCurrent

View all duties for next month: viewNext

Brings up calendar view, with all duties for the next month.
Format: viewNext

Adding a user : add

Add a user to the system with the corresponding NRIC, company, section, rank, name and contact number.
Format: add nr/NRIC c/COMPANY s/SECTION r/RANK n/NAME p/PHONE [t/TAG]

  • By default, the user will be a General type account, and the password will be the NRIC.

  • Password and account type can be changed using the edit command.

  • The entries can be in any order, except for tag, which must be at the end.

  • Tag always has to be the last field. eg. add nr/NRIC c/COMPANY s/SECTION r/RANK n/NAME [t/TAG] p/PHONE will not work.

Each of the following fields entered by the user following each prefix are compulsory, and must adhere to the following format (Only the Tag field is optional):

  • NRIC should be of the format [S/T/F/G][7][A-Z].

  • Company can take any value and should not be blank.

  • Section can take any value and should not be blank.

  • Rank must be composed of 3 alphanumerical characters, either digits or uppercase letters.

  • Name should only contain alphanumeric characters and spaces, and it should not be blank.

  • Phone should only contain numbers and a plus in front , and it should be at least 3 digits long and a maximum of 20 digits long

Example:

  • add nr/S9012345L c/Echo s/2 r/CFC n/William Tan p/91234567 t/injured
    Adds CFC William Tan in Echo Company Section 2 into the database.

Edit own details : edit

Edits user’s own details. Can edit one or more fields.
Format: edit [c/COMPANY] [s/SECTION] [r/RANK] [n/NAME] [p/PHONE] [t/TAG] [pw/PASSWORD]

  • At least one of the optional fields must be provided.

  • Existing values will be updated to the input values.

  • When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.

  • You can remove all the person’s tags by typing t/ without specifying any tags after it.

Examples:

  • edit p/84523546 r/CPL
    Edits the phone number and rank of the user to be `84523546
    and CPL respectively.

  • edit c/Hotel t/ pw/pass
    Edits the company of the user to be Hotel, clears all existing tags, and changes password to 'pass'.

Edit any user’s details : edit

Edits an existing user’s details in the personnel list. Format: edit INDEX [nr/NRIC] [c/COMPANY] [s/SECTION] [r/RANK] [n/NAME] [p/PHONE] [t/TAG] [pw/PASSWORD] [u/A or G]

  • Edits the person at the specified INDEX. The index refers to the index number shown in the displayed person list. The index must be a positive integer 1, 2, 3, …​

  • At least one of the optional fields must be provided.

  • Existing values will be updated to the input values.

  • When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.

  • You can remove all the person’s tags by typing t/ without specifying any tags after it.

  • For account type field specified by u/, A corresponds to an Admin account, G corresponds to a general account.

  • The program will exit if you edit your own NRIC or change your usertype to a general account.

  • If you edit another user’s NRIC, the user’s password does not automatically change to that NRIC (since the user might choose to have his own password). If you really do want to change the password to the new NRIC, please specify it in the pw/ field.

Examples:

  • edit 2 p/84523546 r/CPL u/A
    Edits the phone number and rank of the 2nd person to be 84523546 and CPL respectively, and grants the person’s account administrator privileges.

  • edit 1 c/Hotel t/ pw/pass
    Edits the company of the 1st person to be Hotel, clears all existing tags, and changes password to 'pass'.

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.

Logging in and account authority feature

Current Implementation

  • Note that in this segment, NRIC and Username may be used interchangeably, since the username is always the NRIC, unless using the default Admin account.

LoginSequenceDiagramDG

There are currently 2 UserTypes found in commons.core.index: UserType.ADMIN and UserType.General. Each NRIC account will be assigned to one of these user types that correspond to different authorities. Note that Admin type user accounts are not only have access to more commands, but some commands (such as edit) have more functionalities as well. The Command class implements AdminCommand and GeneralCommand interfaces.

Upon entering the username and password into the LoginBox, the LogicManager searches the list of personnel until it finds a personnel with the same username and (hashed) password. This returns the username and UserType of the account, and initializes the MainWindow with the username and Usertype as fields. The MainWindow then initializes the commandbox with these fields as well: the usertype so that the commands are executed using executeAdmin() or executeGeneral(), and the nric for several commands that require it to execute (for example, using the "Edit" command as a general account, since the account can only affect its own information.

DeleteCommandFinalDG

The execute Command in logic will decide to initialize the commands as either AdminCommand or GeneralCommand, to ensure the user does not have access to the wrong authority level.

Design Considerations

Aspect: handling logging in and UserType
  • Alternative 1 (current choice): LogIn box handles logic of finding account, MainWindow has UserType and NRIC field.

    • Pros: MainWindow initialized with a final UserType and NRIC field, which in turn creates a commandbox with a final UserType and NRIC field, which is safer for the commands, making sure the commands will be created as an AdminCommand or GeneralCommand correctly.

    • Cons: UI best not to handle logic, UserType or NRIC of user might be might be changed, but since the UserType and NRIC fields in the MainWindow are final, they cannot be changed. This might mess up some commands or functionalities that target the admin’s own account.

    • Implemented fix for cons: Login Box does not store Logic, but rather logic has a method to find the account given the NRIC and password, but LoginBox has a functional interface of the method as a field. To handle security concerns of the user changing his own NRIC or UserType, the program automatically exits once an admin account changes his own UserType or NRIC, or an admin deletes his own account.

  • Alternative 2: Logging in is now a command, where LoginCommand extends Command. After which the MainWindow creates the initializes the CommandBox with UserType and NRIC.

    • Pros: This is easier to implement, since the command functionality has already been set up. Logic operations now handled by Logic class, UserType and NRIC can be final attribute of CommandBox as well. After the admin changes his own UserType or NRIC, a new commandbox may be initialized with the new fields, instead of exiting the program.

    • Cons: Difficult to hide the password text this way, as we have to change how the command box textArea functions to hide password text. We also have to change the command in such a way that the logger does not save the command, since we do not want the the username and password being shown in the logger.

Aspect: handling commands that require UI changes

For example, the ExitCommand, HelpCommand, ListCommand, ViewNextCommand.

  • Alternative 1 (current choice): An enum type (UiCommandInteraction.java) exists for each kind of possible UI change in the program. For example, there is a UiCommandInteraction.EXIT and UiCOmmandInteraction.CALENDAR_CURRENT. When ViewCurrentCommand is executed, a CommandResult will have a field that contains the enum type, and the Ui change will be executed based on this enum type.

    • Pros: Easy to implement, especially for this iteration of Duty Planner, where there aren’t many UI changes.

    • Cons: More tedious to implement if there are commands that use more UI changes, due to the possible number of permutations. For example, if you want a command to update the calendar to the next month, but also show the personnel list view, while bringing up a help window. The switch case can get very huge quickly the more commands there are.

  • Alternative 2 (previous iteration of AB4): CommandResult has boolean fields "exit" and "showHelp", as well as methods "isExit()" and "isShowHelp()". After executing the command, the CommandResult is checked for each off these fields, and the relevant UI change is executed for each of the boolean fields.

    • Pros: Easy to implement, does not have the downside of the previous alternative, since each field only needs to be checked once, so the number of checks only grows linearly with the possible number of UI changes.

    • Cons: Very tedious and more prone to error. For example, in AB4, the ExitCommand returns new CommandResult(message, false, true). If there are many fields like DutyPlanner 1.4, it will be CommandResult(message, false, true, false, false, false), which is both tedious for most commands, and prone to error in the long run, especially if even more UI changes are implemented.

    • Possible fix for cons: Similar to how a PersonBuilder is used to AB4, testcases, create a CommandResultBuilder class, with UI fields being the same as Command Result, but all UI fields false by default. To create a command result that shows help and shows the list, simply use: new CommandResultBuilder().withHelp().withList().build(). This should reduce tediousness and results in less errors.

PROJECT: PowerPointLabs


{Optionally, you may include other projects in your portfolio.}