# Business Logic — JBSbatKKAdChgSmtvlRnki.initial() [22 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKAdChgSmtvlRnki` |
| Layer | Service (Batch Service Component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKAdChgSmtvlRnki.initial()

This method performs the **initialization routine** for the Smart Balance location-change-linked batch process (`JBSbatKKAdChgSmtvlRnki`), which is part of the K-Opticom customer backbone system's address change / service migration module. Its sole business responsibility is to prepare the batch processing context by invoking the common parameter setup from its parent class (`JBSbatBusinessService.setCommonInfo`), and then instantiating five `JBSbatSQLAccess` database access handlers, each wired to a specific database table required by this batch's main processing phase. The tables covered are: `KK_T_TAJGSWKEI_TGKEI` (Other-business-discount-contract-target-contracts), `KK_T_PRG` (Progress-tracking), `KK_T_SVC_KEI` (Service-contract — added in OM-2014-0002047), `KK_T_IDO_RSV` (Migration-reservation — added in ANK-2186-00-00 for home-to-meson move anomaly notifications to KDDI), and `KK_T_TAJGS_WRIB_KEI` (Other-business-discount-contract — added in OM-2014-00003664). This initialization is a **prerequisite setup step** executed by the orchestrator batch `JBSbatKKAdChgCstScreenKidou`, which chains multiple sub-processing units together; each sub-unit's `initial()` method runs in sequence to prepare its own DB access handles before the main `execute()` phase. The method follows a **delegation + factory pattern**: it delegates common context setup to the parent class and constructs per-table SQL access objects (factories) that will be reused during the batch's data fetch/update/insert operations.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    STEP1["setCommonInfo(commonItem)
// Set common parameters"]
    STEP2["db_KK_T_TAJGSWKEI_TGKEI
= new JBSbatSQLAccess()
// Other-business discount
// contract target contracts"]
    STEP3["db_KK_T_PRG
= new JBSbatSQLAccess()
// Progress tracking"]
    STEP4["db_KK_T_SVC_KEI
= new JBSbatSQLAccess()
// Service contract
// [OM-2014-0002047]"]
    STEP5["db_KK_T_IDO_RSV
= new JBSbatSQLAccess()
// Migration reservation
// [ANK-2186-00-00]"]
    STEP6["db_KK_T_TAJGS_WRIB_KEI
= new JBSbatSQLAccess()
// Other-business discount
// contract
// [OM-2014-00003664]"]
    END_NODE(["Return / Next"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> END_NODE
```

**Processing flow:**

1. **Common parameter setup** — Calls `super.setCommonInfo(commonItem)` to inherit operational context (operation date, batch user ID, system code, job ID, etc.) from the parent `JBSbatBusinessService`.
2. **DB Access Handler instantiation** — Sequentially creates five `JBSbatSQLAccess` instances, each bound to a specific table via its constant table name. These handlers are stored as private instance fields and reused during the batch's `execute()` phase for SELECT/INSERT/UPDATE operations.
3. No conditional branches exist in this method; all five DB access handlers are always initialized unconditionally.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter message — carries operational metadata including operation date (`opeDate`), online operation date (`onlineOpeDate`), batch user ID (`batchUserId`), system code (`systemCode`), job ID (`jobid`), log print control flag (`logPrint`), and free-item data. This object is the central data carrier shared across all batch sub-processes. |

**Instance fields read by the method:** None directly (only written to).

**Private instance fields written by the method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_TAJGSWKEI_TGKEI` | `JBSbatSQLAccess` | DB access handler for `KK_T_TAJGSWKEI_TGKEI` (Other-business-discount-contract-target-contracts table) |
| `db_KK_T_PRG` | `JBSbatSQLAccess` | DB access handler for `KK_T_PRG` (Progress-tracking table) |
| `db_KK_T_SVC_KEI` | `JBSbatSQLAccess` | DB access handler for `KK_T_SVC_KEI` (Service-contract table — OM-2014-0002047) |
| `db_KK_T_IDO_RSV` | `JBSbatSQLAccess` | DB access handler for `KK_T_IDO_RSV` (Migration-reservation table — ANK-2186-00-00) |
| `db_KK_T_TAJGS_WRIB_KEI` | `JBSbatSQLAccess` | DB access handler for `KK_T_TAJGS_WRIB_KEI` (Other-business-discount-contract table — OM-2014-00003664) |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatBusinessService.setCommonInfo` | - | - | Calls `setCommonInfo` in parent class `JBSbatBusinessService` to initialize common batch parameters (operation date, batch user ID, system code, job ID, etc.) |
| - | `JBSbatSQLAccess` constructor | - | `KK_T_TAJGSWKEI_TGKEI` | Instantiates SQL access handler for Other-business-discount-contract-target-contracts table |
| - | `JBSbatSQLAccess` constructor | - | `KK_T_PRG` | Instantiates SQL access handler for Progress-tracking table |
| - | `JBSbatSQLAccess` constructor | - | `KK_T_SVC_KEI` | Instantiates SQL access handler for Service-contract table (OM-2014-0002047 addition) |
| - | `JBSbatSQLAccess` constructor | - | `KK_T_IDO_RSV` | Instantiates SQL access handler for Migration-reservation table (ANK-2186-00-00 addition) |
| - | `JBSbatSQLAccess` constructor | - | `KK_T_TAJGS_WRIB_KEI` | Instantiates SQL access handler for Other-business-discount-contract table (OM-2014-00003664 addition) |

**Notes:** This method is purely an initialization/Setup-phase method. No actual CREATE/READ/UPDATE/DELETE operations occur here. The `JBSbatSQLAccess` constructors establish connection contexts and prepare statement handlers for later use in the batch's `execute()` phase.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKAdChgCstScreenKidou` | `JBSbatKKAdChgCstScreenKidou.initial(commonItem)` -> `execRunObjSmtvl.initial(commonItem)` | `db_KK_T_TAJGSWKEI_TGKEI [R] KK_T_TAJGSWKEI_TGKEI`<br>`db_KK_T_PRG [R] KK_T_PRG`<br>`db_KK_T_SVC_KEI [R] KK_T_SVC_KEI`<br>`db_KK_T_IDO_RSV [R] KK_T_IDO_RSV`<br>`db_KK_T_TAJGS_WRIB_KEI [R] KK_T_TAJGS_WRIB_KEI` |

**Caller details:**
- `JBSbatKKAdChgCstScreenKidou` is the orchestrator batch class for address-change/location-change processing. It instantiates `JBSbatKKAdChgSmtvlRnki` as the `execRunObjSmtvl` field (Smart-balance-linked update processing) and delegates both `initial()` and `execute()` phases to it.
- No other callers were found in the codebase.

## 6. Per-Branch Detail Blocks

**Block 1** — [EXEC] `setCommonInfo(commonItem)` (L149)

> Sets common batch parameters by delegating to the parent class. This establishes the operational context (operation date, batch user ID, system code, job ID, etc.) shared across all batch sub-processes.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem);` // Set common parameters from parent JBSbatBusinessService |

---

**Block 2** — [SET] `db_KK_T_TAJGSWKEI_TGKEI` instantiation (L152)

> Initializes SQL access handler for the Other-business-discount-contract-target-contracts table. Used for managing contracts eligible for third-party provider discounts.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_TAJGSWKEI_TGKEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_TAJGSWKEI_TGKEI);` // DB Access Class (Other-business discount contract target contracts) [-> D_TBL_NAME_KK_T_TAJGSWKEI_TGKEI = "KK_T_TAJGSWKEI_TGKEI"] |

---

**Block 3** — [SET] `db_KK_T_PRG` instantiation (L153)

> Initializes SQL access handler for the Progress-tracking table. Used to track batch processing progress.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_PRG = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_PRG);` // DB Access Class (Progress) [-> D_TBL_NAME_KK_T_PRG = "KK_T_PRG"] |

---

**Block 4** — [SET] `db_KK_T_SVC_KEI` instantiation (L156)

> Initializes SQL access handler for the Service-contract table. This handler was added in OM-2014-0002047 (2014/06/11, Hoshino) to support service-contract data access during the Smart Balance location-change batch process.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_SVC_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_SVC_KEI);` // DB Access Class (Service contract) [OM-2014-0002047 Hoshino ADD] [-> D_TBL_NAME_KK_T_SVC_KEI = "KK_T_SVC_KEI"] |

---

**Block 5** — [SET] `db_KK_T_IDO_RSV` instantiation (L159)

> Initializes SQL access handler for the Migration-reservation table. This handler was added in ANK-2186-00-00 (2014/07/18, Fujimoto) to send anomaly notifications to KDDI when customers move their residence between home and meson locations during the Smart Balance process.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_IDO_RSV = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_IDO_RSV);` // DB Access Class (Migration reservation) [ANK-2186-00-00 Send anomaly notification to KDDI when residence changes between home and meson 2014/07/18] [-> D_TBL_NAME_KK_T_IDO_RSV = "KK_T_IDO_RSV"] |

---

**Block 6** — [SET] `db_KK_T_TAJGS_WRIB_KEI` instantiation (L162)

> Initializes SQL access handler for the Other-business-discount-contract table. This handler was added in OM-2014-00003664 to support discount contract processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_TAJGS_WRIB_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_TAJGS_WRIB_KEI);` // DB Access Class (Other-business discount contract) [OM-2014-00003664] [-> D_TBL_NAME_KK_T_TAJGS_WRIB_KEI = "KK_T_TAJGS_WRIB_KEI"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `commonItem` | Parameter | Batch common parameter message — central data carrier holding operational metadata (operation date, batch user ID, system code, job ID, etc.) shared across all batch sub-processes |
| `JBSbatCommonItem` | Class | Batch common parameter item — framework-level object carrying batch-wide operational context |
| `JBSbatSQLAccess` | Class | Database SQL access handler — framework class providing SELECT/INSERT/UPDATE/DELETE operations against a specific database table |
| `setCommonInfo` | Method | Common parameter setup method in parent `JBSbatBusinessService` — initializes operational fields (operation date, batch user ID, system code, job ID, log print flag, etc.) |
| `KK_T_TAJGSWKEI_TGKEI` | Table | Other-business discount contract target contracts table — stores contracts that are targets for third-party provider discount applications |
| `KK_T_PRG` | Table | Progress tracking table — records batch processing progress status |
| `KK_T_SVC_KEI` | Table | Service contract table — core table storing service contract information (added for this batch in OM-2014-0002047) |
| `KK_T_IDO_RSV` | Table | Migration reservation table — stores migration reservation records for Smart Balance home-to-meson move anomaly notification to KDDI (added in ANK-2186-00-00) |
| `KK_T_TAJGS_WRIB_KEI` | Table | Other-business discount contract table — stores discount contract records for third-party provider services |
| TAJGS | Acronym | Other-business (他事業者) — refers to third-party service providers in K-Opticom's ecosystem |
| SWKEI | Acronym | Service detail (サービス種類) — service type/detail classification |
| TGKEI | Acronym | Target contract (対象契約) — contract that is a target of a specific operation |
| WRIB | Acronym | Writing/Registration (登録) — contract registration/discount application records |
| IDO | Acronym | Migration/Relocation (異動) — service migration or relocation between service types/lines |
| RESV | Acronym | Reservation — reserved/migrated state records |
| SVC_KEI | Acronym | Service type/detail (サービス種類) — service classification identifier |
| PRG | Acronym | Progress — batch processing progress tracking |
| Smart Balance | Business term | K-Opticom's Smart Balance service — a bundled telecom service offering that links multiple services (FTTH, phone, etc.) with discount benefits |
| Address Change (住所変更) | Business term | Customer residence change processing — the broader batch process that this Smart Balance-linked class supports |
| Home-to-meson move (ホーム->メゾン間での住変) | Business term | Customer relocation between home (single-family) and meson (apartment/building) housing types during Smart Balance service |
| ANK | Acronym | Issue tracking prefix — internal issue/bug ticket identifier (e.g., ANK-2186-00-00) |
| OM | Acronym | Issue tracking prefix — internal modification request ticket identifier (e.g., OM-2014-0002047) |
| K-Opticom | Business term | Japanese telecommunications provider — the domain of this customer backbone system |
| KK | Prefix | K-Opticom internal prefix — used in table names, SQL keys, and class names to denote K-Opticom-specific entities |
