Assignment 2
Develop a gradle based Java web application that has the following features:
- Index/default page
- Display a list of Person records stored in the application database. There will be no records when application is run the first time. No login is required to access this page.
- Displays a link (anchor tag) that will lead user to a create person page that presents a HTML form used to create a user. This page will be accessible only if logged in as application admin user (see below for details).
- Each person record stored in the database is displayed on the listing screen ordered by name.
- Each person entry on the page should display the name, gender and age of the person. The name should be a hyperlink to a page that presents a form that can be used to edit the information related to the person. This edit page can be accessed either by the application admin user (see below), or the username/password combination for the selected person. A person can only edit their details, not any other person's details. The username should not be editable.
- Login screen - allows either the application admin or a person to log on using the username/password stored for a person.
- Logout screen - allow testing use of application using application admin user or any person created using the application.
- Application admin user - A hard-coded (in code) user who can login to the application and manage (create/update/delete) person records.
- Person record - stored in a database table, and also represented as an equivalent model object in code. The following information needs to be stored related to the person (treat all as required):
name
- Name is unique and should be validated by backend code without just delegating to database error.gender
- restricted to standard valuesage
username
- Username should be unique and validated by backend code without just delegating to database error.password
- Person repository - Handles all database interactions such as saving Person objects to database, reading from database, removing from database etc.
- Servlets as appropriate to handle application logic.
- Full test suite that tests all aspects of the application including negative tests such as:
- Attempt to create a person with duplicate name and the expected error response
- Attempt to create a person with duplicate username and the expected error response.
- Attempt to login using invalid credentials.