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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW07101SF.FUW07101SF02DBean` |
| Layer | View / Data Access Bean (Web Client, X33 Framework) |
| Module | `FUW07101SF` (Package: `eo.web.webview.FUW07101SF`) |

## 1. Role

### FUW07101SF02DBean.loadModelData()

This method serves as the central **property accessor and data dispatcher** for the `FUW07101SF02DBean` data bean, implementing the `X33VDataTypeBeanInterface` contract within the Fujitsu X33 Web Client framework. The X33 framework is a JavaServer Faces (JSF) component toolkit used by K-Opticom for building telecom service order screens. In business terms, this method enables screen components to dynamically retrieve field values and list metadata by key name — a core mechanism for data binding between UI controls and the backing bean.

The method implements a **routing/dispatch pattern**: it inspects the `key` parameter to determine which logical property group the caller is querying, then delegates to either simple scalar getters (`getSelect_cd_value`, `getSelect_cd_state`) or list-aware accessors that index into structured `nm_list_list` (subscriber line name list) or `val_list_list` (subscriber line value list) collections. This allows dynamic forms to request individual items, metadata (list sizes), and nested properties without hardcoding property access paths.

Its **role in the larger system** is foundational: it is the single entry point for the X33 data-binding layer to fetch all field values rendered by the screen. Called methods are typically invoked by the X33 framework during JSF view rendering and form submission, making this method a bridge between user-facing subscription (申込) data structures and the presentation tier. When a key does not match any registered property, it safely returns `null`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key subkey"])
    NULL_CHECK["key or subkey is null"]
    RETURN_NULL1(["Return null"])
    FIND_SLASH["Find slash position in key"]
    CHECK_SELECT_CD["key equals 申込台数リスト選択値"]
    CHECK_VALUE["subkey equals value"]
    GET_VALUE["getSelect_cd_value"]
    RETURN_VALUE["Return select_cd_value"]
    CHECK_STATE["subkey equals state"]
    GET_STATE["getSelect_cd_state"]
    RETURN_STATE["Return select_cd_state"]
    CHECK_NM_LIST["key equals 申込台数名リスト"]
    SUBSTR_NM["Extract subkey from key"]
    CHECK_STAR1["subkey equals star"]
    RETURN_NM_SIZE["Return nm_list_list size"]
    PARSE_INDEX1["Parse index from key"]
    CATCH_INDEX1["NumberFormatException"]
    RETURN_NULL2(["Return null"])
    CHECK_BOUND1["Index in range"]
    DELEGATE_NM["Delegated loadModelData on nm_list"]
    RETURN_NM["Return delegated result"]
    CHECK_VAL_LIST["key equals 申込台数値リスト"]
    SUBSTR_VAL["Extract subkey from key"]
    CHECK_STAR2["subkey equals star"]
    RETURN_VAL_SIZE["Return val_list_list size"]
    PARSE_INDEX2["Parse index from key"]
    CATCH_INDEX2["NumberFormatException"]
    CHECK_BOUND2["Index in range"]
    DELEGATE_VAL["Delegated loadModelData on val_list"]
    RETURN_VAL["Return delegated result"]
    RETURN_NULL3(["Return null"])

    START --> NULL_CHECK
    NULL_CHECK --> Y1["true"]
    Y1 --> RETURN_NULL1
    NULL_CHECK --> N1["false"]
    N1 --> FIND_SLASH
    FIND_SLASH --> CHECK_SELECT_CD
    CHECK_SELECT_CD --> Y2["true"]
    Y2 --> CHECK_VALUE
    CHECK_VALUE --> Y3["true"]
    Y3 --> GET_VALUE
    GET_VALUE --> RETURN_VALUE
    CHECK_VALUE --> N2["false"]
    N2 --> CHECK_STATE
    CHECK_STATE --> Y4["true"]
    Y4 --> GET_STATE
    GET_STATE --> RETURN_STATE
    CHECK_STATE --> N3["false"]
    N3 --> NM_FALSE
    CHECK_SELECT_CD --> N4["false"]
    N4 --> NM_FALSE
    NM_FALSE --> CHECK_NM_LIST
    CHECK_NM_LIST --> Y5["true"]
    Y5 --> SUBSTR_NM
    SUBSTR_NM --> CHECK_STAR1
    CHECK_STAR1 --> Y6["true"]
    Y6 --> RETURN_NM_SIZE
    CHECK_STAR1 --> N5["false"]
    N5 --> PARSE_INDEX1
    PARSE_INDEX1 --> CATCH_INDEX1
    CATCH_INDEX1 --> RETURN_NULL2
    PARSE_INDEX1 --> CHECK_BOUND1
    CHECK_BOUND1 --> N6["false"]
    N6 --> RETURN_NULL2
    CHECK_BOUND1 --> Y7["true"]
    Y7 --> DELEGATE_NM
    DELEGATE_NM --> RETURN_NM
    CHECK_NM_LIST --> N7["false"]
    N7 --> CHECK_VAL_LIST
    CHECK_VAL_LIST --> Y8["true"]
    Y8 --> SUBSTR_VAL
    SUBSTR_VAL --> CHECK_STAR2
    CHECK_STAR2 --> Y9["true"]
    Y9 --> RETURN_VAL_SIZE
    CHECK_STAR2 --> N8["false"]
    N8 --> PARSE_INDEX2
    PARSE_INDEX2 --> CATCH_INDEX2
    CATCH_INDEX2 --> RETURN_NULL2
    PARSE_INDEX2 --> CHECK_BOUND2
    CHECK_BOUND2 --> N9["false"]
    N9 --> RETURN_NULL2
    CHECK_BOUND2 --> Y10["true"]
    Y10 --> DELEGATE_VAL
    DELEGATE_VAL --> RETURN_VAL
    CHECK_VAL_LIST --> N10["false"]
    N10 --> RETURN_NULL3
```

**Processing summary:**
1. **Null guard:** If either `key` or `subkey` is `null`, return `null` immediately (lines 150–153).
2. **Slash detection:** Find the position of `/` in `key` for later substring extraction (line 155).
3. **Dispatch on key:** The method branches on three distinct property keys:
   - **`"申込台数リスト選択値"` (Subscription Line Count List Selection Value):** If `subkey` is `"value"`, return the selected value. If `"state"`, return the selection state.
   - **`"申込台数名リスト"` (Subscription Line Name List):** Extract the subkey portion after `/`. If `"*"`, return the list size. Otherwise, parse an integer index, validate bounds, then delegate to the indexed item's `loadModelData(subkey)`.
   - **`"申込台数値リスト"` (Subscription Line Value List):** Same logic as the name list, operating on `val_list_list` instead.
4. **Fallback:** If no branch matches, return `null`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The property name used to identify which data field or list the caller is requesting. It can take three forms: (a) `"申込台数リスト選択値"` — the subscription line count list selection value property (with subkey `value` or `state`), (b) `"申込台数名リスト"` — the subscription line name list (the subkey can be `"*"` for size, a numeric string for an index, or a property name for nested access), or (c) `"申込台数値リスト"` — the subscription line value list (same subkey semantics as name list). In list modes, the key is parsed by extracting the element after the `/` separator. |
| 2 | `subkey` | `String` | A secondary key that refines the lookup within the property group identified by `key`. For the selection value property, it specifies `value` or `state`. For list properties, it specifies `"*"` (list size), a numeric index, or a property name for delegated access on a list item. |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `nm_list_list` | `X33VDataTypeList` | Subscription line name list — the ordered list of subscriber line identifiers rendered on screen |
| `val_list_list` | `X33VDataTypeList` | Subscription line value list — the ordered list of subscriber line values corresponding to names |
| `select_cd_value` | `String` | The currently selected subscription line count value |
| `select_cd_state` | `String` | The selection state of the subscription line count (e.g., validated/unvalidated) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `FUW07101SF02DBean.getSelect_cd_value` | FUW07101SF02DBean | - | Returns the selected subscription line count value field (`select_cd_value`) |
| R | `FUW07101SF02DBean.getSelect_cd_state` | FUW07101SF02DBean | - | Returns the selection state field (`select_cd_state`) |
| R | `X33VDataTypeStringBean.loadModelData` | X33V DataType Bean | - | Delegates nested data loading on individual list items (nm_list_list or val_list_list entries) |
| R | `X33VDataTypeList.size` | X33V DataType List | - | Returns the size of the subscription line name or value list |

**CRUD classification rationale:**
- All operations in this method are **Read (R)** — the method performs no mutations. It retrieves scalar fields, list sizes, and delegates property lookups on list items.
- There are no database, SC (Service Component), or CBS (Common Business Service) calls. This bean is a pure view-layer data accessor within the X33 JSF framework.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Self-reference | `FUW07101SF02DBean.loadModelData` -> `FUW07101SF02DBean.loadModelData` | `getSelect_cd_value [R] select_cd_value`, `getSelect_cd_state [R] select_cd_state`, `X33VDataTypeStringBean.loadModelData [R] list item fields`, `X33VDataTypeList.size [R] list size` |

**Notes:**
- The pre-extracted caller graph indicates this method is primarily called by itself (self-referencing) through the X33 framework's data-binding mechanism.
- The `FUW07101SF02DBean` implements `X33VDataTypeBeanInterface`, which requires `loadModelData` as the standard method for framework-driven property access. The X33 framework (not in this codebase) invokes this method during JSF rendering cycles.
- List items (delegated to `X33VDataTypeStringBean.loadModelData`) follow the same pattern recursively — each list element is itself a data-access bean that handles its own nested property lookups.

## 6. Per-Branch Detail Blocks

### Block 1 — IF `(key == null || subkey == null)` (L150)

> Null guard: if either parameter is null, return null immediately. The comment reads: 項目名とサブキーがnullの場合、nullを返す (Return null if item name or subkey is null).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // 項目名とサブキーがnullの場合、nullを返す (Return null if item name or subkey is null) |

### Block 2 — SET `(slash position detection)` (L155)

> Calculate the slash position in `key` for subsequent substring extraction on list-type keys.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` |

### Block 3 — IF/ELSE-IF chain `(key dispatch)` (L158–L216)

> The comment reads: 項目ごとに処理を入れる。(Insert processing per item.) This is a multi-branch dispatch on the `key` parameter, handling three property types.

---

**Block 3.1** — IF `(key.equals("申込台数リスト選択値"))` (L160)

> The comment reads: データタイプがStringの項目"申込台数リスト選択値"(項目ID:select_cd) (Data type is String item "Subscription Line Count List Selection Value" (item ID: select_cd)). This block handles scalar accessor requests for the selection value property.

**Block 3.1.1** — IF `(subkey.equalsIgnoreCase("value"))` (L161)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getSelect_cd_value();` // Returns the selected subscription line count value |

**Block 3.1.2** — ELSE-IF `(subkey.equalsIgnoreCase("state"))` (L163)

> The comment reads: subkeyが"state"の場合、ステータスを返す。(If subkey is "state", return the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `return getSelect_cd_state();` // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status) |

---

**Block 3.2** — ELSE-IF `(key.equals("申込台数名リスト"))` (L168)

> The comment reads: 配列項目 "申込台数名リスト"(String型、項目ID:nm_list) (Array item "Subscription Line Name List" (String type, item ID: nm_list)). This block handles list property access for the subscriber line name list.

**Block 3.2.1** — SET `(extract subkey portion)` (L170)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // keyの次の要素を取得 (Get the next element of key) |

**Block 3.2.2** — IF `(key.equals("*"))` (L172)

> The comment reads: インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す。(If "*" is specified instead of an index value, return the number of elements in the list.)

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer returnValue = Integer.valueOf(nm_list_list.size());` |
| 2 | RETURN | `return returnValue;` // リストの要素数を返す (Return the number of elements in the list) |

**Block 3.2.3** — TRY-CATCH `(parse index from key)` (L177–L185)

> The comment reads: 次にリスト中のインデックスを見る。(Next, look at the index in the list.) Followed by: インデックス値が数値文字列でない場合は、ここでnullを返す。(If the index value is not a numeric string, return null here.)

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null;` |
| 2 | SET | `tmpIndexInt = Integer.valueOf(key);` // リスト中のインデックスを見る (Look at the index in the list) |
| 3 | CATCH | `catch(NumberFormatException e) { return null; }` // インデックス値が数値文字列でない場合は、ここでnullを返す (If the index value is not a numeric string, return null here) |

**Block 3.2.4** — IF `(tmpIndexInt == null)` (L186)

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

**Block 3.2.5** — SET `(cast index)` (L188)

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

**Block 3.2.6** — IF `(tmpIndex < 0 || tmpIndex >= nm_list_list.size())` (L189)

> The comment reads: インデックス値がリスト個数-1を超えたら、ここでnullを返す。(If the index value exceeds list count - 1, return null here.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // インデックス値がリスト個数-1を超えたら、ここでnullを返す (If the index value exceeds list count - 1, return null here) |

**Block 3.2.7** — SET/RETURN `(delegated list item access)` (L191)

| # | Type | Code |
|---|------|------|
| 1 | SET | `X33VDataTypeStringBean bean = (X33VDataTypeStringBean) nm_list_list.get(tmpIndex);` |
| 2 | RETURN | `return bean.loadModelData(subkey);` // リスト項目に処理を委譲 (Delegate processing to list item) |

---

**Block 3.3** — ELSE-IF `(key.equals("申込台数値リスト"))` (L195)

> The comment reads: 配列項目 "申込台数値リスト"(String型、項目ID:val_list) (Array item "Subscription Line Value List" (String type, item ID: val_list)). This block mirrors Block 3.2 but operates on `val_list_list` instead.

**Block 3.3.1** — SET `(extract subkey portion)` (L197)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1);` // keyの次の要素を取得 (Get the next element of key) |

**Block 3.3.2** — IF `(key.equals("*"))` (L199)

> The comment reads: インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す。(If "*" is specified instead of an index value, return the number of elements in the list.)

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer returnValue = Integer.valueOf(val_list_list.size());` |
| 2 | RETURN | `return returnValue;` // リストの要素数を返す (Return the number of elements in the list) |

**Block 3.3.3** — TRY-CATCH `(parse index from key)` (L204–L212)

| # | Type | Code |
|---|------|------|
| 1 | SET | `Integer tmpIndexInt = null;` |
| 2 | SET | `tmpIndexInt = Integer.valueOf(key);` |
| 3 | CATCH | `catch(NumberFormatException e) { return null; }` |

**Block 3.3.4** — IF `(tmpIndexInt == null)` (L213)

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

**Block 3.3.5** — SET `(cast index)` (L215)

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

**Block 3.3.6** — IF `(tmpIndex < 0 || tmpIndex >= val_list_list.size())` (L216)

> The comment reads: インデックス値がリスト個数-1を超えたら、ここでnullを返す。(If the index value exceeds list count - 1, return null here.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // インデックス値がリスト個数-1を超えたら、ここでnullを返す (If the index value exceeds list count - 1, return null here) |

**Block 3.3.7** — SET/RETURN `(delegated list item access)` (line after L216)

| # | Type | Code |
|---|------|------|
| 1 | SET | `X33VDataTypeStringBean bean = (X33VDataTypeStringBean) val_list_list.get(tmpIndex);` |
| 2 | RETURN | `return bean.loadModelData(subkey);` // リスト項目に処理を委譲 (Delegate processing to list item) |

### Block 4 — RETURN `(fallback)` (L216 end)

> The comment reads: 条件に一致するプロパティが存在しない場合は、nullを返す。(If no property matching the condition exists, return null.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // 条件に一致するプロパティが存在しない場合は、nullを返す (If no property matching the condition exists, return null) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `申込台数リスト選択値` | Field / Key | Subscription Line Count List Selection Value — the property key for the list selection value data type in the subscription configuration screen |
| `申込台数名リスト` | Field / Key | Subscription Line Name List — the property key for the list of subscriber line names (e.g., line identifiers) |
| `申込台数値リスト` | Field / Key | Subscription Line Value List — the property key for the list of subscriber line values (e.g., pricing or plan values associated with each line) |
| `select_cd` | Field | Selection Code — the item ID for the subscription line count selection value and state fields |
| `nm_list` | Field | Name List — the item ID for the subscriber line name list (`nm_list_list`) |
| `val_list` | Field | Value List — the item ID for the subscriber line value list (`val_list_list`) |
| X33 Framework | Technical | Fujitsu's X33 Web Client Framework — a JSF-based component toolkit for building enterprise web screens in the K-Opticom system |
| `X33VDataTypeBeanInterface` | Interface | The X33 interface contract that requires `loadModelData(String, String)` for property-based data access during view rendering |
| `X33VListedBeanInterface` | Interface | The X33 interface for beans that contain list-type data fields |
| `X33VDataTypeList` | Type | An X33 framework type for representing ordered lists of typed data items |
| `X33VDataTypeStringBean` | Type | An X33 framework bean wrapping a String-typed data value, used as the element type in `nm_list_list` and `val_list_list` |
| `select_cd_value` | Field | The currently selected subscription line count value stored in this bean |
| `select_cd_state` | Field | The validation/selection state of the subscription line count (e.g., "valid", "modified", "cleared") |
| `nm_list_list` | Field | The ordered list of `X33VDataTypeStringBean` items representing subscriber line names |
| `val_list_list` | Field | The ordered list of `X33VDataTypeStringBean` items representing subscriber line values |
| `"*"` | Constant | Special subkey value meaning "return the size/count of the list" rather than a specific element |
| JSF | Technical | JavaServer Faces — the web component framework underlying X33 |
