# ellouzati-mohammed/can-m-java architecture

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

- Interactive diagram: https://gitdiagram.com/ellouzati-mohammed/can-m-java
- Repository: https://github.com/ellouzati-mohammed/can-m-java

## Overview

This is a small Java access-control application for managing event users, badges and secured zones. Its principal workflow is: the demo registers users and zones, issues validity-dated badges, then requests access; the service delegates authorization to the access controller, updates badge failure state and records each attempt. The service also supports badge management, access history and refusal/blocking reports. The graph reflects the demonstrated entry point and sampled calls; unsampled profile and interface implementations are represented only at their exact tree paths.

Main entry points: [`src/service/SecurityService.java`](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/service/SecurityService.java) (Security service), [`src/service/ControleAccess.java`](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/service/ControleAccess.java) (Access controller), [`src/model/Badge.java`](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Badge.java) (Badge), [`src/Main.java`](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Main.java) (Demo workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Demo workflow<br/>[Main.java]"]
end

subgraph group_services["Access services"]
  node_security["Security service"]
  node_control["Access controller"]
end

subgraph group_domain["Access domain"]
  node_badge["Badge<br/>[Badge.java]"]
  node_user["CAN user"]
  node_spectator["Spectator<br/>[Spectateur.java]"]
  node_staff["Staff<br/>[Staff.java]"]
  node_vip["VIP<br/>[VIP.java]"]
  node_zone["Secured zone<br/>[ZoneSecurisee.java]"]
  node_log["Access log<br/>[AccesLog.java]"]
end

subgraph group_contracts["Contracts and errors"]
  node_accreditable["Badge contract<br/>[Accreditable.java]"]
  node_securisable["Security contract<br/>[Securisable.java]"]
  node_exceptions["Domain exceptions"]
end

node_main -->|"registers and requests"| node_security
node_main -->|"creates zones"| node_zone
node_main -->|"creates user"| node_spectator
node_main -->|"creates user"| node_staff
node_main -->|"creates user"| node_vip
node_main -->|"uses issued badge"| node_badge
node_security -->|"delegates checks"| node_control
node_security -->|"issues and manages"| node_badge
node_security -->|"registers and assigns"| node_user
node_security -->|"registers and locates"| node_zone
node_security -->|"stores and reports"| node_log
node_security -->|"throws validation errors"| node_exceptions
node_control -->|"checks validity"| node_badge
node_control -->|"checks access level"| node_user
node_control -->|"checks required level"| node_zone
node_control -->|"creates attempt log"| node_log
node_control -->|"implements"| node_securisable
node_control -->|"rejects missing badge"| node_exceptions
node_badge -->|"implements"| node_accreditable
node_badge -->|"references holder"| node_user
node_user -->|"stores assigned badge"| node_badge
node_securisable -->|"accepts badge"| node_badge
node_securisable -->|"accepts zone"| node_zone

click node_main "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Main.java"
click node_security "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/service/SecurityService.java"
click node_control "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/service/ControleAccess.java"
click node_badge "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Badge.java"
click node_user "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/UtilisateurCAN.java"
click node_spectator "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Spectateur.java"
click node_staff "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Staff.java"
click node_vip "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/VIP.java"
click node_zone "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/ZoneSecurisee.java"
click node_log "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/AccesLog.java"
click node_accreditable "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Interface/Accreditable.java"
click node_securisable "https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Interface/Securisable.java"
click node_exceptions "https://github.com/ellouzati-mohammed/can-m-java/tree/main/src/Exception"

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 toneBlue
class node_security,node_control toneAmber
class node_badge,node_user,node_spectator,node_staff,node_vip,node_zone,node_log toneMint
class node_accreditable,node_securisable,node_exceptions toneRose
```

## Components

### Application

- [Demo workflow](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Main.java): `src/Main.java`

### Access services

- [Security service](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/service/SecurityService.java): `src/service/SecurityService.java`
- [Access controller](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/service/ControleAccess.java): `src/service/ControleAccess.java`

### Access domain

- [Badge](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Badge.java): `src/model/Badge.java`
- [CAN user](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/UtilisateurCAN.java): `src/model/UtilisateurCAN.java`
- [Spectator](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Spectateur.java): `src/model/Spectateur.java`
- [Staff](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/Staff.java): `src/model/Staff.java`
- [VIP](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/VIP.java): `src/model/VIP.java`
- [Secured zone](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/ZoneSecurisee.java): `src/model/ZoneSecurisee.java`
- [Access log](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/model/AccesLog.java): `src/model/AccesLog.java`

### Contracts and errors

- [Badge contract](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Interface/Accreditable.java): `src/Interface/Accreditable.java`
- [Security contract](https://github.com/ellouzati-mohammed/can-m-java/blob/main/src/Interface/Securisable.java): `src/Interface/Securisable.java`
- [Domain exceptions](https://github.com/ellouzati-mohammed/can-m-java/tree/main/src/Exception): `src/Exception`

## Connections

- Demo workflow → Security service: registers and requests (evidence: `src/Main.java`)
- Demo workflow → Secured zone: creates zones (evidence: `src/Main.java`)
- Demo workflow → Spectator: creates user (evidence: `src/Main.java`)
- Demo workflow → Staff: creates user (evidence: `src/Main.java`)
- Demo workflow → VIP: creates user (evidence: `src/Main.java`)
- Demo workflow → Badge: uses issued badge (evidence: `src/Main.java`)
- Security service → Access controller: delegates checks (evidence: `src/service/SecurityService.java`)
- Security service → Badge: issues and manages (evidence: `src/service/SecurityService.java`)
- Security service → CAN user: registers and assigns (evidence: `src/service/SecurityService.java`)
- Security service → Secured zone: registers and locates (evidence: `src/service/SecurityService.java`)
- Security service → Access log: stores and reports (evidence: `src/service/SecurityService.java`)
- Security service → Domain exceptions: throws validation errors (evidence: `src/service/SecurityService.java`)
- Access controller → Badge: checks validity (evidence: `src/service/ControleAccess.java`)
- Access controller → CAN user: checks access level (evidence: `src/service/ControleAccess.java`)
- Access controller → Secured zone: checks required level (evidence: `src/service/ControleAccess.java`)
- Access controller → Access log: creates attempt log (evidence: `src/service/ControleAccess.java`)
- Access controller → Security contract: implements (evidence: `src/service/ControleAccess.java`)
- Access controller → Domain exceptions: rejects missing badge (evidence: `src/service/ControleAccess.java`)
- Badge → Badge contract: implements (evidence: `src/model/Badge.java`)
- Badge → CAN user: references holder (evidence: `src/model/Badge.java`)
- CAN user → Badge: stores assigned badge (evidence: `src/model/UtilisateurCAN.java`)
- Security contract → Badge: accepts badge (evidence: `src/Interface/Securisable.java`)
- Security contract → Secured zone: accepts zone (evidence: `src/Interface/Securisable.java`)
