How archit-d300/enterprise-expense-reimbursement-system works
Purpose and Entry Points
A Java enterprise expense-reimbursement application demonstrating policy-driven claim handling, approval workflows, persistence, notifications, and payment. Execution begins at src/Main.java; the central application façade/singleton is src/singleton/ExpenseManagementSystem.java.
Claim Domain and Expense Creation
Claims are represented by src/model/ExpenseClaim.java with concrete expense categories such as src/model/TravelExpense.java, src/model/FoodExpense.java, and src/model/AccommodationExpense.java. Category-specific factories—src/factory/ExpenseFactory.java, src/factory/TravelExpenseFactory.java, and src/factory/OfficeExpenseFactory.java—separate claim construction from workflow logic.
User Roles and Policy Selection
Role entities and factories in src/policy/User.java, src/policy/UserFactory.java, and src/policy/Manager.java establish the claimant/approver context. src/policy/ExpensePolicyFactory.java selects role-specific policy implementations such as src/policy/EmployeeExpensePolicy.java and src/policy/ExecutiveExpensePolicy.java. src/policy/PolicyEvaluator.java produces src/policy/PolicyDecision.java, forming a boundary between eligibility/business-rule evaluation and approval execution.
Approval Pipeline
Approval is modeled as a chain of handlers: src/approval/Chain.java, src/approval/ExpenseHandler.java, src/approval/ReceiptValidationHandler.java, src/approval/ManagerApprovalHandler.java, src/approval/FinanceVerificationHandler.java, src/approval/DepartmentApprovalHandler.java, and src/approval/FinalApprovalHandler.java. A submitted claim moves through validation and organizational approval stages; rejection or failure can stop the chain before payment.
Orchestration and Outcomes
src/system/ReimbursementSystem.java defines the reimbursement-system boundary, while src/system/EmployeeReimbursementSystem.java coordinates claim processing and src/system/EmployeeReimbursementSystemProxy.java provides an intermediary/proxy access layer. src/system/ClaimOutcome.java carries the resulting state between approval, notification, persistence, and reimbursement concerns.
Persistence and Pending Work
SQLite-backed persistence is encapsulated by src/db/DatabaseManager.java; its JDBC runtime is supplied by lib/sqlite-jdbc-3.42.0.0.jar. src/db/PendingExpense.java represents claims awaiting resolution, creating a durable boundary around deferred or incomplete approval processing.
Reimbursement and Payment
Approved claims are converted into reimbursement/payment records through src/payment/ReimbursementProcessor.java, src/payment/Reimbursement.java, and src/payment/PaymentRecord.java. Role-aware reimbursement calculations use src/policy/ReimbursementCalculator.java plus implementations such as src/policy/ManagerReimbursementCalculator.java. Payment access is abstracted by src/payment/PaymentService.java; src/payment/PaymentServiceProxy.java fronts src/payment/RealPaymentService.java.
Notifications and Observers
Workflow outcomes are published to observers through src/observer/ExpenseClaimSubject.java and role recipients including src/observer/EmployeeObserver.java, src/observer/ManagerObserver.java, and src/observer/FinanceObserver.java. Notification delivery is independently dispatched through src/Notification/NotificationDispatcher.java and src/Notification/NotificationChannel.java; src/Notification/EmailChannel.java uses Jakarta Mail/Angus dependencies in lib/jakarta.mail-api-2.1.5.jar and lib/angus-mail-2.0.5.jar.
Main entry points: ClaimOutcome.java Claim Outcome · EmployeeReimbursementSystem.java Employee Reimbursement System · ExpenseManagementSystem.java Expense Management System · ReimbursementProcessor.java Reimbursement Processor
Components 20
Application
- Main
src/Main.java - Expense Management System · Singleton application entry façade.
src/singleton/ExpenseManagementSystem.java
Claims & Policy
- Expense Claims · Base claim and category-specific expenses.
src/model/ExpenseClaim.java - Expense Factories · Constructs category-specific expenses.
src/factory/ExpenseFactory.java - Users & Roles · Claimant and approver context.
src/policy/User.java - Policy Factory · Selects role-specific expense policies.
src/policy/ExpensePolicyFactory.java - Policy Evaluator · Evaluates eligibility before approval.
src/policy/PolicyEvaluator.java - Policy Decision
src/policy/PolicyDecision.java - Reimbursement Calculator · Applies role-aware reimbursement calculations.
src/policy/ReimbursementCalculator.java
Approval Workflow
- Reimbursement System · Defines reimbursement processing access.
src/system/ReimbursementSystem.java - Employee Reimbursement System · Coordinates claim processing.
src/system/EmployeeReimbursementSystem.java - System Proxy
src/system/EmployeeReimbursementSystemProxy.java - Approval Chain · Runs receipt, manager, finance, department, and final approval stages.
src/approval/Chain.java - Claim Outcome · Carries approval result across downstream concerns.
src/system/ClaimOutcome.java
Settlement & Delivery
- Database Manager · Persists claims and pending work via JDBC.
src/db/DatabaseManager.java - Pending Expense · Durable representation of unresolved claims.
src/db/PendingExpense.java - Reimbursement Processor · Converts approved claims into reimbursement records.
src/payment/ReimbursementProcessor.java - Payment Service Proxy · Fronts the real payment service.
src/payment/PaymentServiceProxy.java - Claim Observers · Publishes outcomes to employee, manager, and finance recipients.
src/observer/ExpenseClaimSubject.java - Notification Dispatcher · Dispatches through configured notification channels.
src/Notification/NotificationDispatcher.java
Connections 21
- Main → Expense Management System: starts
- Expense Management System → Expense Factories: creates expenses
- Expense Factories → Expense Claims: builds
- Expense Management System → System Proxy: submits through
- System Proxy → Reimbursement System: accesses
- Reimbursement System → Employee Reimbursement System: implemented by
- Employee Reimbursement System → Users & Roles: uses roles
- Employee Reimbursement System → Policy Factory: selects policy
- Policy Factory → Policy Evaluator: supplies policy to
- Policy Evaluator → Policy Decision: produces
- Employee Reimbursement System → Approval Chain: executes approval
- Policy Decision → Approval Chain: gates
- Approval Chain → Claim Outcome: returns
- Claim Outcome → Pending Expense: unresolved claims
- Pending Expense → Database Manager: stored in
- Claim Outcome → Reimbursement Processor: approved claims
- Reimbursement Processor → Reimbursement Calculator: calculates
- Reimbursement Processor → Payment Service Proxy: initiates payment
- Claim Outcome → Claim Observers: publishes outcome
- Claim Observers → Notification Dispatcher: triggers delivery
- Claim Outcome → Database Manager: persists state