# Business Logic — KKW00130SF01DBean.loadModelData() [77 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00130SF.KKW00130SF01DBean` |
| Layer | Web View Bean (UI Data Binding / Model-View component) |
| Module | `KKW00130SF` (Package: `eo.web.webview.KKW00130SF`) |

## 1. Role

### KKW00130SF01DBean.loadModelData()

This method implements the **key-based data access and dispatch** pattern for the KKW00130SF screen's data model. It serves as the central data retrieval gateway for the view bean, enabling the web framework to resolve arbitrary data references using a structured key and subkey naming convention.

The method handles **three categories of data access**: (1) **Index metadata** — retrieves the current index's value or state for the "替え字" (modified character) field; (2) **Code list data** — resolves indexed elements from the `コードリスト` (code list) array, supporting both size queries (via wildcard `*`) and individual element access by integer index; (3) **Code name list data** — similarly resolves indexed elements from the `コード名リスト` (code name list) array with the same size/index access pattern.

The design implements a **routing/dispatch pattern** where a compound key string (potentially using `/` as a separator) determines the data category and subkey determines the specific access mode. Array-indexed list types delegate further to the `loadModelData(subkey)` method of each list element (`X33VDataTypeStringBean`), creating a recursive lookup chain. Within the larger system, this method fulfills the `X33VDataTypeBeanInterface.loadModelData` contract, acting as a shared data accessor called by the X33 view framework during page rendering and data binding cycles.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData(key, subkey)"])
    CHECK_NULL["key or subkey is null?"]
    NULL_RETURN["Return null"]

    FIND_SLASH["Find '/' in key (separaterPoint)"]

    CHECK_ADDAJI["key == '替え字' (Field ID: index)?"]

    SUBKEY_VALUE["subkey == 'value' (case-insensitive)?"]
    GET_INDEX_VALUE["Call getIndex_value()"]

    SUBKEY_STATE["subkey == 'state' (case-insensitive)?"]
    GET_INDEX_STATE["Call getIndex_state()"]

    CHECK_CODELIST["key == 'コードリスト' (String type, item ID: cd_list)?"]
    SUBSTRING_KEY["key = key.substring(separaterPoint + 1)"]
    CHECK_STAR["key == '*' (wildcard)?"]
    RETURN_LIST_SIZE["Return cd_list_list.size()"]
    PARSE_INDEX_INT["Try: tmpIndexInt = Integer.valueOf(key)"]
    CATCH_NUM_FORMAT["Catch NumberFormatException: Return null"]
    CHECK_INDEX_NULL["tmpIndexInt is null?"]
    CONV_INDEX["tmpIndex = tmpIndexInt.intValue()"]
    CHECK_BOUNDS["tmpIndex < 0 or >= cd_list_list.size()?"]
    BOUNDS_RETURN["Return null"]
    GET_CODELIST_ITEM["Get (X33VDataTypeStringBean)cd_list_list.get(tmpIndex)"]
    DELEGATE_LOAD1["Call loadModelData(subkey) on item"]
    RETURN_ITEM_VALUE["Return item data"]

    CHECK_CODE_NAME_LIST["key == 'コード名リスト' (String type, item ID: cd_nm_list)?"]
    SUBSTRING_KEY_NMLIST["key = key.substring(separaterPoint + 1)"]
    CHECK_STAR_NM["key == '*' (wildcard)?"]
    RETURN_NMLIST_SIZE["Return cd_nm_list_list.size()"]
    PARSE_INDEX_NMLIST["Try: tmpIndexInt = Integer.valueOf(key)"]
    CATCH_NUM_FORMAT_NMLIST["Catch NumberFormatException: Return null"]
    CHECK_INDEX_NULL_NM["tmpIndexInt is null?"]
    CONV_INDEX_NM["tmpIndex = tmpIndexInt.intValue()"]
    CHECK_BOUNDS_NM["tmpIndex < 0 or >= cd_nm_list_list.size()?"]
    BOUNDS_RETURN_NM["Return null"]
    GET_NMLIST_ITEM["Get (X33VDataTypeStringBean)cd_nm_list_list.get(tmpIndex)"]
    DELEGATE_LOAD2["Call loadModelData(subkey) on item"]
    RETURN_ITEM_VALUE_NM["Return item data"]

    NO_MATCH_RETURN["Return null"]

    START --> CHECK_NULL
    CHECK_NULL -->|true| NULL_RETURN
    CHECK_NULL -->|false| FIND_SLASH
    FIND_SLASH --> CHECK_ADDAJI
    CHECK_ADDAJI -->|true| SUBKEY_VALUE
    CHECK_ADDAJI -->|false| CHECK_CODELIST
    SUBKEY_VALUE -->|true| GET_INDEX_VALUE
    SUBKEY_VALUE -->|false| SUBKEY_STATE
    SUBKEY_STATE -->|true| GET_INDEX_STATE
    SUBKEY_STATE -->|false| CHECK_CODELIST
    GET_INDEX_VALUE --> RETURN_ITEM_VALUE
    GET_INDEX_STATE --> RETURN_ITEM_VALUE
    CHECK_CODELIST -->|true| SUBSTRING_KEY
    CHECK_CODELIST -->|false| CHECK_CODE_NAME_LIST
    SUBSTRING_KEY --> CHECK_STAR
    CHECK_STAR -->|true| RETURN_LIST_SIZE
    CHECK_STAR -->|false| PARSE_INDEX_INT
    PARSE_INDEX_INT -->|success| CHECK_INDEX_NULL
    PARSE_INDEX_INT -->|exception| CATCH_NUM_FORMAT
    CHECK_INDEX_NULL -->|true| BOUNDS_RETURN
    CHECK_INDEX_NULL -->|false| CONV_INDEX
    CONV_INDEX --> CHECK_BOUNDS
    CHECK_BOUNDS -->|true| BOUNDS_RETURN
    CHECK_BOUNDS -->|false| GET_CODELIST_ITEM
    GET_CODELIST_ITEM --> DELEGATE_LOAD1
    DELEGATE_LOAD1 --> RETURN_ITEM_VALUE
    RETURN_LIST_SIZE --> RETURN_ITEM_VALUE
    CATCH_NUM_FORMAT --> RETURN_ITEM_VALUE
    BOUNDS_RETURN --> RETURN_ITEM_VALUE
    CHECK_CODE_NAME_LIST -->|true| SUBSTRING_KEY_NMLIST
    CHECK_CODE_NAME_LIST -->|false| NO_MATCH_RETURN
    SUBSTRING_KEY_NMLIST --> CHECK_STAR_NM
    CHECK_STAR_NM -->|true| RETURN_NMLIST_SIZE
    CHECK_STAR_NM -->|false| PARSE_INDEX_NMLIST
    PARSE_INDEX_NMLIST -->|success| CHECK_INDEX_NULL_NM
    PARSE_INDEX_NMLIST -->|exception| CATCH_NUM_FORMAT_NMLIST
    CHECK_INDEX_NULL_NM -->|true| BOUNDS_RETURN_NM
    CHECK_INDEX_NULL_NM -->|false| CONV_INDEX_NM
    CONV_INDEX_NM --> CHECK_BOUNDS_NM
    CHECK_BOUNDS_NM -->|true| BOUNDS_RETURN_NM
    CHECK_BOUNDS_NM -->|false| GET_NMLIST_ITEM
    GET_NMLIST_ITEM --> DELEGATE_LOAD2
    DELEGATE_LOAD2 --> RETURN_ITEM_VALUE_NM
    RETURN_NMLIST_SIZE --> RETURN_ITEM_VALUE_NM
    CATCH_NUM_FORMAT_NMLIST --> RETURN_ITEM_VALUE_NM
    BOUNDS_RETURN_NM --> RETURN_ITEM_VALUE_NM
    NO_MATCH_RETURN --> END_NODE(["Return null"])
    END_NODE --> END(["End"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name** (field identifier) used to look up data. Can be a simple field name like "替え字" (modified character/index) or a compound key like "コードリスト/0" for code list elements. For list types, the portion after "/" encodes either the wildcard "*" (to request list size) or a numeric index. |
| 2 | `subkey` | `String` | A **sub-key** that further refines the data request. For index fields, it specifies whether to return "value" (the current index value) or "state" (the current index state). For list elements, it is forwarded to the item bean's `loadModelData` for nested data resolution. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `cd_list_list` | `X33VDataTypeList` | The code list — a list of selectable code values (e.g., dropdown options) used on the screen |
| `cd_nm_list_list` | `X33VDataTypeList` | The code name list — a list of code descriptions with display names |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `KKW00130SF01DBean.getIndex_value` | KKW00130SF01DBean | - | Calls `getIndex_value` in `KKW00130SF01DBean` — returns the stored index value string |
| R | `KKW00130SF01DBean.getIndex_state` | KKW00130SF01DBean | - | Calls `getIndex_state` in `KKW00130SF01DBean` — returns the stored index state string |
| R | `KKW00130SF01DBean.loadModelData` | KKW00130SF01DBean | - | Recursively calls `loadModelData` on list element beans (`X33VDataTypeStringBean`) |
| - | `String.substring` | java.lang.String | - | Calls `substring` to extract the index portion from the compound key |
| - | `X33VDataTypeList.size` | com.fujitsu.futurity.web.x33.beans | - | Calls `size()` on the `X33VDataTypeList` to return list element count |
| - | `X33VDataTypeList.get` | com.fujitsu.futurity.web.x33.beans | - | Calls `get(index)` on the list to retrieve an `X33VDataTypeStringBean` item |
| - | `Integer.valueOf` | java.lang | - | Parses the numeric index string via `Integer.valueOf()` |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00130SF (internal) | `KKW00130SF01DBean.loadModelData(String, String)` (overloaded variant) -> `KKW00130SF01DBean.loadModelData(String, String)` | `getIndex_value [R] index_value field`<br>`getIndex_state [R] index_state field`<br>`item.loadModelData(subkey) [R] nested item data` |

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(key == null || subkey == null)` (L148)

> Null guard: returns null if either key or subkey is null. Prevents NPE downstream.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // Find the separator position in key [L151] |
| 2 | RETURN | `return null` // Return null when key or subkey is null |

**Block 2** — IF `(key.equals("替え字"))` — [IF/ELSE-IF] `key == "替え字" (Field ID: index)` (L154)

> Handles the "modified character" (替え字) index field. The field name "替え字" maps to an index tracking mechanism.

**Block 2.1** — IF-ELSE-IF `(subkey.equalsIgnoreCase("value"))` (L155)

> When the subkey is "value" (case-insensitive), return the stored index value.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIndex_value()` // Returns the current index value [-> index_value field] |

**Block 2.2** — ELSE-IF `(subkey.equalsIgnoreCase("state"))` — `subkey == "state"` (L157)

> When the subkey is "state" (case-insensitive), return the stored index state. (subkeyが"state"の場合、ステータスを返す。)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getIndex_state()` // Returns the current index state [-> index_state field] |

**Block 3** — ELSE-IF `(key.equals("コードリスト"))` — [IF/ELSE-IF] `key == "コードリスト" (code list, String type, item ID: cd_list)` (L163)

> Handles the code list array access. The key contains a sub-component after "/" which is either "*" (wildcard for size) or a numeric index.

**Block 3.1** — EXEC `(key.substring)` (L165)

> Extracts the sub-component after the "/" separator.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Get the element after "/" |

**Block 3.2** — IF `(key.equals("*"))` (L167)

> When the sub-component is "*", return the list element count instead of a specific element. (インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す。)

| # | Type | Code |
|---|------|------|
| 1 | SET | `return Integer.valueOf(cd_list_list.size())` // Return size as Integer |

**Block 3.3** — TRY-CATCH `(Integer.valueOf)` (L173-L179)

> Attempts to parse the sub-component as a numeric index. If parsing fails (e.g., non-numeric string), returns null. (インデックス値が数値文字列でない場合は、ここでnullを返す。)

| # | Type | Code |
|---|------|------|
| 1 | SET (try) | `tmpIndexInt = Integer.valueOf(key)` // Parse numeric index from key string |
| 2 | SET (catch) | `return null` // NumberFormatException — return null for non-numeric indices |

**Block 3.4** — IF `(tmpIndexInt == null)` (L180)

> After exception handling, if tmpIndexInt is still null, return null.

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

**Block 3.5** — SET (L183)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndex = tmpIndexInt.intValue()` // Convert Integer to int primitive |

**Block 3.6** — IF `(tmpIndex < 0 || tmpIndex >= cd_list_list.size())` (L184)

> Bounds check: if the index is out of the valid range [0, size-1], return null. (インデックス値がリスト個数-1を超えたら、ここでnullを返す。)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // Out-of-bounds index |

**Block 3.7** — EXEC + CALL (L186)

> Retrieve the list element at the validated index and delegate to its `loadModelData` for nested data resolution.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `cd_list_list.get(tmpIndex)` // Retrieve item from code list at index |
| 2 | SET | Cast to `(X33VDataTypeStringBean)` |
| 3 | CALL | `.loadModelData(subkey)` // Delegate to item bean's loadModelData with subkey |

**Block 4** — ELSE-IF `(key.equals("コード名リスト"))` — [IF/ELSE-IF] `key == "コード名リスト" (code name list, String type, item ID: cd_nm_list)` (L190)

> Handles the code name list array access. Structurally identical to Block 3 but operates on `cd_nm_list_list`.

**Block 4.1** — EXEC `(key.substring)` (L192)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Get the element after "/" |

**Block 4.2** — IF `(key.equals("*"))` (L194)

> When the sub-component is "*", return the code name list element count. (インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す。)

| # | Type | Code |
|---|------|------|
| 1 | SET | `return Integer.valueOf(cd_nm_list_list.size())` // Return code name list size as Integer |

**Block 4.3** — TRY-CATCH `(Integer.valueOf)` (L200-L206)

> Attempts to parse the sub-component as a numeric index for code name list. Same pattern as Block 3.3.

| # | Type | Code |
|---|------|------|
| 1 | SET (try) | `tmpIndexInt = Integer.valueOf(key)` // Parse numeric index from key string |
| 2 | SET (catch) | `return null` // NumberFormatException — return null for non-numeric indices |

**Block 4.4** — IF `(tmpIndexInt == null)` (L207)

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

**Block 4.5** — SET (L210)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndex = tmpIndexInt.intValue()` // Convert Integer to int primitive |

**Block 4.6** — IF `(tmpIndex < 0 || tmpIndex >= cd_nm_list_list.size())` (L211)

> Bounds check for code name list. Same pattern as Block 3.6. (インデックス値がリスト個数-1を超えたら、ここでnullを返す。)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // Out-of-bounds index |

**Block 4.7** — EXEC + CALL (L213)

> Retrieve the code name list element at the validated index and delegate to its `loadModelData`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `cd_nm_list_list.get(tmpIndex)` // Retrieve item from code name list at index |
| 2 | SET | Cast to `(X33VDataTypeStringBean)` |
| 3 | CALL | `.loadModelData(subkey)` // Delegate to item bean's loadModelData with subkey |

**Block 5** — RETURN (L216)

> Fallback: no matching key was found. Returns null. (条件に一致するプロパティが存在しない場合は、nullを返す。)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // No matching key found |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `替え字` | Field | Modified character — a screen field that tracks a replacement/mapping character, with associated index value and state metadata |
| `index_value` | Field | The current value of the index (modified character) field — stores the selected replacement character value |
| `index_state` | Field | The current state/status of the index (modified character) field — stores metadata about the index's operational state |
| `コードリスト` | Field | Code list — a selectable list of code values (e.g., dropdown options with internal codes), mapped to `cd_list_list` |
| `コード名リスト` | Field | Code name list — a selectable list of code descriptions with human-readable display names, mapped to `cd_nm_list_list` |
| `cd_list_list` | Field | Internal list holding `X33VDataTypeList` data — the backing store for the code list field |
| `cd_nm_list_list` | Field | Internal list holding `X33VDataTypeList` data — the backing store for the code name list field |
| `key` | Parameter | Item name — the field identifier used to look up data (e.g., "替え字", "コードリスト/0") |
| `subkey` | Parameter | Sub-key — a refinement key that further specifies the data type or nested element to retrieve |
| X33 | Acronym | Fujitsu Futurity X33 web framework — the enterprise web application framework providing the bean lifecycle, data binding, and view component model |
| `X33VDataTypeList` | Framework type | A framework-provided list data type container that holds typed data elements (supports `get(int)`, `size()`) |
| `X33VDataTypeStringBean` | Framework type | A string data type bean within the X33 framework; each list element is wrapped in this type and supports `loadModelData` for nested property access |
| `X33VListedBeanInterface` | Framework interface | X33 interface that marks a bean as containing listed (iterable) data, enabling framework-level iteration and binding |
| `X31CBaseBean` | Framework class | Base bean class from the X31 framework that provides common setter/getter behavior including `loadModelData(String, String)` |
| `separaterPoint` | Local variable | The position of "/" in the key string, used as a delimiter to split compound keys into category and sub-component |
