# xlisden/sistemadegestiondocumentaria architecture

> Architecture diagram of the GitHub repository xlisden/sistemadegestiondocumentaria, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xlisden/sistemadegestiondocumentaria
- Repository: https://github.com/xlisden/sistemadegestiondocumentaria

## Overview

1. **What this repository is**
   - A **Java Swing desktop application** for document management (“Sistema de Gestión Documentaria”).
   - It is built as a **layered monolith**: UI forms on top, service/repository layers in the middle, and **JPA/Hibernate** persistence at the bottom.

2. **Startup and application shell**
   - The main entry points are `Main.java` and `SistemaDeGestionDocumentaria.java`, with additional frame classes like `NewJFrame.java`.
   - The UI is a traditional desktop shell, not a web frontend: forms, tabs, drawers, login screen, and modal-style panels.

3. **UI layer**
   - All user interaction lives under `ui/raven`.
   - Major UI pieces include:
     - `login/Login.java`
     - `form/FormDocumentos.java`, `FormOficios.java`, `FormTipoDocumento.java`
     - `tabbed/*` for tab container behavior
     - `drawer/MyDrawerBuilder.java` for navigation
   - The presence of `.form` files indicates the UI was built with **NetBeans GUI Builder**.

4. **Document-centered domain model**
   - The core domain is organized around document workflows.
   - Main entities include `Documento`, `Oficio`, `Memorandum`, `ActaSustentacionTesis`, `Sustentacion`, `Expediente`, `Persona`, `Administrativo`, `TipoDocumento`, `Estado`, and supporting detail entities.
   - `DocumentoDto` and `DocumentoAtributos` suggest some UI-friendly projection or data-transfer shaping on top of the persisted entities.

5. **Business/service layer**
   - The `service` package provides the application’s business façade.
   - Each major entity or workflow has a corresponding service class, such as `DocumentoService`, `OficioService`, `MemorandumService`, `ExpedienteService`, `PersonaService`, and `TipoDocumentoService`.
   - This layer is where validation, orchestration, and document-specific rules are likely centralized before persistence.

6. **Repository/persistence layer**
   - The `repository` package is the data-access boundary.
   - There is a generic `Repository` base plus entity-specific repositories like `DocumentoRepository`, `PersonaRepository`, `ExpedienteRepository`, `OficioRepository`, etc.
   - This layer isolates JPA/Hibernate operations from the service and UI layers.

7. **Database and ORM configuration**
   - Persistence is configured through `src/main/resources/META-INF/persistence.xml`.
   - `config/HibernateConfig.java` indicates Hibernate is used as the ORM/bootstrap layer.
   - The README identifies the database as **`SistemaDeGestionDocumentaria`**, so the app depends on an external relational database for runtime state.

8. **Validation boundary**
   - Input checks are separated into `validations/Validation.java` and `ValidationException.java`.
   - This suggests validation is treated as a cross-cutting concern between forms and services, rather than being embedded directly in UI code.

9. **UI support libraries**
   - The repo vendors several Swing UI libraries under `libs/raven`, including:
     - `swing-toast-notifications`
     - `swing-glasspane-popup`
     - `swing-crazy-panel`
     - `datechooser-swing`
     - `raven-bean-pack`
   - These are not backend dependencies; they shape the desktop UX with toasts, popups, date pickers, and custom panels.

10. **Theming and static assets**
   - `src/main/resources/Tema` contains FlatLaf theme property files for dark, light, and default styling.
   - `Icons` and `Imagenes` are bundled assets used by the Swing UI.

11. **Primary data flow**
   - User action in a form → UI component builds/loads a domain object → service applies rules/validation → repository persists or queries via Hibernate → database responds → service returns results to the UI for display.
   - This is the key architectural flow to show in a diagram.

12. **Overall boundary map**
   - **Presentation boundary:** `ui/raven`, `Main`, `NewJFrame`
   - **Application/business boundary:** `service`, `validations`
   - **Persistence boundary:** `repository`, `config/HibernateConfig`, `persistence.xml`
   - **Domain boundary:** `entity`
   - **External dependencies:** relational database, vendored Swing libraries, theme/assets

Main entry points: [`src/main/java/com/unu/sistemadegestiondocumentaria/service/DocumentoService.java`](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/service/DocumentoService.java) (Services), [`src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormDocumentos.java`](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormDocumentos.java) (Document forms), [`src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/drawer/MyDrawerBuilder.java`](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/drawer/MyDrawerBuilder.java) (Drawer nav), [`src/main/java/com/unu/sistemadegestiondocumentaria/repository/Repository.java`](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/repository/Repository.java) (Repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_main_shell["App shell<br/>entrypoint<br/>[Main.java]"]
  node_login_ui["Login<br/>ui-form<br/>[Login.java]"]
  node_doc_forms["Document forms<br/>ui-forms"]
  node_oficio_form["Oficio form<br/>ui-form<br/>[FormOficios.java]"]
  node_tipo_form["Tipo form<br/>ui-form"]
  node_nav_drawer["Drawer nav<br/>ui-navigation"]
  node_tabbed_shell["Tabbed shell<br/>ui-container<br/>[WindowsTabbed.java]"]
end

subgraph group_application["Application"]
  node_app_services["Services<br/>business-facade"]
  node_validation["Validation<br/>cross-cutting<br/>[Validation.java]"]
end

subgraph group_persistence["Persistence"]
  node_repos["Repositories<br/>data-access<br/>[Repository.java]"]
  node_orm_config["Hibernate<br/>orm-bootstrap"]
  node_database[("Database<br/>external-db<br/>[persistence.xml]")]
end

subgraph group_domain["Domain"]
  node_doc_domain["Documents<br/>domain-model<br/>[Documento.java]"]
  node_people_domain["People & refs<br/>domain-model<br/>[Persona.java]"]
  node_dto_model["DTO model<br/>projection<br/>[DocumentoDto.java]"]
end

subgraph group_support["Support"]
  node_assets["Themes & assets<br/>static-resources"]
  node_ui_libs["Swing libs<br/>vendored-ui"]
end

node_main_shell -->|"opens"| node_login_ui
node_main_shell -->|"hosts"| node_tabbed_shell
node_tabbed_shell -->|"navigates"| node_nav_drawer
node_nav_drawer -->|"opens"| node_doc_forms
node_nav_drawer -->|"opens"| node_oficio_form
node_nav_drawer -->|"opens"| node_tipo_form
node_doc_forms -->|"uses"| node_app_services
node_oficio_form -->|"uses"| node_app_services
node_tipo_form -->|"uses"| node_app_services
node_login_ui -->|"checks"| node_validation
node_doc_forms -->|"checks"| node_validation
node_app_services -->|"coordinates"| node_doc_domain
node_app_services -->|"coordinates"| node_people_domain
node_app_services -->|"projects"| node_dto_model
node_app_services -->|"persists via"| node_repos
node_repos -->|"uses"| node_orm_config
node_orm_config -->|"connects to"| node_database
node_doc_domain -->|"stored by"| node_repos
node_people_domain -->|"stored by"| node_repos
node_doc_forms -->|"renders with"| node_ui_libs
node_tabbed_shell -->|"skins with"| node_assets

click node_main_shell "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/Main.java"
click node_login_ui "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/login/Login.java"
click node_doc_forms "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormDocumentos.java"
click node_oficio_form "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormOficios.java"
click node_tipo_form "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormTipoDocumento.java"
click node_nav_drawer "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/drawer/MyDrawerBuilder.java"
click node_tabbed_shell "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/tabbed/WindowsTabbed.java"
click node_app_services "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/service/DocumentoService.java"
click node_validation "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/validations/Validation.java"
click node_doc_domain "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/entity/Documento.java"
click node_people_domain "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/entity/Persona.java"
click node_dto_model "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/entity/DocumentoDto.java"
click node_repos "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/repository/Repository.java"
click node_orm_config "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/config/HibernateConfig.java"
click node_assets "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/resources/Tema/FlatDarkLaf.properties"
click node_ui_libs "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/libs/raven/toast/swing-toast-notifications/1.0.1/swing-toast-notifications-1.0.1.jar"
click node_database "https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/resources/META-INF/persistence.xml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_shell,node_login_ui,node_doc_forms,node_oficio_form,node_tipo_form,node_nav_drawer,node_tabbed_shell toneBlue
class node_app_services,node_validation toneAmber
class node_repos,node_orm_config,node_database toneMint
class node_doc_domain,node_people_domain,node_dto_model toneRose
class node_assets,node_ui_libs toneIndigo
```

## Components

### Presentation

Desktop shell and Swing forms

- [App shell](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/Main.java): entrypoint · Desktop application entry and frame bootstrap · `src/main/java/com/unu/sistemadegestiondocumentaria/Main.java`
- [Login](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/login/Login.java): ui-form · Authentication and first-screen access · `src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/login/Login.java`
- [Document forms](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormDocumentos.java): ui-forms · Main document CRUD screens · `src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormDocumentos.java`
- [Oficio form](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormOficios.java): ui-form · Oficio-specific workspace · `src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormOficios.java`
- [Tipo form](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormTipoDocumento.java): ui-form · Document type management screen · `src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/form/FormTipoDocumento.java`
- [Drawer nav](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/drawer/MyDrawerBuilder.java): ui-navigation · Sidebar navigation builder · `src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/drawer/MyDrawerBuilder.java`
- [Tabbed shell](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/tabbed/WindowsTabbed.java): ui-container · Tabbed desktop workspace coordination · `src/main/java/com/unu/sistemadegestiondocumentaria/ui/raven/tabbed/WindowsTabbed.java`

### Application

Services and validation

- [Services](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/service/DocumentoService.java): business-facade · Orchestrates document workflows and use cases · `src/main/java/com/unu/sistemadegestiondocumentaria/service/DocumentoService.java`
- [Validation](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/validations/Validation.java): cross-cutting · Shared input and rule checks · `src/main/java/com/unu/sistemadegestiondocumentaria/validations/Validation.java`

### Persistence

Repositories and ORM setup

- [Repositories](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/repository/Repository.java): data-access · JPA repository boundary for entities · `src/main/java/com/unu/sistemadegestiondocumentaria/repository/Repository.java`
- [Hibernate](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/config/HibernateConfig.java): orm-bootstrap · JPA/Hibernate bootstrap and persistence unit config · `src/main/java/com/unu/sistemadegestiondocumentaria/config/HibernateConfig.java`
- [Database](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/resources/META-INF/persistence.xml): external-db · External relational database used at runtime · `src/main/resources/META-INF/persistence.xml`

### Domain

Entities and document model

- [Documents](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/entity/Documento.java): domain-model · Core document entities and workflow variants · `src/main/java/com/unu/sistemadegestiondocumentaria/entity/Documento.java`
- [People & refs](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/entity/Persona.java): domain-model · Person, staff, status, and lookup entities · `src/main/java/com/unu/sistemadegestiondocumentaria/entity/Persona.java`
- [DTO model](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/java/com/unu/sistemadegestiondocumentaria/entity/DocumentoDto.java): projection · UI-facing document projections and attribute shaping · `src/main/java/com/unu/sistemadegestiondocumentaria/entity/DocumentoDto.java`

### Support

Bundled UI libraries and static resources

- [Themes & assets](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/src/main/resources/Tema/FlatDarkLaf.properties): static-resources · FlatLaf themes, icons, and images · `src/main/resources/Tema/FlatDarkLaf.properties`
- [Swing libs](https://github.com/xlisden/sistemadegestiondocumentaria/blob/main/libs/raven/toast/swing-toast-notifications/1.0.1/swing-toast-notifications-1.0.1.jar): vendored-ui · Bundled Swing UI libraries for toasts, popups, panels, and date picking · `libs/raven/toast/swing-toast-notifications/1.0.1/swing-toast-notifications-1.0.1.jar`

## Connections

- App shell → Login: opens · Application starts in the login/UI shell
- App shell → Tabbed shell: hosts · Main frame hosts the tabbed workspace
- Tabbed shell → Drawer nav: navigates · Drawer controls access to module screens
- Drawer nav → Document forms: opens · Navigation routes to document management screens
- Drawer nav → Oficio form: opens · Navigation routes to oficio workflow screens
- Drawer nav → Tipo form: opens · Navigation routes to type management screens
- Document forms → Services: uses · Forms delegate document actions to services
- Oficio form → Services: uses · Oficio UI calls application services
- Tipo form → Services: uses · Type screens use service layer operations
- Login → Validation: checks · Login and form inputs are validated before actions
- Document forms → Validation: checks · Document inputs pass through shared validation
- Services → Documents: coordinates · Business rules operate on document entities
- Services → People & refs: coordinates · Services manage people, status, and reference data
- Services → DTO model: projects · Services expose UI-friendly document views
- Services → Repositories: persists via · Services call repository boundary for CRUD and queries
- Repositories → Hibernate: uses · Repositories rely on JPA/Hibernate bootstrap
- Hibernate → Database: connects to · Persistence unit connects to the relational database
- Documents → Repositories: stored by · Document entities are persisted through repositories
- People & refs → Repositories: stored by · Reference entities are persisted through repositories
- Document forms → Swing libs: renders with · UI uses vendored Swing libraries for enhanced interaction
- Tabbed shell → Themes & assets: skins with · Tabbed desktop UI uses bundled themes and graphics
