# Business Logic — KKW00844SF02DBean.loadModelData() [33 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00844SF.KKW00844SF02DBean` |
| Layer | Data Bean / UI Component (View layer — implements X33VDataTypeBeanInterface, X33VListedBeanInterface) |
| Module | `KKW00844SF` (Package: `eo.web.webview.KKW00844SF`) |

## 1. Role

### KKW00844SF02DBean.loadModelData()

This method is the data-loading dispatch entry point for the "Reason for Change" (異動理由) data type bean within the Smart Link Premium Registration Confirmation screen (KKW00844 — スマートリンクプレミアム登録確認). It implements a routing/dispatch pattern that selects one of four getter methods based on the combination of a `key` (item name) and `subkey` (sub-key: "value" or "state").

Specifically, it handles two item types: **Reason for Change Code** (異動理由コード, item ID: `ido_rsn_cd`) and **Reason for Change Memo** (異動理由メモ, item ID: `ido_rsn_memo`). For each item type, if the `subkey` is `"value"` (case-insensitive), it returns the current data value. If the `subkey` is `"state"` (case-insensitive), it returns the modification state flag. This separation allows the framework to distinguish between the actual data payload and its change-tracking metadata (dirty state).

The method is used by the parent bean `KKW00844SFBean` as part of its data type bean-type item handling logic — specifically in `listKoumokuIds()` (which returns a list of item IDs for registered data type beans) and `addListDataInstance()` (which instantiates new `KKW00844SF02DBean` entries in the "Reason for Change List"). It follows the X31C framework convention for `X33VDataTypeBeanInterface` implementations, enabling dynamic data population during screen initialization and row-level data access.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    START --> CHECK_NULL["key == null || subkey == null"]
    CHECK_NULL --> |true| RETURN_NULL["return null"]
    CHECK_NULL --> |false| CHECK_KEY1["key.equals(異動理由コード)"]
    CHECK_KEY1 --> |true| CHECK_SUBKEY1["subkey.equalsIgnoreCase(value)"]
    CHECK_SUBKEY1 --> |true| RET_VALUE1["return getIdo_rsn_cd_value()"]
    CHECK_SUBKEY1 --> |false| CHECK_STATE1["subkey.equalsIgnoreCase(state)"]
    CHECK_STATE1 --> |true| RET_STATE1["return getIdo_rsn_cd_state()"]
    CHECK_STATE1 --> |false| CHECK_KEY2["key.equals(異動理由メモ)"]
    RET_VALUE1 --> END_NODE(["Return / Next"])
    RET_STATE1 --> END_NODE
    CHECK_KEY2 --> |true| CHECK_SUBKEY2["subkey.equalsIgnoreCase(value)"]
    CHECK_SUBKEY2 --> |true| RET_VALUE2["return getIdo_rsn_memo_value()"]
    CHECK_SUBKEY2 --> |false| CHECK_STATE2["subkey.equalsIgnoreCase(state)"]
    CHECK_STATE2 --> |true| RET_STATE2["return getIdo_rsn_memo_state()"]
    CHECK_STATE2 --> |false| RET_NULL_END["return null"]
    RET_VALUE2 --> END_NODE
    RET_STATE2 --> END_NODE
    RET_NULL_END --> END_NODE
    CHECK_KEY2 --> |false| RET_NULL_END
    END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | Item name — the business identifier for which data field to retrieve. Valid values: `異動理由コード` ("Reason for Change Code", item ID: `ido_rsn_cd`) and `異動理由メモ` ("Reason for Change Memo", item ID: `ido_rsn_memo`). The key determines which pair of internal fields (`ido_rsn_cd_*` or `ido_rsn_memo_*`) will be accessed. If null, the method returns null immediately. |
| 2 | `subkey` | `String` | Sub-key — specifies whether to return the data value or the modification state flag. Valid values (case-insensitive): `"value"` returns the actual field content (e.g., the code or memo text), and `"state"` returns the dirty-state indicator (e.g., whether the field has been modified by the user). If null, the method returns null immediately. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_value` | `String` | The current Reason for Change Code value. Default-initialized to empty string. |
| `ido_rsn_cd_state` | `String` | The modification state flag for the Reason for Change Code. Default-initialized to empty string. |
| `ido_rsn_memo_value` | `String` | The current Reason for Change Memo text. Default-initialized to empty string. |
| `ido_rsn_memo_state` | `String` | The modification state flag for the Reason for Change Memo. Default-initialized to empty string. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW00844SF02DBean.getIdo_rsn_cd_value` | KKW00844SF02DBean | - (in-memory field) | Returns the `ido_rsn_cd_value` field — retrieves the Reason for Change Code value from the bean instance. |
| R | `KKW00844SF02DBean.getIdo_rsn_cd_state` | KKW00844SF02DBean | - (in-memory field) | Returns the `ido_rsn_cd_state` field — retrieves the modification state flag for the Reason for Change Code. |
| R | `KKW00844SF02DBean.getIdo_rsn_memo_value` | KKW00844SF02DBean | - (in-memory field) | Returns the `ido_rsn_memo_value` field — retrieves the Reason for Change Memo text from the bean instance. |
| R | `KKW00844SF02DBean.getIdo_rsn_memo_state` | KKW00844SF02DBean | - (in-memory field) | Returns the `ido_rsn_memo_state` field — retrieves the modification state flag for the Reason for Change Memo. |

**Analysis Notes:**
This method performs **no external CRUD operations**. All four called methods are internal getter methods within `KKW00844SF02DBean` itself that return in-memory String fields. There is no database access, no SC (Service Component) call, and no CBS (Common Business Service) invocation. The method is purely a data-access router that delegates to simple field getters within the same bean instance.

## 5. Dependency Trace

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00844 | `KKW00844SFBean.listKoumokuIds()` → returns `KKW00844SF02DBean.listKoumokuIds()` (not direct loadModelData call) | `getIdo_rsn_cd_value [R] in-memory`, `getIdo_rsn_cd_state [R] in-memory`, `getIdo_rsn_memo_value [R] in-memory`, `getIdo_rsn_memo_state [R] in-memory` |
| 2 | Screen:KKW00844 | `KKW00844SFBean.addListDataInstance()` → instantiates `KKW00844SF02DBean`, then framework may call `loadModelData` during screen rendering | `getIdo_rsn_cd_value [R] in-memory`, `getIdo_rsn_cd_state [R] in-memory`, `getIdo_rsn_memo_value [R] in-memory`, `getIdo_rsn_memo_state [R] in-memory` |
| 3 | Framework (X31C) | Screen initialization invokes `loadModelData` on all data-type bean items via `X33VDataTypeBeanInterface` contract | Same as above |

**How this method is accessed:**
- `KKW00844SF02DBean.loadModelData()` is NOT called directly by Java code in this codebase (the search for explicit callers of `loadModelData` in the KKW00844SF module returned zero results).
- Instead, it is invoked indirectly through the **X31C framework's data type bean interface contract**. When `KKW00844SFBean.listKoumokuIds()` or `KKW00844SFBean.addListDataInstance()` creates `KKW00844SF02DBean` instances for the "Reason for Change List" (異動理由リスト) data type bean-type item, the framework calls `loadModelData(key, subkey)` during screen data initialization and value retrieval phases.
- The screen `KKW00844` (Smart Link Premium Registration Confirmation) is the primary entry point that uses this bean.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) (L127)

> Returns null immediately if either parameter is null, preventing NPE on downstream string comparisons.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.indexOf("/")` // Computes separator position (unused in current branches, reserved for future extensibility) [-> unused] |
| 2 | IF | `if(key == null || subkey == null)` |
| 3 | RETURN | `return null` |

---

**Block 2** — IF (key == "異動理由コード"/"Reason for Change Code") (L133)

> Handles data retrieval for the "Reason for Change Code" field. Branches on subkey to return either the code value or its modification state.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key.equals("異動理由コード"))` [key = "Reason for Change Code", item ID: ido_rsn_cd] |
| 2 | IF | `if(subkey.equalsIgnoreCase("value"))` [L135, subkey = "value" — case-insensitive] |
| 3 | CALL | `return getIdo_rsn_cd_value()` [Returns `ido_rsn_cd_value` field] |
| 4 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [L138, subkey = "state" — case-insensitive] |
| 5 | CALL | `return getIdo_rsn_cd_state()` [Returns `ido_rsn_cd_state` field] |

**Block 2.1** — IF-Nested (subkey == "value") (L135)

> Returns the actual Reason for Change Code data value stored in the bean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_rsn_cd_value()` [-> Returns `this.ido_rsn_cd_value`, default = ""] |

**Block 2.2** — ELSE-IF (subkey == "state") (L138)

> Returns the modification state flag for the Reason for Change Code field. The comment reads: subkeyが"state"の場合、ステータスを返す。 (When subkey is "state", returns the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_rsn_cd_state()` [-> Returns `this.ido_rsn_cd_state`, default = ""] |

---

**Block 3** — ELSE-IF (key == "異動理由メモ"/"Reason for Change Memo") (L144)

> Handles data retrieval for the "Reason for Change Memo" field. Branches on subkey to return either the memo text or its modification state.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(key.equals("異動理由メモ"))` [key = "Reason for Change Memo", item ID: ido_rsn_memo] |
| 2 | IF | `if(subkey.equalsIgnoreCase("value"))` [L146, subkey = "value" — case-insensitive] |
| 3 | CALL | `return getIdo_rsn_memo_value()` [Returns `ido_rsn_memo_value` field] |
| 4 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` [L149, subkey = "state" — case-insensitive] |
| 5 | CALL | `return getIdo_rsn_memo_state()` [Returns `ido_rsn_memo_state` field] |

**Block 3.1** — IF-Nested (subkey == "value") (L146)

> Returns the actual Reason for Change Memo text stored in the bean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_rsn_memo_value()` [-> Returns `this.ido_rsn_memo_value`, default = ""] |

**Block 3.2** — ELSE-IF (subkey == "state") (L149)

> Returns the modification state flag for the Reason for Change Memo field. The comment reads: subkeyが"state"の場合、ステータスを返す。 (When subkey is "state", returns the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIdo_rsn_memo_state()` [-> Returns `this.ido_rsn_memo_state`, default = ""] |

---

**Block 4** — ELSE (no matching key) (L153)

> Fallback return — no matching key was found, so return null. The comment reads: 条件に合致するプロパティが存在しない場合は、nullを返す。 (When no property matches the condition, return null.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` [-> No matching item key found] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Reason for Change Code — the code identifying why a service change was made (internal field: `ido_rsn_cd_value`) |
| `ido_rsn_cd_value` | Field | Current Reason for Change Code value — the actual code stored in the bean instance |
| `ido_rsn_cd_state` | Field | Modification state flag for the Reason for Change Code — indicates whether the field has been changed by the user |
| `ido_rsn_cd_update` | Field | Update flag for the Reason for Change Code — tracks whether this field needs to be persisted on save |
| `ido_rsn_memo` | Field | Reason for Change Memo — free-text reason for the change (internal field: `ido_rsn_memo_value`) |
| `ido_rsn_memo_value` | Field | Current Reason for Change Memo value — the actual memo text stored in the bean instance |
| `ido_rsn_memo_state` | Field | Modification state flag for the Reason for Change Memo — indicates whether the memo has been changed by the user |
| `ido_rsn_memo_update` | Field | Update flag for the Reason for Change Memo — tracks whether this field needs to be persisted on save |
| `ido_rsn_list` | Item ID | Reason for Change List — the data type bean-type item that holds a list of `KKW00844SF02DBean` instances |
| `KKW00844` | Screen ID | Smart Link Premium Registration Confirmation — the screen that uses this bean (スマートリンクプレミアム登録確認) |
| 異動理由コード | Field | Reason for Change Code — the Japanese item name used as the `key` parameter to select the Reason for Change Code data |
| 異動理由メモ | Field | Reason for Change Memo — the Japanese item name used as the `key` parameter to select the Reason for Change Memo data |
| 項目名 | Term | Item name — the business identifier for a data field (maps to the `key` parameter) |
| サブキー | Term | Sub-key — a secondary identifier that specifies the data attribute to retrieve, typically "value" or "state" |
| X31C | Framework | The K-Opticom web application framework (Enterprise Application Platform) providing the screen/controller infrastructure |
| X33VDataTypeBeanInterface | Interface | Framework interface for data type beans that support dynamic data loading via `loadModelData` |
| X33VListedBeanInterface | Interface | Framework interface for beans that participate in data type bean-type list items (repeatable row structures) |
| Smart Link Premium | Business term | Smart Link Premium — a bundled telecom service offering from K-Opticom (スマートリンクプレミアム) |
