# Business Logic — KKW00801SF02DBean.typeModelData() [39 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00801SF.KKW00801SF02DBean` |
| Layer | Utility / Data-Binding Bean (View layer — X33V framework data-type bean) |
| Module | `KKW00801SF` (Package: `eo.web.webview.KKW00801SF`) |

## 1. Role

### KKW00801SF02DBean.typeModelData()

This method serves as a **runtime type-introspection dispatcher** for the X33V view framework's data-binding system. Its purpose is to answer the question "what Java type should this field have?" when the framework needs to instantiate, validate, or render form fields on the dropdown option editor screen. It implements the `X33VDataTypeBeanInterface.typeModelData()` contract, which the X33V framework calls to determine the Java class (`Class<?>`) of each sub-property (e.g., `value`, `enable`, `state`) of a dropdown option data entry.

The method handles **two service types of dropdown option items**: (1) "プルダウン選択肢値" (Dropdown Option Value — item ID `pd_id`) which represents the actual stored value of a dropdown choice, and (2) "プルダウン選択肢名" (Dropdown Option Name — item ID `pd_op_nm`) which represents the human-readable label displayed to the user. For each type, it resolves the subkey `value`, `enable`, and `state` to their corresponding Java types: `String.class`, `Boolean.class`, and `String.class` respectively.

The design pattern is a **routing/dispatch** pattern: the method acts as a simple lookup table mapped through conditional branching, delegating type resolution to no other method — it is entirely self-contained. Its role in the larger system is as a **shared utility within the bean hierarchy**, allowing the X33V framework to dynamically introspect the structure of data entry forms without needing to know field types at compile time.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    CHECK_NULL{"key or subkey is null?"}
    FIND_SEP{"Find separator"}
    CHECK_KEY1{"key equals プルダウン選択肢値?
(Dropdown Option Value)"}
    CHECK_SUBVAL{"subkey equals value?"}
    CHECK_SUBEN1{"subkey equals enable?"}
    CHECK_SUBST1{"subkey equals state?"}
    CHECK_KEY2{"key equals プルダウン選択肢名?
(Dropdown Option Name)"}
    CHECK_SUBVAL2{"subkey equals value?"}
    CHECK_SUBEN2{"subkey equals enable?"}
    CHECK_SUBST2{"subkey equals state?"}
    RETURN_NULL1["Return null"]
    RETURN_STRING1["Return String.class"]
    RETURN_BOOL1["Return Boolean.class"]
    RETURN_STRING2["Return String.class"]
    RETURN_STRING3["Return String.class"]
    RETURN_STRING4["Return String.class"]
    RETURN_BOOL2["Return Boolean.class"]
    RETURN_STRING5["Return String.class"]
    RETURN_NULL2["Return null
No matching property"]
    END_RETURN(["Return / Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| RETURN_NULL1
    CHECK_NULL -->|No| FIND_SEP
    FIND_SEP --> CHECK_KEY1
    CHECK_KEY1 -->|Yes| CHECK_SUBVAL
    CHECK_KEY1 -->|No| CHECK_KEY2
    CHECK_SUBVAL -->|Yes| RETURN_BOOL1
    CHECK_SUBVAL -->|No| CHECK_SUBEN1
    CHECK_SUBEN1 -->|Yes| RETURN_BOOL1
    CHECK_SUBEN1 -->|No| CHECK_SUBST1
    CHECK_SUBST1 -->|Yes| RETURN_STRING1
    CHECK_SUBST1 -->|No| RETURN_NULL1
    CHECK_KEY2 -->|Yes| CHECK_SUBVAL2
    CHECK_KEY2 -->|No| RETURN_NULL2
    CHECK_SUBVAL2 -->|Yes| RETURN_BOOL2
    CHECK_SUBVAL2 -->|No| CHECK_SUBEN2
    CHECK_SUBEN2 -->|Yes| RETURN_BOOL2
    CHECK_SUBEN2 -->|No| CHECK_SUBST2
    CHECK_SUBST2 -->|Yes| RETURN_STRING3
    CHECK_SUBST2 -->|No| RETURN_NULL2
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (項目名) that identifies which dropdown option category the type query belongs to. It distinguishes between "プルダウン選択肢値" (Dropdown Option Value, representing the stored value of a choice, item ID `pd_id`) and "プルダウン選択肢名" (Dropdown Option Name, representing the display label, item ID `pd_op_nm`). The value determines which branch of type resolution is taken. |
| 2 | `subkey` | `String` | The sub-property name (サブキー) of the item within the key category. Acceptable values are `"value"` (the actual field value), `"enable"` (a boolean flag indicating whether the option is enabled/disabled), and `"state"` (a string representing the UI state, e.g., editable/readonly). The comparison is case-insensitive (`equalsIgnoreCase`). |

**Instance fields read by the method:** None. The method is entirely stateless — it does not read any instance variables or external state.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and **calls no external services**. It is a purely self-contained type-introspection method that returns `Class<?>` instances based on string matching. There are no database reads, SC (Service Component) calls, CBS (Common Business Service) invocations, or entity interactions.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (none) | — | — | — | This method has no database or service interactions. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0080 (KKW00801SF01DBean) | `KKW00801SF01DBean.addListData` (instantiates `KKW00801SF02DBean tmpBean`) -> `typeModelData` called by X33V framework at runtime when the bean is registered as a data-type item in the list | (none — no SC/CRUD) |
| 2 | X33V Framework Runtime | Framework's `X33VDataTypeBeanInterface.typeModelData(key, subkey)` contract invocation -> `KKW00801SF02DBean.typeModelData` | (none — no SC/CRUD) |
| 3 | (Framework-level) | Various FUW* screens (FUW00912SF, FUW00926SF, FUW00959SF, FUW00964SF, etc.) implement their own `typeModelData` following the same pattern, calling `X33VDataTypeStringBean.typeModelData(subkey)` on their list items. These are sibling patterns, not callers of KKW00801SF02DBean. | (none) |

**Note:** The primary caller is the X33V framework itself. `KKW00801SF01DBean` instantiates `KKW00801SF02DBean` objects as list entries (for dropdown option lists like "メールメールN容量選択リスト" and "ウイルスチェック選択リスト"). When the framework needs to know the type of a sub-property of these beans, it calls `typeModelData(key, subkey)` through the `X33VDataTypeBeanInterface` contract.

## 6. Per-Branch Detail Blocks

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

> Null-guard: If either parameter is null, return null immediately. The comment explains: "key,subkeyがnullの場合、nullを返す" (If key/subkey is null, return null).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `int separaterPoint = key.indexOf("/");` // Compute separator position (not used — dead code) [L283] |
| 2 | RETURN | `return null;` |

**Block 2** — [IF] `(key.equals("プルダウン選択肢値"))` — Dropdown Option Value (L287)

> The comment explains: "データタイプがStringの項目'プルダウン選択肢値'(項目ID:pd_id)" (Data type is String item "Dropdown Option Value" (item ID: pd_id)). This handles type introspection for the dropdown choice's stored value field.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` — Check if querying the value sub-property [L288] |

  **Block 2.1** — [nested IF] `(subkey.equalsIgnoreCase("value"))` (L288)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return String.class;` — The value property is a String |

  **Block 2.2** — [nested ELSE-IF] `(subkey.equalsIgnoreCase("enable"))` (L290)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return Boolean.class;` — The enable flag is a Boolean |

  **Block 2.3** — [nested ELSE-IF] `(subkey.equalsIgnoreCase("state"))` — "stateの場合、ステータスを返す" (When subkey is "state", return status) [L292] (L292)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return String.class;` — The state field is a String |

  **Block 2.4** — [else / fall-through to end of method] (L294)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return null;` — No matching subkey, fall through to final null return [L308] |

**Block 3** — [ELSE-IF] `(key.equals("プルダウン選択肢名"))` — Dropdown Option Name (L297)

> The comment explains: "データタイプがStringの項目'プルダウン選択肢名'(項目ID:pd_op_nm)" (Data type is String item "Dropdown Option Name" (item ID: pd_op_nm)). This handles type introspection for the dropdown choice's display label field.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` — Check if querying the value sub-property [L298] |

  **Block 3.1** — [nested IF] `(subkey.equalsIgnoreCase("value"))` (L298)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return String.class;` — The value property is a String |

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

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return Boolean.class;` — The enable flag is a Boolean |

  **Block 3.3** — [nested ELSE-IF] `(subkey.equalsIgnoreCase("state"))` — "stateの場合、ステータスを返す" (When subkey is "state", return status) [L302] (L302)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return String.class;` — The state field is a String |

  **Block 3.4** — [else / fall-through to end of method] (L304)

  | # | Type | Code |
  |---|------|------|
  | 1 | RETURN | `return null;` — No matching subkey, fall through to final null return [L308] |

**Block 4** — [else / final return] (L308)

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

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` — No matching key or subkey found |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `pd_id` | Field | Dropdown Option Value — the stored value (actual data) of a dropdown choice item |
| `pd_op_nm` | Field | Dropdown Option Name — the human-readable display label of a dropdown choice item |
| プルダウン選択肢値 | Field | Dropdown Option Value — Japanese term for the key identifying dropdown choice stored values |
| プルダウン選択肢名 | Field | Dropdown Option Name — Japanese term for the key identifying dropdown choice display names |
| `value` | Sub-property | The actual data value stored for a dropdown option |
| `enable` | Sub-property | Boolean flag indicating whether the dropdown option is currently enabled or disabled |
| `state` | Sub-property | String representing the UI state (e.g., editable, readonly, hidden) of the dropdown option |
| X33V | Framework | Fujitsu Futurity Web Client framework v3.3 — a Java-based MVC web application framework with data-binding and type introspection capabilities |
| `X33VDataTypeBeanInterface` | Interface | X33V interface for beans that provide runtime type information for their sub-properties via `typeModelData()` |
| `X33VListedBeanInterface` | Interface | X33V interface for beans that can be used as items in typed lists (e.g., `X33VDataTypeList`) |
| X33VDataTypeList | Class | A framework class representing a typed list of `X33VDataTypeBeanInterface` items |
| KKW00801SF | Screen module | Screen for managing dropdown option configurations (メールN容量選択 = Mail N-capacity selection, ウイルスチェック = Virus check) |
| KKW00801SF01DBean | Bean | Parent data bean that manages dropdown option lists and delegates type introspection to `KKW00801SF02DBean` |
| KKW00801SF02DBean | Bean | Per-item data bean for a single dropdown option entry, providing type introspection for its sub-properties |
| 項目名 (Koumoku-mei) | Term | Item name — the business identifier for a form field or option |
| サブキー (Sabukii) | Term | Sub-key — the property name within an item (e.g., `value`, `enable`, `state`) |
