# Business Logic — KKW14301SF02DBean.loadModelData() [39 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA35101SF.KKW14301SF02DBean` |
| Layer | View / Data Bean (Web Client framework — X33VDataTypeBeanInterface) |
| Module | `KKA35101SF` (Package: `eo.web.webview.KKA35101SF`) |

## 1. Role

### KKW14301SF02DBean.loadModelData()

This method serves as a **data routing and dispatch utility** for the K-Opticom FTTH (Fiber To The Home) service order screen. It resolves a pair of logical identifiers — a `key` representing a display item name and a `subkey` representing a property accessor pattern — to return typed model data from the bean's internal state. Specifically, it handles two categories of items: (1) the **PEO Optical TV Tuner (STB)** configuration data for a given number of set-top boxes, and (2) the **Count** of N-count items.

The method implements a **routing/dispatch pattern**: it inspects the `key` to determine the data category, then inspects the `subkey` (case-insensitively) to determine which property accessor — `value`, `enable`, or `state` — to delegate to. This allows the screen framework to request individual attributes of complex bean items through a single unified entry point.

Its **role in the larger system** is as a shared data accessor used by the parent bean (`KKW14301SFBean`) during screen initialization and rendering, particularly when building select-item lists for TV tuner and count configuration fields. It operates purely as a read-only data router — no external services, databases, or CBS components are invoked.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    CHECK_NULL(["key or subkey is null?"])
    NULL_RET1(["return null"])
    CHECK_TV(["key = N台目PEO光テレビチューナー STB?"])
    CHECK_TV_SUBVAL(["subkey = value?"])
    TV_RET_VAL(["return getKcn_n_cnt_tv_tuner_value"])
    CHECK_TV_SUBEN(["subkey = enable?"])
    TV_RET_EN(["return getKcn_n_cnt_tv_tuner_enabled"])
    CHECK_TV_SUBST(["subkey = state?"])
    TV_RET_ST(["return getKcn_n_cnt_tv_tuner_state"])
    CHECK_CNT(["key = N台目カウント?"])
    CHECK_CNT_SUBVAL(["subkey = value?"])
    CNT_RET_VAL(["return getKcn_n_cnt_value"])
    CHECK_CNT_SUBEN(["subkey = enable?"])
    CNT_RET_EN(["return getKcn_n_cnt_enabled"])
    CHECK_CNT_SUBST(["subkey = state?"])
    CNT_RET_ST(["return getKcn_n_cnt_state"])
    NO_MATCH(["return null"])

    START --> CHECK_NULL
    CHECK_NULL -->|"Yes"| NULL_RET1
    CHECK_NULL -->|"No"| CHECK_TV
    CHECK_TV -->|"Yes"| CHECK_TV_SUBVAL
    CHECK_TV -->|"No"| CHECK_CNT
    CHECK_TV_SUBVAL -->|"Yes"| TV_RET_VAL
    CHECK_TV_SUBVAL -->|"No"| CHECK_TV_SUBEN
    CHECK_TV_SUBEN -->|"Yes"| TV_RET_EN
    CHECK_TV_SUBEN -->|"No"| CHECK_TV_SUBST
    CHECK_TV_SUBST -->|"Yes"| TV_RET_ST
    CHECK_TV_SUBST -->|"No"| NO_MATCH
    CHECK_CNT -->|"Yes"| CHECK_CNT_SUBVAL
    CHECK_CNT -->|"No"| NO_MATCH
    CHECK_CNT_SUBVAL -->|"Yes"| CNT_RET_VAL
    CHECK_CNT_SUBVAL -->|"No"| CHECK_CNT_SUBEN
    CHECK_CNT_SUBEN -->|"Yes"| CNT_RET_EN
    CHECK_CNT_SUBEN -->|"No"| CHECK_CNT_SUBST
    CHECK_CNT_SUBST -->|"Yes"| CNT_RET_ST
    CHECK_CNT_SUBST -->|"No"| NO_MATCH
```

**Processing branches:**

1. **Null guard** (L148–L150): If either `key` or `subkey` is `null`, returns `null` immediately. (Japanese comment: "key,subkeyがnullの場合、nullを返す" — "If key/subkey is null, return null")

2. **Branch A — TV Tuner (STB) item** (L153–L166): When `key` equals `"Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）"` (Item ID: `kcn_n_cnt_tv_tuner`). Splits on `subkey`:
   - `value` → returns the TV tuner value via `getKcn_n_cnt_tv_tuner_value()`
   - `enable` → returns the TV tuner enabled flag via `getKcn_n_cnt_tv_tuner_enabled()` (Japanese comment: "subkeyが"enable"の場合、kcn_n_cnt_tv_tuner_enableのgetterの戻り値を返す" — "If subkey is 'enable', return the getter of kcn_n_cnt_tv_tuner_enable")
   - `state` → returns the TV tuner status via `getKcn_n_cnt_tv_tuner_state()` (Japanese comment: "subkeyが"state"の場合、ステータスを返す" — "If subkey is 'state', return the status")

3. **Branch B — Count item** (L169–L180): When `key` equals `"Ｎ台目カウント"` (Item ID: `kcn_n_cnt`). Splits on `subkey`:
   - `value` → returns the count value via `getKcn_n_cnt_value()`
   - `enable` → returns the count enabled flag via `getKcn_n_cnt_enabled()` (Japanese comment: "subkeyが"enable"の場合、kcn_n_cnt_enableのgetterの戻り値を返す" — "If subkey is 'enable', return the getter of kcn_n_cnt_enable")
   - `state` → returns the count status via `getKcn_n_cnt_state()` (Japanese comment: "subkeyが"state"の場合、ステータスを返す" — "If subkey is 'state', return the status")

4. **Default fallthrough** (L182): No matching property found — returns `null`. (Japanese comment: "条件に一致するプロパティが存在しない場合は、nullを返す" — "If no matching property exists, return null")

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The display item name that identifies which configuration data category to retrieve. Accepts one of two values: `"Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）"` (Nth set PEO Optical TV Tuner (STB)) which routes to TV tuner-related getters, or `"Ｎ台目カウント"` (Nth set Count) which routes to count-related getters. This key is matched exactly (case-sensitive) via `equals()`. |
| 2 | `subkey` | `String` | The property accessor sub-key that determines which attribute of the selected item to return. Accepts (case-insensitively) `"value"`, `"enable"`, or `"state"`. Controls the final getter dispatch — value returns the data payload, enable returns the enabled/disabled flag, and state returns the component status. |

**Additional notes on `key`:** The `key.indexOf("/")` call on L151 is present but its result (`separaterPoint`) is **never used** in the method body — it appears to be a leftover from a prior design that planned to parse nested key paths (e.g., `"tv_tuner/value"`).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW14301SF02DBean.getKcn_n_cnt_enabled` | - | - | Calls `getKcn_n_cnt_enabled` in `KKW14301SF02DBean` |
| R | `KKW14301SF02DBean.getKcn_n_cnt_state` | - | - | Calls `getKcn_n_cnt_state` in `KKW14301SF02DBean` |
| R | `KKW14301SF02DBean.getKcn_n_cnt_tv_tuner_enabled` | - | - | Calls `getKcn_n_cnt_tv_tuner_enabled` in `KKW14301SF02DBean` |
| R | `KKW14301SF02DBean.getKcn_n_cnt_tv_tuner_state` | - | - | Calls `getKcn_n_cnt_tv_tuner_state` in `KKW14301SF02DBean` |
| R | `KKW14301SF02DBean.getKcn_n_cnt_tv_tuner_value` | - | - | Calls `getKcn_n_cnt_tv_tuner_value` in `KKW14301SF02DBean` |
| R | `KKW14301SF02DBean.getKcn_n_cnt_value` | - | - | Calls `getKcn_n_cnt_value` in `KKW14301SF02DBean` |

**CRUD Classification:**

This method performs **pure read operations** — it is a data accessor that delegates to internal bean getter methods. No external service components (SC), CBS, database tables, or entity operations are involved. All six called methods are local getter invocations within the same bean class.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW14301SF02DBean.getKcn_n_cnt_tv_tuner_value` | - | - | [R] Retrieves the TV tuner (STB) configuration value for display |
| R | `KKW14301SF02DBean.getKcn_n_cnt_tv_tuner_enabled` | - | - | [R] Retrieves whether the TV tuner (STB) component is enabled for the given Nth set |
| R | `KKW14301SF02DBean.getKcn_n_cnt_tv_tuner_state` | - | - | [R] Retrieves the operational status (state) of the TV tuner (STB) component |
| R | `KKW14301SF02DBean.getKcn_n_cnt_value` | - | - | [R] Retrieves the count value for the Nth set item |
| R | `KKW14301SF02DBean.getKcn_n_cnt_enabled` | - | - | [R] Retrieves whether the count component is enabled for the given Nth set |
| R | `KKW14301SF02DBean.getKcn_n_cnt_state` | - | - | [R] Retrieves the operational status (state) of the count component |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW14301SF (koptWebA) | `KKW14301SFBean.listKcn_n_cnt_tv_tuner_value` → cast to `KKW14301SF02DBean` → `loadModelData("Ｎ台目PEO光テレビチューナー（ＳＴＢ）", "value")` | `getKcn_n_cnt_tv_tuner_value [R] kcn_n_cnt_tv_tuner` |
| 2 | Screen:KKW14301SF (koptWebA) | `KKW14301SFBean.listKcn_n_cnt_value` → cast to `KKW14301SF02DBean` → `loadModelData("Ｎ台目カウント", "value")` | `getKcn_n_cnt_value [R] kcn_n_cnt` |
| 3 | Screen:KKW14301SF (koptWebB) | `KKW14301SFBean.listKcn_n_cnt_tv_tuner_value` → cast to `KKW14301SF02DBean` → `loadModelData("Ｎ台目PEO光テレビチューナー（ＳＴＢ）", "value")` | `getKcn_n_cnt_tv_tuner_value [R] kcn_n_cnt_tv_tuner` |
| 4 | Screen:KKW14301SF (koptWebB) | `KKW14301SFBean.listKcn_n_cnt_value` → cast to `KKW14301SF02DBean` → `loadModelData("Ｎ台目カウント", "value")` | `getKcn_n_cnt_value [R] kcn_n_cnt` |

**Call chain details:**

- **Rows 1, 3 (TV Tuner):** In `KKW14301SFBean`, the method `listKcn_n_cnt_tv_tuner_value()` (line ~5930 in koptWebA, ~5991 in koptWebB) iterates over `kcn_tv_tuner_list_list`, casts each element to `X33VDataTypeBeanInterface`, and invokes `loadModelData("Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）", "value")` to resolve the display value.
- **Rows 2, 4 (Count):** In `KKW14301SFBean`, the method `listKcn_n_cnt_value()` similarly iterates over count-related lists and invokes `loadModelData("Ｎ台目カウント", "value")` to resolve count display values.

The `KKW14301SF02DBean` class also overrides the framework's `X31CBaseBean.loadModelData(String key, String subkey)` and `X31CBaseBean.loadModelData(String gamenId, String key, String subkey)` methods, making it the canonical data source for these configuration items within the X33V screen framework.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null || subkey == null)` (L148–L150)

> Null guard: if either parameter is null, return null immediately. The original Japanese comment states: "key,subkeyがnullの場合、nullを返す" — "If key/subkey is null, return null".

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key == null || subkey == null)` |
| 2 | RETURN | `return null;` |

**Block 2** — [EXEC] `key.indexOf("/")` (L151–L152)

> The `separaterPoint` variable is computed but never used in the method body. This appears to be a leftover from a prior design that planned to parse nested key paths (e.g., `"tv_tuner/value"`). No conditional branch depends on it.

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

**Block 3** — [IF-ELSE IF-ELSE] (key = TV Tuner category) (L153–L166)

> Item category: TV Tuner (STB). The original Japanese comment states: "データタイプがStringの項目"Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）"(項目ID:kcn_n_cnt_tv_tuner)" — "Data type is String item 'Nth set PEO Optical TV Tuner (STB)' (item ID: kcn_n_cnt_tv_tuner)".
>
> **Condition:** `key.equals("Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）")`
>
> Note: The string `"Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）"` uses full-width Latin and Katakana characters. Item ID: `kcn_n_cnt_tv_tuner`.

**Block 3.1** — [IF] `(subkey.equalsIgnoreCase("value"))` (L154–L155)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getKcn_n_cnt_tv_tuner_value();` |

**Block 3.2** — [ELSE IF] `(subkey.equalsIgnoreCase("enable"))` (L156–L158)

> Original Japanese comment: "subkeyが"enable"の場合、kcn_n_cnt_tv_tuner_enableのgetterの戻り値を返す" — "If subkey is 'enable', return the getter value of kcn_n_cnt_tv_tuner_enable".

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getKcn_n_cnt_tv_tuner_enabled();` |

**Block 3.3** — [ELSE IF] `(subkey.equalsIgnoreCase("state"))` (L159–L161)

> Original Japanese comment: "subkeyが"state"の場合、ステータスを返す" — "If subkey is 'state', return the status".

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getKcn_n_cnt_tv_tuner_state();` |

**Block 3.4** — [ELSE] (no matching subkey for TV tuner) → falls through to Block 6 (default return null)

| # | Type | Code |
|---|------|------|
| 1 | — | No direct else; control flows to Block 6 |

**Block 4** — [ELSE IF] (key = Count category) (L169–L180)

> Item category: Count. The original Japanese comment states: "データタイプがStringの項目"Ｎ台目カウント"(項目ID:kcn_n_cnt)" — "Data type is String item 'Nth set Count' (item ID: kcn_n_cnt)".
>
> **Condition:** `key.equals("Ｎ台目カウント")`
>
> Note: The string `"Ｎ台目カウント"` uses full-width Latin and Katakana characters. Item ID: `kcn_n_cnt`.

**Block 4.1** — [IF] `(subkey.equalsIgnoreCase("value"))` (L170–L171)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` |
| 2 | CALL | `return getKcn_n_cnt_value();` |

**Block 4.2** — [ELSE IF] `(subkey.equalsIgnoreCase("enable"))` (L172–L174)

> Original Japanese comment: "subkeyが"enable"の場合、kcn_n_cnt_enableのgetterの戻り値を返す" — "If subkey is 'enable', return the getter value of kcn_n_cnt_enable".

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` |
| 2 | CALL | `return getKcn_n_cnt_enabled();` |

**Block 4.3** — [ELSE IF] `(subkey.equalsIgnoreCase("state"))` (L175–L177)

> Original Japanese comment: "subkeyが"state"の場合、ステータスを返す" — "If subkey is 'state', return the status".

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` |
| 2 | CALL | `return getKcn_n_cnt_state();` |

**Block 5** — [ELSE] (no matching subkey for count) → falls through to Block 6 (default return null)

| # | Type | Code |
|---|------|------|
| 1 | — | No direct else; control flows to Block 6 |

**Block 6** — [RETURN] (default fallthrough) (L182)

> Original Japanese comment: "条件に一致するプロパティが存在しない場合は、nullを返す" — "If no property matches the condition, return null".

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kcn_n_cnt_tv_tuner` | Field | TV tuner item ID — configuration data for the Nth set PEO Optical TV Tuner (STB) displayed on the service order screen |
| `kcn_n_cnt` | Field | Count item ID — configuration data for the Nth set count displayed on the service order screen |
| `getKcn_n_cnt_tv_tuner_value` | Method | Getter that returns the TV tuner (STB) configuration value |
| `getKcn_n_cnt_tv_tuner_enabled` | Method | Getter that returns whether the TV tuner (STB) component is enabled |
| `getKcn_n_cnt_tv_tuner_state` | Method | Getter that returns the operational status of the TV tuner (STB) component |
| `getKcn_n_cnt_value` | Method | Getter that returns the count value for the Nth set |
| `getKcn_n_cnt_enabled` | Method | Getter that returns whether the count component is enabled |
| `getKcn_n_cnt_state` | Method | Getter that returns the operational status of the count component |
| `Ｎ台目ＰＥＯ光テレビチューナー（ＳＴＢ）` | Japanese field | Nth set PEO Optical TV Tuner (STB) — display label for the TV tuner configuration item; uses full-width Latin characters. Item ID: `kcn_n_cnt_tv_tuner` |
| `Ｎ台目カウント` | Japanese field | Nth set Count — display label for the count configuration item; uses full-width Latin characters. Item ID: `kcn_n_cnt` |
| `value` | Subkey | Property accessor pattern — retrieves the data payload/configuration value |
| `enable` | Subkey | Property accessor pattern — retrieves the enabled/disabled flag |
| `state` | Subkey | Property accessor pattern — retrieves the operational status |
| FTTH | Business term | Fiber To The Home — fiber-optic internet service; this bean is part of the FTTH service order workflow |
| PEO | Brand | PEO Optical — K-Opticom's branded optical network service |
| STB | Acronym | Set-Top Box — hardware device for receiving and decoding TV signals, configured per Nth set in this bean |
| X33V | Framework | Fujitsu Futurity X33V Web Client Framework — the web application framework providing `X33VDataTypeBeanInterface`, `X31CBaseBean` |
| `X33VDataTypeBeanInterface` | Interface | Framework interface that `KKW14301SF02DBean` implements to support typed data loading via `loadModelData` |
| `KKW14301SFBean` | Class | Parent screen bean that calls `KKW14301SF02DBean.loadModelData()` during screen list initialization |
| K-Opticom | Brand | Internet service provider; copyright holder of the source code |
