# sazanrjb/inventorymanagementsystem architecture

> Architecture diagram of the GitHub repository sazanrjb/inventorymanagementsystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sazanrjb/inventorymanagementsystem
- Repository: https://github.com/sazanrjb/inventorymanagementsystem

## Overview

##### Main Components

a) Presentation Layer (UI)
- UI forms (Login, Dashboard, Products, Customers, etc.)
- Use rectangles with rounded corners for UI components
- Them under a "UI Layer" container

b) Business Logic Layer (DAO)
- This in the middle
- DAO classes (ProductDAO, CustomerDAO, SupplierDAO, etc.)
- Use rectangles for DAO components
- BuildTableModel as a utility component

c) Data Layer
- At the bottom
- ConnectionFactory
- Database connection
- DTO (Data Transfer Objects) components

##### Component Relationships

- DAO Layer → Database (through ConnectionFactory)

##### Specific Implementation Details

Create sections showing:
a) User Types:
- Administrator
- Normal User

b) Core Functionalities:
- Product Management
- Supplier Management
- Customer Management
- Purchase/Sales Management
- Stock Management
- User Management (Admin only)
- Reports (Admin only)

##### Technical Specifications

A technical specifications section showing:
- Java SE as the primary technology
- MySQL as the database
- Third-party dependencies:
- JCalendar
- JTattoo
- MySQL Connector

##### Data Flow

Following flows:
- User Authentication Flow
- Product Management Flow
- Sales/Purchase Flow
- Reporting Flow

**[UI Layer (Forms)]**
- ↓
**[Business Logic (DAO)]**
- ↓
**[Data Access (DTO & ConnectionFactory)]**
- ↓
**[Database]**

##### Additional Elements

- Notes for important configurations (database credentials)
- System boundaries
- External dependencies
- Admin-only features with a special indicator

##### Architecture Patterns

Following patterns:
- MVC-like structure (UI, DAO, DTO)
- Data Access Object pattern
- DTO pattern
- Singleton pattern (for database connection)

Remember to:
- Use consistent symbols throughout
- A version number
- Necessary annotations for clarity
- Both static structure and dynamic interactions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef ui fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef dao fill:#98fb98,stroke:#333,stroke-width:2px
    classDef dto fill:#fff59d,stroke:#333,stroke-width:2px
    classDef db fill:#d3d3d3,stroke:#333,stroke-width:2px
    classDef util fill:#ffb3b3,stroke:#333,stroke-width:2px

    %% Main Application
    MainApp["Inventory Management System"]:::ui
    click MainApp "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/inventorymangagementsystem/InventoryManagementSystem.java"
    Dashboard["Dashboard"]:::ui
    click Dashboard "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/Dashboard.java"
    HomePage["Home Page"]:::ui
    click HomePage "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/HomePage.java"

    subgraph UI["Presentation Layer"]
        Login["Login Dialog"]:::ui
        click Login "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/LoginDialog.java"
        
        subgraph CoreUI["Core Management UI"]
            Products["Products UI"]:::ui
            click Products "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/Products.java"
            Suppliers["Suppliers UI"]:::ui
            click Suppliers "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/Suppliers.java"
            Customers["Customers UI"]:::ui
            click Customers "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/Customers.java"
            Stocks["Current Stocks UI"]:::ui
            click Stocks "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/CurrentStocks.java"
            Users["Users UI"]:::ui
            click Users "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/Users.java"
        end

        subgraph ReportingUI["Reporting UI"]
            SalesReport["Sales Report"]:::ui
            click SalesReport "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/SalesReport.java"
            Logs["Logs"]:::ui
            click Logs "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/ui/Logs.java"
        end
    end

    subgraph BLL["Business Logic Layer"]
        BuildTable["Build Table Model"]:::util
        click BuildTable "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dao/BuildTableModel.java"
        
        subgraph DAOs["Data Access Objects"]
            ProductDAO["Product DAO"]:::dao
            click ProductDAO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dao/ProductDAO.java"
            SupplierDAO["Supplier DAO"]:::dao
            click SupplierDAO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dao/SupplierDAO.java"
            CustomerDAO["Customer DAO"]:::dao
            click CustomerDAO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dao/CustomerDAO.java"
            StockDAO["Stock DAO"]:::dao
            click StockDAO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dao/Stocks.java"
            UserDAO["User DAO"]:::dao
            click UserDAO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dao/UserDAO.java"
        end
    end

    subgraph DL["Data Layer"]
        subgraph DTOs["Data Transfer Objects"]
            ProductDTO["Product DTO"]:::dto
            click ProductDTO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dto/ProductDTO.java"
            SupplierDTO["Supplier DTO"]:::dto
            click SupplierDTO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dto/SupplierDTO.java"
            CustomerDTO["Customer DTO"]:::dto
            click CustomerDTO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dto/CustomerDTO.java"
            UserDTO["User DTO"]:::dto
            click UserDTO "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/dto/UserDTO.java"
        end
        
        ConnectionFactory["Connection Factory"]:::db
        click ConnectionFactory "https://github.com/sazanrjb/InventoryManagementSystem/blob/master/src/com/inventory/database/ConnectionFactory.java"
        DB[(MySQL Database)]:::db
    end

    %% Relationships
    MainApp --> Dashboard
    Dashboard --> HomePage
    HomePage --> CoreUI
    HomePage --> ReportingUI
    Login --> UserDAO
    
    Products --> ProductDAO
    Suppliers --> SupplierDAO
    Customers --> CustomerDAO
    Stocks --> StockDAO
    Users --> UserDAO
    
    ProductDAO --> ProductDTO
    SupplierDAO --> SupplierDTO
    CustomerDAO --> CustomerDTO
    UserDAO --> UserDTO
    
    DAOs --> ConnectionFactory
    ConnectionFactory --> DB
    
    %% Legend
    subgraph Legend
        UI_Component["UI Component"]:::ui
        DAO_Component["DAO Component"]:::dao
        DTO_Component["DTO Component"]:::dto
        DB_Component["Database Component"]:::db
        Utility["Utility Component"]:::util
    end
```
