# Business Logic — KKW22301SF03DBean.storeModelData() [93 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW22301SF.KKW22301SF03DBean` |
| Layer | Utility / Data Bean (Futurity Web Client framework D-BEAN) |
| Module | `KKW22301SF` (Package: `eo.web.webview.KKW22301SF`) |

## 1. Role

### KKW22301SF03DBean.storeModelData()

This method is the central **data-binding dispatch router** for the `KKW22301SF03DBean` data bean within the K-Opticom Web Client (Futurity X33) framework. It receives a key-based path and a value, then routes the assignment to the appropriate instance field or sub-element based on the key name. The key parameter follows a hierarchical path format: for simple items the key is just the item name (e.g., `"追加字" / "Add Item"`), while for list-based items it uses a slash-delimited path such as `"コードリスト/index"` (e.g., `"cd_div_list/0"`), enabling the method to descend into nested list beans and delegate the actual field assignment further down the tree.

The method handles three distinct business data categories:

- **Add Item Fields** (`"追加字"`) — Direct field setters for the item's value, enabled state, and visual state. This represents a single-row record's editable properties.
- **Code List** (`"コードリスト"`, item ID `cd_div_list`) — A list of code definitions. Each list element stores a code classification key/value pair used throughout the application for dropdowns, lookups, and display mappings.
- **Code Name List** (`"コード名リスト"`, item ID `cd_div_nm_list`) — A list of code display names corresponding to the code list. Each list element stores the human-readable label for a given code.
- **Name List** (`"名前リスト"`, item ID `nm_list`) — A list of name values, used for item name bindings in list-based UI components.

The method implements the **delegation pattern** by checking the key type, extracting a list index from the path, and delegating the actual field write to the individual list element's own `storeModelData()` method. This allows the bean to maintain a tree-like data structure that can be populated recursively. Its role in the larger system is as the **primary data sink** for the view layer — when the X33 framework serializes screen data into the D-BEAN (e.g., on form submission or model load), it routes data through this method using key paths that identify exactly which field or list element to populate.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeModelData params"])

    START --> CHECK_NULL{key or subkey null}
    CHECK_NULL -->|Yes| RETURN_RETURN(["return - no-op"])
    CHECK_NULL -->|No| FIND_SEP["key.indexOf forward slash find separator"]

    FIND_SEP --> CHECK_KEY1{key is Add Item}

    CHECK_KEY1 -->|Yes| CHECK_SUB1{subkey equals value}
    CHECK_SUB1 -->|Yes| SET_VALUE["setIndex_value String"]
    CHECK_SUB1 -->|No| CHECK_SUB1B{subkey equals enable}
    CHECK_SUB1B -->|Yes| SET_ENABLED["setIndex_enabled Boolean"]
    CHECK_SUB1B -->|No| CHECK_SUB1C{subkey equals state}
    CHECK_SUB1C -->|Yes| SET_STATE["setIndex_state String"]
    CHECK_SUB1C -->|No| SKIP_ADDITEM(["Proceed no matching subkey"])

    CHECK_KEY1 -->|No| CHECK_KEY2{key is Code List}
    CHECK_KEY2 -->|Yes| EXTRACT_CODE_KEY["key substring from separator"]
    EXTRACT_CODE_KEY --> PARSE_CODE_INDEX["tmpIndexInt Integer.valueOf key"]
    PARSE_CODE_INDEX --> CATCH_CODE{NumberFormatException}
    CATCH_CODE -->|Yes| CODE_NULL["tmpIndexInt null"]
    CATCH_CODE -->|No| CODE_VALID{tmpIndexInt not null}
    CODE_NULL --> CODE_NO_ACTION(["No action null index"])
    CODE_VALID -->|Yes| CODE_BOUNDS{index in list bounds}
    CODE_VALID -->|No| CODE_NO_ACTION
    CODE_BOUNDS -->|Yes| DELEGATE_CODE["Delegate cd_div_list_item storeModelData"]
    CODE_BOUNDS -->|No| CODE_OUT_OF_RANGE(["No action out of range"])

    CHECK_KEY2 -->|No| CHECK_KEY3{key is Code Name List}
    CHECK_KEY3 -->|Yes| EXTRACT_NM_KEY["key substring from separator"]
    EXTRACT_NM_KEY --> PARSE_NM_INDEX["tmpIndexInt Integer.valueOf key"]
    PARSE_NM_INDEX --> CATCH_NM{NumberFormatException}
    CATCH_NM -->|Yes| NM_NULL["tmpIndexInt null"]
    CATCH_NM -->|No| NM_VALID{tmpIndexInt not null}
    NM_NULL --> NM_NO_ACTION(["No action null index"])
    NM_VALID -->|Yes| NM_BOUNDS{index in list bounds}
    NM_VALID -->|No| NM_NO_ACTION
    NM_BOUNDS -->|Yes| DELEGATE_NM["Delegate cd_div_nm_list_item storeModelData"]
    NM_BOUNDS -->|No| NM_OUT_OF_RANGE(["No action out of range"])

    CHECK_KEY3 -->|No| CHECK_KEY4{key is Name List}
    CHECK_KEY4 -->|Yes| EXTRACT_NAME_KEY["key substring from separator"]
    EXTRACT_NAME_KEY --> PARSE_NAME_INDEX["tmpIndexInt Integer.valueOf key"]
    PARSE_NAME_INDEX --> CATCH_NAME{NumberFormatException}
    CATCH_NAME -->|Yes| NAME_NULL["tmpIndexInt null"]
    CATCH_NAME -->|No| NAME_VALID{tmpIndexInt not null}
    NAME_NULL --> NAME_NO_ACTION(["No action null index"])
    NAME_VALID -->|Yes| NAME_BOUNDS{index in list bounds}
    NAME_VALID -->|No| NAME_NO_ACTION
    NAME_BOUNDS -->|Yes| DELEGATE_NAME["Delegate nm_list_item storeModelData"]
    NAME_BOUNDS -->|No| NAME_OUT_OF_RANGE(["No action out of range"])

    CHECK_KEY4 -->|No| UNKNOWN_KEY(["No action unknown key"])

    SET_STATE --> END_RETURN(["return void"])
    SKIP_ADDITEM --> END_RETURN
    DELEGATE_CODE --> END_RETURN
    CODE_NO_ACTION --> END_RETURN
    CODE_OUT_OF_RANGE --> END_RETURN
    NM_NO_ACTION --> END_RETURN
    NM_OUT_OF_RANGE --> END_RETURN
    NAME_NO_ACTION --> END_RETURN
    NAME_OUT_OF_RANGE --> END_RETURN
    UNKNOWN_KEY --> END_RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The hierarchical key identifying which data field or list item to populate. For simple (non-list) items, it is the field name in Japanese (e.g., `"追加字"` = Add Item, `"コードリスト"` = Code List, `"コード名リスト"` = Code Name List, `"名前リスト"` = Name List). For list items, it is a slash-delimited path containing the list type prefix and a zero-based index (e.g., `"コードリスト/0"` maps to `cd_div_list_list` element at index 0). |
| 2 | `subkey` | `String` | The sub-field name within the identified data element. For simple items, it specifies which property to set on the record: `"value"` (the data value, mapped to `index_value`), `"enable"` (the enabled/active state, mapped to `index_enabled`), or `"state"` (the display/state tag, mapped to `index_state`). For list items, it is passed through to the nested element's `storeModelData()`. Case-insensitive comparison is used. |
| 3 | `in_value` | `Object` | The raw data value to store. Its concrete type depends on the `subkey`: for `value` it is a `String`, for `enable` it is a `Boolean`, and for list items it is passed through as-is to the nested bean. The method performs casting based on the expected type at the assignment point. |
| 4 | `isSetAsString` | `boolean` | Flag indicating whether the value should be stored as a String when targeting a Long-type item's Value property. This parameter is not directly used in this method's logic but is forwarded to nested `storeModelData` calls on list elements (e.g., `X33VDataTypeLongBean`), allowing the bean to preserve type coercion semantics. |

**Instance fields / external state read:**

| Field | Type | Usage |
|-------|------|-------|
| `cd_div_list_list` | `X33VDataTypeList` | The code list; iterated by index to find the target element |
| `cd_div_nm_list_list` | `X33VDataTypeList` | The code name list; iterated by index to find the target element |
| `nm_list_list` | `X33VDataTypeList` | The name list; iterated by index to find the target element |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKAdEditCC.substring` | JKKAdEditCC | - | Calls `substring` in `JKKAdEditCC` |
| - | `JKKAdEdit.substring` | JKKAdEdit | - | Calls `substring` in `JKKAdEdit` |
| - | `JKKTelnoInfoAddMapperCC.substring` | JKKTelnoInfoAddMapperCC | - | Calls `substring` in `JKKTelnoInfoAddMapperCC` |
| - | `JDKejbStringEdit.substring` | JDKejbStringEdit | - | Calls `substring` in `JDKejbStringEdit` |
| - | `KKW22301SF03DBean.setIndex_enabled` | KKW22301SF03DBean | - | Sets the enabled state property on the Add Item record |
| - | `KKW22301SF03DBean.setIndex_state` | KKW22301SF03DBean | - | Sets the display state property on the Add Item record |
| - | `KKW22301SF03DBean.setIndex_value` | KKW22301SF03DBean | - | Sets the value property on the Add Item record |
| - | `KKW22301SF03DBean.storeModelData` | KKW22301SF03DBean | - | Recursively delegates to sub-item bean |

This method is a **pure setter (U — Update)** operation. It does not read from or write to any database tables or invoke Service Component (SC) / CBS endpoints. It operates entirely in-memory, updating the bean's own fields and delegating field writes into nested list beans. There are no entity or DB table associations.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: `storeModelData` [-], `storeModelData` [-], `storeModelData` [-], `substring` [-], `substring` [-], `substring` [-], `substring` [-], `storeModelData` [-], `storeModelData` [-], `storeModelData` [-], `substring` [-], `substring` [-], `substring` [-], `substring` [-], `storeModelData` [-], `storeModelData` [-], `storeModelData` [-], `substring` [-], `substring` [-], `substring` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | KKW22301SF03DBean (self-recursion) | `storeModelData` (list element delegation) | `storeModelData [-] (nested bean)` |
| 2 | KKW22301SF03DBean (self-recursion) | `storeModelData` (list element delegation) | `storeModelData [-] (nested bean)` |
| 3 | KKW22301SF03DBean (self-recursion) | `storeModelData` (list element delegation) | `storeModelData [-] (nested bean)` |

This method has no external screen or batch entry points. All callers are internal recursive calls — the method delegates to itself on individual list elements (`X33VDataTypeStringBean`), which in turn may further delegate. The terminal operations are all `storeModelData` calls down into nested beans, and `substring` calls used during key path parsing. No SC codes, CBS endpoints, or database tables are reached.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null || subkey == null)` (L316)

Early-exit guard: if either the key or subkey parameter is null, processing stops immediately.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // Find separator index [-> integer position of forward slash in key] |

**Block 2** — [IF-ELSEIF-ELSEIF-ELSEIF] `(key.equals("追加字"))` (L321) — Condition: `key` equals `"追加字"` (Add Item)

This block handles direct field assignment for the Add Item record — a single-row data item with value, enabled, and state properties.

> (Optional: brief business description of what this block does)

For the Add Item key, the method examines the `subkey` to determine which field to set. The subkey comparison is case-insensitive, supporting `"value"`, `"enable"`, and `"state"`.

**Block 2.1** — [IF] `(subkey.equalsIgnoreCase("value"))` (L322) [ADD_ITEM_SUBKEY_VALUE="value"]

Sets the value property of the Add Item record.

| # | Type | Code |
|---|------|------|
| 1 | SET | `setIndex_value((String)in_value)` // Cast in_value to String and set as the item value [-> KKW22301SF03DBean.index_value] |

**Block 2.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("enable"))` (L325) [ADD_ITEM_SUBKEY_ENABLE="enable"]

Sets the enabled/active state of the Add Item record. The comment indicates: subkey that is "enable" → execute the index_enabled setter (サブキーが"enable"の場合、index_enabled setterを実行する).

| # | Type | Code |
|---|------|------|
| 1 | SET | `setIndex_enabled((Boolean)in_value)` // Cast in_value to Boolean and set as enabled state [-> KKW22301SF03DBean.index_enabled] |

**Block 2.3** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L328) [ADD_ITEM_SUBKEY_STATE="state"]

Sets the state/display tag of the Add Item record. The comment indicates: subkey that is "state" → return the status (サブキーが"state"の場合、ステータスを返す).

| # | Type | Code |
|---|------|------|
| 1 | SET | `setIndex_state((String)in_value)` // Cast in_value to String and set as display state [-> KKW22301SF03DBean.index_state] |

**Block 3** — [ELSE-IF] `(key.equals("コードリスト"))` (L333) — Condition: `key` equals `"コードリスト"` (Code List), item ID: `cd_div_list`

This block handles delegation into the code list (`cd_div_list_list`). It extracts the list index from the key path, parses it as an integer, bounds-checks it, and delegates to the target list element.

> The comment indicates this is a list-type item of String type with item ID "cd_div_list" (配列項目 "コードリスト"(String型。項目ID:cd_div_list)).

**Block 3.1** — [SET] Extract path element after separator (L335)

Extracts the portion of the key string after the first forward slash (e.g., from `"cd_div_list/0"` → `"0"`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Extract the element after the first "/" [-> converts "cd_div_list/0" to "0"] |

**Block 3.2** — [TRY-CATCH] Parse index from extracted key (L337-L343)

Attempts to convert the extracted path element into an integer index. If the key path is malformed (not a number), it catches the exception and sets the index to null.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key)` // Parse the path element as an integer |
| 2 | CATCH | `NumberFormatException e` → `tmpIndexInt = null` // If not a numeric string, set index to null [-> key path element is not a number] |

**Block 3.3** — [IF] `(tmpIndexInt != null)` (L344) [CODE_LIST_INDEX_VALID]

Only proceeds if the index was successfully parsed.

**Block 3.3.1** — [SET] Unbox Integer to int (L345)

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

**Block 3.4** — [IF] `(tmpIndex >= 0 && tmpIndex < cd_div_list_list.size())` (L346) [CODE_LIST_INDEX_IN_BOUNDS]

Bounds-checks the index against the code list size.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `((X33VDataTypeStringBean)cd_div_list_list.get(tmpIndex)).storeModelData(subkey, in_value)` // Cast list element to X33VDataTypeStringBean and delegate [-> The cast portion specifies X33VDataTypeStringBean, X33VDataTypeLongBean, or X33VDataTypeBooleanBean per item definition type. For X33VDataTypeLongBean, the subkey, input value, and isSetAsString flag are passed as parameters.] |

**Block 4** — [ELSE-IF] `(key.equals("コード名リスト"))` (L355) — Condition: `key` equals `"コード名リスト"` (Code Name List), item ID: `cd_div_nm_list`

This block handles delegation into the code name list (`cd_div_nm_list_list`). It follows the exact same pattern as Block 3: extract the index from the key path, parse it, bounds-check, and delegate.

> The comment indicates this is a list-type item of String type with item ID "cd_div_nm_list" (配列項目 "コード名リスト"(String型。項目ID:cd_div_nm_list)).

**Block 4.1** — [SET] Extract path element after separator (L357)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Extract the element after the first "/" [-> converts "cd_div_nm_list/0" to "0"] |

**Block 4.2** — [TRY-CATCH] Parse index from extracted key (L359-L365)

Identical logic to Block 3.2: attempt `Integer.valueOf(key)`, catch `NumberFormatException` and set `tmpIndexInt = null`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key)` // Parse the path element as an integer |
| 2 | CATCH | `NumberFormatException e` → `tmpIndexInt = null` // If not a numeric string, set index to null |

**Block 4.3** — [IF] `(tmpIndexInt != null)` (L366) [CODE_NAME_LIST_INDEX_VALID]

**Block 4.3.1** — [SET] Unbox Integer to int (L367)

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

**Block 4.4** — [IF] `(tmpIndex >= 0 && tmpIndex < cd_div_nm_list_list.size())` (L368) [CODE_NAME_LIST_INDEX_IN_BOUNDS]

| # | Type | Code |
|---|------|------|
| 1 | CALL | `((X33VDataTypeStringBean)cd_div_nm_list_list.get(tmpIndex)).storeModelData(subkey, in_value)` // Cast list element to X33VDataTypeStringBean and delegate |

**Block 5** — [ELSE-IF] `(key.equals("名前リスト"))` (L377) — Condition: `key` equals `"名前リスト"` (Name List), item ID: `nm_list`

This block handles delegation into the name list (`nm_list_list`). It follows the identical same pattern as Block 3 and Block 4.

> The comment indicates this is a list-type item of String type with item ID "nm_list" (配列項目 "名前リスト"(String型。項目ID:nm_list)).

**Block 5.1** — [SET] Extract path element after separator (L379)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // Extract the element after the first "/" [-> converts "nm_list/0" to "0"] |

**Block 5.2** — [TRY-CATCH] Parse index from extracted key (L381-L387)

Identical parsing logic: `Integer.valueOf(key)` with `NumberFormatException` handling.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key)` // Parse the path element as an integer |
| 2 | CATCH | `NumberFormatException e` → `tmpIndexInt = null` // If not a numeric string, set index to null |

**Block 5.3** — [IF] `(tmpIndexInt != null)` (L388) [NAME_LIST_INDEX_VALID]

**Block 5.3.1** — [SET] Unbox Integer to int (L389)

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

**Block 5.4** — [IF] `(tmpIndex >= 0 && tmpIndex < nm_list_list.size())` (L390) [NAME_LIST_INDEX_IN_BOUNDS]

| # | Type | Code |
|---|------|------|
| 1 | CALL | `((X33VDataTypeStringBean)nm_list_list.get(tmpIndex)).storeModelData(subkey, in_value)` // Cast list element to X33VDataTypeStringBean and delegate |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `index_value` | Field | Item value — the primary data value stored on the Add Item record |
| `index_enabled` | Field | Item enabled state — boolean flag controlling whether the Add Item field is active/editable |
| `index_state` | Field | Item display state — a string tag describing the current state of the item (e.g., "NEW", "MODIFIED", "DELETED") |
| `index_update` | Field | Item update flag — tracks whether the Add Item record has been modified |
| `追加字` | Field (Japanese) | Add Item — the key for a single-row data record with value, enabled, and state properties |
| `コードリスト` | Field (Japanese) | Code List — key for a list of code classification definitions (item ID: `cd_div_list`), used for data lookup mappings |
| `コード名リスト` | Field (Japanese) | Code Name List — key for a list of human-readable code labels (item ID: `cd_div_nm_list`), paired with the code list |
| `名前リスト` | Field (Japanese) | Name List — key for a list of name values (item ID: `nm_list`), used for item name bindings in list-based UI components |
| `cd_div_list_list` | Field | The list container for code classification items — holds `X33VDataTypeList` of `X33VDataTypeStringBean` elements |
| `cd_div_nm_list_list` | Field | The list container for code name items — holds `X33VDataTypeList` of `X33VDataTypeStringBean` elements |
| `nm_list_list` | Field | The list container for name items — holds `X33VDataTypeList` of `X33VDataTypeStringBean` elements |
| X33VDataTypeStringBean | Class | Futurity X33 framework bean — represents a single string-type data element within a list, with its own `storeModelData()` for nested delegation |
| X33VDataTypeList | Class | Futurity X33 framework list container — a typed list of data beans (`List<? extends X33VDataTypeBeanInterface>`), providing `get(index)` and `size()` operations |
| X33 Framework | Technology | Fujitsu Futurity X33 Web Client framework — the enterprise application framework used for the K-Opticom web application, providing D-BEAN data binding, screen lifecycle, and model serialization |
| D-BEAN | Technology | Data Bean — the X33 framework's model object pattern where screen data is stored and exchanged between view and controller layers |
| subkey | Parameter | Sub-field identifier — specifies which property of the identified data element to set (e.g., "value", "enable", "state"); case-insensitive comparison |
| `isSetAsString` | Parameter | Type coercion flag — indicates whether to store a value as a String when the target property is Long type; forwarded to nested beans |
| `separaterPoint` | Variable | Separator index — the position of the first "/" in the key path, used to split the list type prefix from the list index |
