# Business Logic — KKW22301SF03DBean.loadModelData() [107 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW22301SF.KKW22301SF03DBean` |
| Layer | Web View Bean / Controller Layer (package `eo.web.webview`, implements `X33VDataTypeBeanInterface`, extends `X31CBaseBean`) |
| Module | `KKW22301SF` (Package: `eo.web.webview.KKW22301SF`) |

## 1. Role

### KKW22301SF03DBean.loadModelData()

This method serves as the **central data routing dispatcher** for the KKW22301SF03DBean web view data bean within the K-Opticom telecom service contract system. It implements a **key-based routing pattern** (also known as a data accessor or getter dispatcher) that maps logical field names (`key`) and sub-field identifiers (`subkey`) to their corresponding internal bean data values. The method supports multiple data categories used across the service screen: **Supplementary Data** (「追加字」) for scalar metadata such as index value, enabled state, and UI state; **Code List** (「コードリスト」) for indexed String-type dropdown options (itemID: `cd_div_list`); **Code Name List** (「コード名リスト」) for indexed String-type code name pairs (itemID: `cd_div_nm_list`); and **Name List** (「名称リスト」) for indexed String-type name entries (itemID: `nm_list`). As a shared utility embedded within a screen-level data bean, it enables the web framework to dynamically retrieve field values by string identifier during form rendering, validation, and postback processing — effectively decoupling the JSP/view layer from the internal bean structure.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> NullCheck{"key == null
or subkey == null?"}
    NullCheck -->|Yes| NULL_RETURN["return null"]
    NullCheck -->|No| FindSlash["separaterPoint = key.indexOf('/')"]

    FindSlash --> AppendKey{"key.equals('追加字')?"}

    AppendKey -->|Yes| SubKeyValue{"subkey.equalsIgnoreCase('value')?"}
    AppendKey -->|No| CodeListKey{"key.equals('コードリスト')?"}

    SubKeyValue -->|Yes| GetValue["return getIndex_value()"]
    SubKeyValue -->|No| SubKeyEnable{"subkey.equalsIgnoreCase('enable')?"}
    SubKeyEnable -->|Yes| GetEnable["return getIndex_enabled()"]
    SubKeyEnable -->|No| SubKeyState{"subkey.equalsIgnoreCase('state')?"}
    SubKeyState -->|Yes| GetState["return getIndex_state()"]
    SubKeyState -->|No| CodeListKey

    GetValue --> END_NODE(["Return / Next"])
    GetEnable --> END_NODE
    GetState --> END_NODE

    CodeListKey -->|Yes| CodeListPrefix["key = key.substring(separaterPoint + 1)"]
    CodeListKey -->|No| CodeNameListKey{"key.equals('コード名リスト')?"}

    CodeListPrefix --> CodeListStar{"key.equals('*')?"}
    CodeListStar -->|Yes| CodeListSize["return Integer.valueOf(cd_div_list_list.size())"]
    CodeListStar -->|No| CodeListParseIndex["Integer tmpIndexInt = Integer.valueOf(key)"]

    CodeListParseIndex --> CodeListParseTry{"NumberFormatException?"}
    CodeListParseTry -->|Yes| CodeListParseNull["return null"]
    CodeListParseTry -->|No| CodeListNullCheck{"tmpIndexInt == null?"}
    CodeListNullCheck -->|Yes| CodeListNullReturn["return null"]
    CodeListNullCheck -->|No| CodeListBounds{"tmpIndex < 0 ||
tmpIndex >= cd_div_list_list.size()?"}
    CodeListBounds -->|Yes| CodeListBoundsNull["return null"]
    CodeListBounds -->|No| CodeListGet["cd_div_list_list.get(tmpIndex)
.loadModelData(subkey)"]
    CodeListGet --> END_NODE
    CodeListBoundsNull --> END_NODE
    CodeListNullReturn --> END_NODE
    CodeListParseNull --> END_NODE
    CodeListSize --> END_NODE

    CodeNameListKey -->|Yes| CodeNameListPrefix["key = key.substring(separaterPoint + 1)"]
    CodeNameListKey -->|No| NameListKey{"key.equals('名称リスト')?"}

    CodeNameListPrefix --> CodeNameListStar{"key.equals('*')?"}
    CodeNameListStar -->|Yes| CodeNameListSize["return Integer.valueOf(cd_div_nm_list_list.size())"]
    CodeNameListStar -->|No| CodeNameListParseIndex["Integer tmpIndexInt = Integer.valueOf(key)"]

    CodeNameListParseIndex --> CodeNameListParseTry{"NumberFormatException?"}
    CodeNameListParseTry -->|Yes| CodeNameListParseNull["return null"]
    CodeNameListParseTry -->|No| CodeNameListNullCheck{"tmpIndexInt == null?"}
    CodeNameListNullCheck -->|Yes| CodeNameListNullReturn["return null"]
    CodeNameListNullCheck -->|No| CodeNameListBounds{"tmpIndex < 0 ||
tmpIndex >= cd_div_nm_list_list.size()?"}
    CodeNameListBounds -->|Yes| CodeNameListBoundsNull["return null"]
    CodeNameListBounds -->|No| CodeNameListGet["cd_div_nm_list_list.get(tmpIndex)
.loadModelData(subkey)"]
    CodeNameListGet --> END_NODE
    CodeNameListBoundsNull --> END_NODE
    CodeNameListNullReturn --> END_NODE
    CodeNameListParseNull --> END_NODE
    CodeNameListSize --> END_NODE

    NameListKey -->|Yes| NameListPrefix["key = key.substring(separaterPoint + 1)"]
    NameListKey -->|No| DefaultNull["return null"]

    NameListPrefix --> NameListStar{"key.equals('*')?"}
    NameListStar -->|Yes| NameListSize["return Integer.valueOf(nm_list_list.size())"]
    NameListStar -->|No| NameListParseIndex["Integer tmpIndexInt = Integer.valueOf(key)"]

    NameListParseIndex --> NameListParseTry{"NumberFormatException?"}
    NameListParseTry -->|Yes| NameListParseNull["return null"]
    NameListParseTry -->|No| NameListNullCheck{"tmpIndexInt == null?"}
    NameListNullCheck -->|Yes| NameListNullReturn["return null"]
    NameListNullCheck -->|No| NameListBounds{"tmpIndex < 0 ||
tmpIndex >= nm_list_list.size()?"}
    NameListBounds -->|Yes| NameListBoundsNull["return null"]
    NameListBounds -->|No| NameListGet["nm_list_list.get(tmpIndex)
.loadModelData(subkey)"]
    NameListGet --> END_NODE
    NameListBoundsNull --> END_NODE
    NameListNullReturn --> END_NODE
    NameListParseNull --> END_NODE
    NameListSize --> END_NODE

    DefaultNull --> END_NODE
```

**CRITICAL — Constant Resolution:**

No external constant classes are referenced in this method. All string literals are directly compared using `key.equals()`:

| Constant | Literal Value | Business Meaning |
|----------|---------------|-----------------|
| `「追加字」` | `"追加字"` | Supplementary Data — scalar metadata item for index tracking |
| `「コードリスト」` | `"コードリスト"` | Code List — indexed String-type dropdown options (itemID: `cd_div_list`) |
| `「コード名リスト」` | `"コード名リスト"` | Code Name List — indexed String-type code name pairs (itemID: `cd_div_nm_list`) |
| `「名称リスト」` | `"名称リスト"` | Name List — indexed String-type name entries (itemID: `nm_list`) |

Subkey literals:

| Constant | Literal Value | Business Meaning |
|----------|---------------|-----------------|
| `"value"` | `"value"` | Returns the index data value |
| `"enable"` | `"enable"` | Returns whether the index is enabled (case-insensitive match) |
| `"state"` | `"state"` | Returns the index state (case-insensitive match) |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name** (project/field identifier) that specifies which data category to retrieve. Determines the routing branch: `"追加字"` (Supplementary Data) for scalar index metadata, `"コードリスト"` (Code List) for the `cd_div_list` dropdown, `"コード名リスト"` (Code Name List) for the `cd_div_nm_list` dropdown, and `"名称リスト"` (Name List) for the `nm_list` dropdown. Supports an optional "/" separator followed by an index (e.g., `"コードリスト/3"`) to access individual list items. |
| 2 | `subkey` | `String` | The **sub-field identifier** that refines the lookup within the selected category. For Supplementary Data, it specifies `"value"`, `"enable"`, or `"state"` to return the corresponding index property. For list items, it is forwarded to the individual list element's `loadModelData` method to resolve nested fields. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `index_value` | `String` | The current index value (defaults to `"0"`) — represents the selected position in data-bound UI components |
| `index_enabled` | `Boolean` | Whether the index is enabled — controls UI interactivity for index-based controls |
| `index_state` | `String` | The current UI state of the index — used for rendering state-dependent behavior |
| `cd_div_list_list` | `X33VDataTypeList` | List of String-type code data items (itemID: `cd_div_list`) — dropdown options for code selection |
| `cd_div_nm_list_list` | `X33VDataTypeList` | List of String-type code name items (itemID: `cd_div_nm_list`) — dropdown options for code name pairs |
| `nm_list_list` | `X33VDataTypeList` | List of String-type name items (itemID: `nm_list`) — dropdown options for name entries |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `KKW22301SF03DBean.getIndex_value` | KKW22301SF03DBean | - | Returns `index_value` field — the current index value for the UI component |
| - | `KKW22301SF03DBean.getIndex_enabled` | KKW22301SF03DBean | - | Returns `index_enabled` field — whether the index is enabled |
| - | `KKW22301SF03DBean.getIndex_state` | KKW22301SF03DBean | - | Returns `index_state` field — the current UI state string |
| R | `KKW22301SF03DBean.loadModelData` (recursive) | KKW22301SF03DBean | - | Recursively delegates to list item's `loadModelData(subkey)` to resolve nested field access |

### Full CRUD Analysis

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getIndex_value` | KKW22301SF03DBean | - | Reads the `index_value` String field — the current index position in data-bound UI components |
| R | `getIndex_enabled` | KKW22301SF03DBean | - | Reads the `index_enabled` Boolean field — whether the index control is active |
| R | `getIndex_state` | KKW22301SF03DBean | - | Reads the `index_state` String field — the current display state of the index |
| R | `X33VDataTypeStringBean.loadModelData` (via list cast) | X33VDataTypeStringBean | - | Reads a nested field from an individual `X33VDataTypeStringBean` element within `cd_div_list_list`, `cd_div_nm_list_list`, or `nm_list_list` |

**Analysis:** This method performs **only Read (R) operations** — it is a pure data retrieval dispatcher with no Create, Update, or Delete operations. It reads local instance fields and delegates to nested bean read operations via the `loadModelData` recursion pattern.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW22301SF03DBean.loadModelData(String, String)` (overload) | `KKW22301SF03DBean.loadModelData(gamenId, key, subkey)` -> `KKW22301SF03DBean.loadModelData(key, subkey)` | `getIndex_value [R] index_value` |
| 2 | `KKW22301SFBean` (Screen) | `KKW22301SFBean.createXXXX` (screen entry) -> `KKW22301SF03DBean tmpBean = new KKW22301SF03DBean()` -> (bean fields populated via setter) -> `KKW22301SF03DBean.loadModelData(key, subkey)` | `getIndex_state [R] index_state` |

**Caller Analysis:**
- The primary caller is the **3-argument overload** of `loadModelData` within `KKW22301SF03DBean` itself, which delegates to this 2-argument method.
- The bean instance is created in the parent screen bean `KKW22301SFBean` (a web screen controller) and populated via setter injection for `cd_div_list_list`, `cd_div_nm_list_list`, and `nm_list_list`.
- This method is accessed during **screen rendering and postback** when the web framework needs to resolve field values by string key name.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (null check) (L172)

> Guard clause: returns null if either parameter is null.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key == null || subkey == null)` — "If key or subkey is null, return null" (key,subkeyがnullの場合、nullを返す) [L172] |
| 2 | RETURN | `return null` [L174] |

### Block 2 — SET (find separator) (L176)

> Locate the "/" separator position in key for list-type lookups.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` — finds the "/" delimiter position [L176] |

### Block 3 — IF/ELSE-IF/ELSE-IF/ELSE-IF (key routing: Supplementary Data → Code List → Code Name List → Name List) (L178–L276)

> The core dispatch logic: routes to the appropriate data category based on the `key` parameter.

#### Block 3.1 — IF (`key.equals("追加字")`) [L178]

> Supplementary Data branch: returns scalar index metadata fields. The original comment: "Put processing for each item" (項目ごとに処理を入れる。) and "Data type is String item 'Supplementary Data' (item ID: index)" (データタイプがStringの項目"追加字"(項目ID:index)).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key.equals("追加字"))` — [追加字="Supplementary Data"] (追加字) [L180] |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("value"))` — subkey "value" [L181] |
| 3 | RETURN | `return getIndex_value()` — returns `index_value` field [L182] |
| 4 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` — subkey "enable" [L184] |
| 5 | RETURN | `return getIndex_enabled()` — returns `index_enabled` field [L185] |
| 6 | Comment | // subkeyが"enable"の場合、index_enableのgetterの戻り値を返す (If subkey is "enable", return the value from index_enable getter) [L184] |
| 7 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` — subkey "state" [L186] |
| 8 | RETURN | `return getIndex_state()` — returns `index_state` field [L187] |
| 9 | Comment | // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status) [L186] |
| 10 | ELSE-IF | `else if(key.equals("コードリスト"))` — [コードリスト="Code List"] (コードリスト) [L190] |

#### Block 3.1.1 — Nested: Code List processing (within "コードリスト" branch) (L190)

> Code List branch: handles indexed access to the `cd_div_list_list` String-type list. Original comment: "配列項目「コードリスト」(String型。項目ID:cd_div_list)" (Array item "Code List" (String type, item ID: cd_div_list)).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` — extracts the element after "/" [L192] |
| 2 | IF | `if(key.equals("*"))` — wildcard for list size [L194] |
| 3 | RETURN | `return Integer.valueOf(cd_div_list_list.size())` — returns list size (element count) [L196] |
| 4 | Comment | // インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す (If "*" is specified instead of an index value, return the number of list elements) [L194] |
| 5 | SET | `tmpIndexInt = null` — initialize index variable [L198] |
| 6 | TRY | `tmpIndexInt = Integer.valueOf(key)` — parse key as integer index [L200] |
| 7 | CATCH | `catch(NumberFormatException e)` — non-numeric index [L203] |
| 8 | RETURN | `return null` — "If the index value is not a numeric string, return null here" (インデックス値が数値文字列ではない場合は、ここでnullを返す。) [L205] |
| 9 | IF | `if(tmpIndexInt == null)` — null safety check [L207] |
| 10 | RETURN | `return null` [L209] |
| 11 | SET | `tmpIndex = tmpIndexInt.intValue()` — extract primitive int [L211] |
| 12 | IF | `if(tmpIndex < 0 || tmpIndex >= cd_div_list_list.size())` — bounds check [L213] |
| 13 | RETURN | `return null` — "If the index value exceeds list count-1, return null here" (インデックス値がリスト個数-1を超える場合は、ここでnullを返す。) [L215] |
| 14 | RETURN | `return ((X33VDataTypeStringBean)cd_div_list_list.get(tmpIndex)).loadModelData(subkey)` — cast list element to StringBean and recursively resolve subkey [L216] |

#### Block 3.2 — ELSE-IF (`key.equals("コード名リスト")`) [L220]

> Code Name List branch: handles indexed access to the `cd_div_nm_list_list` String-type list. Original comment: "配列項目「コード名リスト」(String型。項目ID:cd_div_nm_list)" (Array item "Code Name List" (String type, item ID: cd_div_nm_list)).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` — extracts the element after "/" [L222] |
| 2 | IF | `if(key.equals("*"))` — wildcard for list size [L224] |
| 3 | RETURN | `return Integer.valueOf(cd_div_nm_list_list.size())` — returns list size [L226] |
| 4 | SET | `tmpIndexInt = null` [L229] |
| 5 | TRY | `tmpIndexInt = Integer.valueOf(key)` — parse key as integer index [L231] |
| 6 | CATCH | `catch(NumberFormatException e)` — non-numeric index [L234] |
| 7 | RETURN | `return null` — "If the index value is not a numeric string, return null here" [L236] |
| 8 | IF | `if(tmpIndexInt == null)` [L238] |
| 9 | RETURN | `return null` [L240] |
| 10 | SET | `tmpIndex = tmpIndexInt.intValue()` [L242] |
| 11 | IF | `if(tmpIndex < 0 || tmpIndex >= cd_div_nm_list_list.size())` — bounds check [L244] |
| 12 | RETURN | `return null` — bounds exceeded, return null [L246] |
| 13 | RETURN | `return ((X33VDataTypeStringBean)cd_div_nm_list_list.get(tmpIndex)).loadModelData(subkey)` — cast and delegate [L247] |

#### Block 3.3 — ELSE-IF (`key.equals("名称リスト")`) [L250]

> Name List branch: handles indexed access to the `nm_list_list` String-type list. Original comment: "配列項目「名称リスト」(String型。項目ID:nm_list)" (Array item "Name List" (String type, item ID: nm_list)).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` — extracts the element after "/" [L252] |
| 2 | IF | `if(key.equals("*"))` — wildcard for list size [L254] |
| 3 | RETURN | `return Integer.valueOf(nm_list_list.size())` — returns list size [L256] |
| 4 | SET | `tmpIndexInt = null` [L259] |
| 5 | TRY | `tmpIndexInt = Integer.valueOf(key)` — parse key as integer index [L261] |
| 6 | CATCH | `catch(NumberFormatException e)` — non-numeric index [L264] |
| 7 | RETURN | `return null` — "If the index value is not a numeric string, return null here" [L266] |
| 8 | IF | `if(tmpIndexInt == null)` [L268] |
| 9 | RETURN | `return null` [L270] |
| 10 | SET | `tmpIndex = tmpIndexInt.intValue()` [L272] |
| 11 | IF | `if(tmpIndex < 0 || tmpIndex >= nm_list_list.size())` — bounds check [L274] |
| 12 | RETURN | `return null` — bounds exceeded, return null [L276] |
| 13 | RETURN | `return ((X33VDataTypeStringBean)nm_list_list.get(tmpIndex)).loadModelData(subkey)` — cast and delegate [L277] |

#### Block 4 — ELSE (no matching key) (L280)

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

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` — "If no property matches the condition, return null" (条件に一致するプロパティが存在しない場合は、nullを返す。) [L280] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|-----------------|
| `追加字` | Field | Supplementary Data — scalar metadata item for index tracking within the UI data bean. Maps to `index_value`, `index_enabled`, and `index_state` properties. |
| `コードリスト` | Field | Code List — indexed list of String-type dropdown options. Internal itemID is `cd_div_list`. Used for selectable code values in service contract screens. |
| `コード名リスト` | Field | Code Name List — indexed list of String-type code name pairs. Internal itemID is `cd_div_nm_list`. Used for code-value display with human-readable labels. |
| `名称リスト` | Field | Name List — indexed list of String-type name entries. Internal itemID is `nm_list`. Used for name-based dropdown selections. |
| `index_value` | Field | Index Value — current position/selection index in data-bound UI components (default: `"0"`). Represents the active entry in list-type items. |
| `index_enabled` | Field | Index Enabled — Boolean flag controlling whether the index control is interactive (enabled/disabled). |
| `index_state` | Field | Index State — String field representing the current UI state of the index (e.g., normal, disabled, locked). |
| `cd_div_list_list` | Field | Code Division List — `X33VDataTypeList` containing `X33VDataTypeStringBean` elements for code values. |
| `cd_div_nm_list_list` | Field | Code Name List — `X33VDataTypeList` containing `X33VDataTypeStringBean` elements for code name pairs. |
| `nm_list_list` | Field | Name List — `X33VDataTypeList` containing `X33VDataTypeStringBean` elements for name entries. |
| `subkey` | Parameter | Sub-key — secondary identifier used to further resolve the requested field within a data category (e.g., `"value"`, `"enable"`, `"state"` for Supplementary Data). |
| `X33VDataTypeBeanInterface` | Interface | X33V Data Type Bean Interface — Fujitsu Futurity framework interface for beans that support property-based data access via `loadModelData`. |
| `X33VListedBeanInterface` | Interface | X33V Listed Bean Interface — Fujitsu Futurity framework interface for beans that contain indexed list data. |
| `X31CBaseBean` | Class | X31C Base Bean — base class for screen-level data beans in the X31 framework, providing common data access utilities. |
| `X33VDataTypeStringBean` | Class | X33V Data Type String Bean — framework bean wrapper for String-typed data elements within lists. |
| `X33VDataTypeList` | Class | X33V Data Type List — framework container for indexed lists of typed data bean elements. |
| `KKW22301SF` | Module | Screen Module — the telecom service contract detail modification screen module (KK prefix = K-Opticom, W = Web, SF = Screen Flow). |
