# niyara-muradova/restaurant-delivery-javafx architecture

> Architecture diagram of the GitHub repository niyara-muradova/restaurant-delivery-javafx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/niyara-muradova/restaurant-delivery-javafx
- Repository: https://github.com/niyara-muradova/restaurant-delivery-javafx

## Overview

##### Main Components
- User Interface Layer:
- Login Package: Contains LoginView.fxml, LoginController.java, and LoginDAO.java. This represents the entry point where both administrators and customers log in.
- Registration Package: Provides customer registration through RegistrationView.fxml, RegistrationController.java, and RegistrationDAO.java.
- Customer Package: Handles customer operations with its own FXML views (CustomerView.fxml) and corresponding controllers and DAO classes.
- Administrator Package: Manages administrator functions including adding dishes, managing restaurants, viewing orders and customers (multiple FXML files and controller/DAO classes).
- Application Bootstrap:
- MainApplication Package: Contains MainApplication.java which serves as the starting point of the application.
- Data Access and Utility:
- DBUtil Package: Provides DBUtil.java, a utility helper for connecting to the Oracle Database (as noted by the reference to a precommitted Oracle database project).
- Domain/Model Layer:
- Model classes like Customer.java, Dish.java, Restaurant.java, and Orders.java—these represent the core data entities.

##### Understand the Architectural Patterns
- MVC (Model-View-Controller) is clearly being employed (each FXML view is paired with a corresponding Controller; the DAO classes handle data persistence).
- The separation of packages (Login, Registration, Customer, Administrator) illustrates modularization by functionality.
- The common DBUtil file shows a centralized database connectivity usage, emphasizing a consistent data access model.

##### Relationships and Data Flow
- The UI layer (JavaFX FXML views) passes user interactions to the respective Controllers.
- Controllers invoke methods from the DAO classes to retrieve or update data.
- The DAOs connect to the Oracle Database using the DBUtil.
- The MainApplication file acts as the starting point that loads the initial view (login screen) and possibly directs to the correct dashboard based on user privilege.
- After successful authentication through the LoginPackage, either the CustomerPackage or AdministratorPackage is engaged, each having independent FXML-driven screens and business logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Bootstrap
    subgraph "Application Bootstrap"
        MainApp["Main Application"]:::bootstrap
    end

    %% User Interface Layer
    subgraph "User Interface Layer"
        %% Login Module
        subgraph "Login Module"
            LoginView["Login View (FXML)"]:::ui
            LoginController["Login Controller"]:::controller
            LoginDAO["Login DAO"]:::dao
            LoginView -->|"triggers"| LoginController
            LoginController -->|"calls"| LoginDAO
            LoginDAO -->|"connects"| DBUtil
        end

        %% Registration Module
        subgraph "Registration Module"
            RegistrationView["Registration View (FXML)"]:::ui
            RegistrationController["Registration Controller"]:::controller
            RegistrationDAO["Registration DAO"]:::dao
            RegistrationView -->|"triggers"| RegistrationController
            RegistrationController -->|"calls"| RegistrationDAO
            RegistrationDAO -->|"connects"| DBUtil
        end

        %% Customer Module
        subgraph "Customer Module"
            CustomerView["Customer View (FXML)"]:::ui
            CustomerController["Customer Controller"]:::controller
            CustomerDAO["Customer DAO"]:::dao
            CustomerView -->|"triggers"| CustomerController
            CustomerController -->|"calls"| CustomerDAO
            CustomerDAO -->|"connects"| DBUtil
        end

        %% Administrator Module
        subgraph "Administrator Module"
            AdminView["Administrator Main View (FXML)"]:::ui
            AdminController["Administrator Controller"]:::controller
            AdminExtra1["Administrator Customer View (FXML)"]:::ui
            AdminExtra2["Administrator Dish View (FXML)"]:::ui
            AdminExtra3["Administrator Restaurant View (FXML)"]:::ui
            AdmDishDAO["AdmDish DAO"]:::dao
            OrdersView["Orders View (FXML)"]:::ui
            OrdersController["Orders Controller"]:::controller
            OrdersDAO["Orders DAO"]:::dao

            AdminView -->|"triggers"| AdminController
            AdminController -->|"calls"| AdmDishDAO
            AdminController -->|"fetches"| OrdersController
            OrdersController -->|"calls"| OrdersDAO
            OrdersDAO -->|"connects"| DBUtil

            AdminController ---|"manages"| AdminExtra1
            AdminController ---|"manages"| AdminExtra2
            AdminController ---|"manages"| AdminExtra3
        end
    end

    %% Data Access and Utility
    subgraph "Data Access & Utility"
        DBUtil["DB Utility"]:::db
    end

    %% Domain Models
    subgraph "Domain Models"
        CustomerModel["Customer Model"]:::domain
        DishModel["Dish Model"]:::domain
        RestaurantModel["Restaurant Model"]:::domain
        OrdersModel["Orders Model"]:::domain
    end

    %% Connections between layers
    MainApp -->|"loads"| LoginView

    %% Dotted links from DAOs/controllers to Domain Models
    LoginDAO -.->|"uses"| CustomerModel
    RegistrationDAO -.->|"uses"| CustomerModel
    CustomerDAO -.->|"uses"| CustomerModel
    AdmDishDAO -.->|"uses"| DishModel
    OrdersDAO -.->|"uses"| OrdersModel
    AdminController -.->|"manages"| RestaurantModel
    AdminController -.->|"manages"| CustomerModel

    %% Click Events
    click LoginView "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/LoginPackage/LoginView.fxml"
    click LoginController "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/LoginPackage/LoginController.java"
    click LoginDAO "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/LoginPackage/LoginDAO.java"
    
    click RegistrationView "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/RegistrationPackage/RegistrationView.fxml"
    click RegistrationController "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/RegistrationPackage/RegistrationController.java"
    click RegistrationDAO "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/RegistrationPackage/RegistrationDAO.java"
    
    click CustomerView "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/CustomerPackage/CustomerView.fxml"
    click CustomerController "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/CustomerPackage/CustomerController.java"
    click CustomerDAO "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/CustomerPackage/CustomerDAO.java"
    
    click AdminView "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/AdministratorView.fxml"
    click AdminController "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/AdministratorController.java"
    click AdminExtra1 "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/AdministratorCustomer.fxml"
    click AdminExtra2 "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/AdministratorDish.fxml"
    click AdminExtra3 "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/AdministratorRestaurant.fxml"
    click AdmDishDAO "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/AdmDishDAO.java"
    click OrdersView "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/OrdersView.fxml"
    click OrdersController "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/OrdersController.java"
    click OrdersDAO "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/OrdersDao.java"
    
    click MainApp "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/MainApplication/MainApplication.java"
    click DBUtil "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/DBUtil/DBUtil.java"
    
    click CustomerModel "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/Customer.java"
    click DishModel "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/Dish.java"
    click RestaurantModel "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/Restaurant.java"
    click OrdersModel "https://github.com/niyara-muradova/restaurant-delivery-javafx/blob/master/AdministratorPackage/Orders.java"
    
    %% Styles
    classDef ui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef controller fill:#ABEBC6,stroke:#196F3D,stroke-width:2px;
    classDef dao fill:#FADBD8,stroke:#922B21,stroke-width:2px;
    classDef bootstrap fill:#D5F5E3,stroke:#1D8348,stroke-width:2px;
    classDef db fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef domain fill:#D6DBDF,stroke:#566573,stroke-width:2px;
```
