# Business Logic — JBSbatKKSvkeiDelTgCst.setDelTrgtDataADSL() [63 LOC]

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

## 1. Role

### JBSbatKKSvkeiDelTgCst.setDelTrgtDataADSL()

This method performs **deletion target data setup processing for ADSL** — it identifies and configures the data records that need to be deleted as part of an ADSL (Asymmetric Digital Subscriber Line) service cancellation or termination batch job. The method is specifically invoked when the billing group code corresponds to "eoADSL (Futures)" (`PGRP_ADSL_06 = "06"`), distinguishing it from similar methods for internet services (`setDelTrgtDataIn`) and telephone services (`setDelTrgtDataTel`).

The method implements the **routing/dispatch pattern** — it is one of several specialized handler methods dispatched by the `execute()` method based on the service's billing group classification. Within this method, it queries the `KK_T_SVKEIUW_EOADSL` (Service Contract Detail [End User ADSL]) table to retrieve all ADSL-related contract detail records, then for each record prepares an output map containing the deletion target data.

The method also implements **conditional output gating**: it only adds records to the output list when the deletion processing type indicates "Delete SOD Issuance / Aging Update" (`DEL_TRAN_SBT_SOD_AGING_UPD = "3"`), meaning records are only output when the associated SOD (Service Order Data) has already been issued. This ensures that ADSL authentication IDs are only flagged for deletion when prior order fulfillment has been completed, preventing premature deletion of pending orders.

The design pattern used is **delegation to helper methods** — data extraction is delegated to `getDelTranSbt()`, which in turn queries the `KK_T_ODR_SET` (Order Setting) table to determine whether a registered SOD has already been issued.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setDelTrgtDataADSL params"])
    INIT["Initialize outmap=null nextRec=null"]
    SELECT004["Execute SQL SELECT_004 on KK_T_SVKEIUW_EOADSL"]
    FETCH["nextRec = db_KK_T_SVKEIUW_EOADSL.selectNext"]
    WHILE{nextRec
!=
null}
    NEWMAP["outmap = new JBSbatServiceInterfaceMap
Initialize output record"]
    GETDATA["Retrieve data from inMap and nextRec
svkeiNo svkeiGadtm svkeiuwNo svkeiuwGadtm adslNinshoId"]
    CHECKTEMP{tempHakkoParam
!=
null}
    POPULATE["Populate tempHakkoParam with 4 entries
service contract number detail number order type service order code"]
    CALCDeltTranSbt["getDelTranSbt tempHakkoParam
Determine deletion processing type"]
    SETFIELDS["Set output fields on outmap
DEL_TRAN_SBT DEL_TRGT_SBT SVKEI_NO SVKEI_GADTM SVKEIUW_NO SVKEIUW_GADTM ADSL_NINSHO_ID setOutFlg true"]
    CHECKDELTYPE{outmap.DEL_TRAN_SBT
equals
DEL_TRAN_SBT_SOD_AGING_UPD}
    ADDOUTPUT["outputBean.addOutMapList outmap
Output only if SOD already issued"]
    FETCHNEXT["nextRec = db_KK_T_SVKEIUW_EOADSL.selectNext"]
    END_NODE(["Return"])

    START --> INIT --> SELECT004 --> FETCH --> WHILE
    WHILE -->|Yes| NEWMAP --> GETDATA --> CHECKTEMP
    CHECKTEMP -->|Yes| POPULATE --> CALCDeltTranSbt
    CHECKTEMP -->|No| CALCDeltTranSbt
    CALCDeltTranSbt --> SETFIELDS --> CHECKDELTYPE
    CHECKDELTYPE -->|Yes| ADDOUTPUT --> FETCHNEXT --> WHILE
    CHECKDELTYPE -->|No| FETCHNEXT --> WHILE
    WHILE -->|No| END_NODE
```

### Detailed Step Description:

1. **Initialization** — `outmap` is initialized to `null` (moved from outer scope to inside the loop per IT1-2013-0000285 fix), and `nextRec` is set to `null`.

2. **SQL Execution** — Executes `executeKK_T_SVKEIUW_EOADSL_KK_SELECT_004(selectWhereParam)` which queries the `KK_T_SVKEIUW_EOADSL` table using parameters from `selectWhereParam` to find ADSL service contract details.

3. **First Fetch** — Calls `db_KK_T_SVKEIUW_EOADSL.selectNext()` to retrieve the first record.

4. **While Loop** — Iterates while `nextRec` is not null, processing each ADSL contract detail record.

5. **Output Map Initialization** — Inside the loop, creates a fresh `JBSbatServiceInterfaceMap` for each record to avoid data contamination between iterations.

6. **Data Retrieval** — Extracts five key data points from `inMap` and `nextRec`:
   - `svkeiNo`: Service contract number
   - `svkeiGadtm`: Service contract generation/addition date-time
   - `svkeiuwNo`: Service contract detail number
   - `svkeiuwGadtm`: Service contract detail generation/addition date-time
   - `adslNinshoId`: ADSL authentication ID

7. **Optional tempHakkoParam Population** — If `tempHakkoParam` is not null, populates it with four entries for SOD issuance confirmation checking:
   - Index 0 = `svkeiNo` (service contract number)
   - Index 1 = `svkeiuwNo` (contract detail number)
   - Index 2 = `ORDER_SBT_CD_NET = "1"` (Order type code: Net)
   - Index 3 = `SVC_ORDER_CD_FTTH_NINSHO = "06"` (Service order code: FTTH Authentication)

8. **Deletion Type Calculation** — Calls `getDelTranSbt(tempHakkoParam)` which queries `KK_T_ODR_SET` to determine whether a registered SOD has already been issued. Returns one of: `"3"` (SOD issued + aging update) or `""` (SOD not issued, deletion target excluded).

9. **Output Field Population** — Sets seven fields on `outmap`:
   - `DEL_TRAN_SBT`: Deletion processing type (from `getDelTranSbt`)
   - `DEL_TRGT_SBT`: `DEL_TRGT_SBT_ADSL_NINSHO_ID = "16"` (Deletion target type: ADSL Authentication ID)
   - `SVKEI_NO`: Service contract number
   - `SVKEI_GADTM`: Service contract date-time
   - `SVKEIUW_NO`: Service contract detail number
   - `SVKEIUW_GADTM`: Service contract detail date-time
   - `ADSL_NINSHO_ID`: ADSL authentication ID
   - `setOutFlg(true)`: Flags this record as an output target

10. **Conditional Output** — If the deletion processing type equals `DEL_TRAN_SBT_SOD_AGING_UPD = "3"` (meaning the SOD has already been issued), adds the output map to the `outputBean` list. Otherwise, the record is silently skipped.

11. **Next Record Fetch** — Advances to the next record and loops back.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | Input message carrying the service contract master data — provides the service contract number (`SVC_KEI_NO`) and service contract generation date-time (`GENE_ADD_DTM`). This is the primary input envelope for the batch job, containing the header-level contract information from which per-record ADSL details are cross-referenced. |
| 2 | `outputBean` | `JBSbatOutputItem` | Output record container — accumulates the prepared deletion target records via `addOutMapList()`. Only records where the associated SOD has already been issued (`DEL_TRAN_SBT = "3"`) are appended. The accumulated output is consumed by downstream processing (e.g., SOD aging update, authentication ID deletion). |
| 3 | `selectWhereParam` | `Object[]` | SQL WHERE clause parameters — used to construct the query for `executeKK_T_SVKEIUW_EOADSL_KK_SELECT_004` against the `KK_T_SVKEIUW_EOADSL` table. Contains the service contract number and other filters to locate ADSL-specific contract detail records. |
| 4 | `tempHakkoParam` | `HashMap<Integer, String>` | Temporary order issuance parameter store — a key-value map indexed by integer keys used for SOD (Service Order Data) issuance confirmation. When not null, the method populates it with service contract number, contract detail number, order type code ("1"), and service order code ("06"). This map is passed to `getDelTranSbt()` to check if a registered SOD has already been issued, which determines whether this ADSL authentication ID should be output for deletion processing. |

**Instance fields read:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_SVKEIUW_EOADSL` | `JBSbatSQLAccess` | Database access object for `KK_T_SVKEIUW_EOADSL` table (Service Contract Detail [End User ADSL]). Initialized in `initial()` method. Used for row-by-row iteration via `selectNext()`. |

## 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_EOADSL_KK_SELECT_004` | KK_T_SVKEIUW_EOADSL | KK_T_SVKEIUW_EOADSL | Queries service contract details for ADSL end-users. Uses SQL key `KK_SELECT_004` to select contract detail rows matching the WHERE clause parameters. |
| R | `JBSbatKK_T_SVC_KEI.getString` | - | - | Retrieves service contract number (`SVC_KEI_NO`) from input map `inMap`. |
| R | `JBSbatKK_T_SVC_KEI.getString` | - | - | Retrieves service contract generation date-time (`GENE_ADD_DTM`) from input map `inMap`. |
| R | `JBSbatKK_T_SVKEIUW_EOADSL.getString` | - | - | Retrieves service contract detail number (`SVC_KEI_UCWK_NO`) from current row. |
| R | `JBSbatKK_T_SVKEIUW_EOADSL.getString` | - | - | Retrieves service contract detail generation date-time (`GENE_ADD_DTM`) from current row. |
| R | `JBSbatKK_T_SVKEIUW_EOADSL.getString` | - | - | Retrieves ADSL authentication ID (`ADSL_NINSHO_ID`) from current row. |
| - | `JBSbatKKConst` | - | - | References constants: `ORDER_SBT_CD_NET="1"`, `SVC_ORDER_CD_FTTH_NINSHO="06"`, `DEL_TRGT_SBT_ADSL_NINSHO_ID="16"` |
| - | `JBSbatKKSvkeiDelTgCst.getDelTranSbt` | KK_T_ODR_SET | KK_T_ODR_SET | Helper method that determines deletion processing type by querying `KK_T_ODR_SET` (Order Setting) table via `executeKK_T_ODR_SET_KK_SELECT_011`. Returns `"3"` if SOD already issued, `""` otherwise. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets deletion processing type (`DEL_TRAN_SBT`) on output map. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets deletion target type (`DEL_TRGT_SBT = "16"`) on output map. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets service contract number (`SVKEI_NO`) on output map. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets service contract date-time (`SVKEI_GADTM`) on output map. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets service contract detail number (`SVKEIUW_NO`) on output map. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets service contract detail date-time (`SVKEIUW_GADTM`) on output map. |
| - | `JBSbatKKIFM160.setString` | - | - | Sets ADSL authentication ID (`ADSL_NINSHO_ID`) on output map. |
| - | `JBSbatKKIFM160.setOutFlg` | - | - | Sets output flag to `true` on the output map. |
| C | `JBSbatKKGetCTITelno.addOutMapList` | - | - | Adds the completed output map to the output bean's list. Only called when deletion processing type is `"3"` (SOD already issued). |

### How each operation is classified:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_SVKEIUW_EOADSL_KK_SELECT_004` | KK_T_SVKEIUW_EOADSL | KK_T_SVKEIUW_EOADSL | SELECT — Retrieves ADSL service contract detail records from the contract detail table using the SQL key `KK_SELECT_004`. Iterated via `selectNext()` in a while loop. |
| R | `getDelTranSbt` | KK_T_ODR_SET | KK_T_ODR_SET | SELECT — Queries the Order Setting table to determine if a registered SOD has already been issued for this contract. Returns processing type code `"3"` if issued, `""` if not. |
| C | `outputBean.addOutMapList` | - | - | CREATE — Appends the prepared output record to the batch output list. Conditionally called only when SOD is confirmed as already issued. |
| - | `inMap.getString` | - | - | READ — Extracts service contract master fields from the input map. |
| - | `nextRec.getString` | - | - | READ — Extracts ADSL contract detail fields from the current database row during iteration. |
| - | `outmap.setString` | - | - | UPDATE — Populates output map fields with deletion target data. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch:JBSbatKKSvkeiDelTgCst | `JBSbatKKSvkeiDelTgCst.execute()` → conditional branch on `PGRP_ADSL_06` → `setDelTrgtDataADSL()` | `addOutMapList [C] -`, `setOutFlg [-]`, `setString [-]`, `executeKK_T_SVKEIUW_EOADSL_KK_SELECT_004 [R] KK_T_SVKEIUW_EOADSL`, `getDelTranSbt [R] KK_T_ODR_SET` |

### Call chain detail:

The `execute()` method in `JBSbatKKSvkeiDelTgCst` is the primary entry point. It branches on the billing group code (`prcGrpCd`) from the input. When `prcGrpCd` equals `JBSbatKKConst.PGRP_ADSL_06 = "06"` (eoADSL / Futures), it invokes `setDelTrgtDataADSL()`. Similar conditional branches dispatch to `setDelTrgtDataIn()` for internet services and `setDelTrgtDataTel()` for telephone services.

The method does not have any screen/batch entry points within 8 hops — it is exclusively called from the `execute()` method of its own class, making it an internal batch processing subroutine.

**Terminal operations reached from this method:**

| Terminal Operation | Type | Description |
|-------------------|------|-------------|
| `addOutMapList` | C | Creates output records by adding to the output bean list |
| `setOutFlg` | - | Flags output record as active |
| `setString` | - | Populates output map fields (7 invocations) |
| `executeKK_T_SVKEIUW_EOADSL_KK_SELECT_004` | R | Reads ADSL contract detail records |
| `getDelTranSbt` | R | Determines deletion processing type via Order Setting table lookup |
| `getString` | R | Extracts fields from input map and database rows |

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L332)

> Initializes local variables. Per IT1-2013-0000285, `outmap` initialization was moved from outer scope to inside the loop to prevent issues with reused maps.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap = null` // Initialize output record map to null (moved inside loop per IT1-2013-0000285) |
| 2 | SET | `nextRec = null` // Initialize database row iterator |

**Block 2** — [EXEC] (L338)

> Executes SQL query to retrieve ADSL service contract detail records.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_SVKEIUW_EOADSL_KK_SELECT_004(selectWhereParam)` // SQL: SELECT from KK_T_SVKEIUW_EOADSL |

**Block 3** — [EXEC] (L340)

> Fetches the first record from the result set.

| # | Type | Code |
|---|------|------|
| 1 | SET | `nextRec = db_KK_T_SVKEIUW_EOADSL.selectNext()` // Fetch first ADSL contract detail row |

**Block 4** — [WHILE LOOP] `(nextRec != null)` (L342)

> Iterates over all ADSL contract detail records. For each iteration:

**Block 4.1** — [SET] (L346)

> Initializes a fresh output map for this iteration. Per IT1-2013-0000285 ADD START/END, the output map is now created inside the loop.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap = new JBSbatServiceInterfaceMap()` // Initialize output record area [IT1-2013-0000285 ADD] |

**Block 4.2** — [DATA RETRIEVAL] (L349-L353)

> Extracts service contract and ADSL detail data from the input map and database row.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svkeiNo = inMap.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO)` // Service contract number |
| 2 | SET | `svkeiGadtm = inMap.getString(JBSbatKK_T_SVC_KEI.GENE_ADD_DTM)` // Service contract generation date-time |
| 3 | SET | `svkeiuwNo = nextRec.getString(JBSbatKK_T_SVKEIUW_EOADSL.SVC_KEI_UCWK_NO)` // Service contract detail number |
| 4 | SET | `svkeiuwGadtm = nextRec.getString(JBSbatKK_T_SVKEIUW_EOADSL.GENE_ADD_DTM)` // Service contract detail generation date-time |
| 5 | SET | `adslNinshoId = nextRec.getString(JBSbatKK_T_SVKEIUW_EOADSL.ADSL_NINSHO_ID)` // ADSL authentication ID |

**Block 4.3** — [IF] `(null != tempHakkoParam)` (L357) [CONSTANT: `tempHakkoParam != null`]

> SQL parameter setup section — prepares temporary parameters for registered SOD issuance confirmation.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SVKEI_NO, svkeiNo)` // Service contract number [index 0] |
| 2 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SVKEIUW_NO, svkeiuwNo)` // Service contract detail number [index 1] |
| 3 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SBT_CD, JBSbatKKConst.ORDER_SBT_CD_NET)` // Order type code [-> `ORDER_SBT_CD_NET = "1"` (Net)] |
| 4 | EXEC | `tempHakkoParam.put(HAKKO_PARAM_IDX_SVC_ORDER_CD, JBSbatKKConst.SVC_ORDER_CD_FTTH_NINSHO)` // Service order code [-> `SVC_ORDER_CD_FTTH_NINSHO = "06"` (FTTH Authentication)] |

**Block 4.4** — [EXEC] (L368)

> Deletion target data setup section — populates the output map with deletion target fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outmap.setString(JBSbatKKIFM160.DEL_TRAN_SBT, getDelTranSbt(tempHakkoParam))` // Deletion processing type [calls getDelTranSbt to determine if SOD is already issued] |
| 2 | SET | `outmap.setString(JBSbatKKIFM160.DEL_TRGT_SBT, DEL_TRGT_SBT_ADSL_NINSHO_ID)` // Deletion target type [-> `DEL_TRGT_SBT_ADSL_NINSHO_ID = "16"` (ADSL Authentication ID)] |
| 3 | SET | `outmap.setString(JBSbatKKIFM160.SVKEI_NO, svkeiNo)` // Service contract number |
| 4 | SET | `outmap.setString(JBSbatKKIFM160.SVKEI_GADTM, svkeiGadtm)` // Service contract generation date-time |
| 5 | SET | `outmap.setString(JBSbatKKIFM160.SVKEIUW_NO, svkeiuwNo)` // Service contract detail number |
| 6 | SET | `outmap.setString(JBSbatKKIFM160.SVKEIUW_GADTM, svkeiuwGadtm)` // Service contract detail generation date-time |
| 7 | SET | `outmap.setString(JBSbatKKIFM160.ADSL_NINSHO_ID, adslNinshoId)` // ADSL authentication ID |
| 8 | EXEC | `outmap.setOutFlg(true)` // Set output flag to true |

**Block 4.5** — [IF] `(outmap.get(JBSbatKKIFM160.DEL_TRAN_SBT).equals(DEL_TRAN_SBT_SOD_AGING_UPD))` (L381) [CONSTANT: `DEL_TRAN_SBT_SOD_AGING_UPD = "3"`]

> Conditional output gating — only outputs when the deletion processing type indicates "Delete SOD Issuance / Aging Update" (`"3"`). This means the record is only added to the output list when the associated ISP/ADSL authentication ID's registered SOD has already been issued. This prevents premature deletion of ADSL authentication IDs for contracts where the SOD has not yet been issued.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `outputBean.addOutMapList(outmap)` // Output only — records whose registered SOD has already been issued |

**Block 4.6** — [EXEC] (L386)

> Advances to the next record in the result set.

| # | Type | Code |
|---|------|------|
| 1 | SET | `nextRec = db_KK_T_SVKEIUW_EOADSL.selectNext()` // Fetch next ADSL contract detail row |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svkeiNo` | Field | Service contract number — unique identifier for a customer's service contract line |
| `svkeiGadtm` | Field | Service contract generation date-time — timestamp of when the service contract record was created/updated |
| `svkeiuwNo` | Field | Service contract detail number — unique identifier for a specific detail/line item within a service contract |
| `svkeiuwGadtm` | Field | Service contract detail generation date-time — timestamp of when the contract detail record was created/updated |
| `adslNinshoId` | Field | ADSL authentication ID — unique identifier for the ADSL-based broadband authentication credential |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity; records service orders for provisioning/deprovisioning |
| ADSL | Business term | Asymmetric Digital Subscriber Line — broadband internet access technology over copper telephone lines |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband service |
| `DEL_TRAN_SBT` | Field | Deletion processing type — classifies the type of deletion operation (e.g., SOD issuance, aging update) |
| `DEL_TRGT_SBT` | Field | Deletion target type — identifies which authentication type is the deletion target |
| `PRC_GRP_CD` | Field | Billing group code — classifies the service billing category (e.g., ADSL Futures = "06") |
| `ORDER_SBT_CD_NET` | Constant | Order type code = "1" — represents "Net" as the order type (broadband internet service) |
| `SVC_ORDER_CD_FTTH_NINSHO` | Constant | Service order code = "06" — represents "FTTH Authentication" service order type |
| `DEL_TRGT_SBT_ADSL_NINSHO_ID` | Constant | Deletion target type = "16" — specifies ADSL Authentication ID as the deletion target |
| `DEL_TRAN_SBT_SOD_AGING_UPD` | Constant | Deletion processing type = "3" — indicates "Delete SOD Issuance / Aging Update" (SOD already issued, proceeding with aging update and deletion) |
| `DEL_TRAN_SBT_SOD` | Constant | Deletion processing type = "1" — indicates "Delete SOD Issuance" (legacy, superseded by "3") |
| KK_T_SVKEIUW_EOADSL | Entity | Service Contract Detail table [End User ADSL] — stores ADSL-specific service contract detail records |
| KK_T_ODR_SET | Entity | Order Setting table — stores order setting/condition records used to determine SOD issuance status |
| `tempHakkoParam` | Field | Temporary order issuance parameter map — HashMap used for SOD issuance confirmation checks |
| `HAKKO_PARAM_IDX_SVKEI_NO` | Constant | Parameter map index = 0 for service contract number |
| `HAKKO_PARAM_IDX_SVKEIUW_NO` | Constant | Parameter map index = 1 for service contract detail number |
| `HAKKO_PARAM_IDX_SBT_CD` | Constant | Parameter map index = 2 for order type code |
| `HAKKO_PARAM_IDX_SVC_ORDER_CD` | Constant | Parameter map index = 3 for service order code |
| JBSbatKKIFM160 | Interface | Input/output field mapping interface defining field keys for deletion target data (DEL_TRAN_SBT, DEL_TRGT_SBT, SVKEI_NO, etc.) |
| PGRP_ADSL_06 | Constant | Billing group code = "06" — represents "eoADSL (Futures)" billing classification |
