# Business Logic — CRW02702SF03DBean.typeModelData() [63 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.CRW02702SF.CRW02702SF03DBean` |
| Layer | Utility / Data-Binding Bean (Framework integration layer within the X33 web framework) |
| Module | `CRW02702SF` (Package: `eo.web.webview.CRW02702SF`) |

## 1. Role

### CRW02702SF03DBean.typeModelData()

This method is a data-binding type resolution utility within the X33 web framework's view layer. Its business purpose is to map form field keys (item names) and subkeys (value/state metadata) to their corresponding Java data types at runtime, enabling the framework to perform dynamic data binding on JSP pages without compile-time type information. Specifically, it handles five **External Connection URL history** (対応履歴外部接続URL) items — URL number, URL type code, URL type code name, URL itself, and URL name — all of which are declared as `String` data types with an optional `state` sub-property for UI status tracking. The method implements a **routing/dispatch design pattern**: it branches on the item name (`key`) and then on the subkey (`value` or `state`) to determine the correct return type. It serves as a shared framework integration point, called indirectly via the parent bean's `typeModelData()` method in `CRW02702SFBean`, which in turn is invoked by the X33 framework during data loading (e.g., `X33VLoadModelException` recovery flows, list iteration patterns via `X33VDataTypeBeanInterface`). This method ensures that the web framework knows the expected type for every UI-bound field on the screen, which drives HTML input generation, type conversion, and validation.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    COND_NULL{key or subkey is null?}
    FIND_SEP["Separate key by slash"]
    COND_KEY1{key == URL Number}
    COND_KEY2{key == URL Type Code}
    COND_KEY3{key == URL Type Code Name}
    COND_KEY4{key == URL}
    COND_KEY5{key == URL Name}
    SUBKEY_VALUE{subkey equals value}
    SUBKEY_STATE{subkey equals state}
    RETURN_STR["return String.class"]
    RETURN_NULL["return null"]
    END_NODE(["Return / Next"])

    START --> COND_NULL
    COND_NULL -->|Yes| RETURN_NULL
    COND_NULL -->|No| FIND_SEP
    FIND_SEP --> COND_KEY1
    COND_KEY1 -->|Yes| SUBKEY_VALUE
    COND_KEY1 -->|No| COND_KEY2
    COND_KEY2 -->|Yes| SUBKEY_VALUE
    COND_KEY2 -->|No| COND_KEY3
    COND_KEY3 -->|Yes| SUBKEY_VALUE
    COND_KEY3 -->|No| COND_KEY4
    COND_KEY4 -->|Yes| SUBKEY_VALUE
    COND_KEY4 -->|No| COND_KEY5
    COND_KEY5 -->|Yes| SUBKEY_VALUE
    COND_KEY5 -->|No| RETURN_NULL
    SUBKEY_VALUE -->|Yes| RETURN_STR
    SUBKEY_VALUE -->|No| SUBKEY_STATE
    SUBKEY_STATE -->|Yes| RETURN_STR
    SUBKEY_STATE -->|No| END_NODE
```

**Processing summary:**
1. **Null guard (L388–391):** If either `key` or `subkey` is `null`, return `null` immediately. This prevents `NullPointerException` in downstream type resolution logic.
2. **Key parsing (L393):** Compute `separaterPoint` by searching for `/` in the key. (Note: This variable is computed but never used within this specific DBean — it is inherited from the base bean's pattern where nested list keys require splitting.)
3. **Item-name dispatch (L396–441):** Five `if`/`else-if` branches check the exact value of `key`. Each branch further splits on `subkey`:
   - `subkey` equals `"value"` (case-insensitive) → return `String.class`
   - `subkey` equals `"state"` (case-insensitive) → return `String.class` (for UI state tracking)
   - Neither matches → fall through to the next branch
4. **Fallback (L444–445):** If no key matches any branch, return `null` (no known type for the given item).

All five matched keys correspond to **External Connection URL history** (対応履歴外部接続URL) fields used for displaying and managing URL-based external system integration records. Each field supports two sub-properties: the actual value and its display state.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | Item name (項目名) — the business identifier for a UI-bound field. In this DBean, it matches against five external connection URL history (対応履歴外部接続URL) items: URL number (URL番号), URL type code (URL種類コード), URL type code name (URL種類コード名), URL itself (URL), and URL name (URL名). The value directly determines which branch is taken and therefore which data type is returned to the framework. |
| 2 | `subkey` | `String` | Sub-property key (サブキー) — distinguishes between the actual field value (`"value"`) and the UI display state (`"state"`). Case-insensitive comparison (`equalsIgnoreCase`) allows flexibility in framework invocation. When `"value"`, returns the data type of the field. When `"state"`, returns `String.class` for the state/status metadata. |

**External state / instance fields:** None. This method is purely stateless — it does not read any instance fields, making it safe for concurrent invocation.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no external services, SCs, or CBSs**. It is a pure type-resolution utility that operates entirely in-memory with only its parameters. All branches return Java `Class` literals (`String.class`, `Integer.class`, or `null`) without side effects.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A | (none) | — | — | Type resolution only — no data access, no database interaction |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean: CRW02702SFBean | `CRW02702SFBean.typeModelData(key, subkey)` → `CRW02702SF03DBean.typeModelData(key, subkey)` | (none — type resolution only) |
| 2 | Bean: CRW02702SF01DBean | `CRW02702SF01DBean.typeModelData(key, subkey)` → (delegated chain via X33VDataTypeBeanInterface pattern) | (none — type resolution only) |
| 3 | Bean: CRW02702SF02DBean | `CRW02702SF02DBean.typeModelData(key, subkey)` → (delegated chain via X33VDataTypeBeanInterface pattern) | (none — type resolution only) |
| 4 | Bean: CRW02702SF04DBean | `CRW02702SF04DBean.typeModelData(key, subkey)` → (delegated chain via X33VDataTypeBeanInterface pattern) | (none — type resolution only) |

**Caller details:**
- `CRW02702SFBean.java` (L1404–1415): Defines both the 3-parameter and 2-parameter overloads of `typeModelData()`. The 2-parameter version delegates directly to `CRW02702SF03DBean.typeModelData()`. This is the primary entry point used by the X33 framework's `X33VDataTypeList` when resolving field types during data loading.
- `CRW02702SF01DBean`, `CRW02702SF02DBean`, `CRW02702SF04DBean`: These sibling DBeans in the same module also implement `typeModelData()`. They follow the same structural pattern as `03DBean` but handle different sets of items. They are called independently by the framework, not from within `03DBean`.
- The X33 framework interface `X33VDataTypeBeanInterface` (imported in this class) defines the contract. The framework's `X33VDataTypeList` iterates over beans and invokes `typeModelData()` to discover field types during dynamic binding.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) `(key == null || subkey == null)` (L388–391)

> Guard clause: If either parameter is null, return null immediately to prevent downstream errors.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key or subkey is null, return null — 項目名とサブキーがnullの場合、nullを返す (When key and subkey are null, return null) |

---

**Block 2** — EXEC (key separator detection) `(key.indexOf("/"))` (L393)

> Compute the position of the first slash in key. This variable is declared for framework compatibility but is not consumed in this specific DBean (it is used by the parent `CRW02702SFBean` for nested list key parsing).

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Find slash position — /の位置を検索 |

---

**Block 3** — IF/ELSE-IF/ELSE (item dispatch) `(key.equals(...))` (L396–441)

> Five branches handle five external connection URL history (対応履歴外部接続URL) fields. Each branch checks subkey for "value" or "state" and returns String.class. All fields are String data types.

**Block 3.1** — IF `(key.equals("対応履歴外部接続URL番号"))` [l1_taiorrk_out_url_no] (L396–404)

> URL Number field — the external connection URL history record number.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — subkeyが"value"の場合 |
| 2 | RETURN | `return String.class;` // Return String type for value — String型を返す |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` // subkey is "state" — subkeyが"state"の場合、ステータスを返す (return the status) |
| 4 | RETURN | `return String.class;` // Return String type for state — String型を返す |

**Block 3.2** — ELSE-IF `(key.equals("対応履歴外部接続URL種類コード"))` [l1_taiorrk_out_url_sbt_cd] (L408–416)

> URL Type Code field — the classification code for the type of external connection URL.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — subkeyが"value"の場合 |
| 2 | RETURN | `return String.class;` // Return String type for value — String型を返す |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` // subkey is "state" — subkeyが"state"の場合、ステータスを返す |
| 4 | RETURN | `return String.class;` // Return String type for state — String型を返す |

**Block 3.3** — ELSE-IF `(key.equals("対応履歴外部接続URL種類コード名"))` [l1_taiorrk_out_url_sbt_cd_nm] (L420–428)

> URL Type Code Name field — the human-readable name for the URL type code.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — subkeyが"value"の場合 |
| 2 | RETURN | `return String.class;` // Return String type for value — String型を返す |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` // subkey is "state" — subkeyが"state"の場合、ステータスを返す |
| 4 | RETURN | `return String.class;` // Return String type for state — String型を返す |

**Block 3.4** — ELSE-IF `(key.equals("対応履歴外部接続URL"))` [l1_taiorrk_out_url] (L432–440)

> URL field — the external connection URL itself.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — subkeyが"value"の場合 |
| 2 | RETURN | `return String.class;` // Return String type for value — String型を返す |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` // subkey is "state" — subkeyが"state"の場合、ステータスを返す |
| 4 | RETURN | `return String.class;` // Return String type for state — String型を返す |

**Block 3.5** — ELSE-IF `(key.equals("対応履歴外部接続URL名"))` [l1_taiorrk_out_url_nm] (L444–452)

> URL Name field — the display name for the external connection URL.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` // subkey is "value" — subkeyが"value"の場合 |
| 2 | RETURN | `return String.class;` // Return String type for value — String型を返す |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` // subkey is "state" — subkeyが"state"の場合、ステータスを返す |
| 4 | RETURN | `return String.class;` // Return String type for state — String型を返す |

---

**Block 4** — ELSE-IF (fallback) `(no match)` (L447–448)

> No matching key was found. Return null indicating no known data type for the given item.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property found, return null — 条件に一致するプロパティが存在しない場合は、nullを返す |

---

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `対応履歴外部接続URL番号` | Field (key value) | External Connection URL History Number — item name (項目名) for the URL history record number (item ID: `l1_taiorrk_out_url_no`) |
| `対応履歴外部接続URL種類コード` | Field (key value) | External Connection URL History Type Code — item name for the URL type classification code (item ID: `l1_taiorrk_out_url_sbt_cd`) |
| `対応履歴外部接続URL種類コード名` | Field (key value) | External Connection URL History Type Code Name — item name for the human-readable URL type code name (item ID: `l1_taiorrk_out_url_sbt_cd_nm`) |
| `対応履歴外部接続URL` | Field (key value) | External Connection URL History URL — item name for the external connection URL itself (item ID: `l1_taiorrk_out_url`) |
| `対応履歴外部接続URL名` | Field (key value) | External Connection URL History URL Name — item name for the display name of the external connection URL (item ID: `l1_taiorrk_out_url_nm`) |
| `key` | Parameter | Item name (項目名) — business field identifier used by the X33 framework to look up data type information |
| `subkey` | Parameter | Sub-property key (サブキー) — distinguishes between `"value"` (the actual data) and `"state"` (UI display status) |
| `value` | Subkey | The actual data value of a UI field |
| `state` | Subkey | The display/status metadata of a UI field (e.g., enabled/disabled, visible/hidden) |
| X33 | Framework | Fujitsu Futurity X33 — a Java EE web application framework providing data binding, view models, and screen flow management |
| DBean | Pattern | Data Binding Bean — a view-layer class implementing `X33VDataTypeBeanInterface` that provides type information for data-bound UI fields |
| `String.class` | Return type | Java class literal indicating the field's data type is a String |
| `null` | Return value | Indicates the key has no known data type (unknown/unregistered item) or input validation failed |
| `equalsIgnoreCase` | Method | Case-insensitive string comparison — allows framework invocation with any casing of "value" or "state" |
