# Business Logic — KKW14301SF01DBean.loadModelData() [52 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA35101SF.KKW14301SF01DBean` |
| Layer | Data Bean / View Component (Web Layer) |
| Module | `KKA35101SF` (Package: `eo.web.webview.KKA35101SF`) |

## 1. Role

### KKW14301SF01DBean.loadModelData()

This method implements a data-type bean router that resolves structured key and subkey lookups to retrieve field values from the bean's internal data model. It is used within the K-Opticom web order entry system to support data-type bean-based screen rendering — specifically for the "WEB Application Screen Data Reference" (WEB申込画面データ参照 / Screen ID: KKW14301). The method dispatches on three data types: "N台目-Eo光テレビチューナー (STB)" (Second Eo Light TV Tunner (STB)), "N台目-コース選択" (Second - Course Selection), and "N台目-カウント" (Second - Count). For each data type, it further dispatches on the subkey to return the corresponding `value`, `enable`, or `state` field. This follows the **routing/dispatch pattern** — acting as a shared utility called by the parent screen bean (`KKW14301SFBean`) which creates instances of this DBean for each row in a data-type bean list, enabling dynamic per-row data loading during screen initialization. The design mirrors the X31CBaseBean `loadModelData` contract, ensuring compatibility with the framework's generic bean loading mechanism.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])

    START --> CHECK_NULL{"key == null<br/>|| subkey == null"}

    CHECK_NULL -->|Yes| RET_NULL_1(["return null"])
    CHECK_NULL -->|No| FIND_SLASH["find '/' separator<br/>indexOf('/')"]

    FIND_SLASH --> KEY_CHECK{"key matches<br/>data type?"}

    KEY_CHECK -->|"N台目-Eo光<br/>テレビチューナー<br/>(STB)"| TV_TUNER_BRANCH["Route to<br/>TV Tuner block"]
    KEY_CHECK -->|"N台目-<br/>コース選択"| COURSE_BRANCH["Route to<br/>Course Selection block"]
    KEY_CHECK -->|"N台目-<br/>カウント"| COUNT_BRANCH["Route to<br/>Count block"]
    KEY_CHECK -->|No match| RET_NULL_3(["return null"])

    TV_TUNER_BRANCH --> TV_SUBKEY{"subkey match"}
    TV_SUBKEY -->|value| TV_VALUE["getKcat_n_cnt_tv_tuner_value()"]
    TV_SUBKEY -->|enable| TV_ENABLE["getKcat_n_cnt_tv_tuner_enabled()"]
    TV_SUBKEY -->|state| TV_STATE["getKcat_n_cnt_tv_tuner_state()"]
    TV_SUBKEY -->|other| RET_NULL_2(["return null"])

    COURSE_BRANCH --> CS_SUBKEY{"subkey match"}
    CS_SUBKEY -->|value| CS_VALUE["getKcat_n_course_choice_value()"]
    CS_SUBKEY -->|enable| CS_ENABLE["getKcat_n_course_choice_enabled()"]
    CS_SUBKEY -->|state| CS_STATE["getKcat_n_course_choice_state()"]
    CS_SUBKEY -->|other| RET_NULL_4(["return null"])

    COUNT_BRANCH --> CNT_SUBKEY{"subkey match"}
    CNT_SUBKEY -->|value| CNT_VALUE["getKcat_n_cnt_value()"]
    CNT_SUBKEY -->|enable| CNT_ENABLE["getKcat_n_cnt_enabled()"]
    CNT_SUBKEY -->|state| CNT_STATE["getKcat_n_cnt_state()"]
    CNT_SUBKEY -->|other| RET_NULL_5(["return null"])

    TV_VALUE --> END_RETURN(["Return data"])
    TV_ENABLE --> END_RETURN
    TV_STATE --> END_RETURN
    CS_VALUE --> END_RETURN
    CS_ENABLE --> END_RETURN
    CS_STATE --> END_RETURN
    CNT_VALUE --> END_RETURN
    CNT_ENABLE --> END_RETURN
    CNT_STATE --> END_RETURN
    RET_NULL_1 --> END_RETURN
    RET_NULL_2 --> END_RETURN
    RET_NULL_3 --> END_RETURN
    RET_NULL_4 --> END_RETURN
    RET_NULL_5 --> END_RETURN
```

**Key observations:**
- The `separaterPoint` variable (line 189) is computed but never used — likely a remnant of a future planned delimiter-based key format (e.g., `"category/subkey"`). It does not affect any branch.
- All subkey comparisons use `equalsIgnoreCase()`, making the routing case-insensitive.
- The three data types map to constant values defined in `KKW14301SFConst`:
  - `KCAT_N_CNT_TV_TUNER_01 = "N台目-Eo光テレビチューナー (STB)"` — TV tuner data for the Nth device in a bundle
  - `KCAT_N_COURSE_CHOICE_01 = "N台目-コース選択"` — Course (plan/service tier) selection for the Nth device
  - `KCAT_N_CNT_01 = "N台目-カウント"` — Device count for the Nth line

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The data type identifier (item name) that selects which data category to access. Valid values are: `"N台目-Eo光テレビチューナー (STB)"` (TV tuner data for the Nth device), `"N台目-コース選択"` (course/plan selection for the Nth device), or `"N台目-カウント"` (device count for the Nth line). Determines which of the three data-type blocks the method dispatches into. |
| 2 | `subkey` | `String` | The field accessor within the selected data type. Valid values are `"value"`, `"enable"`, or `"state"` (case-insensitive). Determines which specific field of the data type is returned: the actual data value, the enabled/disabled flag, or the status/state string respectively. |

**Instance fields read:**
| Field | Type | Description |
|-------|------|-------------|
| `kcat_n_cnt_tv_tuner_value` | `String` | TV tuner value data for the Nth device |
| `kcat_n_cnt_tv_tuner_enabled` | `Boolean` | TV tuner enabled/disabled flag |
| `kcat_n_cnt_tv_tuner_state` | `String` | TV tuner state/status |
| `kcat_n_course_choice_value` | `String` | Course selection value for the Nth device |
| `kcat_n_course_choice_enabled` | `Boolean` | Course selection enabled/disabled flag |
| `kcat_n_course_choice_state` | `String` | Course selection state/status |
| `kcat_n_cnt_value` | `String` | Count value for the Nth device |
| `kcat_n_cnt_enabled` | `Boolean` | Count enabled/disabled flag |
| `kcat_n_cnt_state` | `String` | Count state/status |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW14301SF01DBean.getKcat_n_cnt_tv_tuner_value` | KKW14301SF01DBean | - | Returns the `kcat_n_cnt_tv_tuner_value` field — the TV tuner value for the Nth device |
| R | `KKW14301SF01DBean.getKcat_n_cnt_tv_tuner_enabled` | KKW14301SF01DBean | - | Returns the `kcat_n_cnt_tv_tuner_enabled` field — whether the TV tuner is enabled |
| R | `KKW14301SF01DBean.getKcat_n_cnt_tv_tuner_state` | KKW14301SF01DBean | - | Returns the `kcat_n_cnt_tv_tuner_state` field — the TV tuner state/status |
| R | `KKW14301SF01DBean.getKcat_n_course_choice_value` | KKW14301SF01DBean | - | Returns the `kcat_n_course_choice_value` field — the course selection value |
| R | `KKW14301SF01DBean.getKcat_n_course_choice_enabled` | KKW14301SF01DBean | - | Returns the `kcat_n_course_choice_enabled` field — whether course selection is enabled |
| R | `KKW14301SF01DBean.getKcat_n_course_choice_state` | KKW14301SF01DBean | - | Returns the `kcat_n_course_choice_state` field — the course selection state |
| R | `KKW14301SF01DBean.getKcat_n_cnt_value` | KKW14301SF01DBean | - | Returns the `kcat_n_cnt_value` field — the count value |
| R | `KKW14301SF01DBean.getKcat_n_cnt_enabled` | KKW14301SF01DBean | - | Returns the `kcat_n_cnt_enabled` field — whether count is enabled |
| R | `KKW14301SF01DBean.getKcat_n_cnt_state` | KKW14301SF01DBean | - | Returns the `kcat_n_cnt_state` field — the count state |

All calls are Read (R) operations on the bean's own internal fields. No external SC, CBS, or database interactions occur within this method.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-Eo光テレビチューナーリスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` during data-type bean rendering | `getKcat_n_cnt_tv_tuner_value [R] bean.field` |
| 2 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-Eo光テレビチューナーリスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_cnt_tv_tuner_enabled [R] bean.field` |
| 3 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-Eo光テレビチューナーリスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_cnt_tv_tuner_state [R] bean.field` |
| 4 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-コース選択リスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_course_choice_value [R] bean.field` |
| 5 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-コース選択リスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_course_choice_enabled [R] bean.field` |
| 6 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-コース選択リスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_course_choice_state [R] bean.field` |
| 7 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-カウントリスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_cnt_value [R] bean.field` |
| 8 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-カウントリスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_cnt_enabled [R] bean.field` |
| 9 | Screen:KKW14301 (WEB Application Screen Data Reference) | `KKW14301SFBean.addListDataInstance("N台目-カウントリスト")` -> creates `KKW14301SF01DBean` instance -> framework calls `loadModelData(key, subkey)` | `getKcat_n_cnt_state [R] bean.field` |

**Note:** The caller identified is `KKW14301SFBean`, which is the parent screen bean for the KKW14301 screen (WEB Application Screen Data Reference / WEB申込画面データ参照). The screen creates `KKW14301SF01DBean` instances via `addListDataInstance()` and the framework's data-type bean infrastructure then invokes `loadModelData()` to retrieve per-row data during screen rendering. The framework uses `X33VDataTypeBeanInterface` contract, iterating over the list and calling `loadModelData()` for each data-type item.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (Null Check) (L184-187)

> Early exit: if either parameter is null, return null immediately.
> key,subkeyがnullの場合、nullを返す (If key/subkey are null, return null)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key == null \|\| subkey == null` |
| 2 | RETURN | `return null` |

### Block 2 — EXEC (Separator Index) (L189)

> Compute the index of "/" in the key. This value is stored but never used — likely a remnant of a planned delimiter-based key format.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` |

### Block 3 — IF/ELSE-IF/ELSE-IF (Data Type: TV Tuner) (L192-205)

> Route to TV Tuner block when key matches the constant `KCAT_N_CNT_TV_TUNER_01 = "N台目-Eo光テレビチューナー (STB)"` (TV tuner data for the Nth device in a bundle).
> データタイプがStringの項目"N台目-Eo光テレビチューナー (STB)" (Item "Nth Eo Light TV Tunner (STB)" of data type String)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key.equals("N台目-Eo光テレビチューナー (STB)")` [-> `KCAT_N_CNT_TV_TUNER_01`] |

#### Block 3.1 — ELSE-IF (Subkey: value) (L194-195)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return getKcat_n_cnt_tv_tuner_value()` |

#### Block 3.2 — ELSE-IF (Subkey: enable) (L196-198)

> subkeyが"enable"の場合、kcat_n_cnt_tv_tuner_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of kcat_n_cnt_tv_tuner_enabled)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("enable")` |
| 2 | RETURN | `return getKcat_n_cnt_tv_tuner_enabled()` |

#### Block 3.3 — ELSE-IF (Subkey: state) (L199-201)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("state")` |
| 2 | RETURN | `return getKcat_n_cnt_tv_tuner_state()` |

### Block 4 — ELSE-IF (Data Type: Course Selection) (L204-217)

> Route to Course Selection block when key matches the constant `KCAT_N_COURSE_CHOICE_01 = "N台目-コース選択"` (Course selection for the Nth device).
> データタイプがStringの項目"N台目-コース選択" (Item "Nth - Course Selection" of data type String)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key.equals("N台目-コース選択")` [-> `KCAT_N_COURSE_CHOICE_01`] |

#### Block 4.1 — ELSE-IF (Subkey: value) (L206-207)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return getKcat_n_course_choice_value()` |

#### Block 4.2 — ELSE-IF (Subkey: enable) (L208-210)

> subkeyが"enable"の場合、kcat_n_course_choice_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of kcat_n_course_choice_enabled)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("enable")` |
| 2 | RETURN | `return getKcat_n_course_choice_enabled()` |

#### Block 4.3 — ELSE-IF (Subkey: state) (L211-213)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("state")` |
| 2 | RETURN | `return getKcat_n_course_choice_state()` |

### Block 5 — ELSE-IF (Data Type: Count) (L216-229)

> Route to Count block when key matches the constant `KCAT_N_CNT_01 = "N台目-カウント"` (Device count for the Nth line).
> データタイプがStringの項目"N台目-カウント" (Item "Nth - Count" of data type String)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key.equals("N台目-カウント")` [-> `KCAT_N_CNT_01`] |

#### Block 5.1 — ELSE-IF (Subkey: value) (L218-219)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return getKcat_n_cnt_value()` |

#### Block 5.2 — ELSE-IF (Subkey: enable) (L220-222)

> subkeyが"enable"の場合、kcat_n_cnt_enableのgetterの戻り値を返す (If subkey is "enable", return the getter value of kcat_n_cnt_enabled)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("enable")` |
| 2 | RETURN | `return getKcat_n_cnt_enabled()` |

#### Block 5.3 — ELSE-IF (Subkey: state) (L223-225)

> subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("state")` |
| 2 | RETURN | `return getKcat_n_cnt_state()` |

### Block 6 — RETURN (No Match) (L228-229)

> 条件に合致するプロパティが存在しない場合は、nullを返す (If no matching property exists for the condition, return null)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kcat_n_cnt_tv_tuner_value` | Field | TV tuner value — the actual TV tuner model/data for the Nth device in a bundled service |
| `kcat_n_cnt_tv_tuner_enabled` | Field | TV tuner enabled flag — whether the TV tuner is active/enabled for the Nth device |
| `kcat_n_cnt_tv_tuner_state` | Field | TV tuner state — the current status string of the TV tuner |
| `kcat_n_course_choice_value` | Field | Course choice value — the selected service course/plan for the Nth device |
| `kcat_n_course_choice_enabled` | Field | Course choice enabled flag — whether the course selection is active |
| `kcat_n_course_choice_state` | Field | Course choice state — the current status string of the course selection |
| `kcat_n_cnt_value` | Field | Count value — the device count for the Nth line |
| `kcat_n_cnt_enabled` | Field | Count enabled flag — whether the count is active |
| `kcat_n_cnt_state` | Field | Count state — the current status string of the count |
| `KCAT_N_CNT_TV_TUNER_01` | Constant | TV Tuner Data Type Key — key value `"N台目-Eo光テレビチューナー (STB)"` used to identify the TV tuner data type in the data-type bean list |
| `KCAT_N_COURSE_CHOICE_01` | Constant | Course Choice Data Type Key — key value `"N台目-コース選択"` used to identify the course selection data type |
| `KCAT_N_CNT_01` | Constant | Count Data Type Key — key value `"N台目-カウント"` used to identify the count data type |
| `KKW14301` | Screen ID | "WEB Application Screen Data Reference" (WEB申込画面データ参照) — the screen that displays web order application screen data |
| `KKW14301SF01DBean` | Class | Data Bean (DBean) — a data-type bean implementing `X33VDataTypeBeanInterface` and `X33VListedBeanInterface` for structured per-row data storage |
| `KKW14301SFBean` | Class | Parent Screen Bean — the main screen bean that creates and manages DBean list instances |
| `N台目` | Business term | "Nth device" — refers to a sequential device number in a bundled service offering (e.g., first line, second line, etc.) |
| Eo光 (Eo Hikari) | Business term | Eo Light — K-Opticom's fiber-optic broadband internet service |
| テレビチューナー | Business term | TV Tuner — the STB (Set-Top Box) device that receives TV signals |
| コース選択 | Business term | Course Selection — the selection of a service plan/course (e.g., internet tier, add-on packages) |
| カウント | Business term | Count — device/line count in a bundled service |
| STB | Acronym | Set-Top Box — the hardware device used for TV signal reception |
| DBean | Abbreviation | Data Bean — a bean class implementing data-type bean interfaces for screen data management |
| Data-Type Bean | Pattern | A framework pattern where each row in a list has its own data bean instance with structured key/subkey access |
| `X33VDataTypeBeanInterface` | Interface | Framework interface defining the contract for data-type beans, including `loadModelData()` |
| `X33VListedBeanInterface` | Interface | Framework interface for beans that can exist in a listed (repeatable) context |
