# Business Logic — JBSbatKKAdHenkoHoyuDataChstu.initial() [27 LOC]

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

## 1. Role

### JBSbatKKAdHenkoHoyuDataChstu.initial()

This method serves as the **initialization entry point** for the "Change Target Address Data Inheritance" batch process. The batch extracts current address data from change-target address master records and copies (inherits) it into designated operational tables. In Japanese: `変更対象住所コードワークより対象テーブルから変更保有可能住所データ抽出クラス` — "A class that extracts changeable address data from target tables to change target address code work." The `initial` method prepares all database access layer (`JBSbatSQLAccess`) instances required for subsequent data extraction and insertion operations during the `execute` phase. It follows a **resource initialization pattern** — creating SQL access handles for every table involved in the address data migration workflow. This is a **shared utility method** in the batch processing lifecycle: it is the first method called in the batch execution chain, executed once before the main `execute` method iterates over customer records. The class itself was created in September 2012 (v1.00.00) by Tomifujitsuu and has been iteratively updated to support new service types including FTTH machine-provided services (v15.00.00, 2015), address consolidation (v19.00.00, 2015), disability support (v23.00.00, 2016), and dual-direction NANO support (v72.00.00, 2024 — ANK-4494-00-00).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    STEP1["Instantiate db_CHGTGAD_CD_WK
(KK_T_CHGTGAD_CD_WK)"]
    STEP2["Instantiate db_CHG_AD_JGRTWK
(KK_T_CHG_AD_JGRTWK)"]
    STEP3["Instantiate db_CK_T_CUST
(CK_T_CUST)"]
    STEP4["Instantiate db_CK_T_CUST_KOJIN
(CK_T_CUST_KOJIN)"]
    STEP5["Instantiate db_KK_T_SVKEIUW_EOH_TEL
(KK_T_SVKEIUW_EOH_TEL)"]
    STEP6["Instantiate db_KK_T_SVKEI_KAISEN_UW
(KK_T_SVKEI_KAISEN_UW)"]
    STEP7["Instantiate db_KK_T_KKTK_SVC_KEI
(KK_T_KKTK_SVC_KEI)"]
    STEP8["Instantiate db_KK_T_OPSVKEI_TV
(KK_T_OPSVKEI_TV)"]
    STEP9["Instantiate db_KK_T_SEIKY_KEI
(KK_T_SEIKY_KEI)"]
    STEP10["Instantiate db_TU_T_DNWACHOMSK_NYO
(TU_T_DNWACHOMSK_NYO)"]
    STEP11["Instantiate db_DK_T_HAISO
(DK_T_HAISO)"]
    STEP12["Instantiate db_KU_T_KOJIAK
(KU_T_KOJIAK)"]
    STEP13["Call super.setCommonInfo(commonItem)"]
    END_NODE(["Return / Next"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> STEP10
    STEP10 --> STEP11
    STEP11 --> STEP12
    STEP12 --> STEP13
    STEP13 --> END_NODE
```

The `initial` method has a **strictly linear flow** with no conditional branches, loops, or method dispatches beyond the final `setCommonInfo` delegation. Each step instantiates a `JBSbatSQLAccess` handle bound to a specific database table, creating the SQL execution context needed for the subsequent `execute` method's SELECT and INSERT operations.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter envelope — carries the shared batch context including database connection, batch execution date (`opeDate`), batch ID, user ID, log handler, and system-wide configuration used across all service components in this batch run |

**Instance fields initialized by this method:**

| Field | Type | Database Table |
|-------|------|----------------|
| `db_CHGTGAD_CD_WK` | `JBSbatSQLAccess` | `KK_T_CHGTGAD_CD_WK` — Change target address code work (temporary work table holding addresses scheduled for change) |
| `db_CHG_AD_JGRTWK` | `JBSbatSQLAccess` | `KK_T_CHG_AD_JGRTWK` — Change address inheritance work (temporary table receiving inherited address data) |
| `db_CK_T_CUST` | `JBSbatSQLAccess` | `CK_T_CUST` — Customer master (NTT contract holder address records) |
| `db_CK_T_CUST_KOJIN` | `JBSbatSQLAccess` | `CK_T_CUST_KOJIN` — Individual customer table (personal customer records) |
| `db_KK_T_SVKEIUW_EOH_TEL` | `JBSbatSQLAccess` | `KK_T_SVKEIUW_EOH_TEL` — Service detail work EOH telephone (telephone number data for service line items) |
| `db_KK_T_SVKEI_KAISEN_UW` | `JBSbatSQLAccess` | `KK_T_SVKEI_KAISEN_UW` — Service detail improvement work (service improvement/reform work records) |
| `db_KK_T_KKTK_SVC_KEI` | `JBSbatSQLAccess` | `KK_T_KKTK_SVC_KEI` — K-Opticom TK service detail (internal service contract line items) |
| `db_KK_T_OPSVKEI_TV` | `JBSbatSQLAccess` | `KK_T_OPSVKEI_TV` — Operation service detail TV (TV service operational records) |
| `db_KK_T_SEIKY_KEI` | `JBSbatSQLAccess` | `KK_T_SEIKY_KEI` — Billing detail (billing/charge line items) |
| `db_TU_T_DNWACHOMSK_NYO` | `JBSbatSQLAccess` | `TU_T_DNWACHOMSK_NYO` — Delivery notice check input (delivery notification delivery check records) |
| `db_DK_T_HAISO` | `JBSbatSQLAccess` | `DK_T_HAISO` — Delivery table (delivery/shipping records) |
| `db_KU_T_KOJIAK` | `JBSbatSQLAccess` | `KU_T_KOJIAK` — Individual account table (individual account holder records) |

**Note:** Two DB access instances were commented out as of v72.00.00 (ANK-4494-00-00): `db_TU_T_BMP_KOJI` and `db_TU_T_DOBANITEN` (removed for dual-direction NANO support refactoring).

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatBusinessService.setCommonInfo` | - | - | Delegates to parent batch service to set common parameters (batch context, connection, logging) into this service instance |

The `initial` method performs **zero CRUD operations**. It is purely a setup/initialization method that creates SQL access handles. All actual database operations (SELECT from customer tables, INSERT into change address work table) occur in the `execute` method which invokes `initial` first.

## 5. Dependency Trace

This method is part of a batch processing class hierarchy. The parent class `JBSbatBusinessService` defines the batch execution contract. Subclasses `JBSbatKKAdHenkoHoyuDataChstuOtr` (Outbound) and `JBSbatKKAdHenkoHoyuDataChstuMan` (Manual) each override `initial` with their own table access configurations.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKAdHenkoHoyuDataChstu` | `Batch entry -> JBSbatKKAdHenkoHoyuDataChstu.initial(commonItem)` | `setCommonInfo -> JBSbatBusinessService` |
| 2 | Batch: `JBSbatKKAdHenkoHoyuDataChstuOtr` | `Batch entry -> JBSbatKKAdHenkoHoyuDataChstuOtr.initial(commonItem)` | `setCommonInfo -> JBSbatBusinessService` |
| 3 | Batch: `JBSbatKKAdHenkoHoyuDataChstuMan` | `Batch entry -> JBSbatKKAdHenkoHoyuDataChstuMan.initial(commonItem)` | `setCommonInfo -> JBSbatBusinessService` |

**What this method calls:**

| # | Called Method | Type | Target Entity / Description |
|---|-------------|------|----------------------------|
| 1 | `new JBSbatSQLAccess(commonItem, tableName)` × 12 | SQL Access Factory | Creates database access handles for 12 tables |
| 2 | `super.setCommonInfo(commonItem)` | Parent delegate | Sets common batch parameters in parent class |

## 6. Per-Branch Detail Blocks

> This method has a linear control flow with no conditional branches or loops. Each block below represents a sequential processing step.

**Block 1** — [CONSTRUCTOR/ALLOCATION] `(db_CHGTGAD_CD_WK initialization) (L77)`

> Instantiates the SQL access handle for the change target address code work table — the source table holding addresses scheduled for change.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_CHGTGAD_CD_WK = new JBSbatSQLAccess(commonItem, "KK_T_CHGTGAD_CD_WK")` |

**Block 2** — [CONSTRUCTOR/ALLOCATION] `(db_CHG_AD_JGRTWK initialization) (L78)`

> Instantiates the SQL access handle for the change address inheritance work table — the target work table where address data will be copied/inserted.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_CHG_AD_JGRTWK = new JBSbatSQLAccess(commonItem, "KK_T_CHG_AD_JGRTWK")` |

**Block 3** — [CONSTRUCTOR/ALLOCATION] `(db_CK_T_CUST initialization) (L79)`

> Instantiates the SQL access handle for the customer master table — source of NTT contract holder address data queried during execute.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_CK_T_CUST = new JBSbatSQLAccess(commonItem, "CK_T_CUST")` |

**Block 4** — [CONSTRUCTOR/ALLOCATION] `(db_CK_T_CUST_KOJIN initialization) (L80)`

> Instantiates the SQL access handle for the individual customer table — stores personal customer records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_CK_T_CUST_KOJIN = new JBSbatSQLAccess(commonItem, "CK_T_CUST_KOJIN")` |

**Block 5** — [CONSTRUCTOR/ALLOCATION] `(db_KK_T_SVKEIUW_EOH_TEL initialization) (L81)`

> Instantiates the SQL access handle for the service detail work EOH telephone table — telephone number data for service line items.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_SVKEIUW_EOH_TEL = new JBSbatSQLAccess(commonItem, "KK_T_SVKEIUW_EOH_TEL")` |

**Block 6** — [CONSTRUCTOR/ALLOCATION] `(db_KK_T_SVKEI_KAISEN_UW initialization) (L82)`

> Instantiates the SQL access handle for the service detail improvement work table — service improvement/reform work records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_SVKEI_KAISEN_UW = new JBSbatSQLAccess(commonItem, "KK_T_SVKEI_KAISEN_UW")` |

**Block 7** — [CONSTRUCTOR/ALLOCATION] `(db_KK_T_KKTK_SVC_KEI initialization) (L83)`

> Instantiates the SQL access handle for the K-Opticom TK service detail table — internal service contract line item records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_KKTK_SVC_KEI = new JBSbatSQLAccess(commonItem, "KK_T_KKTK_SVC_KEI")` |

**Block 8** — [CONSTRUCTOR/ALLOCATION] `(db_KK_T_OPSVKEI_TV initialization) (L84)`

> Instantiates the SQL access handle for the operation service detail TV table — TV service operational records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_OPSVKEI_TV = new JBSbatSQLAccess(commonItem, "KK_T_OPSVKEI_TV")` |

**Block 9** — [CONSTRUCTOR/ALLOCATION] `(db_KK_T_SEIKY_KEI initialization) (L85)`

> Instantiates the SQL access handle for the billing detail table — billing/charge line item records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_SEIKY_KEI = new JBSbatSQLAccess(commonItem, "KK_T_SEIKY_KEI")` |

**Block 10** — [CONSTRUCTOR/ALLOCATION] `(db_TU_T_DNWACHOMSK_NYO initialization) (L91)`

> Instantiates the SQL access handle for the delivery notice check input table — delivery notification delivery check records. (Previously commented out tables `db_TU_T_BMP_KOJI` and `db_TU_T_DOBANITEN` were removed in v72.00.00.)

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_TU_T_DNWACHOMSK_NYO = new JBSbatSQLAccess(commonItem, "TU_T_DNWACHOMSK_NYO")` |

**Block 11** — [CONSTRUCTOR/ALLOCATION] `(db_DK_T_HAISO initialization) (L92)`

> Instantiates the SQL access handle for the delivery table — delivery/shipping records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_DK_T_HAISO = new JBSbatSQLAccess(commonItem, "DK_T_HAISO")` |

**Block 12** — [CONSTRUCTOR/ALLOCATION] `(db_KU_T_KOJIAK initialization) (L93)`

> Instantiates the SQL access handle for the individual account table — individual account holder records.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KU_T_KOJIAK = new JBSbatSQLAccess(commonItem, "KU_T_KOJIAK")` |

**Block 13** — [CALL] `(super.setCommonInfo delegation) (L96)`

> Delegates to the parent `JBSbatBusinessService.setCommonInfo` to register the common batch parameter envelope into the parent class context. This propagates the batch connection, user info, and log handler.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem)` // Set common batch parameters |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `CHGTGAD_CD` | Field | Change target address code — identifies address records that are scheduled for modification or migration |
| `AD_CD` | Field | Address code — unique identifier for a customer's registered address |
| `NEW_AD_CD` | Field | New address code — the replacement address code after address change |
| `OLD_AD_CD` | Field | Old address code — the former address code before modification |
| `CHG_AD_JGRTWK` | Field/Entity | Change address inheritance work — temporary work table receiving inherited address data |
| `CHG_AD_JGRTWK_NO` | Field | Change address inheritance work number — sequence-generated primary key for inheritance work records |
| `SVC_KEI_NO` | Field | Service detail number — internal tracking ID for service contract line items |
| `SVC_KEI` | Field | Service detail — service line item / service contract classification |
| `CK_T_CUST` | Entity | Customer master table — stores NTT contract holder (subscriber) address records |
| `KK_T_CHGTGAD_CD_WK` | Entity | Change target address code work — temporary work table holding addresses scheduled for change |
| `KK_T_CHG_AD_JGRTWK` | Entity | Change address inheritance work — temporary table where address data is copied during batch processing |
| `HENKO_ADD_CD_MI` | Constant | Change/addition code "not done" — indicates the address change has not yet been transferred to the historical table (`AD_TOHAIGO_TRN_STAT_CD = HENKO_ADD_CD_MI` means "transfer status: not transferred") |
| `SEQ_CHG_AD_JGRTWK_NO` | Constant | Sequence name — Oracle database sequence for generating change address inheritance work numbers |
| `CK0011` | Constant | Change target schema ID — identifier for the change address inheritance target schema |
| `KEISHA_AD_CD` | Field | Keisha (company/customer) address code — original address code used as the "old" reference for NTT contract holders |
| `CSSTI_SHS_AD_CD` | Field | Customer-specified delivery destination address code — delivery address designated by the customer, distinct from the registered address |
| `JKKBatConst.SEQ_KETA` | Constant | Sequence digit count — fixed number of digits for formatted sequence output |
| `JBSbatCommonItem` | Entity | Batch common parameter envelope — carries the shared batch context including DB connection, batch date, batch ID, user ID, and log handler |
| `JBSbatSQLAccess` | Class | SQL access layer — database abstraction wrapper that provides SELECT/INSERT/UPDATE/DELETE operations per table |
| `JBSbatBusinessService` | Class | Parent batch business service — defines the common batch execution lifecycle and provides `setCommonInfo` |
| `opeDate` | Field | Operation date — the batch execution date used as a filter in SQL queries |
| `JKKBatConst` | Class | K-Opticom batch constants — holds shared constant definitions including sequence settings and status codes |
| `JZMBatCommon` | Class | K-Opticom batch common utility — provides common batch processing utilities |
| `AD_TOHAIGO_TRN_STAT_CD` | Field | Address to historical table transfer status code — tracks whether address change data has been copied to the historical (after-change) table; `HENKO_ADD_CD_MI` means "not yet transferred" |
| `CHG_TG_SCHEMA_ID` | Field | Change target schema ID — identifies the schema/category of the change target |
| `CHG_TG_KMK_NM_EINM` | Field | Change target mark column name (EINM/English) — English name of the marked column in the change target |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| NANO | Business term | Dual-direction NANO — NTT West's fiber-to-premises service; ANK-4494-00-00 added support for bidirectional NANO |
| `CK_SELECT_040` | Constant | SQL define ID — queries NTT contract holder address data from customer master |
| `CK_SELECT_041` | Constant | SQL define ID — queries customer-specified delivery destination address data from customer master |
| K-Opticom | Business term | K-Opticom — Japanese telecommunications provider (K-Opticom Co., Ltd.) |
