# josesanchezr/struts2-project architecture

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

- Interactive diagram: https://gitdiagram.com/josesanchezr/struts2-project
- Repository: https://github.com/josesanchezr/struts2-project

## Overview

This Struts2 web application accepts institution or branch requests, checks for duplicate headquarters or same-name country/city branches, and saves accepted records. It also lists stored requests and institution names, and supplies ISO country choices. The request/list actions obtain a file-backed DAO through a factory; the DAO serializes Request records to JSON. README documents the web entry points, but configuration and JSP behavior were not sampled, so those runtime links are shown only where supported.

Main entry points: [`src/main/java/com/empresa/struts/actions/RequestAction.java`](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/RequestAction.java) (Submit request), [`src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java`](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java) (JSON DAO), [`src/main/java/com/empresa/struts/actions/ListRequestAction.java`](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/ListRequestAction.java) (List requests), [`src/main/java/com/empresa/struts/dao/DaoFactory.java`](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/DaoFactory.java) (DAO factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web actions"]
  node_submit["Submit request<br/>[RequestAction.java]"]
  node_list["List requests"]
  node_countries["Country choices"]
end

subgraph group_data["Request data"]
  node_factory["DAO factory<br/>[DaoFactory.java]"]
  node_service["DAO contract<br/>[IDaoService.java]"]
  node_record["Request record<br/>[Request.java]"]
end

subgraph group_storage["File persistence"]
  node_dao["JSON DAO"]
  node_json[("Request JSON<br/>[file.json]")]
end

node_user(("Web user"))
node_webapp(("Struts web app"))

node_user -.->|"submits form"| node_submit
node_submit -->|"gets DAO"| node_factory
node_submit -->|"checks and saves"| node_service
node_submit -->|"validates fields"| node_record
node_list -->|"gets DAO"| node_factory
node_list -->|"loads requests"| node_service
node_factory -->|"registers implementation"| node_dao
node_dao -->|"implements"| node_service
node_dao -->|"serializes records"| node_record
node_dao -->|"reads and writes"| node_json
node_user -.->|"requests listing"| node_list
node_user -.->|"requests choices"| node_countries
node_webapp -.->|"routes actions"| node_submit
node_webapp -.->|"routes actions"| node_list

click node_submit "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/RequestAction.java"
click node_list "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/ListRequestAction.java"
click node_countries "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/ListCountryAction.java"
click node_factory "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/DaoFactory.java"
click node_service "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/IDaoService.java"
click node_record "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/models/Request.java"
click node_dao "https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java"
click node_json "https://github.com/josesanchezr/struts2-project/blob/master/src/main/resources/data/file.json"

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_submit,node_list,node_countries,node_user toneBlue
class node_factory,node_service,node_record toneAmber
class node_dao,node_json toneMint
class node_webapp toneIndigo
```

## Components

### Web actions

- [Submit request](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/RequestAction.java): `src/main/java/com/empresa/struts/actions/RequestAction.java`
- [List requests](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/ListRequestAction.java): `src/main/java/com/empresa/struts/actions/ListRequestAction.java`
- [Country choices](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/actions/ListCountryAction.java): `src/main/java/com/empresa/struts/actions/ListCountryAction.java`

### Request data

- [DAO factory](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/DaoFactory.java): `src/main/java/com/empresa/struts/dao/DaoFactory.java`
- [DAO contract](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/IDaoService.java): `src/main/java/com/empresa/struts/dao/IDaoService.java`
- [Request record](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/models/Request.java): `src/main/java/com/empresa/struts/models/Request.java`

### File persistence

- [JSON DAO](https://github.com/josesanchezr/struts2-project/blob/master/src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java): `src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java`
- [Request JSON](https://github.com/josesanchezr/struts2-project/blob/master/src/main/resources/data/file.json): `src/main/resources/data/file.json`

### Other components

- **Web user**
- **Struts web app**

## Connections

- Web user → Submit request: submits form (evidence: `README.MD`)
- Submit request → DAO factory: gets DAO (evidence: `src/main/java/com/empresa/struts/actions/RequestAction.java`)
- Submit request → DAO contract: checks and saves (evidence: `src/main/java/com/empresa/struts/actions/RequestAction.java`)
- Submit request → Request record: validates fields (evidence: `src/main/java/com/empresa/struts/actions/RequestAction.java`)
- List requests → DAO factory: gets DAO (evidence: `src/main/java/com/empresa/struts/actions/ListRequestAction.java`)
- List requests → DAO contract: loads requests (evidence: `src/main/java/com/empresa/struts/actions/ListRequestAction.java`)
- DAO factory → JSON DAO: registers implementation (evidence: `src/main/java/com/empresa/struts/dao/DaoFactory.java`)
- JSON DAO → DAO contract: implements (evidence: `src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java`)
- JSON DAO → Request record: serializes records (evidence: `src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java`)
- JSON DAO → Request JSON: reads and writes (evidence: `src/main/java/com/empresa/struts/dao/file/DaoRequestImpl.java`)
- Web user → List requests: requests listing (evidence: `README.MD`)
- Web user → Country choices: requests choices
- Struts web app → Submit request: routes actions
- Struts web app → List requests: routes actions
