# Business Logic — JBSbatKKSvkeiDelTgCst.setDelTrgtDataIn() [73 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSvkeiDelTgCst` |
| Layer | Service (Batch sub-layer — internet service variant) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSvkeiDelTgCst.setDelTrgtDataIn()

This method is the **internet-service variant of the deletion-target-data-setting processing** (消去対象データ設定処理 - "internet service"), responsible for preparing output records for ISP authentication ID deletion as part of a contract cancellation (消去 = deletion/cancellation) batch job. It reads service contract line-item records from the `KK_T_SVKEIUW_EOH_NET` table — which holds internet (EOH/EO-net) service contract details — and for each row, constructs a `JBSbatServiceInterfaceMap` carrying the deletion target payload. The method routes each record through `getDelTranSbt()` to determine whether a pending SOD (Service Order Data) exists; only records whose deletion process type resolves to `"3"` (SOD deletion + aging update) are emitted to the output bean via `addOutMapList()`. This implements a **routing/dispatch pattern**: the method iterates over all matching database rows, enriches each with context from the input map, applies a conditional filter based on the SOD issuance confirmation parameter, and produces a filtered output list for downstream processing. It plays the role of a **shared data-transformer** called by the class's `execute()` method during batch cancellation workflows, and is part of a family of parallel methods (e.g., `setDelTrgtDataADSL`, `setDelTrgtDataPPP`) that handle different access-layer service types (ADSL, PPP, Internet/EO-net).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setDelTrgtDataIn params"])

    START --> INIT["Initialize: outmap = null, nextRec = null"]

    INIT --> DB_EXEC["Execute: executeKK_T_SVKEIUW_EOH_NET_KK_SELECT_005"]

    DB_EXEC --> DB_QUERY["Query: db_KK_T_SVKEIUW_EOH_NET.selectNext"]

    DB_QUERY --> WHILE_CHECK{"nextRec is not null?"}

    WHILE_CHECK -->|No| WHILE_END(["End"])

    WHILE_CHECK -->|Yes| LOOP_START["Create: outmap = new JBSbatServiceInterfaceMap"]

    LOOP_START --> READ_DATA["Read data from inMap and nextRec"]

    READ_DATA --> READ_SVKEI["Set svkeiNo from inMap"]
    READ_DATA --> READ_SVKEIGAD["Set svkeiGadtm from inMap"]
    READ_DATA --> READ_SVKEIUW["Set svkeiuwNo from nextRec"]
    READ_DATA --> READ_SVKEIWGAD["Set svkeiuwGadtm from nextRec"]
    READ_DATA --> READ_ISP["Set ispNinshoId from nextRec"]

    READ_ISP --> HAKKO_CHECK{"tempHakkoParam is not null?"}

    HAKKO_CHECK -->|Yes| HAKKO_SET["Set HAKKO_PARAM values in tempHakkoParam"]

    HAKKO_CHECK -->|No| SET_DEL_TRAN

    HAKKO_SET --> SET_DEL_TRAN["Set deletion data in outmap"]

    SET_DEL_TRAN --> SET_DEL_TRAN_SBT["Set DEL_TRAN_SBT via getDelTranSbt"]

    SET_DEL_TRAN_SBT --> SET_DEL_TRGT_SBT["Set DEL_TRGT_SBT to 01"]

    SET_DEL_TRGT_SBT --> SET_OUTMAP_FIELDS["Set SVKEI_NO, SVKEI_GADTM in outmap"]

    SET_OUTMAP_FIELDS --> SET_OUTMAP_UWNO["Set SVKEIUW_NO, SVKEIUW_GADTM in outmap"]

    SET_OUTMAP_UWNO --> SET_OUTMAP_ISP["Set ISP_NINSHO_ID in outmap"]

    SET_OUTMAP_ISP --> SET_OUTFLG["Set outFlg to true"]

    SET_OUTFLG --> SOD_CHECK{"DEL_TRAN_SBT equals 3?"}

    SOD_CHECK -->|No| FETCH_NEXT

    SOD_CHECK -->|Yes| ADD_OUTPUT["outputBean.addOutMapList outmap"]

    ADD_OUTPUT --> FETCH_NEXT["nextRec = selectNext"]

    FETCH_NEXT --> WHILE_END
```

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `JBSbatKKConst.ORDER_SBT_CD_NET` | `"1"` | Order type code for Internet (EO-net) |
| `JBSbatKKConst.SVC_ORDER_CD_FTTH_NINSHO` | `"06"` | Service order code for FTTH authentication |
| `DEL_TRGT_SBT_ISP_NINSHO_ID` | `"01"` | Deletion target type: ISP Authentication ID |
| `DEL_TRAN_SBT_SOD_AGING_UPD` | `"3"` | Deletion process type: SOD deletion + aging update |
| `HAKKO_PARAM_IDX_SVKEI_NO` | `0` | Index in tempHakkoParam: service contract number |
| `HAKKO_PARAM_IDX_SVKEIUW_NO` | `1` | Index in tempHakkoParam: service contract detail number |
| `HAKKO_PARAM_IDX_SBT_CD` | `2` | Index in tempHakkoParam: order type code |
| `HAKKO_PARAM_IDX_SVC_ORDER_CD` | `3` | Index in tempHakkoParam: service order code |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message carrier containing the service contract number (`SVC_KEI_NO`) and service contract generation registration datetime (`GENE_ADD_DTM`). Represents the parent-level contract context from which deletion target data is derived. |
| 2 | `outputBean` | `JBSbatOutputItem` | Output container to which deletion target records (outmaps) are appended. Only records with `DEL_TRAN_SBT = "3"` (SOD deletion + aging update) are added. Acts as the collection point for downstream consumption. |
| 3 | `selectWhereParam` | `Object[]` | WHERE-clause parameters for the SQL query `KK_T_SVKEIUW_EOH_NET_KK_SELECT_005`. Used to filter service contract line-item records from the `KK_T_SVKEIUW_EOH_NET` table — typically based on batch key fields such as cancellation batch number, account key, and service contract number. |
| 4 | `tempHakkoParam` | `HashMap<Integer, String>` | Temporary map storing order issuance condition parameters. When not null, this method populates it with the service contract number, contract detail number, order type code ("1"), and service order code ("06" for FTTH auth). These parameters are then consumed by `getDelTranSbt()` to check for pending SOD issuance for this contract detail. |

**External state read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_SVKEIUW_EOH_NET` | `JBSbatSQLAccess` | Database access handler for the `KK_T_SVKEIUW_EOH_NET` table, initialized during class construction with the table name `"KK_T_SVKEIUW_EOH_NET"` |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatKKSvkeiDelTgCst.executeKK_T_SVKEIUW_EOH_NET_KK_SELECT_005` | - | `KK_T_SVKEIUW_EOH_NET` | Executes SQL query to fetch service contract line-item records (internet/EO-net) from `KK_T_SVKEIUW_EOH_NET` table |
| R | `db_KK_T_SVKEIUW_EOH_NET.selectNext` | - | `KK_T_SVKEIUW_EOH_NET` | Iterates over query result set row by row, returning the next record as `JBSbatCommonDBInterface` |
| R | `JBSbatKK_T_SVC_KEI.getString` | - | In-memory (inMap) | Reads `SVC_KEI_NO` (service contract number) from input message map |
| R | `JBSbatKK_T_SVC_KEI.getString` (GENE_ADD_DTM) | - | In-memory (inMap) | Reads `GENE_ADD_DTM` (service contract generation registration datetime) from input message map |
| R | `JBSbatKK_T_SVKEIUW_EOH_NET.getString` | - | In-memory (nextRec) | Reads `SVC_KEI_UCWK_NO` (service contract detail number) from database result row |
| R | `JBSbatKK_T_SVKEIUW_EOH_NET.getString` (GENE_ADD_DTM) | - | In-memory (nextRec) | Reads `GENE_ADD_DTM` (contract detail generation registration datetime) from database result row |
| R | `JBSbatKK_T_SVKEIUW_EOH_NET.getString` (ISP_NINSHO_ID) | - | In-memory (nextRec) | Reads `ISP_NINSHO_ID` (ISP authentication ID) from database result row |
| - | `JBSbatKKSvkeiDelTgCst.getDelTranSbt` | - | - | Determines deletion process type by checking for pending SOD issuance; returns `"1"` (SOD deletion) or `"3"` (SOD deletion + aging update) |
| - | `tempHakkoParam.put` | - | In-memory | Stores key-value pairs into the temporary parameter map for downstream SOD issuance confirmation |
| - | `JBSbatKKIFM160.setString` (DEL_TRAN_SBT) | - | Interface field | Sets deletion process type code in output interface map |
| - | `JBSbatKKIFM160.setString` (DEL_TRGT_SBT) | - | Interface field | Sets deletion target type code (`"01"` = ISP auth ID) in output interface map |
| - | `JBSbatKKIFM160.setString` (SVKEI_NO) | - | Interface field | Sets service contract number in output interface map |
| - | `JBSbatKKIFM160.setString` (SVKEI_GADTM) | - | Interface field | Sets service contract generation datetime in output interface map |
| - | `JBSbatKKIFM160.setString` (SVKEIUW_NO) | - | Interface field | Sets service contract detail number in output interface map |
| - | `JBSbatKKIFM160.setString` (SVKEIUW_GADTM) | - | Interface field | Sets service contract detail generation datetime in output interface map |
| - | `JBSbatKKIFM160.setString` (ISP_NINSHO_ID) | - | Interface field | Sets ISP authentication ID in output interface map |
| - | `outmap.setOutFlg` | - | Interface field | Marks the output record as valid/active for downstream consumption |
| C | `outputBean.addOutMapList` | - | - | Appends the prepared output map to the output item list (only when deletion type is `"3"`) |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKSvkeiDelTgCst | `JBSbatKKSvkeiDelTgCst.execute()` -> `setDelTrgtDataIn(inMap, outputBean, selectWhereParam, tempHakkoParam)` | `addOutMapList [C]`, `setOutFlg [-]`, `setString [-]` (x7), `getDelTranSbt [R]` |

**Terminal operations from this method:** `addOutMapList` [C], `setOutFlg` [-], `setString` [-] (7 instances), `getDelTranSbt` [R], `put` [-] (4 instances), `getString` [-] (6 instances)

## 6. Per-Branch Detail Blocks

### Block 1 — [INITIALIZATION] (L248)

> Initializes local variables before database access. The `outmap` variable was moved from class-level to local (L249) to avoid thread-safety issues when `outmap` is reused (IT1-2013-0000285).

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap = null;` // Output record (L249) |
| 2 | SET | `nextRec = null;` // Next database record (L253) |

### Block 2 — [CALL] (L258)

> Executes the SQL query to fetch service contract line-item records from the internet (EOH/EO-net) service contract detail table.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_SVKEIUW_EOH_NET_KK_SELECT_005(selectWhereParam);` // Query service contract detail [KK_T_SVKEIUW_EOH_NET] (L258) |

### Block 3 — [CALL] (L260)

> Fetches the first row from the query result set.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `nextRec = db_KK_T_SVKEIUW_EOH_NET.selectNext();` // Get first row from KK_T_SVKEIUW_EOH_NET (L260) |

### Block 4 — [WHILE LOOP] `(nextRec != null)` (L262)

> Iterates over each service contract line-item record. For each iteration, creates a fresh `outmap`, reads contract data, optionally sets SOD issuance parameters, constructs the deletion target output record, and conditionally emits it.

#### Block 4.1 — [INITIALIZATION] (L266)

> Creates a new output map for each row (moved from class-level initialization per IT1-2013-0000285).

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap = new JBSbatServiceInterfaceMap();` // Create output record (L266) |

#### Block 4.2 — [DATA EXTRACTION] (L267–L276)

> Reads service contract context from `inMap` and contract detail data from the current `nextRec` database row.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svkeiNo = inMap.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO);` // Service contract number (L267) |
| 2 | SET | `svkeiGadtm = inMap.getString(JBSbatKK_T_SVC_KEI.GENE_ADD_DTM);` // Service contract generation registration datetime (L268) |
| 3 | SET | `svkeiuwNo = nextRec.getString(JBSbatKK_T_SVKEIUW_EOH_NET.SVC_KEI_UCWK_NO);` // Service contract detail number (L270) |
| 4 | SET | `svkeiuwGadtm = nextRec.getString(JBSbatKK_T_SVKEIUW_EOH_NET.GENE_ADD_DTM);` // Service contract detail generation registration datetime (L275) |
| 5 | SET | `ispNinshoId = nextRec.getString(JBSbatKK_T_SVKEIUW_EOH_NET.ISP_NINSHO_ID);` // ISP authentication ID (L276) |

#### Block 4.3 — [IF] `(tempHakkoParam != null)` (L279)

> When temporary issuance parameters are provided, populates them with the service contract number, contract detail number, order type code, and service order code. These parameters are subsequently used by `getDelTranSbt()` to check for pending SOD (Service Order Data) issuance.

**[HAKKO_PARAM_IDX_SVKEI_NO=0, HAKKO_PARAM_IDX_SVKEIUW_NO=1, HAKKO_PARAM_IDX_SBT_CD=2, HAKKO_PARAM_IDX_SVC_ORDER_CD=3]**

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SVKEI_NO, svkeiNo);` // Set service contract number [-> HAKKO_PARAM_IDX_SVKEI_NO=0] (L281) |
| 2 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SVKEIUW_NO, svkeiuwNo);` // Set service contract detail number [-> HAKKO_PARAM_IDX_SVKEIUW_NO=1] (L282) |
| 3 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SBT_CD, JBSbatKKConst.ORDER_SBT_CD_NET);` // Set order type code [-> ORDER_SBT_CD_NET="1"] (L283) |
| 4 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SVC_ORDER_CD, JBSbatKKConst.SVC_ORDER_CD_FTTH_NINSHO);` // Set service order code [-> SVC_ORDER_CD_FTTH_NINSHO="06"] (L284) |

#### Block 4.4 — [DATA SET] (L289–L299)

> Sets all deletion target fields into the output map. The deletion process type (`DEL_TRAN_SBT`) is determined dynamically via `getDelTranSbt()`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap.setString(JBSbatKKIFM160.DEL_TRAN_SBT, getDelTranSbt(tempHakkoParam));` // Deletion process type (L289) |
| 2 | SET | `outmap.setString(JBSbatKKIFM160.DEL_TRGT_SBT, DEL_TRGT_SBT_ISP_NINSHO_ID);` // Deletion target type [-> DEL_TRGT_SBT_ISP_NINSHO_ID="01"] (L290) |
| 3 | SET | `outmap.setString(JBSbatKKIFM160.SVKEI_NO, svkeiNo);` // Service contract number (L291) |
| 4 | SET | `outmap.setString(JBSbatKKIFM160.SVKEI_GADTM, svkeiGadtm);` // Service contract generation registration datetime (L292) |
| 5 | SET | `outmap.setString(JBSbatKKIFM160.SVKEIUW_NO, svkeiuwNo);` // Service contract detail number (L293) |
| 6 | SET | `outmap.setString(JBSbatKKIFM160.SVKEIUW_GADTM, svkeiuwGadtm);` // Service contract detail generation registration datetime (L294) |
| 7 | SET | `outmap.setString(JBSbatKKIFM160.ISP_NINSHO_ID, ispNinshoId);` // ISP authentication ID (L295) |
| 8 | SET | `outmap.setOutFlg(true);` // Mark as valid output record (L296) |

#### Block 4.5 — [IF] `(outmap.get(JBSbatKKIFM160.DEL_TRAN_SBT).equals(DEL_TRAN_SBT_SOD_AGING_UPD))` (L300)

> Filters output records: only emits to the output bean when the deletion process type is `"3"` (SOD deletion + aging update). Records with other deletion types (e.g., `"1"` = simple SOD deletion) are silently skipped. This is a **conditional emit** — records that do not match are still fully constructed but discarded.

**[DEL_TRAN_SBT_SOD_AGING_UPD="3"]**

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputBean.addOutMapList(outmap);` // Add to output (only when DEL_TRAN_SBT = "3") (L302) |

#### Block 4.6 — [CALL] (L305)

> Advances to the next row in the query result set.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `nextRec = db_KK_T_SVKEIUW_EOH_NET.selectNext();` // Get next row from KK_T_SVKEIUW_EOH_NET (L305) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a customer's service contract line |
| `svc_kei_ucwk_no` | Field | Service contract detail number — identifier for a specific line-item within a service contract |
| `gene_add_dtm` | Field | Generation registration datetime — timestamp when the service contract or contract detail record was created in the system |
| `isp_ninsho_id` | Field | ISP authentication ID — authentication identifier for the Internet Service Provider (e.g., PPPoE credentials) |
| `DEL_TRAN_SBT` | Field | Deletion process type — code specifying the type of deletion operation (e.g., "1" = SOD deletion, "3" = SOD deletion + aging update) |
| `DEL_TRGT_SBT` | Field | Deletion target type — code specifying what entity is being deleted (e.g., "01" = ISP authentication ID, "06" = PPP authentication ID, "16" = ADSL authentication ID) |
| SOD | Acronym | Service Order Data — telecommunications service order data entity used in order fulfillment |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| EOH / EO-net | Business term | Enterprise on Home / Enterprise on Net — NTT's internet service brand line (EO-net) |
| `ORDER_SBT_CD_NET` | Constant | Order type code "1" — indicates an Internet (EO-net) service order |
| `SVC_ORDER_CD_FTTH_NINSHO` | Constant | Service order code "06" — indicates FTTH authentication service order |
| `HAKKO_PARAM` | Field | Issuance parameter — temporary map used to pass order issuance condition parameters for SOD issuance confirmation checks |
| `KK_T_SVKEIUW_EOH_NET` | DB Table | Service contract detail (EOH/EO-net) table — stores internet service contract line-item records |
| `getDelTranSbt` | Method | Deletion process type resolver — determines whether a pending SOD exists for a contract detail by querying `KK_T_ODR_SET` (via `executeKK_T_ODR_SET_KK_SELECT_011`); returns "1" for simple SOD deletion or "3" for SOD deletion + aging update |
| `setDelTrgtDataIn` | Method | Internet service deletion target data setting — prepares output records for ISP authentication ID deletion in internet (EO-net) service cancellations |
| `setDelTrgtDataADSL` | Method | ADSL service deletion target data setting — parallel method handling ADSL access-layer deletions |
| `outputBean` | Field | Output item carrier — collects valid deletion records for downstream batch processing |
