# Business Logic — JBSbatKKFmtcelSodUpdInfCst.executeKU_T_SVKEI_KOJIAK_KK_SELECT_007() [10 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKFmtcelSodUpdInfCst` |
| Layer | Service (Business Service Component — CC / Common Component) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKFmtcelSodUpdInfCst.executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()

This method is a **private data-access helper** within the Frame Cell Service Update Information Constant class (`JBSbatKKFmtcelSodUpdInfCst`). Its sole responsibility is to query the `KU_T_SVKEI_KOJIAK` (Service Contract / Construction Project) database table and populate the result into a shared `JBSbatCommonDBInterface` query handle, so that the calling method can immediately follow up with a `selectNext()` call to retrieve the matched row.

In the broader system, this class is responsible for **extracting frame cell service update information** — that is, identifying and reporting on service contract lines associated with newly installed or cancelled construction projects following an address change (`Kuusho Henko`) operation. The method is used as part of a two-pronged lookup: first searching for records tied to new construction completion (`KK_T_KJ_FIN_WK` with `KK_SELECT_020`), and second, searching for records tied to cancelled construction completion (`KK_T_KJ_FIN_WK` with `KK_SELECT_019`). In both branches, `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007` is invoked to verify whether a matching row exists in `KU_T_SVKEI_KOJIAK`.

The method implements a **delegation pattern**: it receives raw binding variables through an `Object[]` array, wraps them in a typed `JBSbatCommonDBInterface` structure, and delegates the actual SQL execution to the `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine()` DAO accessor. This encapsulation keeps the calling method clean and centralizes SQL definition key management (the key `KK_SELECT_007` is stored as a private static final constant).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKU_T_SVKEI_KOJIAK_KK_SELECT_007(Object[] param)"])
    STEP1["Create JBSbatCommonDBInterface paramList"]
    STEP2["Set param[0] as String - Service Contract Number"]
    STEP3["Set param[1] as String - Construction Project Number"]
    STEP4["Execute SQL query KK_SELECT_007 on KU_T_SVKEI_KOJIAK table"]
    END_NODE["Return / Next"]

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> END_NODE
```

**Processing Steps:**

1. **Parameter binding preparation** — A new `JBSbatCommonDBInterface` instance (`paramList`) is created to serve as the prepared-statement binding container.
2. **Set Service Contract Number** — The first element of the `param` array (`param[0]`) is cast to `String` via `toString()` and bound as the first bind variable. This represents the service contract number (`svc_kei_no`).
3. **Set Construction Project Number** — The second element of the `param` array (`param[1]`) is cast to `String` via `toString()` and bound as the second bind variable. This represents the construction project number (`kojiak_no`).
4. **Execute SQL query** — The `db_KU_T_SVKEI_KOJIAK` SQL access handler executes the predefined SQL identified by the key `KK_SELECT_007`, passing in the populated `paramList`. The result set (if any) is loaded into the shared database interface for the caller to read via `selectNext()`.

No conditional branches, loops, or exception-handling blocks exist in this method — it is a straight-line execution path.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | An array of two bind variable values for the SQL query. `param[0]` is the **Service Contract Number** (`svc_kei_no`) — the unique identifier for a service contract line item. `param[1]` is the **Construction Project Number** (`kojiak_no`) — the unique identifier for a construction project record. The array is always populated with `String` values by the caller (e.g., `new String[]{inChafSkbtNo, newKojiakNo}`). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KU_T_SVKEI_KOJIAK` | `JBSbatSQLAccess` | SQL access handler initialized on the `KU_T_SVKEI_KOJIAK` table (`D_TBL_NAME_KU_T_SVKEI_KOJIAK`), used to execute the `KK_SELECT_007` SQL definition. Initialized during the `execute()` lifecycle. |
| `KU_T_SVKEI_KOJIAK_KK_SELECT_007` | `String` (constant) | SQL definition key with value `"KK_SELECT_007"`. Reference to the SQL statement defined in the SQL definition file that performs the SELECT on `KU_T_SVKEI_KOJIAK`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine` | - | `KU_T_SVKEI_KOJIAK` | Executes SQL definition `KK_SELECT_007` to read rows from the Service Contract / Construction Project table, binding the service contract number and construction project number as WHERE clause parameters. |
| U | `JBSbatCommonDBInterface.setValue` | JDK | - (in-memory item) | Sets bind variable values into the `paramList` object. First call sets the Service Contract Number, second call sets the Construction Project Number. |

**CRUD Classification:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine` | - | `KU_T_SVKEI_KOJIAK` | Reads service contract / construction project records matching the given contract number and project number. Result is loaded into the shared query handle for downstream `selectNext()` retrieval. |
| U | `JBSbatCommonDBInterface.setValue` | - | - (in-memory) | Populates the bind variable container with two values: service contract number and construction project number. |

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JBSbatKKFmtcelSodUpdInfCst.execute() | `execute()` → `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()` | `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine [R] KU_T_SVKEI_KOJIAK` |

**Caller Details:**

The method is called from within the same class (`JBSbatKKFmtcelSodUpdInfCst.execute()` method) in two distinct business branches:

- **Branch A (New Construction)** — When searching for records associated with newly completed construction (`KK_SELECT_020` from `KK_T_KJ_FIN_WK`), the method is called with the chara settlement number (`inChafSkbtNo`) and the new construction project number (`newKojiakNo`). This verifies whether the service contract line is associated with the new construction project.
- **Branch B (Cancelled Construction)** — When searching for records associated with cancelled construction (`KK_SELECT_019` from `KK_T_KJ_FIN_WK`), the method is called with the pre-change settlement number (`inMap.getString(CHBF_SKBT_NO)`) and the cancelled construction project number (`dslKojiakNo`). This verifies whether the service contract line is associated with the cancelled construction project.

In both branches, if the query returns a matching row (`selectNext() != null`), the method's result is used to output the service contract information to the intermediate file, and the caller returns early. If neither branch finds a match, the method returns `null`.

## 6. Per-Branch Detail Blocks

**Block 1** — [PROCESSING] `(straight-line execution)` (L489)

> Creates the bind variable list container and populates it with values from the param array.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();` // Create binding container [-> JBSbatCommonDBInterface] |
| 2 | EXEC | `paramList.setValue(param[0].toString());` // Set Service Contract Number (svc_kei_no) as first bind variable |
| 3 | EXEC | `paramList.setValue(param[1].toString());` // Set Construction Project Number (kojiak_no) as second bind variable |

**Block 2** — [PROCESSING] `(SQL execution)` (L493)

> Executes the predefined SQL query against the KU_T_SVKEI_KOJIAK table using the SQL definition key `KK_SELECT_007`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine(paramList, KU_T_SVKEI_KOJIAK_KK_SELECT_007);` // Execute SELECT on KU_T_SVKEI_KOJIAK using key "KK_SELECT_007" [-> CONSTANT: KU_T_SVKEI_KOJIAK_KK_SELECT_007 = "KK_SELECT_007"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service Contract Number — unique identifier for a service contract line item. The primary key reference for service offerings. |
| `kojiak_no` | Field | Construction Project Number — unique identifier for a construction project record associated with a service contract. Tracks the physical installation or removal work. |
| `inChafSkbtNo` | Field | Chara Settlement Number — settlement number used in address change processing, referencing the chara (characteristic) settlement record. |
| `dslKojiakNo` | Field | DSL Construction Project Number — the construction project number extracted from cancelled (dsl = cancel/dismantle) work completion records. |
| `KU_T_SVKEI_KOJIAK` | Table | Service Contract / Construction Project table — links service contracts to their associated construction projects. "KU" prefix indicates a unified/consolidated table scope. |
| `KK_SELECT_007` | SQL Key | SQL definition key for the SELECT query on `KU_T_SVKEI_KOJIAK` table, matched by service contract number and construction project number. |
| `KK_T_KJ_FIN_WK` | Table | Construction Completion Work table — tracks newly completed (`KK_SELECT_020`) or cancelled (`KK_SELECT_019`) construction project records. "KJ" = construction completion (`kouji kanryo`), "WK" = work. |
| `KK_T_SVKEI_KAISEN_UW` | Table | Service Detail Historical Update table — holds historical updates for service detail records. |
| `KK_T_ADCHG_DTL` | Table | Address Change Detail table — stores detail records for address change operations. |
| `KK_T_SVC_KEI` | Table | Service Contract table — stores service contract header information. |
| `JBSbatCommonDBInterface` | Class | Framework binding container — a generic data structure used to pass bind variable values to SQL execution methods and to hold query result sets. |
| `JBSbatSQLAccess` | Class | Framework SQL access handler — a DAO-level accessor that wraps database connection management and SQL execution for a specific table. |
| `selectBySqlDefine` | Method | Framework method that executes a predefined SQL statement (identified by a key string) using the provided bind variable list. |
| `selectNext` | Method | Framework method that fetches the next row from a previously executed query result set. Returns `null` when no more rows exist. |
| `ku_ji` | Japanese term | Construction project / work order — `kouji` (工事) means construction/work. |
| `kojiak` | Japanese term | Construction completion record — `kouzi kanryo akas` (工事完了アカウント) or similar, referring to the construction completion account/record. |
| `chaf` | Abbreviation | Chara — short for characteristic; refers to service characteristic or service feature records in address change processing. |
| `dsl` | Abbreviation | Dismantle / cancel — refers to cancelled construction work, as opposed to newly completed construction. Used as a prefix for variables tracking cancelled construction project data. |
| `adchg` | Abbreviation | Address Change — short for address change (`kuusho henkou`), a business operation where a customer's registered address is modified. |
| `skbt` | Abbreviation | Settlement — refers to settlement records in the service billing/accounting system. |
| `fmtcel` | Abbreviation | Frame Cell — refers to the frame-based cell architecture used for organizing service update information. |
| `sod` | Abbreviation | Service Order Data — the core order fulfillment data model in the telecom service domain. |
| `upd` | Abbreviation | Update — refers to service update information processing. |
| `inf` | Abbreviation | Information — refers to information retrieval/extract operations. |
| `cst` | Abbreviation | Constant — indicates this class contains constant/configuration data for the service update information extraction process. |
