# Getting Started

## What This Project Does

Optage Mini Fixture is a Maven-based Java project (`com.optage.kopt`) that provides auto-generated fixture classes used for SPEC-SCOPED-WIKI documentation tests. It models a set of interconnected business-process components — batch jobs, contract processing, service control, and data-transfer objects — as a lightweight reference architecture.

## Recommended Reading Order

Read the wiki pages in this order to build a mental model of the codebase:

1. **Project Overview** — understand the high-level architecture and module boundaries.
2. **Business Process (`bp`)** — the central service layer that coordinates dispatch, validation, and sending logic.
3. **Batch Jobs (`batch`)** — the job execution layer that triggers downstream contract processing.
4. **Contract Processing (`ekk`)** — the domain logic for handling contracts and notifications.
5. **Data Objects (`dto`)** — the request/response payload shapes used across the project.
6. **Test Coverage** — review `JKKHakkoSODCCTest` to see how fixtures are exercised.

## Key Entry Points

These classes form the main execution paths and are the best places to start reading:

- **`JKKHakkoSODCC`** — the primary dispatcher. It delegates sending to `JKKSodSendCC` and validation to the batch layer `KKPRC14901`. Start here to understand the top-level flow.
- **`KKPRC14901`** — the leading batch processor. Its `run()` method triggers contract processing via `EKK0301A010`.
- **`EKK0301A010`** — handles contract processing logic and triggers notifications through `KKW0100B001`.
- **`JKKBpServiceBase`** — the base class for business-process services. Provides shared initialization (`baseInit()`).
- **`JKKHakkoSODHelper`** — a utility helper for string formatting used by the service layer.

## Project Structure

The source tree follows standard Maven conventions under `com/optage/kopt`:

```
src/
  main/java/com/optage/kopt/
    batch/   — Batch job entry points
    bp/      — Business process services and helpers
    dto/     — Data transfer objects (request/response)
    ekk/     — Contract processing logic
    esc/     — Service control components
    kkw/     — Batch trigger mechanisms
    unrelated/ — Isolated classes (no dependencies on other modules)
  test/java/com/optage/kopt/
    bp/      — Unit tests for business process layer
```

### Module Overview

| Package | Purpose | Key Classes |
|---------|---------|-------------|
| `batch` | Batch job processing and execution | `KKPRC14901`, `KKPRC24901`, `KKPRC34901` |
| `bp` | Business process services, dispatch, helpers | `JKKHakkoSODCC`, `JKKSodSendCC`, `JKKHakkoSODHelper` |
| `dto` | Request/response data shapes | `JKKSodRequestDTO`, `JKKSodResponseDTO` |
| `ekk` | Contract processing | `EKK0301A010`, `EKK0301A020` |
| `esc` | Service control | `ESC0101B001` |
| `kkw` | Batch trigger | `KKW0100B001` |
| `unrelated` | Standalone classes | `XYZ99999Unrelated` |

### Source Code Layout

```mermaid
flowchart TD
    B["bp / Business Process"]
    BDTO["dto / Data Transfer Objects"]
    BBA["batch / Batch Jobs"]
    BEK["ekk / Contract Processing"]
    BES["esc / Service Control"]
    BKK["kkw / Batch Trigger"]
    BUN["unrelated / Isolated Classes"]

    B --> BDTO
    B --> BBA
    B --> BEK
    B --> BES
    B --> BKK
    B --> BUN

    BDTO --> DR["JKKSodRequestDTO"]
    BDTO --> DRE["JKKSodResponseDTO"]
    BBA --> K14["KKPRC14901"]
    BBA --> K24["KKPRC24901"]
    BBA --> K34["KKPRC34901"]
    BEK --> E10["EKK0301A010"]
    BEK --> E20["EKK0301A020"]
    BES --> ESC1["ESC0101B001"]
    BKK --> KKW1["KKW0100B001"]
    BUN --> XYZ["XYZ99999Unrelated"]
```

## Configuration

The project uses a minimal Maven build with no external dependencies declared.

**`pom.xml`** — the sole configuration file. It declares:
- **GroupId**: `com.optage.kopt`
- **ArtifactId**: `optage-mini-fixture`
- **Version**: `1.0.0-SPEC-SCOPED-WIKI`
- **Packaging**: `jar`

No plugins, profiles, or dependency management are configured beyond the default Maven build lifecycle. Running `mvn package` will compile sources and produce a JAR.

## Common Patterns

### Class Naming Conventions

Classes follow a prefix-based naming scheme:
- **`JKK`** prefix — business process and helper classes (e.g., `JKKHakkoSODCC`, `JKKHakkoSODHelper`).
- **`KKPRC`** prefix — batch processing classes (e.g., `KKPRC14901`).
- **`EKK`** prefix — contract processing classes (e.g., `EKK0301A010`).
- **`ESC`** prefix — service control classes (e.g., `ESC0101B001`).
- **`KKW`** prefix — batch trigger classes (e.g., `KKW0100B001`).
- **`XYZ`** prefix — standalone, unrelated classes.

Suffixes like `CC` indicate a coordinator/controller class, `DTO` marks data transfer objects, and `Helper` denotes utility classes.

### Package-by-Component Structure

The codebase is organized by functional component rather than by layer. Each package is a self-contained vertical slice:
- The `bp` package contains both the service logic (`JKKHakkoSODCC`) and its collaborators (`JKKSodSendCC`, `JKKHakkoSODHelper`).
- Cross-module calls are explicit — a class instantiates and calls methods on classes in other packages directly (e.g., `JKKHakkoSODCC.dispatch()` creates a new `JKKSodSendCC()` and calls `send()`).

### Fixture Class Pattern

All classes are auto-generated fixtures for SPEC-SCOPED-WIKI tests. They follow a consistent pattern:
- A Javadoc comment identifying the class as a fixture: `JKKHakkoSODCC — auto-generated fixture class for SPEC-SCOPED-WIKI tests.`
- Minimal, focused methods with single-line or empty method bodies.
- Methods document their role in the comment (e.g., `/* SOD dispatch logic */`, `/* Contract processing */`).

### Test Organization

Tests mirror the main source structure:
- Tests live in `src/test/java/com/optage/kopt/<component>/`.
- Naming convention: `ClassNameTest.java` (e.g., `JKKHakkoSODCCTest`).
- Uses JUnit 4 — test methods are annotated with `@Test` and use `org.junit.Assert` static imports.

### Execution Flow Pattern

The primary execution path follows a cascade pattern:

```
JKKHakkoSODCC.dispatch()
    --> JKKSodSendCC.send()
KKKHakkoSODCC.validate()
    --> KKPRC14901.check()
KKPRC14901.run()
    --> EKK0301A010.process()
EKK0301A010.notify()
    --> KKW0100B001.trigger()
```

Each class instantiates its collaborator directly (no dependency injection), keeping the fixture classes self-contained and easy to trace.
