# Business Logic — JBSbatKKSvkeiuwDelTgCst.isAddSodHakCfmTrn() [28 LOC]

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

## 1. Role

### JBSbatKKSvkeiuwDelTgCst.isAddSodHakCfmTrn()

This method performs a **registered SOD (Service Order Data) issuance confirmation check** for FTTH (Fiber To The Home) authentication service contracts. It queries the `KK_T_ODR_SET` (Order Settings) database table to determine whether a service order record has already been issued for the given service contract. The method extracts the service contract number (`SVC_KEI_NO`) and service detail number (`SVC_KEI_UCWK_NO`) from the input message map, then constructs a 4-element parameter array filtering by order subtype code `"1"` (Net-based orders) and service order code `"06"` (FTTH Authentication). It delegates to `executeKK_T_ODR_SET_KK_SELECT_011` to execute a SQL select query against `KK_T_ODR_SET`, retrieves the next record via `selectNext()`, and returns `true` if a matching record exists (indicating the SOD has already been issued) or `false` otherwise. This is a guard-check method called during the deletion target data setup phase to decide whether an SOD issuance process is required — it functions as a **conditional routing utility** shared across service cancellation workflows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["isAddSodHakCfmTrn(inMap)"])

    START --> S1["Initialize selectWhereParam = null, nextRec = null"]
    S1 --> S2["selectWhereParam = new Object[4]"]
    S2 --> S3["selectWhereParam[0] = inMap.getString(SVC_KEI_NO)"]
    S3 --> S4["selectWhereParam[1] = inMap.getString(SVC_KEI_UCWK_NO)"]
    S4 --> S5["selectWhereParam[2] = JBSbatKKConst.ORDER_SBT_CD_NET \"1\""]
    S5 --> S6["selectWhereParam[3] = JBSbatKKConst.SVC_ORDER_CD_FTTH_NINSHO \"06\""]
    S6 --> S7["executeKK_T_ODR_SET_KK_SELECT_011(selectWhereParam)"]
    S7 --> S8["nextRec = db_KK_T_ODR_SET.selectNext()"]
    S8 --> COND{nextRec != null?}
    COND -->|true| RET_TRUE["Return true (Registered SOD issued)"]
    COND -->|false| RET_FALSE["Return false (Registered SOD not issued)"]
    RET_TRUE --> END(["END"])
    RET_FALSE --> END
```

**Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `JBSbatKKConst.ORDER_SBT_CD_NET` | `"1"` | Order subtype code — Net-based orders (as opposed to other service channels) |
| `JBSbatKKConst.SVC_ORDER_CD_FTTH_NINSHO` | `"06"` | Service order code — FTTH Authentication (Fiber-to-the-home service registration confirmation) |

**Source Fields Used from `inMap`:**

| Index | Source Class | Field |
|-------|-------------|-------|
| 0 | `JBSbatKK_T_SVC_KEI` | `SVC_KEI_NO` — Service contract number |
| 1 | `JBSbatKK_T_SVC_KEI_UCWK` | `SVC_KEI_UCWK_NO` — Service detail work number |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `inMap` | `JBSbatServiceInterfaceMap` | The input message containing service contract identification data. Specifically, it must hold the service contract number (`SVC_KEI_NO`) and service detail work number (`SVC_KEI_UCWK_NO`) extracted from the caller's deletion target data setup flow. These values identify the specific service line item whose SOD issuance status is being verified. |

**Instance fields read by this method:**

| Field | Type | Description |
|-------|------|-------------|
| `db_KK_T_ODR_SET` | `JBSbatSQLAccess` | Database access handle for the `KK_T_ODR_SET` table — used to execute the select query and retrieve the next result record |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatServiceInterfaceMap.getString` | JBSbatKK_T_SVC_KEI | `SVC_KEI_NO` field | Reads the service contract number from the input message map |
| R | `JBSbatServiceInterfaceMap.getString` | JBSbatKK_T_SVC_KEI_UCWK | `SVC_KEI_UCWK_NO` field | Reads the service detail work number from the input message map |
| R | `executeKK_T_ODR_SET_KK_SELECT_011` | KK_SELECT_011 | `KK_T_ODR_SET` | Executes a SQL SELECT query against the Order Settings table with 4 filter parameters to check for an existing SOD record |
| R | `db_KK_T_ODR_SET.selectNext` | - | `KK_T_ODR_SET` | Retrieves the next matching record from the result set produced by `executeKK_T_ODR_SET_KK_SELECT_011` |

**Classification Notes:**
- **R (Read)**: The method only performs database reads — no data is modified. `executeKK_T_ODR_SET_KK_SELECT_011` internally calls `db_KK_T_ODR_SET.selectBySqlDefine()` with SQL key `KK_SELECT_011`.
- **Entity/DB Table**: `KK_T_ODR_SET` (Order Settings table) — stores service order settings/registrations.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: JBSbatKKSvkeiuwDelTgCst.setDelTrgtDataIn | `setDelTrgtDataIn()` calls `isAddSodHakCfmTrn(inMap)` within conditional branch (L275) to check SOD status before proceeding with deletion target data setup | `executeKK_T_ODR_SET_KK_SELECT_011 [R] KK_T_ODR_SET`, `selectNext [R] KK_T_ODR_SET`, `getString [R] SVC_KEI_NO`, `getString [R] SVC_KEI_UCWK_NO` |

**Call Chain Detail:**
- `setDelTrgtDataIn()` (line 275 in `JBSbatKKSvkeiuwDelTgCst`) calls `isAddSodHakCfmTrn(inMap)` within an `if` block to determine whether the SOD has already been issued. If the result is `true` (SOD already issued), the caller may skip re-issuance logic; if `false`, the caller may trigger SOD issuance for the service contract.

## 6. Per-Branch Detail Blocks

**Block 1** — VARIABLE INITIALIZATION (L431)

> Initializes local variables before building the query parameter array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam = null` |
| 2 | SET | `nextRec = null` |
| 3 | SET | `selectWhereParam = new Object[4]` // Allocates 4-element array for SQL WHERE parameters |

**Block 2** — SQL PARAMETER SETUP (L433–440)

> Populates the 4-element select parameter array with values from the input map and constant values. These parameters form the WHERE clause of the SQL query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `selectWhereParam[0] = inMap.getString(JBSbatKK_T_SVC_KEI.SVC_KEI_NO)` // Service contract number [Source field: SVC_KEI_NO] |
| 2 | SET | `selectWhereParam[1] = inMap.getString(JBSbatKK_T_SVC_KEI_UCWK.SVC_KEI_UCWK_NO)` // Service detail work number [Source field: SVC_KEI_UCWK_NO] |
| 3 | SET | `selectWhereParam[2] = JBSbatKKConst.ORDER_SBT_CD_NET "1"` // Order subtype code — Net-based [-> CONSTANT ORDER_SBT_CD_NET="1"] |
| 4 | SET | `selectWhereParam[3] = JBSbatKKConst.SVC_ORDER_CD_FTTH_NINSHO "06"` // Service order code — FTTH Authentication [-> CONSTANT SVC_ORDER_CD_FTTH_NINSHO="06"] |

**Block 3** — SQL EXECUTION (L444–446)

> Executes the select query against the `KK_T_ODR_SET` table. The commented-out legacy call to `executeKK_T_ODR_HAKKO_JOKEN_KK_SELECT_005` was replaced per IT1-2013-0000285 (2013/02/13) to query `KK_T_ODR_SET` instead of `KK_T_ODR_HAKKO_JOKEN`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeKK_T_ODR_SET_KK_SELECT_011(selectWhereParam)` // Delegates to SQL access method with 4 filter parameters |
| 2 | EXEC | `nextRec = db_KK_T_ODR_SET.selectNext()` // Retrieves the next matching record; returns null if no rows found |

**Block 4** — IF BRANCH: `nextRec != null` (L448)

> If a matching record was found, the method confirms that a registered SOD has already been issued for this service contract. Returns `true`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true;` // Registered SOD issued (SOD is complete for this service contract) |

**Block 5** — ELSE BRANCH: `nextRec == null` (L451)

> If no matching record was found, the method confirms that no registered SOD exists yet. Returns `false`, indicating the caller should proceed with SOD issuance.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return false;` // Registered SOD not issued (SOD needs to be created for this service contract) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a customer's service contract line item |
| `svc_kei_ucwk_no` | Field | Service detail work number — an internal tracking ID for a specific service contract line item's sub-work |
| `odr_set` | Table | Order Settings — database table (`KK_T_ODR_SET`) storing service order registration/setting records |
| `odr_hakko_joken` | Table | Order issuance conditions — legacy table (`KK_T_ODR_HAKKO_JOKEN`) formerly queried before migration in 2013 |
| SOD | Acronym | Service Order Data — a telecom order fulfillment entity representing a generated service order |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service |
| NINSHO | Japanese | 認証 (authentication/authorization) — FTTH service registration confirmation |
| ORDER_SBT_CD_NET | Constant | Order subtype code = "1" — identifies net-based (internet) service orders |
| SVC_ORDER_CD_FTTH_NINSHO | Constant | Service order code = "06" — identifies FTTH authentication service orders |
| KK_T_ODR_SET_KK_SELECT_011 | SQL Key | Database query definition key for selecting records from `KK_T_ODR_SET` with 4 filter parameters |
| `JBSbatServiceInterfaceMap` | Class | Service interface map — the input message object carrying business data between batch processing stages |
| `JBSbatSQLAccess` | Class | SQL access wrapper — provides database query execution methods (`selectBySqlDefine`, `selectNext`) |
| `selectNext` | Method | Retrieves the next row from the current result set; returns `null` when no more rows exist |
| setDelTrgtDataIn | Method | Calling method that sets up deletion target data for internet services — calls `isAddSodHakCfmTrn` to check SOD status before proceeding |
