# Business Logic — JBSbatKKAdChbCsChgFixBfDlRvCl.terminal() [9 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKAdChbCsChgFixBfDlRvCl` |
| Layer | Service (Business Service — extends `JBSbatBusinessService`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKAdChbCsChgFixBfDlRvCl.terminal()

The `terminal()` method serves as the **business service termination handler** for the Address Change – Course Change Confirmation Pre-Contract Cancellation batch service (`JBSbatKKAdChbCsChgFixBfDlRvCl`). Its sole responsibility is to release database resources acquired during the service lifecycle by closing the `db_KK_T_IDO_RSV` DB access object. This follows the standard resource cleanup pattern used across all business services in the K-Opticom customer core system: after `initial()` creates the `JBSbatSQLAccess` instance for the movement reservation table (`KK_T_IDO_RSV`) and `execute()` performs the primary processing (checking and updating movement reservation numbers), `terminal()` ensures the connection is properly shut down. The method is called automatically by the service framework at the end of the execute lifecycle and implements a deterministic teardown with no conditional branches, making it a pure cleanup utility that prevents resource leaks in long-running batch operations.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["terminal()"])
    CLOSE_DB["Close DB Access<br/>db_KK_T_IDO_RSV.close()"]
    END_NODE(["Return / Next"])

    START --> CLOSE_DB --> END_NODE
```

The method follows a single-path linear pattern. It does not contain any conditional branches, loops, or conditional method calls. The only operation is closing the `JBSbatSQLAccess` instance (`db_KK_T_IDO_RSV`) that was instantiated in `initial()`. This is the standard resource acquisition is initialization (RAII) pattern — the database access object is closed to release connection pool resources and clear any open cursors, ensuring the batch process does not leak connections back to the pool.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | - |

The method takes no parameters and returns `void`. It operates entirely on instance-level state:

| No | Field Name | Type | Business Description |
|----|-----------|------|---------------------|
| 1 | `db_KK_T_IDO_RSV` | `JBSbatSQLAccess` | Database access object for the `KK_T_IDO_RSV` (movement reservation) table. Created during `initial()`, closed here to release the connection. |
| 2 | `idoRsvList` | `ArrayList<String>` | Movement reservation number list — tracks which reservation numbers have already been processed to avoid duplicate updates. No access in `terminal()`. |
| 3 | `commonItem` | `JBSbatCommonItem` | Batch common parameter — inherited via `super.setCommonInfo()`. No access in `terminal()`. |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JACbatDataBnktUtil.close` | JACbatDataBnkt | - | Calls `close` in `JACbatDataBnktUtil` |
| - | `JACbatParamUtil.close` | JACbatParam | - | Calls `close` in `JACbatParamUtil` |
| - | `JACbatSchdlUtil.close` | JACbatSchdl | - | Calls `close` in `JACbatSchdlUtil` |
| - | `JBSbatCHChangeGroupKei.close` | JBSbatCHChangeGroupKei | - | Calls `close` in `JBSbatCHChangeGroupKei` |
| - | `JBSbatKKPrcIfCommon.close` | JBSbatKKPrcIfCommon | - | Calls `close` in `JBSbatKKPrcIfCommon` |

### Method calls within `terminal()`:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `db_KK_T_IDO_RSV.close` | - | - | Closes the `JBSbatSQLAccess` instance, releasing the database connection to the pool. No CRUD operation — this is connection teardown. |

The `close()` method on `JBSbatSQLAccess` is a framework-level resource cleanup call. It does not perform any Create, Read, Update, or Delete operation on data — it simply returns the database connection to the pool and releases any associated resources (prepared statements, cursors, buffers).

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKAdChbCsChgFixBfDlRvCl` | `execute()` (framework lifecycle) -> `terminal()` | `db_KK_T_IDO_RSV.close()` [Resource cleanup] |

This method is invoked by the K-Opticom business service framework as part of the standard execute lifecycle: `initial()` -> `execute()` -> `terminal()`. It is not called directly by any screen, CBS, or other service — the framework orchestrates the full lifecycle automatically. No callers were found in the codebase that directly reference `terminal()`.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXECUTE] `(terminal body — single linear path)` (L105–L113)

> The terminal method executes the sole operation: closing the DB access object for the movement reservation table. This is the standard resource cleanup step in the business service lifecycle.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `db_KK_T_IDO_RSV.close()` // Close DB access object — 業務サービス終了処理 (Business service termination processing) |

No nested blocks, conditional branches, loops, or additional method calls exist within this method. The processing path is a single linear execution of one resource cleanup operation.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_IDO_RSV` | Table | Movement Reservation Table — stores reservation records for service line movements (異動予約) during address/course change confirmations before pre-contract cancellation |
| `idoRsvNo` | Field | Movement Reservation Number — unique identifier for a movement reservation record |
| `idoRsvList` | Field | Movement Reservation Number List — tracks processed reservation numbers to prevent duplicate updates |
| Address Change | Business term |住所変更 — Customer address change processing, a core service modification in the telecom domain |
| Course Change | Business term | コース変更 — Customer service plan/course change processing |
| Pre-Contract Cancellation | Business term | 確定前解約予約 — Pre-contract cancellation reservation — customers who request to cancel service before the change confirmation takes effect |
| 異動予約 | Field | Movement Reservation — Japanese domain term for service line movement/cancellation reservation records |
| JBSbatSQLAccess | Class | Framework database access abstraction — manages connections, prepared statements, and query execution for a specific table |
| JBSbatBusinessService | Class | Base class for all business services — provides lifecycle management (`initial()`, `execute()`, `terminal()`) and common utilities |
| 業務サービス終了処理 | Javadoc | Business service termination processing — framework lifecycle callback for resource cleanup at service end |
