java.lang.Object
jku.se.User
jku.se.Administrator
Represents an administrator user with extended permissions.
Administrators can view and manage all invoices, add or delete users,
and approve or decline invoices.
-
Constructor Summary
ConstructorsConstructorDescriptionAdministrator
(String name, String email, String password) Constructs an Administrator object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdministrator
(String name, String email, String password, boolean isAdministrator) Adds a new administrator to the system.void
Adds a new user to the system.void
approveInvoice
(Invoice invoice) Approves an invoice by setting its status to APPROVED and updating the database.void
correctInvoice
(Invoice invoice, double newAmount, Category newCategory, LocalDate newDate) Corrects invoice data such as amount, category, or date.void
declinedInvoice
(Invoice invoice) Declines an invoice by setting its status to DECLINED and updating the database.boolean
deleteUser
(String email) Deletes a user or administrator from the system.Retrieves all invoices stored in the system (visible to admins only).Methods inherited from class jku.se.User
getEmail, getName, getPassword, isAdministrator, login, receiveNotification, setNotification, viewHistory
-
Constructor Details
-
Administrator
Constructs an Administrator object.- Parameters:
name
- Administrator's name.email
- Administrator's email.password
- Administrator's password.
-
-
Method Details
-
viewAllInvoices
Retrieves all invoices stored in the system (visible to admins only).- Overrides:
viewAllInvoices
in classUser
- Returns:
- List of all invoices.
-
addUser
Adds a new user to the system.- Parameters:
name
- Name of the user.email
- Email address.password
- Password.isAdministrator
- false for normal users.
-
addAdministrator
Adds a new administrator to the system.- Parameters:
name
- Name of the administrator.email
- Email address.password
- Password.isAdministrator
- true for admin accounts.
-
deleteUser
Deletes a user or administrator from the system.- Parameters:
email
- Email of the user to delete.- Returns:
- true if successful, false otherwise.
-
approveInvoice
Approves an invoice by setting its status to APPROVED and updating the database.- Parameters:
invoice
- Invoice to approve.
-
declinedInvoice
Declines an invoice by setting its status to DECLINED and updating the database.- Parameters:
invoice
- Invoice to decline.
-
correctInvoice
public void correctInvoice(Invoice invoice, double newAmount, Category newCategory, LocalDate newDate) Corrects invoice data such as amount, category, or date.- Parameters:
invoice
- Invoice to correct.newAmount
- Corrected amount.newCategory
- Corrected category.newDate
- Corrected date.
-