# quynh124/decor-vista architecture

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

- Interactive diagram: https://gitdiagram.com/quynh124/decor-vista
- Repository: https://github.com/quynh124/decor-vista

## Overview

##### Main components
- EJB Module (FunitureWebsite-ejb): This module contains the enterprise business logic. It includes entity beans (in the “com/entitybeans” folder) that represent database entities (such as Categories, Consultations, Products, etc.) and session beans (in the “com/sessionbeans” and “com/sessionbeansprocess” folders) which encapsulate the business rules and operations, including even specialized processes like cart management.
- Web Module (FunitureWebsite-war): This contains the presentation layer including JSF pages (with various xhtml files under “admin”, “client”, and “design” subdirectories) and Managed Beans (in “com/mbeans”). This module is responsible for rendering the UI and handling HTTP requests.
- Database: The persistence.xml files and the database script (in the “db” folder – e.g., DecorVistaWebsite.sql) indicate that a relational database is used for storage. The entity beans interact with the database via JPA.
- External Libraries and Frameworks: The project utilizes PrimeFaces (as seen in the EJB lib folder with primefaces-11.0.0.jar) along with other typical JEE libraries. Additionally, the presence of configuration files (e.g., web.xml, glassfish-web.xml, and persistence.xml) signals standard Java EE deployment.

##### Relationships and interactions
- The client (web browser) interacts with the Web Module. The web container (running the WAR) handles incoming HTTP requests. Managed Beans (e.g., LoginMB, DashboardMB) process these requests.
- The Web Module then calls business logic encapsulated in the EJB Module (using session beans and process beans).
- The EJB Module, in turn, manages interactions with the database, mapping data objects to entities (a typical persistence and ORM layer) and processing business rules.
- There is also a clear separation between the administrative and client areas in the presentation layer (with separate directories and xhtml pages).

##### Architectural patterns/design principles
- Layered/MVC Architecture: The design clearly separates the presentation (view + controllers managed by JSF and Managed Beans), business logic (EJB session beans), and data access (entity beans with JPA connectivity).
- Enterprise Java Beans: Use of stateless or stateful session beans supporting transactional business operations.
- Loose coupling: The modular separation (EJB and WAR modules) supports maintainability and scalability.

##### Technologies and frameworks
- Java EE (with EJB, JPA, and JSF)
- PrimeFaces (as part of the UI framework)
- Apache Ant/NetBeans build (build.xml and nbproject folders)
- GlassFish (as indicated by glassfish-web.xml and glassfish-resources.xml files)

##### Elements
- Clear labels for each component (e.g., “Presentation Layer – FunitureWebsite-war”, “Business Logic – FunitureWebsite-ejb”, “Database Layer”).
- “process” components (for example, the CartSB in “com/sessionbeansprocess” for shopping cart processing).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Components
    Browser["Browser"]:::frontend

    %% Presentation Layer – FunitureWebsite-war
    subgraph "Presentation Layer – FunitureWebsite-war"
        MB["Managed Beans"]:::frontend
        Admin["Admin JSF Pages"]:::frontend
        Client["Client JSF Pages"]:::frontend
        Design["Design JSF Pages"]:::frontend
    end

    %% Business Logic – FunitureWebsite-ejb
    subgraph "Business Logic – FunitureWebsite-ejb"
        EB["Entity Beans"]:::business
        SB["Session Beans"]:::business
        PB["Process Beans (CartSB)"]:::business
    end

    %% Database Layer
    subgraph "Database Layer"
        DBConfig["Database Configuration"]:::database
        DBScript["Database Script"]:::database
    end

    %% External Libraries
    Lib["PrimeFaces Library"]:::external

    %% Connections / Data flow
    Browser -->|"HTTPRequest"| MB
    MB -->|"UIRequest"| Admin
    MB -->|"UIRequest"| Client
    MB -->|"UIRequest"| Design
    MB -->|"CallsEJB"| SB
    SB -->|"CRUDOperations"| EB
    SB -->|"InvokeProcess"| PB
    PB -->|"BusinessProcess"| EB
    EB -->|"JPAORM"| DBConfig
    DBConfig -->|"ConfiguredData"| DBScript
    Lib -->|"UIComponents"| MB

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px
    classDef business fill:#d4edda,stroke:#155724,stroke-width:2px
    classDef database fill:#fff3cd,stroke:#856404,stroke-width:2px
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px

    %% Click Events
    click MB "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-war/src/java/com/mbeans"
    click Admin "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-war/web/admin"
    click Client "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-war/web/client"
    click Design "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-war/web/design"
    click EB "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-ejb/src/java/com/entitybeans"
    click SB "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-ejb/src/java/com/sessionbeans"
    click PB "https://github.com/quynh124/decor-vista/tree/master/FunitureWebsite-ejb/src/java/com/sessionbeansprocess"
    click DBConfig "https://github.com/quynh124/decor-vista/blob/master/FunitureWebsite-ejb/src/conf/META-INF/persistence.xml"
    click DBScript "https://github.com/quynh124/decor-vista/blob/master/db/DecorVistaWebsite.sql"
    click Lib "https://github.com/quynh124/decor-vista/blob/master/FunitureWebsite-ejb/lib/primefaces-11.0.0.jar"
```
