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

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

## 1. Role

### JBSbatTUBmpHaishiSodHakTrn.initial()

This method performs the **initialization phase** of the Phone Number Disconnection Service Order (SOD) Issuance batch service. Specifically, it prepares the batch processing environment for handling service cancellation (disconnection) orders for NTT telephone numbers — in other words, it processes cases where a customer has disconnected their phone service and a corresponding Service Order Data (SOD) document must be generated for billing, accounting, or regulatory purposes.

The method extends the `JBSbatBusinessService` base class, which provides a standardized batch processing framework. It acts as the **entry point / initialization method** for the batch, following the Template Method design pattern — called automatically by the batch framework before the main `execute()` processing begins.

The initialization involves two key activities: (1) setting up common batch parameters (operation date, batch user ID, system code, log controller, job ID) by delegating to the parent class's `setCommonInfo()` method, and (2) instantiating three `JBSbatSQLAccess` objects that provide database access to the Service Contract Details table (`KK_T_SVC_KEI_UCWK`), the Service Contract Details for eo Light Phone table (`KK_T_SVKEIUW_EOH_TEL`), and the Phone Number master table (`ZM_M_TELNO`). These DB access objects are stored as instance fields and used by the subsequent `execute()` method to query service contract statuses and phone number data.

As a framework-managed entry point, this method is **not directly called by any screen or external caller** — it is invoked by the `JBSbatBusinessService` batch base class infrastructure when the batch job `TUSV0109` (Phone Number Disconnection SOD Issuance Processing) starts.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    STEP1["setCommonInfo(commonItem)
Set batch common parameters:
- operation date (opeDate)
- online operation date (onlineOpeDate)
- batch update user ID (batchUserId)
- system code (systemCode)
- log print controller (logPrint)
- job ID (jobid)
- free item (freeItem)
- common item reference (commonItem)
- set process ID on log print object"]
    STEP2["db_KK_T_SVC_KEI_UCWK = new JBSbatSQLAccess(commonItem,
    KK_T_SVC_KEI_UCWK)
Initialize DB access for Service Contract Details table"]
    STEP3["db_KK_T_SVKEIUW_EOH_TEL = new JBSbatSQLAccess(commonItem,
    KK_T_SVKEIUW_EOH_TEL)
Initialize DB access for Service Contract Details: eo Light Phone table"]
    STEP4["db_ZM_M_TELNO = new JBSbatSQLAccess(commonItem,
    ZM_M_TELNO)
Initialize DB access for Phone Number master table"]
    END_NODE(["Return void
(Initialization complete, proceed to execute())"])

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

**Processing Summary:**
The `initial()` method executes a linear sequence of setup operations with no conditional branches. It first delegates to the parent class to configure shared batch infrastructure, then creates three database access handles for the tables the batch will query during its main processing loop.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameters — carries shared batch context including the operation date (processing target date), batch user ID, system code, log print controller, job ID, and free item fields. This object is the central payload passed between all batch processing components. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `D_TBL_NAME_KK_T_SVC_KEI_UCWK` | `String` (static final) | Table name constant: `"KK_T_SVC_KEI_UCWK"` — Service Contract Details table containing service agreement status (e.g., `SVC_KEI_UCWK_STAT = "910"` for contracted/resolved) |
| `D_TBL_NAME_KK_T_SVKEIUW_EOH_TEL` | `String` (static final) | Table name constant: `"KK_T_SVKEIUW_EOH_TEL"` — Service Contract Details for eo Light Phone table (Fiber-To-The-Home service line) |
| `D_TBL_NAME_ZM_M_TELNO` | `String` (static final) | Table name constant: `"ZM_M_TELNO"` — Phone Number master table containing phone number registration and update timestamps |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JBSbatBusinessService.setCommonInfo` | - | - | Updates parent class instance fields with batch common parameters (operation date, user ID, system code, log controller, job ID) from `commonItem` |
| - | `new JBSbatSQLAccess(..., KK_T_SVC_KEI_UCWK)` | - | `KK_T_SVC_KEI_UCWK` | Creates DB access handle for Service Contract Details table (used for subsequent SELECT queries) |
| - | `new JBSbatSQLAccess(..., KK_T_SVKEIUW_EOH_TEL)` | - | `KK_T_SVKEIUW_EOH_TEL` | Creates DB access handle for Service Contract Details: eo Light Phone table (used for subsequent SELECT queries) |
| - | `new JBSbatSQLAccess(..., ZM_M_TELNO)` | - | `ZM_M_TELNO` | Creates DB access handle for Phone Number master table (used for subsequent SELECT queries) |

**Classification Notes:**
- The `setCommonInfo` call is classified as **U** (Update) because it writes batch context fields into the parent class instance.
- The `JBSbatSQLAccess` constructors are classified as **non-CRUD setup operations** — they instantiate framework objects that will later perform SELECT (R) queries during the `execute()` method. The tables referenced are:
  - `KK_T_SVC_KEI_UCWK` — queried for `SVC_KEI_UCWK_STAT` to check disconnection completion status (`"910"` = DSL resolution completed)
  - `KK_T_SVKEIUW_EOH_TEL` — queried for eo Light Phone service line data
  - `ZM_M_TELNO` — queried for phone number update timestamp (`UPD_DTM`)

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: TUSV0109 | `JBSbatBusinessService.batchProcess` -> `JBSbatTUBmpHaishiSodHakTrn.initial(commonItem)` | `setCommonInfo [U] -` ; `db_KK_T_SVC_KEI_UCWK [R] KK_T_SVC_KEI_UCWK` ; `db_KK_T_SVKEIUW_EOH_TEL [R] KK_T_SVKEIUW_EOH_TEL` ; `db_ZM_M_TELNO [R] ZM_M_TELNO` |

**Note:** This method is not called directly by any external screen or CBS component. It is an entry-point method managed by the `JBSbatBusinessService` batch framework infrastructure, invoked automatically when the batch job `TUSV0109` (identified by `USECASE_ID = "TUSV0109"`) is executed. The batch processes phone disconnection SOD issuance records, checking service contract status (`"910"` = DSL resolution completed), verifying service line existence, and invoking external service APIs for SOD creation.

## 6. Per-Branch Detail Blocks

> This method contains no conditional branches (no if/else, switch, or loops). It follows a single linear execution path.

### Block 1 — [CALL] `(parent method delegation)` (L122)

> Delegate to parent class `JBSbatBusinessService` to set up batch common parameters from the incoming `commonItem` object.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem)` // Set common parameters: operation date, online operation date, batch user ID, system code, log print controller, job ID, free item, common item reference |

### Block 2 — [CALL] `(DB access initialization)` (L126)

> Initialize the first database access handle for the Service Contract Details table (`KK_T_SVC_KEI_UCWK`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_SVC_KEI_UCWK = new JBSbatSQLAccess(commonItem, "KK_T_SVC_KEI_UCWK")` // DB access class (Service Contract Details) [-> D_TBL_NAME_KK_T_SVC_KEI_UCWK="KK_T_SVC_KEI_UCWK"] |

### Block 3 — [CALL] `(DB access initialization)` (L127)

> Initialize the second database access handle for the Service Contract Details: eo Light Phone table (`KK_T_SVKEIUW_EOH_TEL`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_KK_T_SVKEIUW_EOH_TEL = new JBSbatSQLAccess(commonItem, "KK_T_SVKEIUW_EOH_TEL")` // DB access class (Service Contract Details: eo Light Phone) [-> D_TBL_NAME_KK_T_SVKEIUW_EOH_TEL="KK_T_SVKEIUW_EOH_TEL"] |

### Block 4 — [CALL] `(DB access initialization)` (L128)

> Initialize the third database access handle for the Phone Number master table (`ZM_M_TELNO`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_ZM_M_TELNO = new JBSbatSQLAccess(commonItem, "ZM_M_TELNO")` // DB access class (Phone Number) [-> D_TBL_NAME_ZM_M_TELNO="ZM_M_TELNO"] |

### Block 5 — [RETURN] `(initialization complete)` (L130)

> Return control to the batch framework. The `JBSbatSQLAccess` instance fields are now populated and available for the `execute()` method to perform SELECT queries.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // End of initialization, proceed to execute() |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_SVC_KEI_UCWK` | Table | Service Contract Details — stores service contract line item records including status, used to determine if a contract has been resolved/canceled |
| `KK_T_SVKEIUW_EOH_TEL` | Table | Service Contract Details: eo Light Phone — stores service contract data specific to the eo Light Phone (fiber-optic) service line |
| `ZM_M_TELNO` | Table | Phone Number master table — stores phone number registration records including update timestamps (`UPD_DTM`) |
| `SVC_KEI_UCWK_STAT` | Field | Service contract status — indicates the current state of a service contract. Value `"910"` (from `SVC_KEI_UCWK_STAT_DSLZUMI`) means DSL resolution completed (disconnection finalized) |
| `SVC_KEI_UCWK_STAT_DSLZUMI` | Constant | DSL resolution completed status code — `"910"`; indicates the service contract has been fully resolved/canceled |
| `opeDate` | Field | Operation date — the business processing date used as a filter for DB queries |
| `batchUserId` | Field | Batch user ID — the ID of the batch job user performing updates |
| `USECASE_ID` | Constant | User case ID — `"TUSV0109"`; identifies this batch processing use case for external service API invocation |
| `TUSV0109` | Business term | Phone Number Disconnection SOD Issuance batch — the batch job that processes phone disconnection orders and generates Service Order Data |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity used for service provisioning and billing |
| SOD Issuance | Business term | Service Order Data generation — the process of creating and submitting a service order for a disconnection event |
| NTT | Business term | Nippon Telegraph and Telephone — the telephone service provider; refers to NTT telephone numbers being processed |
| DSLZUMI | Business term | Japanese: DSL済み (DSL Completed) — status indicating the DSL (service line) disconnection process has been completed |
| `KK` | Prefix | Korean/Japanese domain prefix — table prefix in this system indicating transactional data tables |
| `ZM` | Prefix | Master data prefix — table prefix indicating master/reference data tables |
| `TUBmp` | Prefix | Batch processing module identifier — part of the class naming convention indicating this is a batch processing component |
| `Haishi` | Business term | Japanese: 廃止 (Cancellation/Disconnection) — refers to service cancellation/disconnection processing |
| `Hakko` | Business term | Japanese: 発行 (Issuance) — refers to SOD document/service order issuance |
| `Trn` | Business term | Transaction — indicates this class handles transactional batch processing |
| `JBSbat` | Prefix | Java Batch framework — the enterprise batch processing framework used across the system |
| `JBSbatSQLAccess` | Class | SQL Access framework class — provides database query capabilities for batch processing |
| `JBSbatCommonItem` | Class | Batch common parameters item — carries shared batch context between all batch processing components |
| `JBSbatBusinessService` | Class | Base batch business service class — provides common batch processing infrastructure including `setCommonInfo`, logging, and error handling |
| `ETUB0620CE` | Code | Error code — error message key for "No record found in phone number table" (異常時のエラーコード) |
| `func_code` | Field | Function code — identifier for the operation type (value `"1"` = check and register / チェック＆登録) |
| `IDO_KNUB` | Constant | Disconnection section identifier — `"09001"`; identifies the disconnection section for tracking |
