# Business Logic — JBSbatKKAdChbCsChgFixBfDlRvCl.initial() [14 LOC]

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

## 1. Role

### JBSbatKKAdChbCsChgFixBfDlRvCl.initial()

This method performs the **initialization routine** for the batch class `JBSbatKKAdChbCsChgFixBfDlRvCl`, which handles address-change course pre-cancellation of delivery reservation items (住所変更コース変更確定前解約予約取消部品 — the Japanese module description). In business terms, when a customer's address is being changed and there are associated delivery reservations that must be cancelled before the address change is finalized, this batch processes that pre-cancellation workflow. The `initial()` method is the entry point that prepares the batch for its main processing by setting up common batch parameters and initializing data structures. It implements the **delegation design pattern** by forwarding parameter setup to its superclass `JBSbatBusinessService.setCommonInfo()`, and the **factory pattern** by instantiating the database access object (`JBSbatSQLAccess`) configured for the `KK_T_IDO_RSV` (Reservations) table. As a batch-level service initializer, it prepares the internal state — specifically the reservation number list (`idoRsvList`) — that the `execute()` method will later populate and process. This method has no conditional branches; it executes a deterministic three-step setup sequence that is required before any business logic proceeds.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    STEP1["setCommonInfo(commonItem)"]
    STEP2["new JBSbatSQLAccess(KK_T_IDO_RSV)"]
    STEP3["idoRsvList = new ArrayList<String>()"]
    END_NODE(["Return / Next"])

    START --> STEP1
    START --> STEP2
    START --> STEP3
    STEP1 --> END_NODE
    STEP2 --> END_NODE
    STEP3 --> END_NODE
```

**Block Summary:** The method performs three sequential, unconditional setup operations with no branching logic:

1. **`setCommonInfo(commonItem)`** — Delegates to superclass `JBSbatBusinessService.setCommonInfo()`. This passes the batch common parameter document (`バッチ共通パラメータ電文`) up to the base batch service, which sets up shared batch context such as tenant info, processing date, batch ID, and other cross-cutting batch metadata.

2. **`db_KK_T_IDO_RSV = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_IDO_RSV)`** — Instantiates a new database access object for the `KK_T_IDO_RSV` (Reservations) table. The `D_TBL_NAME_KK_T_IDO_RSV` constant resolves to `"KK_T_IDO_RSV"`, which is the **Reservation Table** (予約テーブル). This SQL access object will be used during the main `execute()` method to read/write reservation data for cancellation processing.

3. **`idoRsvList = new ArrayList<String>()`** — Initializes an empty `ArrayList<String>` for the reservation number list (予約番号リスト). This instance field will be populated during execution with the list of delivery reservation numbers that need to be cancelled as part of the address change pre-cancellation workflow.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter document — carries the shared batch execution context including batch ID, processing date/time, user ID, tenant identifier, and other cross-cutting batch metadata required by all batch service components. This parameter is delegated to the superclass for standard batch setup. |
| 2 | `D_TBL_NAME_KK_T_IDO_RSV` | `String` (private static final) | Database table name constant resolving to `"KK_T_IDO_RSV"` — the Reservation Table (予約テーブル) that stores delivery reservation records associated with customer address changes. Used to configure the `JBSbatSQLAccess` object. |
| 3 | `idoRsvList` | `ArrayList<String>` (instance field) | Reservation number list (予約番号リスト) — holds the sequence of reservation identifiers to be processed during cancellation. Initialized as empty here and populated during main execution. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JBSbatBusinessService.setCommonInfo` | JBSbatBusinessService | JBSbatCommonItem (in-memory) | Sets common batch parameter context via superclass delegation. Updates internal batch state including tenant, date, and user metadata. |
| C | `new JBSbatSQLAccess(commonItem, "KK_T_IDO_RSV")` | JBSbatSQLAccess | KK_T_IDO_RSV (Reservations) | Creates a new SQL access handle for the Reservations table. Factory instantiation that prepares the database connection and table context for subsequent CRUD operations in the `execute()` phase. |
| C | `new ArrayList<String>()` | JBSbatStringUtil / Java StdLib | - (in-memory) | Creates a new empty in-memory list to hold reservation numbers (`idoRsvList`). Allocation, not a database operation. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKAdChbCsChgFixBfDlRvCl | `batchFrame.invoke()` -> `JBSbatKKAdChbCsChgFixBfDlRvCl.initial(commonItem)` | `setCommonInfo [U] JBSbatCommonItem`, `SQLAccess [C] KK_T_IDO_RSV`, `ArrayList [C] in-memory` |

**Notes:** This method is the `initial()` hook of a standalone batch class. It is called by the batch framework execution engine as the first phase before `execute()`. No external screen or CBS class directly invokes `initial()` — it is invoked exclusively by the batch runtime infrastructure through the standard batch execution lifecycle. The class `JBSbatKKAdChbCsChgFixBfDlRvCl` is only defined in its own file with no other references across the codebase, confirming it is an entry-point batch with no inter-batch dependency chain.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `(super.setCommonInfo(commonItem))` (L62)

> Sets common batch parameter context by delegating to the superclass `JBSbatBusinessService.setCommonInfo()`. This establishes the shared batch execution environment (tenant, date, user, etc.).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem)` // Delegate to superclass — set common batch parameter context (共通パラメータを設定します) |

**Block 2** — [SET] `(db_KK_T_IDO_RSV = new JBSbatSQLAccess(...))` (L64)

> Instantiates the database access object for the Reservations table. The table name constant `D_TBL_NAME_KK_T_IDO_RSV` resolves to `"KK_T_IDO_RSV"` (予約テーブル — Reservation Table). This SQL access handle is stored in the instance field and used during the main `execute()` method for CRUD operations on reservation data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_IDO_RSV = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_IDO_RSV)` // Generate DB access class (DBアクセスクラスを生成します), D_TBL_NAME_KK_T_IDO_RSV = "KK_T_IDO_RSV" (Reservation Table) |

**Block 3** — [SET] `(idoRsvList = new ArrayList<String>())` (L66)

> Initializes the reservation number list as an empty ArrayList. The instance field `idoRsvList` (予約番号リスト) will be populated during the main `execute()` method with reservation identifiers that need to be cancelled in the address-change pre-cancellation workflow.

| # | Type | Code |
|---|------|------|
| 1 | SET | `idoRsvList = new ArrayList<String>()` // Initialize reservation number list (予約番号リストを初期化) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `JBSbatKKAdChbCsChgFixBfDlRvCl` | Class Name | Address Change Course Change Pre-Cancellation Delivery Reservation Cancel Item — a batch service that processes cancellation of delivery reservations prior to finalizing a customer address change |
| `KK_T_IDO_RSV` | Table Name | Reservation Table (予約テーブル) — stores delivery reservation records (予約情報) associated with customer contracts, used for tracking reservations that must be cancelled during address changes |
| `idoRsv` | Field | Reservation (予約) — short for "ido" (異動, transfer/change) + "rsv" (reservation). Refers to reservation records that need to be cancelled |
| `idoRsvList` | Field | Reservation Number List (予約番号リスト) — in-memory list of reservation identifiers to be processed during cancellation |
| `JBSbatCommonItem` | Parameter | Batch Common Parameter Document (バッチ共通パラメータ電文) — carries shared batch execution metadata: batch ID, processing date, user ID, tenant, etc. |
| `JBSbatSQLAccess` | Class | Database SQL Access Class — framework class that encapsulates database connection and CRUD operations for a specific table |
| `setCommonInfo` | Method | Sets common batch parameter information (共通パラメータを設定) — base batch service method that configures shared batch context |
| `JBSbatBusinessService` | Class | Business Service Base Class — superclass providing common batch service lifecycle and parameter management |
| `initial` | Method | Initial Processing (初期処理) — batch initialization hook called before the main `execute()` method |
| `KK` | Prefix | Customer (顧客) — internal abbreviation for customer-related modules in the K-Opticom system |
| `AdCh` | Prefix | Address Change (住所変更) — abbreviation for address modification workflows |
| `ChgFix` | Prefix | Change Fix / Finalize (変更確定) — indicates operations performed before an address change is finalized |
| `Bf` | Prefix | Before (前) — indicates pre-operations |
| `DlRvCl` | Prefix | Delivery Reservation Cancel (配達予約取消) — indicates cancellation of delivery reservations |
| `SOD` | Acronym | Service Order Data — telecom order fulfillment entity (referenced in constant domain codes) |
| Batch | Domain | Scheduled automated program execution in the K-Opticom customer management system |
