Introduction To Software Engineering
Introduction To Software Engineering
2. Description:
-This use case describes the process by which a user logs into the application using their email and
password.
3. Actors:
- Primary Actor:User(Super Admin , Admin)
4. Preconditions:
- The user must have a valid email and password.
- The user must be registered in the system and their account status must be active.
5. Postconditions:
- On successful login, the user will be redirected to the home page corresponding to their role.
- On unsuccessful login, the user will receive an error message indicating that the email or password is
incorrect.
6. Basic Flow:
1. The use case begins when the user opens the login form.
2. The user enters their email in the Username field.
3. The user enters their password in the Password field.
4. The user clicks the `Login` button.
5. The system validates the email and password against the database.
6. If the credentials are correct and the account status is 'Active':
- The system hides the login form.
- The system opens the home page corresponding to the user's role.
7. If the credentials are incorrect or the account status is not 'Active':
- The system displays an error message indicating "Incorrect Email or Password".
7. Alternative Flows:
Alternative Flow 1: User Exits Application
- 3a. The user clicks the `Exit` button.
- 3b. The system prompts the user with a confirmation dialog.
- 3c. If the user confirms, the system closes the application.
8. Exceptions:
Exception 1: Database Connection Error
- If there is an error connecting to the database, the system displays an error message indicating the
issue.
9. Assumptions:
- The database connection and querying mechanisms are correctly implemented and functional.
- User roles are predefined in the system and associated with user accounts.
Main Flow:
1. User opens the login form:
- The system displays the login form centered on the screen.
Alternative Flow:
1. User clicks 'Exit' button:
- The user clicks on the `Exit button`.
- The system prompts the user with a confirmation dialog "Are you sure you want to Exit?" with
Yes/No options.
- If the user confirms (Yes), the system closes the application.
Use Cases
Description:
-The admin opens the home management application.
Primary Actor:
- Admin
Preconditions:
-The admin has the application installed and launched.
Postconditions:
-The main interface of the application is displayed.
Main Flow:
Description:
- The admin manages user accounts.
Preconditions:
-The admin is logged into the application.
Postconditions:
- The `ManageUser` interface is displayed for managing user accounts.
Main Flow:
Description:
-The admin manages product categories.
Primary Actor:
-Admin
Preconditions:
- The admin is logged into the application.
Postconditions:
- The `ManageCategory` interface is displayed for managing categories.
Main Flow:
Description:
- The admin manages products.
Primary Actor:
-Admin
Preconditions:
-The admin is logged into the application.
Postconditions:
-The `ManageProduct` interface is displayed for managing products.
Main Flow:
1. The admin clicks the "PRODUCT" button.
2. The system displays the `ManageProduct` interface.
Primary Actor:
- Admin
Preconditions:
- The admin is logged into the application.
Postconditions:
- The `ManageCustomer` interface is displayed for managing customers.
Main Flow:
Description:
-The admin manages orders.
Primary Actor:
- Admin
Preconditions:
- The admin is logged into the application.
Postconditions:
The `ManageOrder` interface is displayed for managing orders.
Main Flow:
1. The admin clicks the "ORDER" button.
2. The system displays the `ManageOrder` interface.
2.6 Logout
Description:
- The admin logs out of the application.
Primary Actor:
- Admin
Preconditions:
- The admin is logged into the application.
Postconditions:
- The admin is logged out and the login interface is displayed.
Main Flow:
1. The admin clicks the "LOGOUT" button.
2. The system prompts the admin to confirm the logout action.
3. The admin confirms the logout action.
4. The system logs out the admin and displays the login interface.
User Interface Components
- **Buttons:**
- `btnUser`: Opens the `ManageUser` interface.
- `btnCategory`: Opens the `ManageCategory` interface.
- `btnProduct`: Opens the `ManageProduct` interface.
- `btnCustomer`: Opens the `ManageCustomer` interface.
- `btnOrder`: Opens the `ManageOrder` interface.
- `btnLogout`: Logs out the admin.
- `JOptionPane`: Used for logout confirmation dialog.
#### Goal:
To manage user accounts in the system including creating, updating, and displaying user details.
### Preconditions
- The admin must be logged into the system.
- The database and connection provider must be properly set up and functioning.
### Postconditions
- The user account details are accurately reflected in the system's database.
- The user interface displays the updated user list.
### Assumptions
- The admin has sufficient permissions to manage user accounts.
- The database schema is set up correctly with the necessary tables and columns.
The `ManageCategory` application is a Java Swing-based GUI that allows users to manage categories in a
database. It provides functionalities to add, update, view, and reset categories. The application interacts
with a backend database to perform CRUD (Create, Read, Update, Delete) operations on the category
data.
#### 2. Actors
- **User**: The primary actor who interacts with the application to manage categories.
#### 3. Pre-conditions
#### 4. Post-conditions
- Changes made to the categories (additions, updates) are persisted in the database.
- The user receives feedback on the success or failure of their actions.
**Pre-condition**: The application is running, and the user has entered a category name in the `txtName`
field.
**Post-condition**: A new category is added to the database, and the table is updated to reflect this
addition.
**Main Flow**:
1. The user enters a category name in the `txtName` field.
2. The user clicks the "Save" button.
3. The system validates the input.
4. If validation passes, the system inserts the new category into the database.
5. The system displays a success message and refreshes the category table.
**Alternative Flow**:
- If validation fails, the system displays an error message indicating that all fields are required.
**Pre-condition**: The application is running, and the user has selected a category from the table and
entered a new name in the `txtName` field.
**Post-condition**: The selected category is updated in the database, and the table is updated to reflect
this change.
**Main Flow**:
1. The user selects a category from the `tableCategory`.
2. The user enters a new name in the `txtName` field.
3. The user clicks the "Update" button.
4. The system validates the input.
5. If validation passes, the system updates the category in the database.
6. The system displays a success message and refreshes the category table.
**Alternative Flow**:
- If validation fails, the system displays an error message indicating that all fields are required.
**Description**: Allows the user to reset the form to its initial state.
**Post-condition**: The form is reset to its initial state, and the category table is reloaded.
**Main Flow**:
1. The user clicks the "Reset" button.
2. The system resets the form fields and reloads the category table.
**Main Flow**:
1. The user clicks the "Close" button.
2. The system closes the application window.
**Description**: Automatically loads and displays all categories in the table when the application starts.
**Main Flow**:
1. The application starts and triggers the `formComponentShown` event.
2. The system retrieves all categories from the database.
3. The system populates the `tableCategory` with the retrieved data.
- **Labels**:
- `jLabel1`: Title label displaying "Manage Category".
- `jLabel2`: Label for the `txtName` field, displaying "Name".
- **Text Field**:
- `txtName`: Input field for entering the category name.
- **Buttons**:
- `btnSave`: Saves a new category.
- `btnUpdate`: Updates the selected category.
- `btnReset`: Resets the form.
- `btnClose`: Closes the application.
- **Table**:
- `tableCategory`: Displays the list of categories with columns "ID" and "Name".
- **Scroll Pane**:
- `jScrollPane1`: Encapsulates `tableCategory` to provide scrolling functionality.
- Validation errors (e.g., missing category name) are communicated to the user via `JOptionPane` dialog
boxes.
- Database errors (e.g., connection issues, SQL exceptions) are caught and displayed to the user via
`JOptionPane` dialog boxes.
The `ManageProduct` application is a Java-based GUI application for managing product records in a
database. It allows users to add, update, and view product details. The application integrates with a
database to store and retrieve product information and uses Java Swing components for the user interface.
Actors
1. User: The primary actor who interacts with the application to manage product records.
Functional Requirements
Precondition:
-The application is launched.
Postcondition:
- The product management interface is displayed.
Description:
-The application should retrieve all categories from the database and display them in a combo box.
Precondition:
- The application is launched.
Postcondition:
-Categories are displayed in the `comboBoxCategory`.
Description:
- The application should retrieve all products from the database and display them in a table.
Precondition:
-The application is launched.
Postcondition:
-Products are displayed in the `tableProduct`.
Description:
-The user can add a new product by entering the product details and clicking the "Save" button.
Precondition:
-The user has entered all required product details and clicked the "Save" button.
Postcondition:
-The new product is added to the database and displayed in the product table.
Validation: All fields must be filled in to save a new product.
Description:
- The user can edit an existing product by selecting it from the table, modifying the details, and clicking
the "Update" button.
Precondition:
- The user has selected a product from the table and made changes to the product details.
Postcondition:
-The product details are updated in the database and the updated information is displayed in the product
table.
Validation:
- All fields must be filled in to update an existing product.
6. Reset Form
Description: The user can reset the form by clicking the "Reset" button.
Precondition: The user has clicked the "Reset" button.
Postcondition: The form fields are cleared and reset to their default states.
7. Close Application
Description: The user can close the application by clicking the "Close" button.
Precondition: The user has clicked the "Close" button.
Postcondition: The application window is closed.
Non-Functional Requirements
1. Usability: The application should have an intuitive user interface to allow users to easily manage
product records.
2. Performance: The application should retrieve and display data from the database promptly.
3. Reliability: The application should handle database errors gracefully and provide appropriate error
messages.
4. Scalability: The application should be able to handle a large number of product records efficiently.
Database Interaction
- ConnectionProvider: Utility class to manage database connections.
- SQL Queries:
- Retrieve categories: `select * from category`
- Retrieve products: `select * from product inner join category on product.category_fk =
category.category_pk’
- Insert product: `insert into product(name, quantity, price, description, category_fk) values (?, ?, ?, ?, ?)`
- Update product: `update product set name =?, quantity=?, price=?, description=?, category_fk=? where
product_pk=?`
Error Handling
- Display error messages using `JOptionPane` for any exceptions encountered during database operations.
Future Enhancements
Certainly! Below is the use case documentation for the "Manage Order" functionality in a Java Swing
application:
2. Description:
This use case allows the user to manage orders by selecting customers, adding products to a cart, and
saving the order. It includes functionality for displaying customer and product lists, adding products to a
cart, calculating total amounts, and generating order invoices in PDF format.
3. Actors:
- User: Typically a sales representative or cashier who manages customer orders.
4. Precondition:
- The application is running, and the user has access to the "Manage Order" functionality.
- Customer and product data are preloaded into the system.
5. Trigger:
The user initiates the "Manage Order" functionality from the main menu or another part of the
application.
6. Main Flow:
6.1. Display Initial Screen:
- The system displays the "Manage Order" screen with lists of customers and products.
7. Alternate Flows:
- A1: Insufficient Stock:
- If the product stock is insufficient during the "Add Product to Cart" step, the system displays an error
message indicating the available stock, and the product is not added to the cart.
9. Assumptions:
- The database is available and operational.
- The customer and product data are accurate and up-to-date.
- The PDF generation library (iText) is correctly configured and functioning.
---