# cesar10007/calibrador architecture

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

- Interactive diagram: https://gitdiagram.com/cesar10007/calibrador
- Repository: https://github.com/cesar10007/calibrador

## Overview

A. Project Type and Purpose
##### Type: A standalone desktop Java application that uses an embedded SQLite database.
2. Purpose: “Calibrador” keeps a registry of calibrated products, logs calibration dates and expiration (in months), and raises alarms for soon-to-expire items.

B. File Structure Analysis
##### src/main/java
– Main.java: application entry point (starts UI and initialization).
– org/example/Calibrador.java: core business logic (CRUD operations, expiry calculations, notifications).
##### src/main/resources
– Inventario.db: embedded SQLite database file.
##### build.gradle, settings.gradle
– Gradle configuration for compiling, testing, packaging (shadowJar → Calibrador.jar in dist/).
##### build/, dist/
– build/: intermediate compilation outputs, test reports.
– dist/Calibrador.jar: standalone distributable.

##### User Interface Layer
– Swing/JavaFX window (Main)
– Dialogs/forms for entering product data and showing alerts
##### Business Logic Layer
– Calibrador class:
- Validates inputs
- Computes expiration dates and thresholds
- Triggers notifications
##### Data Access Layer
– JDBC/SQLite driver connecting to Inventario.db
– SQL queries for create/read/update/delete
##### Persistence (Embedded Database)
– Inventario.db file on local filesystem
##### Notification Mechanism
– In-app pop-up or system tray alert (could be in UI or separate NotificationService)
##### Build & Deployment
– Gradle (build.gradle → compile, test, shadowJar)
– Output JAR (Calibrador.jar) executed on JVM

D. Relationships and Interactions
##### Business Logic → Notification Mechanism → UI Layer (display alarms)

E. Architectural Patterns & Design Principles
– Layered Architecture: clear separation between Presentation (UI), Application/Business Logic, and Data Access.
– Single-owner embedded DB: no external network dependencies.
– Gradle-driven build pipeline: reproducible packaging.

F. Technologies & Frameworks
– Java SE (Swing or JavaFX)
– SQLite (via JDBC driver)
– Gradle (shadowJar plugin)

G. Diagramming Guidelines
– Group related classes/files into layers (e.g., “UI”, “Business Logic”, “Data Access”).
##### Labels

H. Tailoring for This Desktop App
– Emphasize the embedded nature of the database—no remote servers.
– Show the Gradle build pipeline on one side: source → compile → shadowJar → JAR.
– Include resource files (app_icon.icns) under “Resources”.
– Highlight the notification path: scheduled checks in Calibrador → UI pop-up.

– UI Layer (Main window)
– Business Logic Layer (Calibrador service)
– Data Access Layer (SQLite JDBC connector)
– Persistence Store (Inventario.db)
– Notification subsystem (in-app alerts)
– Build & Deploy (Gradle → Calibrador.jar)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    Main["Main.java\n(UI Layer)"]:::ui
    Icon["app_icon.icns\n(Resource)"]:::ui

    %% Business Logic Layer
    Calibrador["Calibrador.java\n(Business Logic)"]:::logic

    %% Data Access Layer
    DAO["Data Access Layer\n(SQL queries)"]:::data
    JDBC["SQLite JDBC Driver"]:::data

    %% Persistence Store
    DB["Inventario.db\n(SQLite DB)"]:::persistence

    %% Notification Mechanism
    Notify["Notification Service\n(In-app/System Tray)"]:::logic

    %% Build & Deployment
    subgraph "Build & Deployment"
        Gradle["build.gradle\n(Gradle Scripts)"]:::build
        Settings["settings.gradle\n(Build Settings)"]:::build
        Wrapper["gradle-wrapper.jar\n(Gradle Wrapper)"]:::build
        Compile["build/classes/java/main\n(Compiled Classes)"]:::build
        ShadowTmp["MANIFEST.MF\n(ShadowJar Manifest)"]:::build
        JAR["Calibrador.jar\n(Distributable JAR)"]:::build
    end

    %% Connections: Layered Architecture
    Main -->|"loads icon"| Icon
    Main -->|"calls"| Calibrador
    Calibrador -->|"executeQuery()/CRUD"| DAO
    DAO -->|"uses driver"| JDBC
    DAO -->|"reads/writes"| DB
    Calibrador -->|"- - triggers - -"| Notify
    Notify -.->|"displayAlert()"| Main

    %% Build & Deployment Flow
    Gradle -->|"configure"| Compile
    Settings -->|"configure"| Compile
    Wrapper -->|"invoke"| Compile
    Compile -->|"uses manifest"| ShadowTmp
    ShadowTmp -->|"packages"| JAR

    %% Click Events
    click Main "https://github.com/cesar10007/calibrador/blob/main/src/main/java/Main.java"
    click Calibrador "https://github.com/cesar10007/calibrador/blob/main/src/main/java/org/example/Calibrador.java"
    click DB "https://github.com/cesar10007/calibrador/blob/main/src/main/resources/Inventario.db"
    click Icon "https://github.com/cesar10007/calibrador/blob/main/src/main/resources/app_icon.icns"
    click Gradle "https://github.com/cesar10007/calibrador/blob/main/build.gradle"
    click Settings "https://github.com/cesar10007/calibrador/blob/main/settings.gradle"
    click JAR "https://github.com/cesar10007/calibrador/blob/main/dist/Calibrador.jar"
    click Compile "https://github.com/cesar10007/calibrador/tree/main/build/classes/java/main"
    click ShadowTmp "https://github.com/cesar10007/calibrador/blob/main/build/tmp/shadowJar/MANIFEST.MF"
    click Wrapper "https://github.com/cesar10007/calibrador/blob/main/gradle/wrapper/gradle-wrapper.jar"

    %% Styles
    classDef ui fill:#AEDFF7,stroke:#034f84,color:#000000;
    classDef logic fill:#A8E6A1,stroke:#2e7d32,color:#000000;
    classDef data fill:#F7C679,stroke:#e65100,color:#000000;
    classDef persistence fill:#D3D3D3,stroke:#616161,color:#000000;
    classDef build fill:#D1C4E9,stroke:#4a148c,color:#000000;
```
