# Business Logic — KKW01027SF02DBean.storeModelData() [70 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA15001SF.KKW01027SF02DBean` |
| Layer | Utility / Data Binding Bean (View-layer helper for model-to-screen data transfer) |
| Module | `KKA15001SF` (Package: `eo.web.webview.KKA15001SF`) |

## 1. Role

### KKW01027SF02DBean.storeModelData()

This method is the primary data-routing dispatcher for binding incoming screen data into the bean's internal model fields. It acts as a polymorphic setter: given a key (field identifier), a subkey (property within that field), and a value, it determines which internal property to update based on the key's semantic type. The method supports three distinct data categories: (1) the **Tateji (Add Character / 添加字)** field, which stores individual index properties (value, enabled state, display state); (2) the **Code List (コードリスト / cd_div_list)** field, which stores a list of code value beans and delegates storage to the appropriate child bean by parsed index; and (3) the **Code Name List (コード名リスト / cd_div_nm_list)** field, which similarly delegates to child code name beans by index. This implements the **delegation pattern** for nested collection fields and the **routing pattern** for flat fields, enabling a single entry point to handle heterogeneous data structures from the view layer without requiring callers to know the internal bean topology.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeModelData(key, subkey, in_value, isSetAsString)"])

    START --> CHECK_NULL["Check if key or subkey is null"]

    CHECK_NULL -->|Yes| EARLY_RETURN["Early return (no processing)"]
    CHECK_NULL -->|No| FIND_SEP["Find '/' separator in key
(separaterPoint = key.indexOf('/'))"]

    FIND_SEP --> BRANCH1["key equals 添加字"]
    BRANCH1 -->|Yes| SUBKEY_CHECK["Check subkey"]
    BRANCH1 -->|No| BRANCH2["key equals コードリスト"]
    BRANCH2 -->|Yes| CODE_LIST_PROCESS["Code List processing"]
    BRANCH2 -->|No| BRANCH3["key equals コード名リスト"]
    BRANCH3 -->|Yes| CODE_NAME_LIST_PROCESS["Code Name List processing"]
    BRANCH3 -->|No| END_NODE["End (no match, implicit return)"]

    SUBKEY_CHECK -->|value| SET_VALUE["setIndex_value(String)"]
    SUBKEY_CHECK -->|enable| SET_ENABLE["setIndex_enabled(Boolean)"]
    SUBKEY_CHECK -->|state| SET_STATE["setIndex_state(String)"]
    SUBKEY_CHECK -->|other| END_NODE

    CODE_LIST_PROCESS --> SUBSTRING_CODE["Extract index from key
key.substring(separaterPoint + 1)"]
    SUBSTRING_CODE --> PARSE_INDEX_1["Try Integer.valueOf(key)"]
    PARSE_INDEX_1 -->|Success| CHECK_INDEX_VALID_1["tmpIndex >= 0
&& tmpIndex < cd_div_list_list.size()"]
    PARSE_INDEX_1 -->|NumberFormatException| SKIP_CODE["Skip (tmpIndexInt is null)"]

    CODE_NAME_LIST_PROCESS --> SUBSTRING_CODE_NAME["Extract index from key
key.substring(separaterPoint + 1)"]
    SUBSTRING_CODE_NAME --> PARSE_INDEX_2["Try Integer.valueOf(key)"]
    PARSE_INDEX_2 -->|Success| CHECK_INDEX_VALID_2["tmpIndex >= 0
&& tmpIndex < cd_div_nm_list_list.size()"]
    PARSE_INDEX_2 -->|NumberFormatException| SKIP_CODE_NAME["Skip (tmpIndexInt is null)"]

    CHECK_INDEX_VALID_1 -->|Yes| RECURSE_CODE["Cast to X33VDataTypeStringBean
storeModelData(subkey, in_value)"]
    CHECK_INDEX_VALID_1 -->|No| SKIP_CODE
    RECURSE_CODE --> END_NODE

    CHECK_INDEX_VALID_2 -->|Yes| RECURSE_CODE_NAME["Cast to X33VDataTypeStringBean
storeModelData(subkey, in_value)"]
    CHECK_INDEX_VALID_2 -->|No| SKIP_CODE_NAME
    RECURSE_CODE_NAME --> END_NODE

    SKIP_CODE --> END_NODE
    SKIP_CODE_NAME --> END_NODE
    SET_VALUE --> END_NODE
    SET_ENABLE --> END_NODE
    SET_STATE --> END_NODE
    EARLY_RETURN --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field identifier that determines which data category to route to. Can be "添加字" (Tateji/Add Character — the main index field), "コードリスト" (Code List — maps to `cd_div_list` collection item ID), or "コード名リスト" (Code Name List — maps to `cd_div_nm_list` collection item ID). When a code list key is used, it follows the format `<listName>/<index>` (e.g., "cd_div_list/0") where the portion after "/" is a zero-based index. |
| 2 | `subkey` | `String` | The property selector within the key's data category. For the "添加字" (Tateji) key, valid subkeys are "value" (the string value), "enable" (the enabled/disabled boolean flag), and "state" (the display state string). For code list keys, the subkey is forwarded recursively to the child bean's `storeModelData`. Case-insensitive comparison is used for subkey matching. |
| 3 | `in_value` | `Object` | The data to be stored. The actual type depends on the subkey: `String` for "value" and "state" subkeys, `Boolean` for "enable" subkey. For code list keys, this value is forwarded to the child bean's `storeModelData` without transformation. |
| 4 | `isSetAsString` | `boolean` | When `true`, signals that a Long-type field's value property should receive a String-type value (for cases where the caller needs to preserve raw string representation). In this method, the flag is passed through to child beans when delegating code list operations. |

**Instance fields read:**
| Field | Type | Usage |
|-------|------|-------|
| `cd_div_list_list` | `ArrayList` | List of code value beans (`X33VDataTypeStringBean`) indexed by integer offset in the key. Used when key is "コードリスト" (Code List). |
| `cd_div_nm_list_list` | `ArrayList` | List of code name beans (`X33VDataTypeStringBean`) indexed by integer offset in the key. Used when key is "コード名リスト" (Code Name List). |

## 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` — invoked during key substring extraction for code list index parsing |
| - | `JKKAdEdit.substring` | JKKAdEdit | - | Calls `substring` in `JKKAdEdit` — string manipulation for index extraction |
| - | `JKKTelnoInfoAddMapperCC.substring` | JKKTelnoInfoAddMapperCC | - | Calls `substring` in `JKKTelnoInfoAddMapperCC` — invoked during key substring extraction |
| - | `JDKejbStringEdit.substring` | JDKejbStringEdit | - | Calls `substring` in `JDKejbStringEdit` — string manipulation utility during key processing |
| - | `KKW01027SF02DBean.setIndex_enabled` | KKW01027SF02DBean | - | Setter for the index_enabled boolean field — called when subkey is "enable" |
| - | `KKW01027SF02DBean.setIndex_state` | KKW01027SF02DBean | - | Setter for the index_state string field — called when subkey is "state" |
| - | `KKW01027SF02DBean.setIndex_value` | KKW01027SF02DBean | - | Setter for the index_value string field — called when subkey is "value" |
| - | `KKW01027SF02DBean.storeModelData` | KKW01027SF02DBean | - | Recursive delegation — called on child beans of code list and code name list collections |

This method performs **no direct database CRUD operations**. It is a pure in-memory data binding utility. All `substring` calls are utility-level string operations used to extract index values from the composite key format (e.g., splitting "cd_div_list/0" into list name and index).

## 5. Dependency Trace

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW01027SF02DBean.storeModelData()` | `KKW01027SF02DBean.storeModelData(key, subkey, in_value, isSetAsString)` | `storeModelData [U] (in-memory bean property)` |
| 2 | `KKW01027SF02DBean.storeModelData()` | `KKW01027SF02DBean.storeModelData(key, subkey, in_value, isSetAsString)` | `storeModelData [U] (in-memory bean property)` |

Terminal operations from this method: `storeModelData` (recursive delegation, 3 instances), `substring` (string index extraction, 4 instances), `setIndex_state`, `setIndex_enabled`, `setIndex_value` (property setters, 3 instances).

## 6. Per-Branch Detail Blocks

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

Guard clause: If either the field identifier or subkey is null, processing is aborted early. This prevents NPE when downstream processing attempts to use either parameter.

| # | Type | Code |
|---|------|------|
| 1 | SET | `return` // 項目名とサブキーがnullの場合、処理を中止 (key and subkey are null → stop processing) |

**Block 2** — [SET] `int separaterPoint = key.indexOf("/")` (L267)

Locates the position of the "/" separator within the key string. This is needed later when processing code list keys that follow the format `<listName>/<index>`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` // 区切り位置を特定 (identify separator position) |

**Block 3** — [IF/ELSE-IF/ELSE-IF] `(key.equals("添加字"))` (L270)

The "添加字" (Tateji / Add Character) key is the primary index field (item ID: `index`). Its subkey determines which property of the index to update: the string value, the enabled flag, or the display state. This is a flat field setter with no nested structure.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("添加字"))` // データタイプがStringの項目"添加字"(項目ID:index) (Data type is String field "Tateji/Add Character" (item ID: index)) |

**Block 3.1** — [ELSE-IF] `(subkey.equalsIgnoreCase("value"))` (L271)

Sets the string value property of the index. The `in_value` is cast to `String` before assignment.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setIndex_value((String)in_value)` // index_valueに値を設定 (set value to index_value) |

**Block 3.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("enable"))` (L276)

Sets the enabled/disabled flag of the index. The `in_value` is cast to `Boolean`. The `isSetAsString` parameter is not forwarded here because the index_enabled field is a native Boolean.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setIndex_enabled((Boolean)in_value)` // subkeyが"enable"の場合、index_enabled setterを実行 (if subkey is "enable", execute index_enabled setter) |

**Block 3.3** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L280)

Sets the display state string of the index. The `in_value` is cast to `String`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setIndex_state((String)in_value)` // subkeyが"state"の場合、ステータスを返す (if subkey is "state", set the status) |

**Block 4** — [ELSE-IF] `(key.equals("コードリスト"))` (L283)

The "コードリスト" (Code List / cd_div_list) key represents a collection of code value beans. The method extracts the zero-based index from the key (e.g., "cd_div_list/0" → index `0`), validates it against the list size, and delegates storage to the child bean at that index. This implements recursive data binding for nested collections.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key = key.substring(separaterPoint + 1)` // ("cd_div_list/0"から最初の"/"より後を取得) (extract portion after first "/" from "cd_div_list/0") |

**Block 4.1** — [TRY-CATCH] `(Integer.valueOf(key))` (L288-L295)

Attempts to parse the extracted key portion as an integer. If the key portion is not a valid number (e.g., "cd_div_list/abc"), a `NumberFormatException` is caught and `tmpIndexInt` remains null, causing the block to be skipped.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null` // インデックス値初期化 (initialize index value) |
| 2 | EXEC | `tmpIndexInt = Integer.valueOf(key)` // インデックス値を数値としてパース (parse index value as number) |
| 3 | CATCH | `catch(NumberFormatException e) { tmpIndexInt = null; }` // インデックス値が数値文字列でない場合はnullを返す (return null if index value is not a numeric string) |

**Block 4.2** — [IF] `(tmpIndexInt != null)` (L296)

Only proceeds when the index was successfully parsed as an integer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int tmpIndex = tmpIndexInt.intValue()` // インデックス値をintに変換 (convert index value to int) |

**Block 4.2.1** — [IF] `(tmpIndex >= 0 && tmpIndex < cd_div_list_list.size())` (L298)

Bounds-checks the parsed index against the actual list size. This prevents `IndexOutOfBoundsException` when the key references an index beyond the list's current contents.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X33VDataTypeStringBean child = (X33VDataTypeStringBean)cd_div_list_list.get(tmpIndex)` // キャスト: 項目定義型に応じたX33VDataTypeStringBean (cast to X33VDataTypeStringBean per item definition type) |
| 2 | CALL | `child.storeModelData(subkey, in_value)` // 再帰的に子Beanにデータを格納 (recursively store data in child Bean) |

> Note: The comment states that the cast portion may be X33VDataTypeStringBean, X33VDataTypeLongBean, or X33VDataTypeBooleanBean depending on the item definition type. In this method, the cast is hardcoded to `X33VDataTypeStringBean`. For `X33VDataTypeLongBean`, the subkey, input value, and `isSetAsString` flag would be passed as parameters.

**Block 5** — [ELSE-IF] `(key.equals("コード名リスト"))` (L308)

The "コード名リスト" (Code Name List / cd_div_nm_list) key mirrors the Code List processing flow but operates on the code name beans list (`cd_div_nm_list_list`). Same index extraction, validation, and recursive delegation pattern.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key = key.substring(separaterPoint + 1)` // ("cd_div_nm_list/0"から最初の"/"より後を取得) (extract portion after first "/" from "cd_div_nm_list/0") |

**Block 5.1** — [TRY-CATCH] `(Integer.valueOf(key))` (L313-L320)

Identical to Block 4.1: parses the extracted key portion as an integer with null on failure.

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null` // インデックス値初期化 (initialize index value) |
| 2 | EXEC | `tmpIndexInt = Integer.valueOf(key)` // インデックス値を数値としてパース (parse index value as number) |
| 3 | CATCH | `catch(NumberFormatException e) { tmpIndexInt = null; }` // インデックス値が数値文字列でない場合はnullを返す (return null if index value is not a numeric string) |

**Block 5.2** — [IF] `(tmpIndexInt != null)` (L321)

Only proceeds when the index was successfully parsed as an integer.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int tmpIndex = tmpIndexInt.intValue()` // インデックス値をintに変換 (convert index value to int) |

**Block 5.2.1** — [IF] `(tmpIndex >= 0 && tmpIndex < cd_div_nm_list_list.size())` (L323)

Bounds-checks the parsed index against the `cd_div_nm_list_list` size and delegates storage to the child code name bean.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `X33VDataTypeStringBean child = (X33VDataTypeStringBean)cd_div_nm_list_list.get(tmpIndex)` // キャスト: 項目定義型に応じたX33VDataTypeStringBean (cast to X33VDataTypeStringBean per item definition type) |
| 2 | CALL | `child.storeModelData(subkey, in_value)` // 再帰的に子Beanにデータを格納 (recursively store data in child Bean) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `添加字` (Tateji) | Field | Add Character — the main index/serial number field. Stores the primary identifier value, its enabled/disabled state, and display state. Item ID: `index`. |
| `コードリスト` (Code List) | Field | Code List — a collection of code value beans. Each entry represents a selectable code option (e.g., dropdown options). Internal item ID: `cd_div_list`. |
| `コード名リスト` (Code Name List) | Field | Code Name List — a collection of code name/display name beans corresponding to the code list entries. Each entry stores the human-readable label for a code option. Internal item ID: `cd_div_nm_list`. |
| `index_value` | Field | The string value stored in the main index/serial number field. |
| `index_enabled` | Field | Boolean flag indicating whether the index field is enabled for editing in the UI. |
| `index_state` | Field | The display state string of the index field (e.g., normal, hidden, read-only). |
| `X33VDataTypeStringBean` | Class | A data-type bean representing a string-valued form field in the view layer. Used as the element type for both `cd_div_list_list` and `cd_div_nm_list_list` collections. |
| `X33VDataTypeLongBean` | Class | A data-type bean representing a long-valued form field. Referenced in comments as an alternative child type for code list items. |
| `X33VDataTypeBooleanBean` | Class | A data-type bean representing a boolean-valued form field. Referenced in comments as an alternative child type for code list items. |
| `storeModelData` | Method | Data binding dispatcher — routes incoming screen data into the bean's model properties based on key/subkey classification. Used by the view layer to push user-entered data into the bean. |
| `isSetAsString` | Parameter | Flag indicating whether a Long-type field should receive a String value (preserving raw representation instead of type-converting). |
| `cd_div_list_list` | Field | Java `ArrayList` holding `X33VDataTypeStringBean` objects for code values. |
| `cd_div_nm_list_list` | Field | Java `ArrayList` holding `X33VDataTypeStringBean` objects for code name/display labels. |
