# nozomi-75/gomis architecture

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

- Interactive diagram: https://gitdiagram.com/nozomi-75/gomis
- Repository: https://github.com/nozomi-75/gomis

## Overview

##### Project Type and Purpose
- GOMIS is a full-stack desktop application (JavaFX) that manages guidance-office workflows (student records, incidents, appointments, certificates) and connects to a MariaDB database.
- It also includes a small standalone “gomis-account-validator” utility and a multi-stage packaging/installer component (“gomis-installer”) that bundles the JRE, wraps the app into an .exe (via Launch4j), and builds an Inno Setup installer.

##### High-Level Components
a. UI Layer (JavaFX)
- Packages: lyfjshs.gomis.view (panels, forms), lyfjshs.gomis.components (custom controls, charts, notifications, tables, form manager)
b. Business Logic / Services
- Core application logic often lives in utils (EventBus, ValidationUtils, SystemOutCapture), FormManager, AlarmManagement, SettingsManager
c. Data Access Layer (DAO)
- lyfjshs.gomis.Database.DAO: DAOs for Users, Students, Incidents, Appointments, etc.
- DBConnection: JDBC connection wrapper, error handling
d. Database
- MariaDB instance (schema created by gomisDB.sql)
- Entities under Database.entity map to tables
e. Document Generation Module
- docPrinter package: generators for dropping forms, good moral certificates, incident reports; template manager; uses docx4j
f. Utility Validator
- gomis-account-validator: small Java Maven project producing a JAR that validates account credentials (used in installer step)
g. Packaging & Installer
- gomis-installer: PowerShell build script (build-all.ps1)
- Launch4j: wraps the main JAR into a Windows .exe, bundles libraries
- Bundled JRE folder under resources/jre
- Inno Setup scripts (.iss) to build the Windows installer, execute SQL, configure MariaDB

##### Relationships & Data Flow
- UI Layer → Business Logic → DAO Layer → MariaDB
(arrowed flows for read/write)
- UI Layer → Document Generation Module → “Print” (DOCX/PDF)
- build-all.ps1 (PowerShell) orchestrates → Maven build of main app & validator → Launch4j wrap → JRE copy → Inno Setup compile → Installer.exe
- Installer.exe on client machine → Deploys JRE + App.exe + Validator.jar → Runs database setup scripts → User launches .exe → app connects to local MariaDB

##### Architectural Patterns / Principles
- MVC-style separation: view (JavaFX), controllers/services (utils, event bus), data layer (DAO + entities)
- Layered architecture: Presentation → Service/Business → Persistence → Database
- Plugin-style doc generators: docPrinter modules implement a common interface for different form types
- Build/packaging pipeline as a separate concern (scripts + external tools)

##### Technologies & Frameworks
- Java 17+, JavaFX for UI
- Apache Maven for dependency management/build
- MariaDB (JDBC) for persistence
- docx4j for document generation
- Launch4j for EXE wrapping
- Inno Setup for installer
- PowerShell & batch scripts to orchestrate build and database setup

##### Must-Include
- Clear component names (e.g., “MainDashboard (JavaFX)”, “AppointmentDAO”, “MariaDB gomisdb”)
- A note on the build-installer pipeline separate from runtime

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    subgraph "UI Layer" 
        direction TB
        UI1["View Packages\n(src/main/java/lyfjshs/gomis/view)"]:::ui
        UI2["Components Packages\n(src/main/java/lyfjshs/gomis/components)"]:::ui
    end

    subgraph "Business Logic / Services"
        direction TB
        SV1["Utils Package\n(src/main/java/lyfjshs/gomis/utils)"]:::service
        SV2["FormManager Package\n(src/main/java/lyfjshs/gomis/components/FormManager)"]:::service
        SV3["AlarmManagement.java"]:::service
        SV4["SettingsManager.java"]:::service
    end

    subgraph "Data Access Layer (DAO)"
        direction TB
        DAO1["DAO Package\n(src/main/java/lyfjshs/gomis/Database/DAO)"]:::data
        DAO2["DBConnection.java"]:::data
        DAO3["SQLExceptionPane.java"]:::data
    end

    subgraph "Database Entities"
        direction TB
        ENT["Entity Package\n(src/main/java/lyfjshs/gomis/Database/entity)"]:::data
    end

    MariaDB["MariaDB\n(gomisdb)"]:::data

    subgraph "Document Generation Module"
        direction TB
        DG1["droppingForm\n(src/main/java/docPrinter/droppingForm)"]:::doc
        DG2["goodMoral\n(src/main/java/docPrinter/goodMoral)"]:::doc
        DG3["incidentReport\n(src/main/java/docPrinter/incidentReport)"]:::doc
        DG4["templateManager.java"]:::doc
    end

    Validator["Account Validator JAR"]:::tool

    subgraph "Packaging & Installer"
        direction TB
        PS["build-all.ps1\n(project root)"]:::tool
        PS2["gomis-installer/build-all.ps1"]:::tool
        LJ["Launch4j\n(launch4j-config.xml)"]:::tool
        JRE["Bundled JRE\n(gomis-installer/resources/jre)"]:::tool
        INNO["Inno Setup\n(gomis-installer/resources/GOMIS_INNO_SETUP.iss)"]:::tool
        SQL["gomisDB.sql\n(gomis-installer/resources/gomisDB.sql)"]:::tool
    end

    InstallerExe["Installer.exe"]:::tool
    AppExe["App.exe"]:::tool

    %% Flows
    UI1 -->|"User Actions"| SV1
    UI2 -->|"UI Events"| SV1
    SV1 -->|"calls Services"| SV2
    SV2 -->|"manages Forms"| SV3
    SV3 -->|"configs"| SV4
    SV1 -->|"DAO Calls"| DAO1
    SV2 -->|"DAO Calls"| DAO1
    DAO1 -->|"uses JDBC"| DAO2
    DAO2 -->|"error handling"| DAO3
    DAO1 -->|"maps to"| ENT
    DAO2 -->|"JDBC Query"| MariaDB
    UI1 -->|"Print Command"| DG4
    DG4 -->|"loads Templates"| DG1
    DG4 -->|"loads Templates"| DG2
    DG4 -->|"loads Templates"| DG3

    PS -.->|"orchestrates"| PS2
    PS2 -.->|"Maven Build"| Validator
    PS2 -.->|"Maven Build"| AppExe
    PS2 -.->|"wrap EXE"| LJ
    PS2 -.->|"copy JRE"| JRE
    PS2 -.->|"compile Installer"| INNO
    INNO -.->|"exec SQL"| SQL
    INNO -.->|"produce"| InstallerExe

    InstallerExe -->|"deploys"| AppExe
    InstallerExe -->|"deploys"| Validator
    InstallerExe -->|"runs scripts"| SQL
    AppExe -->|"connects via JDBC"| MariaDB

    %% Click events
    click UI1 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/lyfjshs/gomis/view"
    click UI2 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/lyfjshs/gomis/components"
    click SV1 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/lyfjshs/gomis/utils"
    click SV2 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/lyfjshs/gomis/components/FormManager"
    click SV3 "https://github.com/nozomi-75/gomis/blob/public/src/main/java/lyfjshs/gomis/components/alarm/AlarmManagement.java"
    click SV4 "https://github.com/nozomi-75/gomis/blob/public/src/main/java/lyfjshs/gomis/components/settings/SettingsManager.java"
    click DAO1 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/lyfjshs/gomis/Database/DAO"
    click DAO2 "https://github.com/nozomi-75/gomis/blob/public/src/main/java/lyfjshs/gomis/Database/DBConnection.java"
    click DAO3 "https://github.com/nozomi-75/gomis/blob/public/src/main/java/lyfjshs/gomis/Database/SQLExceptionPane.java"
    click ENT "https://github.com/nozomi-75/gomis/tree/public/src/main/java/lyfjshs/gomis/Database/entity"
    click DG1 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/docPrinter/droppingForm"
    click DG2 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/docPrinter/goodMoral"
    click DG3 "https://github.com/nozomi-75/gomis/tree/public/src/main/java/docPrinter/incidentReport"
    click DG4 "https://github.com/nozomi-75/gomis/blob/public/src/main/java/docPrinter/templateManager.java"
    click Validator "https://github.com/nozomi-75/gomis/tree/public/gomis-account-validator/src/main/java/lyfjshs/gomis/utils"
    click Validator "https://github.com/nozomi-75/gomis/blob/public/gomis-account-validator/src/main/java/lyfjshs/gomis/utils/ValidateGomisUser.java"
    click PS "https://github.com/nozomi-75/gomis/blob/public/build-all.ps1"
    click PS2 "https://github.com/nozomi-75/gomis/blob/public/gomis-installer/build-all.ps1"
    click LJ "https://github.com/nozomi-75/gomis/blob/public/gomis-installer/resources/launch4j-config.xml"
    click JRE "https://github.com/nozomi-75/gomis/tree/public/gomis-installer/resources/jre"
    click INNO "https://github.com/nozomi-75/gomis/blob/public/gomis-installer/resources/GOMIS_INNO_SETUP.iss"
    click SQL "https://github.com/nozomi-75/gomis/blob/public/gomis-installer/resources/gomisDB.sql"

    %% Legend
    subgraph Legend
        direction TB
        L1["Green = UI"]:::ui
        L2["Blue = Services"]:::service
        L3["Orange = DAO/DB"]:::data
        L4["Purple = DocGen"]:::doc
        L5["Gray = Tools"]:::tool
    end

    %% Styles
    classDef ui fill:#9f6,stroke:#333
    classDef service fill:#6bf,stroke:#333
    classDef data fill:#fa6,stroke:#333
    classDef doc fill:#b6f,stroke:#333
    classDef tool fill:#ccc,stroke:#333 style:#333
    classDef Legend fill:#fff,stroke:#000,stroke-dasharray: 2 2, font-style:italic
    class L1,L2,L3,L4,L5 Legend
```
