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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW07101SF.FUW07101SF02DBean` |
| Layer | Service (DBean / Data Bean — presentation-tier data binding layer) |
| Module | `FUW07101SF` (Package: `eo.web.webview.FUW07101SF`) |

## 1. Role

### FUW07101SF02DBean.typeModelData()

This method serves as a **data-type routing and dispatch utility** within the application-order (申請台数, *Application Count*) screen data-binding layer. The Fujitsu X33 framework uses a model-driven approach where view components declare their expected data types via a `typeModelData(subkey)` contract; this method resolves what Java `Class` type a given field descriptor should return at runtime, enabling automatic type-safe data loading and rendering.

The method handles three distinct business scenarios: (1) scalar selection-value fields (`申請台数リスト選択値`) that return `String` for value/state sub-keys, (2) application count **name** lists (`申請台数名リスト`) that delegate per-element type queries into `X33VDataTypeStringBean.typeModelData()`, and (3) application count **value** lists (`申請台数値リスト`) with identical delegation semantics. When the sub-key `"*"` is provided for list-type keys, the method returns `Integer.class` to signal that the list size itself should be treated as an integer count.

The design pattern employed is **routing/dispatch with delegation**: the method acts as a central dispatcher that inspects the `key` parameter against known business field names, then either returns a primitive type binding directly or delegates deeper type resolution to individual list-element beans. This is a core infrastructure method called by the X33 framework's data-loading pipeline (`X33VLoadModelException` is a transit import), ensuring the view layer receives accurate type metadata for every field.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(key, subkey)"])

    START --> NULL_CHK["key, subkey null?"]

    NULL_CHK -->|Yes| NULL_RET["return null"]
    NULL_CHK -->|No| FIND_SEP["find first '/' in key"]
    FIND_SEP --> KEY_CHK1{"key == '申請台数リスト選択値' ?"}

    KEY_CHK1 -->|Yes| SUBKEY_CHK1{"subkey equalsIgnoreCase 'value' or 'state' ?"}
    SUBKEY_CHK1 -->|Yes| STR_RET1["return String.class"]
    SUBKEY_CHK1 -->|No| KEY_CHK2{"key == '申請台数名リスト' ?"}

    KEY_CHK2 -->|No| KEY_CHK3{"key == '申請台数値リスト' ?"}
    KEY_CHK3 -->|No| NULL_RET

    KEY_CHK3 -->|Yes| SUBSTR_VAL["key = key.substring(separaterPoint + 1)"]
    SUBSTR_VAL --> WILD_CHK2{"key == '*' ?"}
    WILD_CHK2 -->|Yes| INT_RET2["return Integer.class"]
    WILD_CHK2 -->|No| PARSE_IDX2["Integer.valueOf(key)"]
    PARSE_IDX2 --> PARSE_OK2{NumberFormatException?}
    PARSE_OK2 -->|Yes| NULL_RET
    PARSE_OK2 -->|No| NULL_PTR_CHK2{tmpIndexInt == null?}
    NULL_PTR_CHK2 -->|Yes| NULL_RET
    NULL_PTR_CHK2 -->|No| BOUND2{"0 <= tmpIndex < val_list_list.size()"}
    BOUND2 -->|No| NULL_RET
    BOUND2 -->|Yes| DELEGATE2["(X33VDataTypeStringBean) val_list_list.get(tmpIndex).typeModelData(subkey)"]

    KEY_CHK2 -->|Yes| SUBSTR_NAME["key = key.substring(separaterPoint + 1)"]
    SUBSTR_NAME --> WILD_CHK1{"key == '*' ?"}
    WILD_CHK1 -->|Yes| INT_RET1["return Integer.class"]
    WILD_CHK1 -->|No| PARSE_IDX1["Integer.valueOf(key)"]
    PARSE_IDX1 --> PARSE_OK1{NumberFormatException?}
    PARSE_OK1 -->|Yes| NULL_RET
    PARSE_OK1 -->|No| NULL_PTR_CHK1{tmpIndexInt == null?}
    NULL_PTR_CHK1 -->|Yes| NULL_RET
    NULL_PTR_CHK1 -->|No| BOUND1{"0 <= tmpIndex < nm_list_list.size()"}
    BOUND1 -->|No| NULL_RET
    BOUND1 -->|Yes| DELEGATE1["(X33VDataTypeStringBean) nm_list_list.get(tmpIndex).typeModelData(subkey)"]
```

**Processing narrative:**

1. **Null guard** — If either `key` or `subkey` is `null`, return `null` immediately.
2. **Separator detection** — Find the first `'/'` character in `key` to support index-based list descriptors of the form `"key/index"`.
3. **Branch 1 — Scalar selection fields** — If `key` equals `"申請台数リスト選択値"` (Application Count List Selection Values), check `subkey`: if it matches `"value"` or `"state"` (case-insensitive), return `String.class`.
4. **Branch 2 — Name list** — If `key` equals `"申請台数名リスト"` (Application Count Name List), extract the substring after the `'/'`, treat `"*"` as a request for list-size type (`Integer.class`), parse the remaining key as an integer index, validate bounds against `nm_list_list`, and delegate to `((X33VDataTypeStringBean) nm_list_list.get(tmpIndex)).typeModelData(subkey)`.
5. **Branch 3 — Value list** — Identical logic to Branch 2 but operates on `val_list_list` (Application Count Value List, 申請台数値リスト).
6. **Fallback** — If no branch matches, return `null`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business field descriptor (項目名). Identifies which data field the caller is querying type metadata for. Can be a scalar field name like `"申請台数リスト選択値"`, or a list-path pattern `"申請台数名リスト/0"` where the portion after `'/'` is an index or `"*"` for list size. |
| 2 | `subkey` | `String` | The sub-field or property name within a field. For scalar selection fields it identifies `"value"` or `"state"`. For list elements, it is forwarded verbatim to the inner `X33VDataTypeStringBean.typeModelData()` for further type resolution. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `nm_list_list` | `X33VDataTypeList` | Application count **name** list — ordered collection of string data beans (`X33VDataTypeStringBean`) representing selectable application names. Indexed 0..n. |
| `val_list_list` | `X33VDataTypeList` | Application count **value** list — ordered collection of string data beans representing corresponding application value entries. Indexed 0..n. |

## 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` |
| - | `FUW07101SF02DBean.typeModelData` | FUW07101SF02DBean | - | Calls `typeModelData` in `FUW07101SF02DBean` |

**Analysis:** This method is a **pure routing utility** — it performs no database operations (CRUD) itself. Its only side-effect-free calls are:
- `String.indexOf()` / `String.substring()` — standard library string operations for parsing the `key` parameter.
- `Integer.valueOf()` — type conversion.
- `X33VDataTypeList.size()` / `X33VDataTypeList.get()` — Java collection access on in-memory list beans.
- `X33VDataTypeStringBean.typeModelData(subkey)` — recursive delegation to inner element beans (same class contract).

No SC codes, CBS calls, or entity/DB table operations are executed within this method.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:FUW07101SF | `FUW07101SF02DBean.typeModelData` (self-invocation via X33 framework) | `typeModelData(subkey) [R] nm_list_list / val_list_list` |

**Notes:** The X33 framework's `X33VLoadModel` (loaded via import `X33VLoadModelException`) calls `typeModelData()` during the model-loading phase to resolve data types for view-bound fields. The caller table is limited because this is a **framework-dispatched** method — it is not invoked directly by application-level CBS or screen classes, but rather through the X33 framework's introspection mechanism when binding data to the presentation layer.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (null guard) (L342)

> Guard clause: if either parameter is null, return null immediately.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key == null || subkey == null)` — 項目名とサブキーがnullの場合、nullを返す // *Returns null if the field name and subkey are null* |
| 2 | RETURN | `return null;` |

### Block 2 — EXEC (separator detection) (L347)

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` — find first '/' to support index-based list paths |

### Block 3 — IF-ELSE-IF (key routing) (L351–L409)

> 項目ごとに処理を入れる。 // *Processes handling per item.*

#### Block 3.1 — IF (scalar selection field) (L352)

> データタイプがStringの項目"申請台数リスト選択値"(項目ID:select_cd) // *Data type is String field "Application Count List Selection Values" (Field ID: select_cd)*

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("申請台数リスト選択値"))` — [APPLICATION_COUNT_LIST_SELECTION_VALUES = "申請台数リスト選択値"] |
| 2 | IF | `if (subkey.equalsIgnoreCase("value"))` |
| 3 | RETURN | `return String.class;` |
| 4 | ELSE-IF | `else if (subkey.equalsIgnoreCase("state"))` — subkeyが"state"の場合、ステータスを返す。 // *If subkey is "state", returns the status.* |
| 5 | RETURN | `return String.class;` |

#### Block 3.2 — ELSE-IF (name list) (L363)

> 配置項目 "申請台数名リスト"(String型、項目ID:nm_list) // *Layout item "Application Count Name List" (String type, Field ID: nm_list)*

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if (key.equals("申請台数名リスト"))` — [APPLICATION_COUNT_NAME_LIST = "申請台数名リスト"] |
| 2 | SET | `key = key.substring(separaterPoint + 1);` —  keyの次の要素を取得 ("申請台数名リスト/0"から最初の"/"より後を取取得) // *Gets the next element after the key ("申請台数名リスト/0") and extracts the portion after the first "/"* |
| 3 | IF | `if (key.equals("*"))` — インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す。 // *If "*" is specified instead of an index value, returns the number of list elements.* |
| 4 | RETURN | `return Integer.class;` |
| 5 | SET | `Integer tmpIndexInt = null;` |
| 6 | TRY | `tmpIndexInt = Integer.valueOf(key);` — パース処理 |
| 7 | CATCH | `catch (NumberFormatException e) { return null; }` — インデックス値が数値文字列でない場合は、ここでnullを返す。 // *If the index value is not a numeric string, return null here.* |
| 8 | IF | `if (tmpIndexInt == null) { return null; }` |
| 9 | SET | `int tmpIndex = tmpIndexInt.intValue();` |
| 10 | IF | `if (tmpIndex < 0 || tmpIndex >= nm_list_list.size())` — インデックス値がリスト個数-1を超え場合は、ここでnullを返す。 // *If the index value exceeds the list count - 1, return null here.* |
| 11 | RETURN | `return null;` |
| 12 | CALL | `((X33VDataTypeStringBean) nm_list_list.get(tmpIndex)).typeModelData(subkey);` — 配列内の要素の型情報を取得 // *Gets the type information of the element within the array* |

#### Block 3.3 — ELSE-IF (value list) (L379)

> 配置項目 "申請台数値リスト"(String型、項目ID:val_list) // *Layout item "Application Count Value List" (String type, Field ID: val_list)*

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if (key.equals("申請台数値リスト"))` — [APPLICATION_COUNT_VALUE_LIST = "申請台数値リスト"] |
| 2 | SET | `key = key.substring(separaterPoint + 1);` — keyの次の要素を取得 |
| 3 | IF | `if (key.equals("*"))` — インデックス値の代わりに"*"が指定されていたら、リストの要素数を返す。 // *If "*" is specified instead of an index value, returns the number of list elements.* |
| 4 | RETURN | `return Integer.class;` |
| 5 | SET | `Integer tmpIndexInt = null;` |
| 6 | TRY | `tmpIndexInt = Integer.valueOf(key);` |
| 7 | CATCH | `catch (NumberFormatException e) { return null; }` — インデックス値が数値文字列でない場合は、ここでnullを返す。 // *If the index value is not a numeric string, return null here.* |
| 8 | IF | `if (tmpIndexInt == null) { return null; }` |
| 9 | SET | `int tmpIndex = tmpIndexInt.intValue();` |
| 10 | IF | `if (tmpIndex < 0 || tmpIndex >= val_list_list.size())` — インデックス値がリスト個数-1を超え場合は、ここでnullを返す。 // *If the index value exceeds the list count - 1, return null here.* |
| 11 | RETURN | `return null;` |
| 12 | CALL | `((X33VDataTypeStringBean) val_list_list.get(tmpIndex)).typeModelData(subkey);` — 配列内の要素の型情報を取得 // *Gets the type information of the element within the array* |

### Block 4 — RETURN (fallback) (L409)

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

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `申請台数リスト選択値` | Field Name | Application Count List Selection Values — scalar field representing the selected entry in a dropdown/list of application counts. Maps to `select_cd` field ID. |
| `申請台数名リスト` | Field Name | Application Count Name List — ordered list layout item (nm_list) containing selectable application count name entries (String type). Accessed via `nm_list_list` property. |
| `申請台数値リスト` | Field Name | Application Count Value List — ordered list layout item (val_list) containing corresponding application count value entries (String type). Accessed via `val_list_list` property. |
| `select_cd` | Field ID | Selection code — the internal field identifier for the scalar application count selection value. |
| `nm_list` | Field ID | Name list — internal identifier for the application count name list. |
| `val_list` | Field ID | Value list — internal identifier for the application count value list. |
| X33 | Acronym | Fujitsu Futurity X33 — the web application framework providing the bean data-binding infrastructure (`X33VViewBaseBean`, `X33VDataTypeList`, etc.). |
| `typeModelData()` | Method Contract | X33 framework method that resolves the Java `Class` type for a given sub-key, enabling automatic type-safe model loading from data to view. |
| `X33VDataTypeStringBean` | Class | A data bean representing a String-typed field in the X33 model. Each entry in `nm_list_list` and `val_list_list` is cast to this type for per-element type resolution. |
| `X33VDataTypeList` | Class | A list container in the X33 framework that holds typed data beans. Provides `size()` and `get(int)` access for indexed list traversal. |
| DBean | Acronym | Data Bean — a presentation-tier Java bean that binds data between the business layer and the JSF/Faces view. |
| "value" | Sub-key | Requested property: the actual string value of a selection field. |
| "state" | Sub-key | Requested property: the display state/status of a selection field. |
| "*" | Sub-key | Special token: when used as the index portion of a list path (e.g., `"申請台数名リスト/*"`), signals a request for the list size type (`Integer.class`). |
