# Business Logic — JBSbatKKBandWidthOverLmtDtTst.executeKK_T_OP_SVC_KEI_KK_SELECT_062() [22 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKBandWidthOverLmtDtTst` |
| Layer | Service (Batch/CC — Common Component used in batch processing) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKBandWidthOverLmtDtTst.executeKK_T_OP_SVC_KEI_KK_SELECT_062()

This method is a **private database access helper** that queries the `KK_T_OP_SVC_KEI` (Option Service Contract) table to retrieve option service contract records matching a given service contract number and application effective date. It is used during batch processing for bandwidth over-limit detection (`JBSbatKKBandWidthOverLmtDtTst`), where the system determines whether a subscriber has exceeded their contracted bandwidth and needs to be notified. Specifically, this method is called to fetch ISP (Internet Service Provider) contract information — including the customer's email address — so that the batch can dispatch an over-limit notification. It implements a simple **query-and-collect** pattern: it accepts bound variables as a parameter array, delegates the SQL execution to a `JBSbatSQLAccess` wrapper, and iterates through the result set to accumulate all matching records into a list.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKK_T_OP_SVC_KEI_KK_SELECT_062(Object[] param)"])
    INIT_LIST["Initialize ArrayList with capacity 2"]
    INIT_PARAM_LIST["Create JBSbatCommonDBInterface paramList"]
    SET_PARAM0["SET paramList.setValue(param[0].toString())"]
    SET_PARAM1["SET paramList.setValue(param[1].toString())"]
    EXEC_SELECT_BY_SQL["CALL db_KK_T_OP_SVC_KEI.selectBySqlDefine(paramList, KK_SELECT_062)"]
    FETCH_FIRST["FETCH resultMap = db.selectNext()"]
    CHECK_NULL{resultMap != null?}
    ADD_TO_LIST["ADD list.add(resultMap)"]
    FETCH_NEXT["FETCH resultMap = db.selectNext()"]
    END_NODE(["Return list"])

    START --> INIT_LIST
    INIT_LIST --> INIT_PARAM_LIST
    INIT_PARAM_LIST --> SET_PARAM0
    SET_PARAM0 --> SET_PARAM1
    SET_PARAM1 --> EXEC_SELECT_BY_SQL
    EXEC_SELECT_BY_SQL --> FETCH_FIRST
    FETCH_FIRST --> CHECK_NULL
    CHECK_NULL -->|true| ADD_TO_LIST
    ADD_TO_LIST --> FETCH_NEXT
    FETCH_NEXT --> CHECK_NULL
    CHECK_NULL -->|false| END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | Array of bind variables for the SQL query. `param[0]` is the **Service Contract Number** (`svcKeiNo`) — the unique identifier for a service contract line item. `param[1]` is the **Reservation Application Effective Date** (`opeDate`) — the operational processing date used to find contracts active on that date. |

**Instance fields read by this method:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KK_T_OP_SVC_KEI` | `JBSbatSQLAccess` | Database access handle for the `KK_T_OP_SVC_KEI` (Option Service Contract) table. Initialized in the class setup with the target table name |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KK_T_OP_SVC_KEI.selectBySqlDefine` | - | `KK_T_OP_SVC_KEI` | Executes a SQL SELECT against the Option Service Contract table using the pre-defined SQL key `KK_SELECT_062`, with bind variables (service contract number, effective date) passed in `paramList` |
| R | `db_KK_T_OP_SVC_KEI.selectNext` | - | `KK_T_OP_SVC_KEI` | Fetches the next row from the open result set. Called iteratively in a while-loop to drain all matching records |

**CRUD Classification Rationale:**
- Both operations are **Read (R)**: `selectBySqlDefine` prepares and executes a SQL query (SELECT statement identified by key `KK_SELECT_062`), and `selectNext` retrieves rows from the open cursor. No insert, update, or delete operations are performed.

## 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: `selectBySqlDefine` [-], `selectNext` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKBandWidthOverLmtDtTst | `JBSbatKKBandWidthOverLmtDtTst.execute` (L275) → `executeKK_T_OP_SVC_KEI_KK_SELECT_062` | `selectBySqlDefine [R] KK_T_OP_SVC_KEI`, `selectNext [R] KK_T_OP_SVC_KEI` |

**Call Context (line 275):** The caller constructs a parameter array `{svcKeiNo, super.opeDate}` and invokes this method to retrieve ISP option service contract records, which include the email address needed for over-limit notification.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(Initialization)` (L612–L613)

> Initialize the result list and parameter holder.

| # | Type | Code |
|---|------|------|
| 1 | SET | `list = new ArrayList<JBSbatCommonDBInterface>(2)` // Create result list with initial capacity 2 |
| 2 | SET | `paramList = new JBSbatCommonDBInterface()` // Create parameter holder object |

**Block 2** — [EXEC] `(Set bind variables)` (L614–L615)

> Bind the two SQL parameters from the input array. param[0] is the service contract number; param[1] is the effective date.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramList.setValue(param[0].toString())` // Set service contract number as bind variable [-> param[0]: svcKeiNo] |
| 2 | EXEC | `paramList.setValue(param[1].toString())` // Set application effective date as bind variable [-> param[1]: opeDate] |

**Block 3** — [CALL] `(Execute SQL query)` (L618)

> Delegate the SQL SELECT to the database access layer. The SQL key `KK_SELECT_062` identifies the pre-defined query that selects from `KK_T_OP_SVC_KEI`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KK_T_OP_SVC_KEI.selectBySqlDefine(paramList, KK_T_OP_SVC_KEI_KK_SELECT_062)` // Execute query [-> KK_T_OP_SVC_KEI_KK_SELECT_062 = "KK_SELECT_062" (JBSbatKKBandWidthOverLmtDtTst.java:86)] |

**Block 4** — [WHILE LOOP] `(Drain result set)` (L622–L628)

> Iteratively fetch all rows from the query result set and accumulate them into the return list.

| # | Type | Code |
|---|------|------|
| 1 | FETCH | `resultMap = db_KK_T_OP_SVC_KEI.selectNext()` // Fetch first row |
| 2 | IF | `resultMap != null` [-> Null check for result set exhaustion] (L624) |
| 3 | SET | `list.add(resultMap)` // Add matching record to result list (L626) |
| 4 | FETCH | `resultMap = db_KK_T_OP_SVC_KEI.selectNext()` // Fetch next row (L627) |
| 5 | RETURN | `return list` // Return all collected option service contract records (L630) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KK_T_OP_SVC_KEI` | DB Table | Option Service Contract table — stores records of optional service contracts (e.g., ISP, additional services) attached to a customer's main service contract |
| `svcKeiNo` | Field | Service contract number — the unique identifier for a service contract line item within a customer's portfolio |
| `opeDate` | Field | Operational processing date — the batch processing date used as a filter for contracts effective on that date |
| `KK_SELECT_062` | SQL Key | Pre-defined SQL query key for selecting option service contract records from `KK_T_OP_SVC_KEI` |
| `JBSbatSQLAccess` | Class | Database access wrapper class that encapsulates SQL execution and result set iteration |
| `JBSbatCommonDBInterface` | Class | Common database result set interface — represents a single row of query results with key-value property access |
| `db_KK_T_OP_SVC_KEI` | Field | Database access handle instance for the `KK_T_OP_SVC_KEI` table, initialized with the table name in the class setup |
| ISP | Business term | Internet Service Provider — the internet connectivity service component of a customer's contracted services |
| Bandwidth Over-Limit | Business domain | The batch processing scenario where a subscriber exceeds their contracted bandwidth threshold, triggering notification procedures |
| `KK_T_OP_SVC_KEI_KK_SELECT_062` | Constant | SQL definition key constant holding the value `"KK_SELECT_062"` — used as the SQL key parameter for the `selectBySqlDefine` call [-> JBSbatKKBandWidthOverLmtDtTst.java:86] |
| `selectBySqlDefine` | Method | Database access method that executes a SQL query identified by a pre-defined SQL key, with bind variables supplied via a parameter object |
| `selectNext` | Method | Database access method that retrieves the next row from an open result set cursor |
| `setValue` | Method | Sets a bind variable value in the `JBSbatCommonDBInterface` parameter holder object — values are set sequentially in the order expected by the SQL query |

---

*Generated from `JBSbatKKBandWidthOverLmtDtTst.java` lines 610–631 | 22 LOC*
