# Business Logic — JBSbatKKSvkeiDelTgCst.getDelTranSbt() [54 LOC]

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

## 1. Role

### JBSbatKKSvkeiDelTgCst.getDelTranSbt()

This method performs **deletion transaction type acquisition** for service contract cancellation processing within the batch framework. Its primary business purpose is to determine the appropriate deletion transaction subtype (`delTranSbt`) based on the authentication ID type being deleted and whether a Service Order Data (SOD) has already been issued.

The method implements a **routing/dispatch design pattern**: it branches on whether the input map contains a service contract detail number (`SVKEIUW_NO`, i.e. `HAKKO_PARAM_IDX_SVKEIUW_NO = 1`). If present, it handles **ISP Authentication ID / ADSL Authentication ID deletion** (deletion target type `"01"` or `"16"`) by building a 4-element WHERE clause and invoking `executeKK_T_ODR_SET_KK_SELECT_011`. If absent, it handles **PPP Authentication ID deletion** (deletion target type `"06"`) by building a 3-element WHERE clause and invoking `executeKK_T_ODR_SET_KK_SELECT_012`.

After the conditional query, the method checks whether the database cursor returned a row. If a matching order setting record exists (meaning a registered SOD has already been issued), it returns `"3"` — the **Deleted SOD Issuance / Aging Update** code, indicating that the SOD needs aging adjustment. If no record is found (no registered SOD issued), it returns an empty string `""`, marking the item as a deletion target exclusion.

This method serves as a **shared utility called by the batch data-setting methods** (`setDelTrgtDataADSL`, `setDelTrgtDataIn`, `setDelTrgtDataTel`) during the service contract deletion batch process. It decouples the authentication-type-specific routing from the SOD status determination logic.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getDelTranSbt tempHakkoParam"])
    INIT["Initialize: selectWhereParam=null, nextRec=null, delTranSbt=null"]

    CHECK_PARAM{tempHakkoParam.containsKey
SVKEIUW_NO}

    BRANCH_ISP["Branch: ISP/ADSL Authentication ID Deletion"]
    SET_PARAM_ISP["SET: selectWhereParam[0..3] = SVKEI_NO, SVKEIUW_NO, SBT_CD, SVC_ORDER_CD"]
    EXEC_SELECT_011["CALL: executeKK_T_ODR_SET_KK_SELECT_011 selectWhereParam"]

    BRANCH_PPP["Branch: PPP Authentication ID Deletion"]
    SET_PARAM_PPP["SET: selectWhereParam[0..2] = SVKEI_NO, SBT_CD, SVC_ORDER_CD"]
    EXEC_SELECT_012["CALL: executeKK_T_ODR_SET_KK_SELECT_012 selectWhereParam"]

    QUERY_NEXT["CALL: nextRec = db_KK_T_ODR_SET.selectNext"]

    CHECK_NEXT{nextRec != null}

    HAS_RECORD["Has registered SOD issuance"]
    SET_SOD_AGING["SET: delTranSbt = DEL_TRAN_SBT_SOD_AGING_UPD = 3"]

    NO_RECORD["No registered SOD issuance"]
    SET_EMPTY["SET: delTranSbt = empty string
Deletion target excluded"]

    RETURN["Return delTranSbt"]

    END(["End"])

    START --> INIT --> CHECK_PARAM
    CHECK_PARAM -->|true| BRANCH_ISP --> SET_PARAM_ISP --> EXEC_SELECT_011 --> QUERY_NEXT
    CHECK_PARAM -->|false| BRANCH_PPP --> SET_PARAM_PPP --> EXEC_SELECT_012 --> QUERY_NEXT
    QUERY_NEXT --> CHECK_NEXT
    CHECK_NEXT -->|true| HAS_RECORD --> SET_SOD_AGING --> RETURN
    CHECK_NEXT -->|false| NO_RECORD --> SET_EMPTY --> RETURN
    RETURN --> END
```

**Processing flow:**

1. **Initialization** — All local variables (`selectWhereParam`, `nextRec`, `delTranSbt`) are set to `null`.

2. **Conditional dispatch (L471)** — The method checks whether `tempHakkoParam` contains the key `HAKKO_PARAM_IDX_SVKEIUW_NO` (constant value `1`, representing the service contract detail number). This determines which authentication ID type is being processed:
   - **true branch**: ISP/ADSL Authentication ID deletion. A 4-element `Object[]` is prepared with service contract number, service contract detail number, order type code, and service order code. The method `executeKK_T_ODR_SET_KK_SELECT_011` is called, which executes a database select against `KK_T_ODR_SET` using SQL key `KK_SELECT_011`.
   - **false branch**: PPP Authentication ID deletion. A 3-element `Object[]` is prepared with service contract number, order type code, and service order code (note: no detail number for PPP). The method `executeKK_T_ODR_SET_KK_SELECT_012` is called, which executes a database select against `KK_T_ODR_SET` using SQL key `KK_SELECT_012`.

3. **Cursor advance (L510)** — `db_KK_T_ODR_SET.selectNext()` fetches the next row from the result set established by the prior select call.

4. **SOD status determination (L511–L519)** — If a row was found (`nextRec != null`), the method sets `delTranSbt` to `DEL_TRAN_SBT_SOD_AGING_UPD` (`"3"`, meaning "Deleted SOD Issuance / Aging Update"). If no row was found, it sets `delTranSbt` to `""` (empty string, meaning "Deletion target excluded"). This was changed from the original `"1"` (Deleted SOD Issuance) to `"3"` per change request IT1-2013-0000285 (2013/02/13).

5. **Return (L521)** — The determined `delTranSbt` value is returned.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `tempHakkoParam` | `HashMap<Integer, String>` | Temporary SQL parameter map carrying order condition data for already-registered SOD issuance confirmation. The map uses integer indices as keys (`HAKKO_PARAM_IDX_*` constants). Key entries: index `0` = Service Contract Number (`SVKEI_NO`), index `1` = Service Contract Detail Number (`SVKEIUW_NO`) — presence or absence of this key determines ISP/ADSL vs. PPP routing, index `2` = Order Type Code (`SBT_CD`), index `3` = Service Order Code (`SVC_ORDER_CD`). The business meaning of this map is that it carries the parameters needed to query the order settings table to determine whether an SOD has been issued for the given service contract. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_ODR_SET` | `JBSbatSQLAccess` | Database access cursor for the `KK_T_ODR_SET` (Order Settings) table. Used to execute the parameterized SQL select and fetch the next result row. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `executeKK_T_ODR_SET_KK_SELECT_011` | — (internal helper) | `KK_T_ODR_SET` | Reads from the Order Settings table using SQL key `KK_SELECT_011` with 4 WHERE parameters (service contract number, detail number, order type code, service order code). Used for ISP/ADSL Authentication ID deletion path. |
| R | `executeKK_T_ODR_SET_KK_SELECT_012` | — (internal helper) | `KK_T_ODR_SET` | Reads from the Order Settings table using SQL key `KK_SELECT_012` with 3 WHERE parameters (service contract number, order type code, service order code). Used for PPP Authentication ID deletion path. |
| R | `db_KK_T_ODR_SET.selectNext()` | — | `KK_T_ODR_SET` | Advances the database cursor to fetch the next result row from the select result set. Returns null if no more rows exist. |

**Classification rationale:**
- Both `executeKK_T_ODR_SET_KK_SELECT_011` and `executeKK_T_ODR_SET_KK_SELECT_012` are **Read** operations — they invoke `selectBySqlDefine()` on the `db_KK_T_ODR_SET` cursor, executing parameterized SQL selects against the `KK_T_ODR_SET` table.
- `db_KK_T_ODR_SET.selectNext()` is also a **Read** — it retrieves the next row from the already-open result set.
- The method performs **zero writes** — it is purely a read-and-determine method. No Create, Update, or Delete operations occur.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 3 methods.
Terminal operations from this method: `executeKK_T_ODR_SET_KK_SELECT_012` [-], `executeKK_T_ODR_SET_KK_SELECT_011` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: `setDelTrgtDataADSL` | `JBSbatKKSvkeiDelTgCst.setDelTrgtDataADSL` -> `getDelTranSbt` | `executeKK_T_ODR_SET_KK_SELECT_011 [R] KK_T_ODR_SET` |
| 2 | CBS: `setDelTrgtDataIn` | `JBSbatKKSvkeiDelTgCst.setDelTrgtDataIn` -> `getDelTranSbt` | `executeKK_T_ODR_SET_KK_SELECT_012 [R] KK_T_ODR_SET` |
| 3 | CBS: `setDelTrgtDataTel` | `JBSbatKKSvkeiDelTgCst.setDelTrgtDataTel` -> `getDelTranSbt` | `executeKK_T_ODR_SET_KK_SELECT_012 [R] KK_T_ODR_SET` |

**Notes:**
- All three callers are internal CBS (Common Business Service) methods within the same class `JBSbatKKSvkeiDelTgCst`. They are data-setting methods that prepare deletion target data for different authentication ID types (ADSL, In (fiber), Tel (telephone)).
- `setDelTrgtDataADSL` calls this method for the ADSL (deletion target type `"16"`) path, which triggers the `KK_SELECT_011` branch.
- `setDelTrgtDataIn` and `setDelTrgtDataTel` call this method for the PPP (deletion target type `"06"`) path, which triggers the `KK_SELECT_012` branch.
- No screen or batch entry points were found within 8 hops — this method is a leaf utility called exclusively by internal batch data-setting methods.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(tempHakkoParam.containsKey(HAKKO_PARAM_IDX_SVKEIUW_NO))` `[HAKKO_PARAM_IDX_SVKEIUW_NO="1"]` (L471)

> ISP/ADSL Authentication ID deletion branch — when the service contract detail number is present, this indicates the deletion involves an ISP or ADSL authentication ID rather than a PPP authentication ID.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam = new Object[4]` // Allocate 4-element parameter array |
| 2 | SET | `selectWhereParam[0] = tempHakkoParam.get(HAKKO_PARAM_IDX_SVKEI_NO)` // [HAKKO_PARAM_IDX_SVKEI_NO="0"] Service contract number |
| 3 | SET | `selectWhereParam[1] = tempHakkoParam.get(HAKKO_PARAM_IDX_SVKEIUW_NO)` // [HAKKO_PARAM_IDX_SVKEIUW_NO="1"] Service contract detail number |
| 4 | SET | `selectWhereParam[2] = tempHakkoParam.get(HAKKO_PARAM_IDX_SBT_CD)` // [HAKKO_PARAM_IDX_SBT_CD="2"] Order type code |
| 5 | SET | `selectWhereParam[3] = tempHakkoParam.get(HAKKO_PARAM_IDX_SVC_ORDER_CD)` // [HAKKO_PARAM_IDX_SVC_ORDER_CD="3"] Service order code |
| 6 | CALL | `executeKK_T_ODR_SET_KK_SELECT_011(selectWhereParam)` // Execute SQL select with 4 params [KK_T_ODR_SET_KK_SELECT_011="KK_SELECT_011"] |

**Block 2** — [ELSE] `(no condition — else of containsKey)` (L492)

> PPP Authentication ID deletion branch — when the service contract detail number is absent, this indicates a PPP authentication ID deletion. PPP deletions do not include the detail number in the WHERE clause.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam = new Object[3]` // Allocate 3-element parameter array |
| 2 | SET | `selectWhereParam[0] = tempHakkoParam.get(HAKKO_PARAM_IDX_SVKEI_NO)` // [HAKKO_PARAM_IDX_SVKEI_NO="0"] Service contract number |
| 3 | SET | `selectWhereParam[1] = tempHakkoParam.get(HAKKO_PARAM_IDX_SBT_CD)` // [HAKKO_PARAM_IDX_SBT_CD="2"] Order type code |
| 4 | SET | `selectWhereParam[2] = tempHakkoParam.get(HAKKO_PARAM_IDX_SVC_ORDER_CD)` // [HAKKO_PARAM_IDX_SVC_ORDER_CD="3"] Service order code |
| 5 | CALL | `executeKK_T_ODR_SET_KK_SELECT_012(selectWhereParam)` // Execute SQL select with 3 params [KK_T_ODR_SET_KK_SELECT_012="KK_SELECT_012"] |

**Block 3** — [SEQUENTIAL] `(cursor advance)` (L510)

> After the conditional branch, advance the database cursor to fetch the next row. This reads from the `KK_T_ODR_SET` table result set established by the prior `selectBySqlDefine` call.

| # | Type | Code |
|---|------|------|
| 1 | SET | `nextRec = db_KK_T_ODR_SET.selectNext()` // Fetch next result row from KK_T_ODR_SET select |

**Block 4** — [IF] `(nextRec != null)` (L511)

> SOD registered branch — when a matching record is found, it means a Service Order Data (SOD) has already been issued for this service contract. The deletion transaction type is set to `"3"` (Deleted SOD Issuance / Aging Update), which was introduced in IT1-2013-0000285 to replace the original `"1"` (Deleted SOD Issuance) to indicate that aging update processing is required.

| # | Type | Code |
|---|------|------|
| 1 | SET | `delTranSbt = DEL_TRAN_SBT_SOD_AGING_UPD` // [DEL_TRAN_SBT_SOD_AGING_UPD="3"] Deleted SOD Issuance / Aging Update |

**Block 5** — [ELSE] `(no condition — else of nextRec != null)` (L517)

> SOD not registered branch — when no matching record is found, no SOD has been issued. The deletion transaction type is set to an empty string, indicating this item is a deletion target exclusion (no further processing needed).

| # | Type | Code |
|---|------|------|
| 1 | SET | `delTranSbt = ""` // Empty string — Deletion target excluded |

**Block 6** — [RETURN] (L521)

> Return the determined deletion transaction subtype value to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return delTranSbt` // Returns "3" if SOD exists, "" if SOD not issued |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SVKEI_NO` (service contract number) | Field | Service contract number — the top-level identifier for a customer's service contract |
| `SVKEIUW_NO` (service contract detail number) | Field | Service contract detail number — identifies a specific line item within a service contract. Presence in the parameter map distinguishes ISP/ADSL from PPP authentication types |
| `SBT_CD` (order type code) | Field | Order type code — classifies the type of order action (registration, cancellation, modification) |
| `SVC_ORDER_CD` (service order code) | Field | Service order code — identifies the specific service order associated with the transaction |
| `tempHakkoParam` | Field | Temporary SQL parameter map — carries order condition parameters for already-registered SOD issuance confirmation. Uses integer-indexed HashMap |
| SOD | Acronym | Service Order Data — the telecom order fulfillment entity representing a confirmed service order that has been issued |
| `DEL_TRAN_SBT_SOD` = "1" | Constant | Deleted SOD Issuance — legacy code indicating deletion with SOD issuance (deprecated per IT1-2013-0000285) |
| `DEL_TRAN_SBT_SOD_AGING_UPD` = "3" | Constant | Deleted SOD Issuance / Aging Update — current code indicating that the deletion involves an already-issued SOD that requires aging adjustment processing |
| `DEL_TRGT_SBT_ISP_NINSHO_ID` = "01" | Constant | Deletion target type: ISP Authentication ID — identifies deletion of an ISP authentication credential |
| `DEL_TRGT_SBT_PPP_NINSHO_ID` = "06" | Constant | Deletion target type: PPP Authentication ID — identifies deletion of a PPP (Point-to-Point Protocol) authentication credential |
| `DEL_TRGT_SBT_ADSL_NINSHO_ID` = "16" | Constant | Deletion target type: ADSL Authentication ID — identifies deletion of an ADSL authentication credential |
| `KK_T_ODR_SET` | Table | Order Settings table — stores order configuration and settings records for service contracts. The table queried to determine SOD issuance status |
| `KK_T_ODR_SET_KK_SELECT_011` | Constant | SQL key for selecting order settings with 4 parameters (service contract number, detail number, order type code, service order code) — used in ISP/ADSL path |
| `KK_T_ODR_SET_KK_SELECT_012` | Constant | SQL key for selecting order settings with 3 parameters (service contract number, order type code, service order code) — used in PPP path |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service provided by K-Opticom |
| ADSL | Business term | Asymmetric Digital Subscriber Line — legacy copper-line broadband technology |
| PPP | Business term | Point-to-Point Protocol — legacy dial-up/network authentication protocol |
| ISP | Business term | Internet Service Provider — network access service |
| Aging Update | Business term | Processing to adjust the aging (age/validity period) of SOD records during deletion — ensures proper lifecycle tracking of service order data when contracts are cancelled |
| `JBSbatKKSvkeiDelTgCst` | Class | Service contract deletion target extraction component — batch common business service for extracting and processing service contract cancellation targets |
| IT1-2013-0000285 | Change request | Change request from 2013/02/13 that modified the deletion transaction type from "1" to "3" and migrated SQL select keys from `KK_T_ODR_HAKKO_JOKEN` to `KK_T_ODR_SET` |
