# Business Logic — KKW00127SF01DBean.storeModelData() [67 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00127SF.KKW00127SF01DBean` |
| Layer | Web / UI Bean (Controller Layer — View data binding helper) |
| Module | `KKW00127SF` (Package: `eo.web.webview.KKW00127SF`) |

## 1. Role

### KKW00127SF01DBean.storeModelData()

This method is a **unified data-binding router** for the subscription information update screen (申込み情報更新画面). Its business purpose is to populate the view-layer model with user input data arriving from the presentation tier — specifically, from form fields that carry a **key label** (項目名) and an optional **sub-key** (サブキー) to disambiguate within multi-valued items. It implements a **routing/dispatch pattern**: based on the `key` argument, it either sets scalar fields on this bean (the "添え字 / subscript" case for index value and index state), or **delegates recursively** into child data-type beans held in two list collections — the code list (コードリスト) and the code name list (コード名リスト). In the larger system, this method serves as the central **back-propagation hook** that bridges form submissions to the bean's internal data model, enabling the screen to accumulate and structure user-entered order data before it is validated and committed by downstream service components. The `isSetAsString` flag provides a secondary hint for how certain types (e.g., Long-type value properties) should interpret incoming strings, though the `storeModelData(String, Object, boolean)` overload handles that directly.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["storeModelData key, subkey, in_value, isSetAsString"])
    CHECK_NULL{key is null or<br/>subkey is null}
    EARLY_EXIT(["Return early"])
    FIND_SLASH["separaterPoint = key.indexOf('/')"]
    CHECK_INDEX_KEY{key equals 添え字}
    CHECK_SUB_VALUE{subkey equals value}
    CHECK_SUB_STATE{subkey equals state}
    SET_VALUE["setIndex_value(in_value)"]
    SET_STATE["setIndex_state(in_value)"]
    CHECK_CODE_LIST{key equals コードリスト}
    EXTRACT_CODE["key = key.substring(separaterPoint + 1)"]
    PARSE_INDEX["tmpIndexInt = Integer.valueOf(key)"]
    PARSE_ERROR["catch NumberFormatException<br/>tmpIndexInt = null"]
    INDEX_NOT_NULL{tmpIndexInt != null}
    INDEX_IN_BOUNDS{tmpIndex >= 0 and<br/>tmpIndex < cd_div_list_list.size}
    DELEGATE_CODE["cd_div_list_list.get(tmpIndex).storeModelData(subkey, in_value)"]
    CHECK_CODE_NAME{key equals コード名リスト}
    EXTRACT_NAME["key = key.substring(separaterPoint + 1)"]
    PARSE_NAME_INDEX["tmpIndexInt = Integer.valueOf(key)"]
    PARSE_NAME_ERROR["catch NumberFormatException<br/>tmpIndexInt = null"]
    NAME_INDEX_NOT_NULL{tmpIndexInt != null}
    NAME_INDEX_IN_BOUNDS{tmpIndex >= 0 and<br/>tmpIndex < cd_div_nm_list_list.size}
    DELEGATE_NAME["cd_div_nm_list_list.get(tmpIndex).storeModelData(subkey, in_value)"]
    END(["Return / Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| EARLY_EXIT
    EARLY_EXIT --> END
    CHECK_NULL -->|No| FIND_SLASH
    FIND_SLASH --> CHECK_INDEX_KEY
    CHECK_INDEX_KEY -->|Yes| CHECK_SUB_VALUE
    CHECK_SUB_VALUE -->|Yes| SET_VALUE
    CHECK_SUB_VALUE -->|No| CHECK_SUB_STATE
    CHECK_SUB_STATE -->|Yes| SET_STATE
    CHECK_SUB_STATE -->|No| CHECK_CODE_LIST
    SET_VALUE --> END
    SET_STATE --> END
    CHECK_INDEX_KEY -->|No| CHECK_CODE_LIST
    CHECK_CODE_LIST -->|Yes| EXTRACT_CODE
    CHECK_CODE_LIST -->|No| CHECK_CODE_NAME
    EXTRACT_CODE --> PARSE_INDEX
    PARSE_INDEX --> PARSE_ERROR
    PARSE_ERROR --> INDEX_NOT_NULL
    INDEX_NOT_NULL -->|Yes| INDEX_IN_BOUNDS
    INDEX_NOT_NULL -->|No| END
    INDEX_IN_BOUNDS -->|Yes| DELEGATE_CODE
    INDEX_IN_BOUNDS -->|No| END
    DELEGATE_CODE --> END
    CHECK_CODE_NAME -->|Yes| EXTRACT_NAME
    CHECK_CODE_NAME -->|No| END
    EXTRACT_NAME --> PARSE_NAME_INDEX
    PARSE_NAME_INDEX --> PARSE_NAME_ERROR
    PARSE_NAME_ERROR --> NAME_INDEX_NOT_NULL
    NAME_INDEX_NOT_NULL -->|Yes| NAME_INDEX_IN_BOUNDS
    NAME_INDEX_NOT_NULL -->|No| END
    NAME_INDEX_IN_BOUNDS -->|Yes| DELEGATE_NAME
    NAME_INDEX_IN_BOUNDS -->|No| END
    DELEGATE_NAME --> END
```

**Block summary:**

| Step | Node Type | Business Description |
|------|-----------|---------------------|
| 1 | Diamond (condition) | Null guard: exits early if `key` or `subkey` is null. Japanese comment: 「key,subkeyがnullの場合、処理を中止」 — "If key/subkey is null, stop processing." |
| 2 | Rectangle | Locate separator position in the key string (`indexOf("/")`). Used to split compound keys like `cd_div_list/0`. |
| 3 | Diamond | Dispatch on `key` equals `"添え字"` (subscript/index — used for the index value and index state fields). |
| 4 | Diamond (nested) | Check subkey equals `"value"` (case-insensitive). Sets `index_value` field. |
| 5 | Diamond (nested else) | Check subkey equals `"state"` (case-insensitive). Sets `index_state` field. Japanese comment: 「subkeyが"state"の場合、ステータスを返す」 — "If subkey is 'state', set the status." |
| 6 | Diamond | Dispatch on `key` equals `"コードリスト"` (code list — item ID: `cd_div_list`). |
| 7 | Rectangle (nested) | Extract the element after the first `/` from key: `key = key.substring(separaterPoint + 1)`. Transforms key like `cd_div_list/0` into the raw index string `"0"`. |
| 8 | Try block | Attempt to parse the extracted key as an integer index. Japanese comment: 「インデックス値が数値文字列でない場合は、ここでnullを返す」 — "If the index value is not a numeric string, return null here." |
| 9 | Diamond (nested) | If parse succeeded (`tmpIndexInt != null`), proceed to bounds check. |
| 10 | Diamond (nested) | Bounds check: ensure the parsed index is within `cd_div_list_list` size. |
| 11 | Rectangle (nested) | Cast the list element at `tmpIndex` to `X33VDataTypeStringBean` and call its `storeModelData(subkey, in_value)`. |
| 12 | Diamond | Dispatch on `key` equals `"コード名リスト"` (code name list — item ID: `cd_div_nm_list`). |
| 13–20 | Nested of 6–11 | Mirror of blocks 6–11 but for the `cd_div_nm_list_list` collection. |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name** (項目名) that identifies which field or data structure should receive the value. Determines the processing branch: `"添え字"` (subscript/index — controls the index_value and index_state scalar fields), `"コードリスト"` (code list, mapped to `cd_div_list` — a list of code definitions), or `"コード名リスト"` (code name list, mapped to `cd_div_nm_list` — a list of code name definitions). For list keys, the value is a compound string like `"cd_div_list/0"` where the part after `/` is the list index. |
| 2 | `subkey` | `String` | The **sub-key** (サブキー) that further disambiguates which property within the identified item to populate. For the "添え字" branch, it distinguishes `"value"` (the actual data value) from `"state"` (the item's status/state). For list-item delegation, it is passed through to the child bean's `storeModelData`. |
| 3 | `in_value` | `Object` | The **data** (データ) to be stored. Type depends on the target field: typically `String` for the index value/state fields and for code list items. The data originates from form submission values submitted by the user on the subscription update screen. |
| 4 | `isSetAsString` | `boolean` | When `true`, indicates that a String-type value should be set into a Long-type item's value property. Note: this parameter is accepted but not actively used in this method overload — it is forwarded to child beans via the `(String, boolean)` overload of `storeModelData` in the list-item delegation path. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `cd_div_list_list` | `ArrayList` | The list of code list beans (`X33VDataTypeStringBean`), representing the structured list of code definitions for the subscription item. |
| `cd_div_nm_list_list` | `ArrayList` | The list of code name list beans (`X33VDataTypeStringBean`), representing the structured list of code name definitions for the subscription item. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKAdEditCC.substring` | JKKAdEditCC | - | Calls `substring` utility for extracting substring from key (via `String.substring`) |
| - | `JKKAdEdit.substring` | JKKAdEdit | - | Calls `substring` utility for extracting substring from key |
| - | `JKKTelnoInfoAddMapperCC.substring` | JKKTelnoInfoAddMapperCC | - | Calls `substring` utility for extracting substring from key |
| - | `JDKejbStringEdit.substring` | JDKejbStringEdit | - | Calls `substring` utility for extracting substring from key |
| - | `KKW00127SF01DBean.setIndex_state` | KKW00127SF01DBean | - | Sets the `index_state` (index status) field on this bean — stores the state string of the subscript item |
| - | `KKW00127SF01DBean.setIndex_value` | KKW00127SF01DBean | - | Sets the `index_value` (index value) field on this bean — stores the data value of the subscript item |
| - | `X33VDataTypeStringBean.storeModelData` | X33VDataTypeStringBean | - | Delegates to a child list-item bean to store subkey/value into the child bean's model |
| - | `KKW00127SF01DBean.storeModelData` | KKW00127SF01DBean | - | Recursive self-call (overloaded with `(String, Object, boolean)`) to pass data into child beans |

This method performs **no direct database operations** (no C/R/U/D on entity tables). It is a pure **data-binding utility** that populates in-memory bean properties from presentation-layer inputs.

## 5. Dependency Trace

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` [-], `setIndex_state` [-], `setIndex_value` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Class: `KKW00127SF01DBean` | `KKW00127SF01DBean.storeModelData(String, String, Object, boolean)` | `setIndex_value [-]`, `setIndex_state [-]`, `cd_div_list_list.get(...).storeModelData [-]` |
| 2 | Class: `KKW00127SF01DBean` | `KKW00127SF01DBean.storeModelData(String, String, Object, boolean)` | `setIndex_value [-]`, `setIndex_state [-]`, `cd_div_nm_list_list.get(...).storeModelData [-]` |

This method is called internally by other code within `KKW00127SF01DBean` itself (self-referencing within the same bean class, likely from screen data initialization or back-propagation methods). It is not a screen entry point and has no direct screen/batch caller chain visible within 8 hops.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null || subkey == null)` Early-return guard (L258)

> Prevents null-pointer exceptions by exiting immediately if either key or subkey is null.
> Japanese comment: 「key,subkeyがnullの場合、処理を中止」 — "If key or subkey is null, abort processing."

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // Early exit when key or subkey is null [-> guard clause] |

---

**Block 2** — [SET] Locate separator position (L260)

> Finds the position of the "/" character in the key string. This is used later to split compound keys like `"cd_div_list/0"` into the list type prefix and the numeric index suffix.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Position of first '/' in key |

---

**Block 3** — [IF-ELSE-IF] Dispatch on `key` — "添え字" (subscript/index) branch (L263)

> The first processing branch: when `key` equals `"添え字"` (subscript/index), the method stores the incoming data into this bean's `index_value` and `index_state` scalar fields. The Japanese comment: 「項目ごとに処理を入れる。」 — "Insert processing for each item."
> Japanese comment on value branch: 「データタイプがStringの項目"添え字"(項目ID:index)」 — "Item with String data type 'subscript' (item ID: index)."

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key.equals("添え字")` // Equals "添え字" (subscript/index) |

**Block 3.1** — [IF-ELSE-IF] Nested dispatch on `subkey` within "添え字" branch (L264)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("value")` // Case-insensitive check for "value" |

**Block 3.1.1** — [SET] Set index_value (L265)

| # | Type | Code |
|---|------|------|
| 1 | SET | `setIndex_value((String)in_value);` // Cast in_value to String and set into index_value field |

**Block 3.1.2** — [ELSE-IF] Set index_state (L267)

> Japanese comment: 「subkeyが"state"の場合、ステータスを返す。」 — "If subkey is 'state', set the status."

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `subkey.equalsIgnoreCase("state")` // Case-insensitive check for "state" |

**Block 3.1.2.1** — [SET] Set index_state (L268)

| # | Type | Code |
|---|------|------|
| 1 | SET | `setIndex_state((String)in_value);` // Cast in_value to String and set into index_state field |

---

**Block 4** — [ELSE-IF] Dispatch on `key` — "コードリスト" (code list) branch (L272)

> The second processing branch: when `key` equals `"コードリスト"` (code list), this branch handles storing data into the `cd_div_list_list` collection. Each element of this list is an `X33VDataTypeStringBean`. The key format is `"cd_div_list/N"` where N is a zero-based index.
> Japanese comment: 「配列項目 "コードリスト"(String型。項目ID:cd_div_list)」 — "Array item 'code list' (String type, item ID: cd_div_list)."

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key.equals("コードリスト")` // Equals "コードリスト" (code list) |

**Block 4.1** — [SET] Extract index from key (L274)

> Extracts the portion of the key after the first "/". Transforms `"cd_div_list/0"` to `"0"`.
> Japanese comment: 「keyの次の要素を取得」 — "Get the next element of key."

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract substring after '/', e.g. "cd_div_list/0" -> "0" |

**Block 4.2** — [SET] Initialize index variable (L276)

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null;` // Initialize to null; will hold parsed index or remain null |

**Block 4.3** — [TRY-CATCH] Parse index string to integer (L277)

> Attempts to parse the extracted key string as an integer.
> Japanese comment: 「インデックス値が数値文字列でない場合は、ここでnullを返す。」 — "If the index value is not a numeric string, return null here."

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key);` // Try to parse key as integer |
| 2 | CATCH | `catch(NumberFormatException e)` |

**Block 4.3.1** — [SET] Catch: set null on parse failure (L281)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = null;` // Parse failed; reset to null |

**Block 4.4** — [IF] Index value is non-null (L283)

> Proceeds only if the extracted key was successfully parsed as an integer.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `tmpIndexInt != null` // Index value is a numeric string |

**Block 4.4.1** — [SET] Unbox Integer to int (L284)

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

**Block 4.4.2** — [IF] Index is within list bounds (L285)

> Japanese comment: 「インデックス値がリスト個数-1以下の場合」 — "If index value is less than or equal to list size minus one."

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `tmpIndex >= 0 && tmpIndex < cd_div_list_list.size()` |

**Block 4.4.2.1** — [EXEC] Delegate to child bean (L286)

> Casts the list element at `tmpIndex` to `X33VDataTypeStringBean` and delegates data storage into it.
> Japanese comment: 「キャスト部分は、項目定義型に従ってX33VDataTypeStringBean, X33VDataTypeLongBean, X33VDataTypeBooleanBeanのうち1つを指定。」 — "The cast portion specifies one of X33VDataTypeStringBean, X33VDataTypeLongBean, X33VDataTypeBooleanBean according to the item definition type."

| # | Type | Code |
|---|------|------|
| 1 | CALL | `((X33VDataTypeStringBean)cd_div_list_list.get(tmpIndex)).storeModelData(subkey, in_value);` // Delegate to child list-item bean |

---

**Block 5** — [ELSE-IF] Dispatch on `key` — "コード名リスト" (code name list) branch (L293)

> The third processing branch: mirrors Block 4 but operates on the `cd_div_nm_list_list` collection for code name list items. Each element is also an `X33VDataTypeStringBean`. The key format is `"cd_div_nm_list/N"` where N is a zero-based index.
> Japanese comment: 「配列項目 "コード名リスト"(String型。項目ID:cd_div_nm_list)」 — "Array item 'code name list' (String type, item ID: cd_div_nm_list)."

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `key.equals("コード名リスト")` // Equals "コード名リスト" (code name list) |

**Block 5.1** — [SET] Extract index from key (L295)

> Same logic as Block 4.1 but for code name list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // Extract substring after '/' from key |

**Block 5.2** — [SET] Initialize index variable (L297)

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null;` // Initialize to null |

**Block 5.3** — [TRY-CATCH] Parse index string to integer (L298)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = Integer.valueOf(key);` // Try to parse key as integer |
| 2 | CATCH | `catch(NumberFormatException e)` |

**Block 5.3.1** — [SET] Catch: set null on parse failure (L302)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = null;` // Parse failed; reset to null |

**Block 5.4** — [IF] Index value is non-null (L304)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `tmpIndexInt != null` // Index value is a numeric string |

**Block 5.4.1** — [SET] Unbox Integer to int (L305)

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

**Block 5.4.2** — [IF] Index is within list bounds (L306)

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `tmpIndex >= 0 && tmpIndex < cd_div_nm_list_list.size()` |

**Block 5.4.2.1** — [EXEC] Delegate to child bean (L307)

> Same pattern as Block 4.4.2.1 but for the code name list collection.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `((X33VDataTypeStringBean)cd_div_nm_list_list.get(tmpIndex)).storeModelData(subkey, in_value);` // Delegate to child list-item bean |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `添え字` | Japanese key | Subscript / Index — a scalar field label used to store the index value (the actual data) and index state (the status) on this bean. Represents a single-value input item on the subscription update screen. |
| `コードリスト` | Japanese key | Code List — a list-type item whose internal ID is `cd_div_list`. Each element holds a code definition (e.g., service type codes). The data type for each element is `X33VDataTypeStringBean`. |
| `コード名リスト` | Japanese key | Code Name List — a list-type item whose internal ID is `cd_div_nm_list`. Each element holds a code name (the human-readable label for a code). The data type for each element is `X33VDataTypeStringBean`. |
| `index_value` | Field | The data value stored for the subscript (添え字) item — carries the actual user-entered value for a single-line item. |
| `index_state` | Field | The status field stored for the subscript (添え字) item — carries the state/status metadata for the item (e.g., whether it has been modified). |
| `cd_div_list` | Item ID | The item identifier for the code list (コードリスト) — stores structured code definitions for the subscription data. |
| `cd_div_nm_list` | Item ID | The item identifier for the code name list (コード名リスト) — stores the human-readable code name labels corresponding to code list entries. |
| `X33VDataTypeStringBean` | Class | A view-layer data-type bean that wraps a single String value with metadata (value, state, type). Used as the element type for list-based items. |
| `storeModelData` | Method (child) | The delegated data-binding method on child beans — accepts a subkey and value to populate the child bean's own model. Overloaded to support `(String, Object, boolean)` for type-aware string-to-Long conversion. |
| `isSetAsString` | Parameter flag | When true, instructs child beans that an incoming String should be set into a Long-type property. Used for fields where the database type is Long but the UI sends a String. |
| `KKW00127SF` | Module | Subscription information update module (申込み情報更新) — the business module handling subscription data changes in the customer contract system. |
| 申込み情報更新画面 | Japanese screen | Subscription Information Update Screen — the web screen where users modify existing subscription/order data. |
