# Business Logic — JBSbatKKSodUpdInfCst.isDelayedZumi() [17 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSodUpdInfCst` |
| Layer | Service (Inferred from package path `eo.business.service`) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSodUpdInfCst.isDelayedZumi()

This method determines whether a given address change record (`inAdchgNo`) has already completed its delayed migration processing — specifically, whether the customer's service has been manually confirmed and the line has already been switched. It acts as a guard condition within the broader address-change update batch process, preventing re-processing of already-switched records and avoiding redundant or conflicting migration operations. The method delegates a primary-key lookup to `executeKK_T_ADCHG_PKSELECT()` to fetch the address change header row from the `KK_T_ADCHG` database table, then evaluates two status fields: the address change status (`ADCHG_STAT`) and the address switch way code (`AD_SWITCH_WAY_CD`). Only when the status equals `"003"` (manual confirmation completed) AND the switch way code equals `"1"` (line switch executed) does it return `true`. Otherwise, it returns `false` — indicating the record still requires processing or has not yet reached the switch-executed state. This method serves as an internal utility within the batch service class and is called by `JBSbatKKSodUpdInfCst.execute()`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isDelayedZumi(inAdchgNo)"])
    PK_QUERY["executeKK_T_ADCHG_PKSELECT(inAdchgNo)"]
    NULL_CHECK{"adchg != null?"}
    GET_STAT["adchgStat = adchg.getString(ADCHG_STAT)"]
    GET_SWITCH["adSwitchWayCd = adchg.getString(AD_SWITCH_WAY_CD)"]
    DUAL_CHECK{"adchgStat == '003' AND adSwitchWayCd == '1'?"}
    RETURN_TRUE["return true"]
    RETURN_FALSE["return false"]
    END_NODE(["Return / Next"])

    START --> PK_QUERY
    PK_QUERY --> NULL_CHECK
    NULL_CHECK -->|true| GET_STAT
    GET_STAT --> GET_SWITCH
    GET_SWITCH --> DUAL_CHECK
    DUAL_CHECK -->|true| RETURN_TRUE
    DUAL_CHECK -->|false| RETURN_FALSE
    RETURN_TRUE --> END_NODE
    NULL_CHECK -->|false| RETURN_FALSE
```

**CRITICAL — Constant Resolution:**

The method hardcodes literal string comparisons (not constant-referenced) for status values:

- `adchgStat == "003"` → Address change status `"003"` means **manual confirmation completed** (手動確定済). This indicates the customer or operator has manually confirmed the address change.
- `adSwitchWayCd == "1"` → Address switch way code `"1"` means **line switch executed** (回線切替済み). This indicates the physical/optical line has been switched to the new address.

Both conditions must be true simultaneously for the method to return `true`, meaning the address change has been fully completed with a manual confirmation and a line switch.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inAdchgNo` | `String` | Address change number — the unique identifier of an address change record in the `KK_T_ADCHG` table. Used as the primary key to look up the address change header row. |

**External state read by the method:**

| Source | Field / Method | Business Description |
|--------|---------------|---------------------|
| `db_KK_T_ADCHG` | `selectByPrimaryKeys(whereMap)` | Database accessor for the `KK_T_ADCHG` (Address Change Header) table. Used to retrieve the address change record by primary key. |
| `JBSbatCommonDBInterface` | `getString(columnName)` | Data interface method to extract string column values from the queried address change record. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_ADCHG_PKSELECT` | (internal helper) | `KK_T_ADCHG` | Primary-key SELECT from the Address Change Header table to retrieve the address change record by `ADCHG_NO` |
| R | `adchg.getString(JBSbatKK_T_ADCHG.ADCHG_STAT)` | (internal helper) | `KK_T_ADCHG` | Reads the address change status field (e.g., "003" = manual confirmation completed) |
| R | `adchg.getString(JBSbatKK_T_ADCHG.AD_SWITCH_WAY_CD)` | (internal helper) | `KK_T_ADCHG` | Reads the address switch way code field (e.g., "1" = line switch executed) |

### Detailed call analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_ADCHG_PKSELECT(Object[])` | (internal) | `KK_T_ADCHG` | Constructs a where-map with `ADCHG_NO` and performs `selectByPrimaryKeys` on `db_KK_T_ADCHG` to retrieve the address change header record |
| R | `adchg.getString(ADCHG_STAT)` | (internal) | `KK_T_ADCHG` | Reads the `ADCHG_STAT` column — status code indicating the state of the address change process |
| R | `adchg.getString(AD_SWITCH_WAY_CD)` | (internal) | `KK_T_ADCHG` | Reads the `AD_SWITCH_WAY_CD` column — code indicating whether and how the line has been switched to the new address |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatKKSodUpdInfCst.execute()` | `JBSbatKKSodUpdInfCst.execute()` → `JBSbatKKSodUpdInfCst.isDelayedZumi(inAdchgNo)` | `executeKK_T_ADCHG_PKSELECT [R] KK_T_ADCHG` |

**Caller Details:**

The method is called directly from `JBSbatKKSodUpdInfCst.execute()`, which is the batch entry point for processing address change updates. The batch process invokes `isDelayedZumi` to determine whether a given address change record has already completed its delayed migration, so it can skip or process the record accordingly.

**Terminal operations reached from this method:**

- `executeKK_T_ADCHG_PKSELECT` [R] `KK_T_ADCHG` — Primary-key SELECT from Address Change Header table
- `adchg.getString(ADCHG_STAT)` [R] `KK_T_ADCHG` — Read address change status field
- `adchg.getString(AD_SWITCH_WAY_CD)` [R] `KK_T_ADCHG` — Read address switch way code field

## 6. Per-Branch Detail Blocks

**Block 1** — [CALL] `(primary key lookup)` (L633)

> Queries the `KK_T_ADCHG` table for the address change record identified by the given address change number (`inAdchgNo`).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_ADCHG_PKSELECT(new String[]{inAdchgNo})` // Primary-key SELECT from KK_T_ADCHG table [-> KK_T_ADCHG] |
| 2 | SET | `JBSbatCommonDBInterface adchg = result` // Address change data interface holding the retrieved record |

**Block 2** — [IF-ELSE] `(adchg != null)` (L634)

> Checks whether a matching address change record was found. If not found, skips directly to returning `false`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if(adchg != null)` // Null-check on the retrieved address change record |

**Block 2.1** — [IF body] `(record exists)` (L635-637)

> The record exists — retrieve the status fields from the address change header.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String adchgStat = adchg.getString(JBSbatKK_T_ADCHG.ADCHG_STAT)` // Address change status field |
| 2 | SET | `String adSwitchWayCd = adchg.getString(JBSbatKK_T_ADCHG.AD_SWITCH_WAY_CD)` // Address switch way code field |

**Block 2.1.1** — [IF-ELSE] `(adchgStat == "003" AND adSwitchWayCd == "1")` (L638)

> `[ADCHG_STAT = "003"]` Manual confirmation completed `[AD_SWITCH_WAY_CD = "1"]` Line switch executed.
> Both conditions must hold: the address change has been manually confirmed AND the line switch has been executed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Address change delay processing is complete (手動確定済かつ回線切替済) |
| 2 | EXEC | `// else falls through to Block 3` |

**Block 3** — [ELSE-IF implicit] `(else — record null or conditions not met)` (L643)

> Either no address change record was found, or the record's status fields do not indicate both manual confirmation and line switch completion. The method returns `false`, meaning the delayed processing has not yet been completed.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false` // Delay processing not complete (not found, or not manually confirmed, or not switched) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ADCHG_NO` | Field | Address change number — primary key of the address change record, used to uniquely identify an address change transaction |
| `ADCHG_STAT` | Field | Address change status — status code indicating the current state of the address change process (e.g., "003" = manual confirmation completed) |
| `AD_SWITCH_WAY_CD` | Field | Address switch way code — indicates whether and how the line has been switched to the new address (e.g., "1" = line switch executed) |
| `KK_T_ADCHG` | Entity / Table | Address Change Header table — stores the main header information for address change transactions |
| `inAdchgNo` | Parameter | Address change number — the unique identifier used to look up an address change record |
| SOD | Acronym | Service Order Data — the broader system handling telecom service order fulfillment |
| Batch | Business term | Batch processing — non-interactive job that runs in the background to process large volumes of data (e.g., address changes) |
| Manual Confirmation (手動確定) | Business term | A status where the address change has been manually confirmed by an operator or customer, as opposed to automatic processing |
| Line Switch (回線切替) | Business term | The physical/optical line has been switched from the old address to the new address |
| Delayed Processing (遅延処理) | Business term | Postponed or deferred processing that may complete after the initial address change request; this method checks whether such delayed work is already done |
| PK | Acronym | Primary Key — used to uniquely identify a record in a database table |
| selectByPrimaryKeys | Method | Database accessor method that retrieves a record using its primary key columns |
| JBSbatCommonDBInterface | Class | Common database interface — generic data interface for accessing database records in a uniform way across the batch processing framework |
