# Business Logic — JBSbatKKNrkeFinKikiHktgi.initial() [50 LOC]

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

## 1. Role

### JBSbatKKNrkeFinKikiHktgi.initial()

This method serves as the **batch entry-point initialization routine** for the service contract finalization processing class `JBSbatKKNrkeFinKikiHktgi`, which extends `JBSbatBusinessService`. It implements the **delegation** and **resource-initialization** patterns by first delegating to the parent class's `setCommonInfo()` to bind common batch parameters (operation date, batch user ID, system code, job ID, free item, etc.), then instantiating a dedicated `JBSbatSQLAccess` object for each of 15 database tables that the batch will subsequently read or write during its lifecycle.

Following the database access setup, the method **queries the business parameter management table** (`ZM_M_WORK_PARAM_KNRI`) to retrieve dummy device codes for five categories of anonymous/unknown equipment: ONU (Optical Network Unit), V-ONU (Virtual ONU), HGW (Home Gateway), MESH, and MLAN. These dummy device codes are essential for equipment provisioning workflows where the actual device identity is unknown or being masked — for example, during bulk service creation or migration scenarios. The retrieved values are stored in an in-memory `HashMap<String, String>` (`humeiModelCdMap`), keyed by the business parameter management ID, for downstream lookup by other processing methods in the same class.

As the `initial()` method of an abstract batch business service, `JBSbatKKNrkeFinKikiHktgi.initial()` is the **primary entry point** called by the batch framework after the `JBSbatCommonItem` payload is constructed. Its role in the larger system is to prepare the processing environment — establishing database connections, loading operational configuration from the parameter management table, and populating the anonymous device code mapping that subsequent service contract processing stages depend on.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["initial(commonItem)"])
    START --> SET_COMMON["super.setCommonInfo(commonItem)"]
    SET_COMMON --> INIT_DB["Initialize JBSbatSQLAccess objects
(db_ZM_M_WORK_PARAM_KNRI,
db_KK_T_KKTK_SVC_KEI, db_KK_T_SVC_KEI,
db_KK_T_KKOP_SVC_KEI, db_DK_T_HAISO_TG_BPIN,
db_DK_T_HMPIN_KIKI, db_DK_T_HMPIN_KIKI_MOTO,
db_KK_T_SVKEI_KAISEN_UW, db_KK_T_ODR_SET,
db_KK_T_SVC_KEI_UCWK, db_KK_T_ODR_HAKKO_JOKEN,
db_KK_T_ODR_INF_SKSI_WK, db_KK_T_PRG,
db_KU_T_KJAK_TG_TKKIKI)"]
    INIT_DB --> INIT_WORK["Initialize working structures:
mapWorkParamKnri = new JBSbatCommonDBInterface()
whereWorkParamKnri = new Object[3]
whereWorkParamKnri[1] = this.opeDate
whereWorkParamKnri[2] = this.opeDate"]
    INIT_WORK --> FOR_CHECK["for i = 0 to HUMEI_MODEL_CD_ARRAY.length"]
    FOR_CHECK --> WHERE_SET["whereWorkParamKnri[0] = HUMEI_MODEL_CD_ARRAY[i]"]
    WHERE_SET --> EXEC_SELECT["executeZM_M_WORK_PARAM_KNRI_KK_SELECT_016(whereWorkParamKnri)"]
    EXEC_SELECT --> SELECT_NEXT["db_ZM_M_WORK_PARAM_KNRI.selectNext()"]
    SELECT_NEXT --> NULL_CHECK{"mapWorkParamKnri
is not null?"}
    NULL_CHECK --> TRUE["true"]
    NULL_CHECK --> FALSE["false"]
    TRUE --> PUT_MAP["humeiModelCdMap.put(
HUMEI_MODEL_CD_ARRAY[i],
mapWorkParamKnri.getString(
WORK_PARAM_SETTE_VALUE))"]
    FALSE --> NEXT_I["i++"]
    PUT_MAP --> NEXT_I
    NEXT_I --> FOR_END["for condition check"]
    FOR_END --> TRUE
    FOR_END --> FALSE
    FALSE --> END_NODE(["Return"])
```

**CRITICAL — Constant Resolution:**

| Constant Name | Actual Value | Business Meaning |
|--------------|--------------|------------------|
| `KK_SBRY_DUMMY_ONU` | `"KK_SBRY_DUMMY_ONU"` | Dummy ONU (Optical Network Unit) for equipment flow — business parameter key for anonymous/unknown ONU equipment |
| `KK_SBRY_DUMMY_TKNRT` | `"KK_SBRY_DUMMY_TKNRT"` | Dummy TKNRT (Terminal Unit) for equipment flow — business parameter key for anonymous/unknown terminal unit equipment |
| `KK_SBRY_DUMMY_HGW` | `"KK_SBRY_DUMMY_HGW"` | Dummy HGW (Home Gateway) for equipment flow — business parameter key for anonymous/unknown home gateway equipment |
| `KK_SBRY_DUMMY_MESH` | `"KK_SBRY_DUMMY_MESH"` | Dummy MESH (MESH network device) for equipment flow — business parameter key for anonymous/unknown MESH equipment |
| `KK_SBRY_DUMMY_MLAN` | `"KK_SBRY_DUMMY_MLAN"` | Dummy MLAN (Mega LAN switch) for equipment flow — business parameter key for anonymous/unknown MLAN equipment |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `commonItem` | `JBSbatCommonItem` | Batch common parameter document — carries the shared batch execution context including operation date (`opeDate`), online operation date, batch user ID, system code, job ID, free item, and log print control. This object is the contract between the batch framework and the business service layer. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `opeDate` | `String` | Operation date — the processing date set by the parent class during batch execution, used as a WHERE clause filter when querying business parameter management records |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JBSbatBusinessService.setCommonInfo` | JBSbatBusinessService | - | Sets common batch parameters (operation date, user ID, system code, etc.) from `commonItem` into this instance |
| R | `JBSbatSQLAccess` (constructor) | - | `ZM_M_WORK_PARAM_KNRI` | Creates SQL access object for business parameter management table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_KKTK_SVC_KEI` | Creates SQL access object for equipment-provided service contract table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_KKTK_SVC_KEI` | Creates SQL access object for equipment-provided service contract table (second alias: `_SAKI`) |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_SVC_KEI` | Creates SQL access object for service contract table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_KKOP_SVC_KEI` | Creates SQL access object for equipment-option service contract table |
| R | `JBSbatSQLAccess` (constructor) | - | `DK_T_HAISO_TG_BPIN` | Creates SQL access object for delivery target product/BPIN table |
| R | `JBSbatSQLAccess` (constructor) | - | `DK_T_HMPIN_KIKI` | Creates SQL access object for returned equipment table |
| R | `JBSbatSQLAccess` (constructor) | - | `DK_T_HMPIN_KIKI` | Creates SQL access object for returned equipment table (second alias: `_MOTO`) |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_SVKEI_KAISEN_UW` | Creates SQL access object for service contract line details table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_ODR_SET` | Creates SQL access object for order settings table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_SVC_KEI_UCWK` | Creates SQL access object for service contract line items table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_ODR_HAKKO_JOKEN` | Creates SQL access object for order release conditions table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_ODR_INF_SKSI_WK` | Creates SQL access object for order information creation work table |
| R | `JBSbatSQLAccess` (constructor) | - | `KK_T_PRG` | Creates SQL access object for progress table |
| R | `JBSbatSQLAccess` (constructor) | - | `KU_T_KJAK_TG_TKKIKI` | Creates SQL access object for work project target indoor equipment table (ANK-4656-00-00 addition) |
| R | `JBSbatKKNrkeFinKikiHktgi.executeZM_M_WORK_PARAM_KNRI_KK_SELECT_016` | (SC code inferred) | `ZM_M_WORK_PARAM_KNRI` | Executes SQL select to retrieve business parameter management records by device type code and operation date range |
| R | `JBSbatCommonDBInterface.getString` | - | - | Retrieves the `WORK_PARAM_SETTE_VALUE` field from the current database result row |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch:JBSbatKKNrkeFinKikiHktgi | `JBSbatBusinessService.initial(commonItem)` -> `JBSbatKKNrkeFinKikiHktgi.initial(commonItem)` | `executeZM_M_WORK_PARAM_KNRI_KK_SELECT_016 [R] ZM_M_WORK_PARAM_KNRI` |

**Note:** No direct callers outside this class were found in the codebase. This method is the abstract `initial()` implementation of the batch business service `JBSbatKKNrkeFinKikiHktgi`, invoked by the batch framework's service execution engine which instantiates concrete service classes and calls their `initial()` methods through the `JBSbatBusinessService` abstract base class interface.

## 6. Per-Branch Detail Blocks

**Block 1** — [CALL] `super.setCommonInfo(commonItem)` (L553)

> Sets common batch parameters from the incoming `commonItem` to instance fields. This is a tool-generated source that delegates to the parent class.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.setCommonInfo(commonItem)` // Sets operation date, online operation date, batch user ID, system code, job ID, free item, log print control, common item |

---

**Block 2** — [CALL] Initialize JBSbatSQLAccess objects (L558–L574)

> Creates dedicated SQL access objects for each database table the batch will operate on. Each `JBSbatSQLAccess` is initialized with the `commonItem` context and a table name constant.

| # | Type | Code |
|---|------|------|
| 1 | SET | `db_ZM_M_WORK_PARAM_KNRI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_ZM_M_WORK_PARAM_KNRI)` // Table: `ZM_M_WORK_PARAM_KNRI` (Business Parameter Management) |
| 2 | SET | `db_KK_T_KKTK_SVC_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_KKTK_SVC_KEI)` // Table: `KK_T_KKTK_SVC_KEI` (Equipment-Provided Service Contract) |
| 3 | SET | `db_KK_T_KKTK_SVC_KEI_SAKI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_KKTK_SVC_KEI)` // Table: `KK_T_KKTK_SVC_KEI` (Equipment-Provided Service Contract — SAKI/next stage alias) |
| 4 | SET | `db_KK_T_SVC_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_SVC_KEI)` // Table: `KK_T_SVC_KEI` (Service Contract) |
| 5 | SET | `db_KK_T_KKOP_SVC_KEI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_KKOP_SVC_KEI)` // Table: `KK_T_KKOP_SVC_KEI` (Equipment-Option Service Contract) |
| 6 | SET | `db_DK_T_HAISO_TG_BPIN = new JBSbatSQLAccess(commonItem, D_TBL_NAME_DK_T_HAISO_TG_BPIN)` // Table: `DK_T_HAISO_TG_BPIN` (Delivery Target Product/BPIN) |
| 7 | SET | `db_DK_T_HMPIN_KIKI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_DK_T_HMPIN_KIKI)` // Table: `DK_T_HMPIN_KIKI` (Returned Equipment) |
| 8 | SET | `db_DK_T_HMPIN_KIKI_MOTO = new JBSbatSQLAccess(commonItem, D_TBL_NAME_DK_T_HMPIN_KIKI)` // Table: `DK_T_HMPIN_KIKI` (Returned Equipment — MOTO/original alias) |
| 9 | SET | `db_KK_T_SVKEI_KAISEN_UW = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_SVKEI_KAISEN_UW)` // Table: `KK_T_SVKEI_KAISEN_UW` (Service Contract Line Details) |
| 10 | SET | `db_KK_T_ODR_SET = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_ODR_SET)` // Table: `KK_T_ODR_SET` (Order Settings) |
| 11 | SET | `db_KK_T_SVC_KEI_UCWK = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_SVC_KEI_UCWK)` // Table: `KK_T_SVC_KEI_UCWK` (Service Contract Line Items) |
| 12 | SET | `db_KK_T_ODR_HAKKO_JOKEN = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_ODR_HAKKO_JOKEN)` // Table: `KK_T_ODR_HAKKO_JOKEN` (Order Release Conditions) |
| 13 | SET | `db_KK_T_ODR_INF_SKSI_WK = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_ODR_INF_SKSI_WK)` // Table: `KK_T_ODR_INF_SKSI_WK` (Order Information Creation Work) |
| 14 | SET | `db_KK_T_PRG = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KK_T_PRG)` // Table: `KK_T_PRG` (Progress) |
| 15 | SET | `db_KU_T_KJAK_TG_TKKIKI = new JBSbatSQLAccess(commonItem, D_TBL_NAME_KU_T_KJAK_TG_TKKIKI)` // Table: `KU_T_KJAK_TG_TKKIKI` (Work Project Target Indoor Equipment) [ANK-4656-00-00 ADD] |

---

**Block 3** — [SET] Initialize working structures (L577–L580)

> Initializes the working objects for the anonymous device query loop. The `whereWorkParamKnri` array has 3 slots: index 0 will be set per-iteration to the device code, indices 1 and 2 are pre-set to the operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mapWorkParamKnri = new JBSbatCommonDBInterface()` // Holds database result for business parameter management record |
| 2 | SET | `whereWorkParamKnri = new Object[3]` // WHERE clause parameters array |
| 3 | SET | `whereWorkParamKnri[1] = this.opeDate` // Operation date (start range) — from instance field set by `setCommonInfo` |
| 4 | SET | `whereWorkParamKnri[2] = this.opeDate` // Operation date (end range) — same date, likely used as inclusive range filter |

---

**Block 4** — [FOR] Loop over HUMEI_MODEL_CD_ARRAY (L582–L596)

> Iterates over 5 anonymous device type codes (ONU, TKNRT, HGW, MESH, MLAN). For each type, it queries the business parameter management table to retrieve the configured dummy device code value, and stores it in the `humeiModelCdMap`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `for (int i = 0; i < HUMEI_MODEL_CD_ARRAY.length; i++)` // Iterates: [KK_SBRY_DUMMY_ONU, KK_SBRY_DUMMY_TKNRT, KK_SBRY_DUMMY_HGW, KK_SBRY_DUMMY_MESH, KK_SBRY_DUMMY_MLAN] |

**Block 4.1** — [SET] Set WHERE clause key (L584) (inside FOR loop)

> Sets the device type code as the first WHERE clause parameter for the query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `whereWorkParamKnri[0] = HUMEI_MODEL_CD_ARRAY[i]` // [-> KK_SBRY_DUMMY_ONU / KK_SBRY_DUMMY_TKNRT / KK_SBRY_DUMMY_HGW / KK_SBRY_DUMMY_MESH / KK_SBRY_DUMMY_MLAN] |

**Block 4.2** — [CALL] Execute SQL select (L585)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `executeZM_M_WORK_PARAM_KNRI_KK_SELECT_016(whereWorkParamKnri)` // Queries ZM_M_WORK_PARAM_KNRI table WHERE device_code = ? AND date BETWEEN ? AND ? |

**Block 4.3** — [CALL] Select next row (L588)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapWorkParamKnri = db_ZM_M_WORK_PARAM_KNRI.selectNext()` // Advances to next result row |

**Block 4.4** — [IF] Null check on result (L590)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null != mapWorkParamKnri)` // Check if a record was found for this device type |

**Block 4.4.1** — [IF] — true branch: Put into map (L593)

> When a matching record exists in the business parameter management table, extracts the `WORK_PARAM_SETTE_VALUE` and stores it in the anonymous device code map, keyed by the device type constant.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `humeiModelCdMap.put(HUMEI_MODEL_CD_ARRAY[i], mapWorkParamKnri.getString(JBSbatZM_M_WORK_PARAM_KNRI.WORK_PARAM_SETTE_VALUE))` // Stores the dummy device code value for downstream use |

**Block 4.4.2** — [IF] — false branch: no-op (L590)

> When no record is found for a device type, the loop continues to the next iteration without adding an entry to the map. This means the `humeiModelCdMap` may contain fewer than 5 entries depending on the configured data.

---

**Block 5** — [RETURN] Method completion (L599)

> The method returns `void`. Processing control passes to the next batch processing stage (typically a business logic method such as `execute()` or `process()` in the same class).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // Implicit return — method completes |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `opeDate` | Field | Operation date — the processing date for the batch run, used as a date-range filter when querying business parameter management records |
| `commonItem` | Field | Batch common parameter document — the shared context object carrying batch execution metadata (user ID, system code, job ID, operation date) |
| `humeiModelCdMap` | Field | Anonymous device code map — in-memory HashMap mapping device type keys to their configured dummy device code values |
| `humeiModelCd` | Field | Anonymous/unknown device model code — a placeholder code used when the actual equipment model is not known or needs to be masked |
| `HUMEI_MODEL_CD_ARRAY` | Field | Array of anonymous device type codes — the 5 device categories (ONU, TKNRT, HGW, MESH, MLAN) whose parameter values are loaded during initialization |
| KK_SBRY_DUMMY_ONU | Constant | Dummy ONU (Optical Network Unit) for equipment flow — business parameter ID for anonymous/unknown ONU equipment |
| KK_SBRY_DUMMY_TKNRT | Constant | Dummy TKNRT (Terminal Unit) for equipment flow — business parameter ID for anonymous/unknown terminal unit equipment |
| KK_SBRY_DUMMY_HGW | Constant | Dummy HGW (Home Gateway) for equipment flow — business parameter ID for anonymous/unknown home gateway equipment |
| KK_SBRY_DUMMY_MESH | Constant | Dummy MESH (MESH network device) for equipment flow — business parameter ID for anonymous/unknown MESH equipment |
| KK_SBRY_DUMMY_MLAN | Constant | Dummy MLAN (Mega LAN switch) for equipment flow — business parameter ID for anonymous/unknown MLAN equipment |
| ONU | Acronym | Optical Network Unit — the customer-premises device in a fiber-optic network that terminates the optical fiber and provides Ethernet/WiFi connectivity |
| HGW | Acronym | Home Gateway — a combined modem/router device provided to customers for home internet connectivity |
| MESH | Acronym | MESH network device — a wireless mesh networking device for whole-home WiFi coverage |
| MLAN | Acronym | Mega LAN — a power-line networking (PLC) device for in-home Ethernet connectivity over electrical wiring |
| TKNRT | Acronym | Terminal Unit — the customer-facing network termination equipment (V-ONU variant) |
| V-ONU | Acronym | Virtual Optical Network Unit — a software-defined or virtualized ONU endpoint |
| ZM_M_WORK_PARAM_KNRI | Table | Business parameter management table — central configuration table storing key-value pairs for operational parameters, including dummy device codes |
| KK_T_KKTK_SVC_KEI | Table | Equipment-provided service contract table — stores service contracts for equipment provided by the carrier |
| KK_T_SVC_KEI | Table | Service contract table — stores general service contract records |
| KK_T_KKOP_SVC_KEI | Table | Equipment-option service contract table — stores service contracts for optional equipment services |
| DK_T_HAISO_TG_BPIN | Table | Delivery target product/BPIN table — stores product delivery target information and BPIN (Billing Product Identification Number) |
| DK_T_HMPIN_KIKI | Table | Returned equipment table — stores records of equipment returned by customers |
| KK_T_SVKEI_KAISEN_UW | Table | Service contract line details table — stores detailed line-level information for service contracts |
| KK_T_ODR_SET | Table | Order settings table — stores order configuration and settings |
| KK_T_SVC_KEI_UCWK | Table | Service contract line items table — stores individual line items within a service contract |
| KK_T_ODR_HAKKO_JOKEN | Table | Order release conditions table — stores the conditions under which orders are released/processed |
| KK_T_ODR_INF_SKSI_WK | Table | Order information creation work table — temporary/work table for order information creation processing |
| KK_T_PRG | Table | Progress table — stores batch processing progress information |
| KU_T_KJAK_TG_TKKIKI | Table | Work project target indoor equipment table — stores indoor equipment records targeted for work projects (ANK-4656-00-00 addition) |
| JBSbatSQLAccess | Class | SQL access abstraction — provides database connectivity and query execution for batch processing, initialized with a `commonItem` context and a table name |
| JBSbatCommonDBInterface | Interface | Common database interface — standard interface for reading database result rows, including `getString()` for column value retrieval |
| JBSbatCommonItem | Class | Batch common item — the shared parameter object passed between batch framework and business service classes |
| JBSbatBusinessService | Class | Abstract base class for all batch business services — defines the `initial()` and `terminal()` lifecycle hooks and `setCommonInfo()` parameter binding |
| `setCommonInfo` | Method | Sets common batch parameters from `commonItem` into this instance (operation date, user ID, system code, etc.) |
| `executeZM_M_WORK_PARAM_KNRI_KK_SELECT_016` | Method | SQL select method — queries the business parameter management table by device type code and operation date range |
| `WORK_PARAM_SETTE_VALUE` | Field | Work parameter set value — the value field in the business parameter management record, containing the actual dummy device code |
| KK_SELECT_016 | Constant | SQL definition key — the SQL statement identifier for the business parameter management select query |
| Batch | Architecture | Batch processing system — the Fujitsu Futurity BP-based batch framework that executes service classes in sequence |
