# Business Logic — JBSbatKKRsvTokiHak.getInsertTokiDataInfo() [85 LOC]

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

## 1. Role

### JBSbatKKRsvTokiHak.getInsertTokiDataInfo()

This method is responsible for assigning the correct toki (start/end date) values to a return map based on the **SOD (Service Order Data) issuance type** and the **transfer toki registration code**. In the context of NTT Oce's telecom service contract processing, "toki" (時期) refers to timing or effective date fields that determine when a service change takes effect or ceases. The method acts as a **routing/dispatch utility** within the batch service layer, translating high-level business codes into concrete date assignments for the `eo光電話` (eo Fiber Phone) service contract details entity.

It handles three SOD issuance types: **Start SOD issuance** (code "1"), **End SOD issuance** (code "2"), and **No SOD issuance** (code "0"). For each SOD type, it further branches by the transfer toki registration code to distinguish between transfers to a new provider (移転先登録) versus transfers from a terminated/paused service (移転元解約・休止). When the SOD type is "Start" or "No SOD," it sets the start date (operation date). When "End," it sets the end date. For "No SOD" transfers, it sets both start and end dates, effectively compressing the service window. The method never performs any database writes — it is a pure data transformer, reading from input maps and the service contract details map, then returning a date info map for downstream use.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getInsertTokiDataInfo"])
    INIT["Initialize rtnDateInfoMap with values from svkeiuwEohTelMap"]
    GET["Extract sodHakSbtCd and itntokiAddCd from inMap"]
    CHECK_STA{"SOD_HAK_SBT_CD equals STA"}
    CHECK_END{"SOD_HAK_SBT_CD equals END"}
    CHECK_NONE{"SOD_HAK_SBT_CD equals NONE"}
    CHECK_ITENS_1{"ITNTOKI_ADD_CD equals ITENS"}
    CHECK_ITENS_2{"ITNTOKI_ADD_CD equals ITENS"}
    CHECK_ITENS_3{"ITNTOKI_ADD_CD equals ITENS"}
    SET_ITENS_STA["Set ITENS_OPAF_TOKI_STA_YMD to trnOpeDate"]
    SET_DSL_STA["Set DSL_PAUSE_TOKI_STA_YMD to trnOpeDate"]
    SET_ITENS_END["Set ITENS_OPAF_TOKI_END_YMD to trnOpeDate"]
    SET_DSL_END["Set DSL_PAUSE_TOKI_END_YMD to trnOpeDate"]
    SET_ITENS_NONE_1["Set ITENS_OPAF_TOKI_STA_YMD to trnOpeDate"]
    SET_ITENS_NONE_2["Set ITENS_OPAF_TOKI_END_YMD to trnOpeDate"]
    SET_DSL_NONE["Set DSL_PAUSE_TOKI_STA_YMD to trnOpeDate"]
    SET_DSL_NONE_2["Set DSL_PAUSE_TOKI_END_YMD to trnOpeDate"]
    NOOP["No-op - no condition matched"]
    RETURN["Return rtnDateInfoMap"]

    START --> INIT
    INIT --> GET
    GET --> CHECK_STA
    CHECK_STA -->|STA = 1| CHECK_ITENS_1
    CHECK_STA -->|false| CHECK_END
    CHECK_END -->|END = 2| CHECK_ITENS_2
    CHECK_END -->|false| CHECK_NONE
    CHECK_NONE -->|NONE = 0| CHECK_ITENS_3
    CHECK_NONE -->|else| NOOP

    CHECK_ITENS_1 -->|ITENS = 1| SET_ITENS_STA
    CHECK_ITENS_1 -->|else| SET_DSL_STA
    CHECK_ITENS_2 -->|ITENS = 1| SET_ITENS_END
    CHECK_ITENS_2 -->|else| SET_DSL_END
    CHECK_ITENS_3 -->|ITENS = 1| SET_ITENS_NONE_1
    CHECK_ITENS_3 -->|else| SET_DSL_NONE

    SET_ITENS_STA --> RETURN
    SET_DSL_STA --> RETURN
    SET_ITENS_END --> RETURN
    SET_DSL_END --> RETURN
    SET_ITENS_NONE_1 --> SET_ITENS_NONE_2
    SET_ITENS_NONE_2 --> RETURN
    SET_DSL_NONE --> SET_DSL_NONE_2
    SET_DSL_NONE_2 --> RETURN
    NOOP --> RETURN
```

**Step-by-step processing:**

1. **Initialize rtnDateInfoMap:** A new `HashMap<String, String>` is created to hold the result date information.

2. **Read service contract details dates from `svkeiuwEohTelMap`:** The method retrieves four date fields from the service contract details map for `eo光電話` (eo Fiber Phone): `DSL_PAUSE_TOKI_STA_YMD` (termination/pause toki start date), `DSL_PAUSE_TOKI_END_YMD` (termination/pause toki end date), `ITENS_OPAF_TOKI_STA_YMD` (start date after transfer-to opening), and `ITENS_OPAF_TOKI_END_YMD` (end date after transfer-to opening). These defaults are placed into the return map.

3. **Extract SOD issuance type and transfer registration code:** Two values are read from the input message map (`inMap`): `sodHakSbtCd` (SOD issuance sub-type code) and `itntokiAddCd` (transfer toki addition code). Both are trimmed via `JBSbatInterface.trim()`.

4. **Branch on SOD issuance type:**
   - **STA = "1" (Start SOD issuance):** Sets the start date. If transfer registration code is ITENS ("1"), sets `ITENS_OPAF_TOKI_STA_YMD`. Otherwise (transfer-from termination/pause), sets `DSL_PAUSE_TOKI_STA_YMD`.
   - **END = "2" (End SOD issuance):** Sets the end date. If transfer registration code is ITENS ("1"), sets `ITENS_OPAF_TOKI_END_YMD`. Otherwise, sets `DSL_PAUSE_TOKI_END_YMD`.
   - **NONE = "0" (No SOD issuance):** Sets both start and end dates simultaneously. If transfer registration code is ITENS ("1"), sets both `ITENS_OPAF_TOKI_STA_YMD` and `ITENS_OPAF_TOKI_END_YMD` to the operation date. Otherwise, sets both `DSL_PAUSE_TOKI_STA_YMD` and `DSL_PAUSE_TOKI_END_YMD`.
   - **Else (unrecognized code):** No-op — the map retains only the default values from the service contract details.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message map carrying the SOD issuance sub-type code (`SOD_HAK_SBT_CD`) and the transfer toki addition code (`ITNTOKI_ADD_CD`). These two codes together determine which toki (timing) fields should be overwritten with the current operation date. |
| 2 | `svkeiuwEohTelMap` | `JBSbatCommonDBInterface` | Service contract details map for `eo光電話` (eo Fiber Phone). Provides the default date values (termination/pause start/end dates and transfer-to start/end dates) that are initially placed into the return map before any overrides are applied. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `trnOpeDate` | `String` | Processing operation date — the current batch run date, used as the value to assign to toki fields. Originally set from `super.onlineOpeDate` (thread-level operation date). |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatInterface.trim` | JBSbatInterface | - | Utility — trims whitespace from string values extracted from the input map |
| - | `JZMBatCommon.trim` | JZMBatCommon | - | Utility — trims whitespace (standard string utility call) |
| R | `JBSbatFUCaseFileRnkData.getString` | JBSbatFUCaseFileRnkData | - | Reads a string field from the FU case file rank data |
| R | `JBSbatFUMoveNaviData.getString` | JBSbatFUMoveNaviData | - | Reads a string field from the move navigation data |
| - | `JBSbatKKBmpKaihkPrdChokNoDel.trim` | JBSbatKKBmpKaihkPrdChokNoDel | - | Utility — trims whitespace from backup execution product checkout deletion data |
| - | `JBSbatKKSodSendReqBase.trim` | JBSbatKKSodSendReqBase | - | Utility — trims whitespace from SOD send request base data |
| - | `JBSbatKKTchishoDelete.trim` | JBSbatKKTchishoDelete | - | Utility — trims whitespace from branch office deletion data |
| R | `JBSbatZMAdDataSet.getString` | JBSbatZMAdDataSet | - | Reads a string field from the ZM advertisement data set |
| R | `JESC0101B010TPMA.getString` | JESC0101B010TPMA | - | Reads a string field from the EOC customer 0101 B010 TPM A |
| R | `JESC0101B020TPMA.getString` | JESC0101B020TPMA | - | Reads a string field from the EOC customer 0101 B020 TPM A |

**Analysis of this method's own calls:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `inMap.getString(JBSbatKKIFM112.SOD_HAK_SBT_CD)` | - | - | Reads the SOD issuance sub-type code from the input message map |
| R | `inMap.getString(JBSbatKKIFM112.ITNTOKI_ADD_CD)` | - | - | Reads the transfer toki addition code from the input message map |
| R | `svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_STA_YMD)` | - | KK_T_SVKEIUW_EOH_TEL | Reads the termination/pause toki start date (年月日) from the service contract details entity |
| R | `svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_END_YMD)` | - | KK_T_SVKEIUW_EOH_TEL | Reads the termination/pause toki end date (年月日) from the service contract details entity |
| R | `svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_STA_YMD)` | - | KK_T_SVKEIUW_EOH_TEL | Reads the transfer-to start date (年月日) from the service contract details entity |
| R | `svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_END_YMD)` | - | KK_T_SVKEIUW_EOH_TEL | Reads the transfer-to end date (年月日) from the service contract details entity |
| - | `JBSbatInterface.trim(String)` | JBSbatInterface | - | Utility — trims whitespace from extracted string values |
| R | `JBSbatKKIFM112.SOD_HAK_SBT_CD` | - | - | Interface constant — input field key for SOD issuance sub-type code |
| R | `JBSbatKKIFM112.ITNTOKI_ADD_CD` | - | - | Interface constant — input field key for transfer toki addition code |
| R | `JBSbatKK_T_SVKEIUW_EOH_TEL.*_YMD` | - | KK_T_SVKEIUW_EOH_TEL | Entity constants — field keys for the four toki (timing) date fields in the service contract details table |

**Note:** This method performs **no database writes or direct DB operations**. All `getString` calls are reads from in-memory map objects that wrap database entity data (`svkeiuwEohTelMap`) and input message data (`inMap`). The `KK_T_SVKEIUW_EOH_TEL` is the service contract details for `eo光電話` entity/table.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `getString` [R], `getString` [R], `getString` [R], `getString` [R], `trim` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JBSbatKKRsvTokiHak.insertSvkeiuwEohTel()` | `insertSvkeiuwEohTel()` → `getInsertTokiDataInfo(inMap, svkeiuwEohTelMap)` | `getString [R] KK_T_SVKEIUW_EOH_TEL (DSL_PAUSE_TOKI_STA_YMD, DSL_PAUSE_TOKI_END_YMD, ITENS_OPAF_TOKI_STA_YMD, ITENS_OPAF_TOKI_END_YMD)` |

**Note:** The caller `insertSvkeiuwEohTel()` resides in the same class `JBSbatKKRsvTokiHak`. It is a batch service method handling `eo光電話` (eo Fiber Phone) service contract insertion/registration. No further screen or batch entry point could be traced within 8 hops of the call graph.

## 6. Per-Branch Detail Blocks

### Block 1 — SET (Initialize return map) (L2568)

> Creates the return map and initializes it with default date values from the service contract details.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap = new HashMap<String, String>()` |
| 2 | SET | `dslPauseTokiStaYmd = svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_STA_YMD)` — termination/pause toki start date (年月日) |
| 3 | SET | `dslPauseTokiEndYmd = svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_END_YMD)` — termination/pause toki end date (年月日) |
| 4 | SET | `itensOpafTokiStaYmd = svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_STA_YMD)` — transfer-to start date (年月日) |
| 5 | SET | `itensOpafTokiEndYmd = svkeiuwEohTelMap.getString(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_END_YMD)` — transfer-to end date (年月日) |
| 6 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_STA_YMD, dslPauseTokiStaYmd)` |
| 7 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_END_YMD, dslPauseTokiEndYmd)` |
| 8 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_STA_YMD, itensOpafTokiStaYmd)` |
| 9 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_END_YMD, itensOpafTokiEndYmd)` |

### Block 2 — SET (Extract input values) (L2579-L2580)

> Reads the two routing codes from the input message map and trims whitespace.

| # | Type | Code |
|---|------|------|
| 1 | SET | `sodHakSbtCd = JBSbatInterface.trim(inMap.getString(JBSbatKKIFM112.SOD_HAK_SBT_CD))` [→ extracts SOD issuance sub-type code] |
| 2 | SET | `itntokiAddCd = JBSbatInterface.trim(inMap.getString(JBSbatKKIFM112.ITNTOKI_ADD_CD))` [→ extracts transfer toki addition code] |

### Block 3 — IF (SOD issuance type = Start) `[SOD_HAK_SBT_CD_STA = "1"]` (L2583)

> When the SOD issuance sub-type code is "1" (Start SOD issuance), set the **start date** field.

#### Block 3.1 — IF-ELSE-IF (Transfer registration code = ITENS) `[JKKBatConst.ITNTOKI_ADD_CD_ITENS = "1"]` (L2585)

> When the transfer registration code is "1" (transfer-to registration: 移転先登録によるトーキ), set the transfer-to start date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_STA_YMD, trnOpeDate)` — Set transfer-to start date to operation date |

#### Block 3.2 — ELSE (Transfer registration code != ITENS) (L2592)

> When the transfer registration code is "2" or "3" (transfer-from termination/pause: 移転元解約・休止によるトーキ), set the termination/pause start date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_STA_YMD, trnOpeDate)` — Set termination/pause start date to operation date |

### Block 4 — ELSE-IF (SOD issuance type = End) `[SOD_HAK_SBT_CD_END = "2"]` (L2606)

> When the SOD issuance sub-type code is "2" (End SOD issuance), set the **end date** field.

#### Block 4.1 — IF-ELSE-IF (Transfer registration code = ITENS) `[JKKBatConst.ITNTOKI_ADD_CD_ITENS = "1"]` (L2608)

> When the transfer registration code is "1" (transfer-to registration), set the transfer-to end date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_END_YMD, trnOpeDate)` — Set transfer-to end date to operation date |

#### Block 4.2 — ELSE (Transfer registration code != ITENS) (L2615)

> When the transfer registration code is "2" or "3" (transfer-from termination/pause), set the termination/pause end date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_END_YMD, trnOpeDate)` — Set termination/pause end date to operation date |

### Block 5 — ELSE-IF (SOD issuance type = None) `[SOD_HAK_SBT_CD_NONE = "0"]` (L2623)

> When the SOD issuance sub-type code is "0" (No SOD issuance), set **both start and end dates** simultaneously. This effectively sets the service window to a single point in time (same day).

#### Block 5.1 — IF-ELSE-IF (Transfer registration code = ITENS) `[JKKBatConst.ITNTOKI_ADD_CD_ITENS = "1"]` (L2625)

> When the transfer registration code is "1" (transfer-to registration), set both transfer-to start and end dates.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_STA_YMD, trnOpeDate)` — Set transfer-to start date to operation date |
| 2 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.ITENS_OPAF_TOKI_END_YMD, trnOpeDate)` — Set transfer-to end date to operation date |

#### Block 5.2 — ELSE (Transfer registration code != ITENS) (L2631)

> When the transfer registration code is "2" or "3" (transfer-from termination/pause), set both termination/pause start and end dates.

| # | Type | Code |
|---|------|------|
| 1 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_STA_YMD, trnOpeDate)` — Set termination/pause start date to operation date |
| 2 | SET | `rtnDateInfoMap.put(JBSbatKK_T_SVKEIUW_EOH_TEL.DSL_PAUSE_TOKI_END_YMD, trnOpeDate)` — Set termination/pause end date to operation date |

### Block 6 — ELSE (SOD issuance type unrecognized) (L2636)

> Catch-all for any SOD issuance sub-type code not matching "0", "1", or "2". No operation is performed — the return map retains only the default values from the service contract details.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | *(No-op — comment only: 処理しない(上記条件以外はない想定))* — Do nothing (assumed no other conditions) |

### Block 7 — RETURN (L2645)

> Returns the populated date information map.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return rtnDateInfoMap;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sodHakSbtCd` | Field | SOD issuance sub-type code — classifies the type of SOD (Service Order Data) issuance: "1"=Start, "2"=End, "0"=No SOD issuance |
| `itntokiAddCd` | Field | Transfer toki addition code — classifies the type of transfer toki registration: "1"=transfer-to registration (移転先登録), "2"=transfer-from termination (移転元解約), "3"=transfer-from pause (移転元休止) |
| `trnOpeDate` | Field | Processing operation date — the current batch run date, serves as the value assigned to toki fields |
| `SOD` | Acronym | Service Order Data — the service order document used in NTT Oce's telecom order fulfillment system |
| `SOD_HAK_SBT_CD` | Field | SOD issuance sub-type code — input field key identifying the SOD issuance type from the input message |
| `ITNTOKI_ADD_CD` | Field | Transfer toki addition code — input field key identifying the transfer toki registration type from the input message |
| `ITENS` | Business term | 移転先 (Iten-saki) — transfer to / destination of transfer. In NTT Oce's context, refers to the new service provider or destination when a customer transfers their phone number |
| `TOKI` (時期) | Field | Timing / effective date — refers to start and end date fields that control when service changes take effect or cease |
| `TOKI STA` (時期開始) | Field | Toki start date (年月日 / YYYY-MM-DD) — the effective start date for a service change |
| `TOKI END` (時期終了) | Field | Toki end date (年月日 / YYYY-MM-DD) — the effective end date for a service change |
| `DSL_PAUSE_TOKI_STA_YMD` | Field | Termination/pause toki start date — the date from which a termination or pause of the service contract takes effect |
| `DSL_PAUSE_TOKI_END_YMD` | Field | Termination/pause toki end date — the date until which a termination or pause of the service contract is valid |
| `ITENS_OPAF_TOKI_STA_YMD` | Field | Transfer-to start date — the date from which the service takes effect after transfer to the destination provider |
| `ITENS_OPAF_TOKI_END_YMD` | Field | Transfer-to end date — the date until which the service is valid after transfer to the destination provider |
| `eo光電話` | Business term | eo Fiber Phone — NTT Oce's bundled fiber-optic phone service product. The `KK_T_SVKEIUW_EOH_TEL` table stores service contract details for this product |
| `KK_T_SVKEIUW_EOH_TEL` | Entity | Service contract details table for eo Fiber Phone — the database entity storing contract line item dates and timing fields |
| `ST` / `END` / `NONE` | Constant | SOD issuance type classifications: ST (Start SOD issuance / 開始SOD発行), END (End SOD issuance / 終了SOD発行), NONE (No SOD issuance / SOD発行なし) |
| `JKKBatConst.ITNTOKI_ADD_CD_ITENS` | Constant | Transfer-to registration code — constant value "1", representing 移転先登録によるトーキ (toki registration by transfer-to) |
| `SOD_HAK_SBT_CD_STA` | Constant | SOD issuance sub-type code for Start = "1" (開始SOD発行) |
| `SOD_HAK_SBT_CD_END` | Constant | SOD issuance sub-type code for End = "2" (終了SOD発行) |
| `SOD_HAK_SBT_CD_NONE` | Constant | SOD issuance sub-type code for No SOD = "0" (SOD発行なし) |
