# Business Logic — CRW02702SF02DBean.typeModelData() [23 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.CRW02702SF.CRW02702SF02DBean` |
| Layer | Utility / Data Bean (View Layer — `eo.web.webview`) |
| Module | `CRW02702SF` (Package: `eo.web.webview.CRW02702SF`) |

## 1. Role

### CRW02702SF02DBean.typeModelData()

This method implements the **Data Type Resolution** responsibility within the CRW02702SF web screen module. It acts as a type introspection service: given a field identifier (`key`) and an optional sub-key (`subkey`), it returns the Java `Class<?>` representing the expected data type of that field in the UI data model.

The method handles a single service type: the **WebID (WEBID)** data type, which represents the internal item identifier (`l2_web_id`) used to track UI element state on the web screen. This is a simple scalar String-typed field used throughout the form.

The design pattern employed is a **routing/dispatch (type lookup) pattern** — the method branches on the `key` value to determine which data type to resolve, and within each key, further branches on `subkey` to differentiate between value and state metadata.

Its role in the larger system is that of a **shared utility** called by the data type bean interface chain. Other DBeans (`CRW02702SF01DBean`, `CRW02702SF03DBean`, `CRW02702SF04DBean`) and the parent `CRW02702SFBean` all define their own `typeModelData()` methods, forming a consistent interface (`X33VDataTypeBeanInterface`) that the view layer uses to determine the expected type of any form field at runtime. This enables generic data binding, serialization, and validation logic to operate without hardcoding field types.

If the method does not recognize the provided `key`, it returns `null` (no matching type found).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(key, subkey)"])
    CHECK_NULL["key or subkey is null?"]
    RETURN_NULL_1(["return null"])
    FIND_SLASH["separaterPoint = key.indexOf('/')"]
    CHECK_WEBID["key equals 'WEBID'?"]
    CHECK_SUBKEY_VALUE["subkey.equalsIgnoreCase('value')?"]
    CHECK_SUBKEY_STATE["subkey.equalsIgnoreCase('state')?"]
    RETURN_STRING["return String.class"]
    RETURN_NULL_2["return null"]

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| RETURN_NULL_1
    CHECK_NULL -->|No| FIND_SLASH
    FIND_SLASH --> CHECK_WEBID
    CHECK_WEBID -->|No| RETURN_NULL_2
    CHECK_WEBID -->|Yes| CHECK_SUBKEY_VALUE
    CHECK_SUBKEY_VALUE -->|Yes| RETURN_STRING
    CHECK_SUBKEY_VALUE -->|No| CHECK_SUBKEY_STATE
    CHECK_SUBKEY_STATE -->|Yes| RETURN_STRING
    CHECK_SUBKEY_STATE -->|No| RETURN_NULL_2
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (フィールド名) that identifies a UI data field. For this DBean, the recognized value is `"WEBID"`, which represents the internal item identifier (`l2_web_id`) tracking the web element's identity within the screen's data model. The key may contain a slash separator (`/`) for nested item paths (parsed but not used in this DBean's branch). |
| 2 | `subkey` | `String` | The sub-key that further qualifies the field access. Recognized values: `"value"` (to retrieve the actual data value type) and `"state"` (to retrieve the state metadata type). Case-insensitive matching is applied. May be `null` when the caller does not require sub-key differentiation. |

**Instance fields read:** None. This method is entirely stateless — it does not reference any instance fields or external state.

## 4. CRUD Operations / Called Services

This method performs **no data access**. It is a pure type-resolution utility with no database queries, no service component invocations, and no entity operations.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(N/A)* | — | — | — | No CRUD operations — pure in-memory type lookup |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | DBean:CRW02702SFBean | `CRW02702SFBean.typeModelData(key, subkey)` → dispatches to registered DBeans | *(none — pure type lookup)* |
| 2 | DBean:CRW02702SF01DBean | `CRW02702SF01DBean.typeModelData(key, subkey)` — sibling DBean with own type model | *(none)* |
| 3 | DBean:CRW02702SF03DBean | `CRW02702SF03DBean.typeModelData(key, subkey)` — sibling DBean with own type model | *(none)* |
| 4 | DBean:CRW02702SF04DBean | `CRW02702SF04DBean.typeModelData(key, subkey)` — sibling DBean with own type model | *(none)* |

**Notes:**
- This method is part of the `X33VDataTypeBeanInterface` chain. Each DBean in the CRW02702SF module (`01`, `02`, `03`, `04`) implements its own `typeModelData()` to handle different sets of field types.
- The method is NOT directly called by screens or CBS components. Instead, the view framework invokes it through the DBean interface during data binding operations.
- Since `CRW02702SF02DBean` only handles the `"WEBID"` key type, it is one of the simpler DBeans in the module — other DBeans handle more complex nested list types.

## 6. Per-Branch Detail Blocks

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

> Null guard: if either parameter is null, return null immediately. This is the primary entry validation.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key and subkey null check — early termination [-> NO CONSTANT] |

**Block 2** — [ASSIGNMENT] `(key.indexOf("/"))` (L202)

> Parse the key by finding the slash separator position. This supports potential future nested key structures but is unused in this DBean's single branch.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // find first slash position [-> NOT USED in this DBean] |

**Block 3** — [IF/ELSE-IF/ELSE] `(key.equals("WEBID"))` (L205) [ODR_NAIYO_CD_101="WEBID"]

> Check if the key matches the WebID item. "WEBID" represents the internal item identifier (`l2_web_id`) used to track the web element's identity.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("WEBID")` // check for WEBID item type [-> "WEBID" = internal item identifier (l2_web_id)] |
| 2 | SET | `// Data type is String for "WEBID" item (item ID: l2_web_id)` |

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

> If subkey is "value", return String.class — the WebID value is stored as a String.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // WebID value is a String type [-> "value" = actual data value] |

**Block 3.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` (L208) [subkey="state"]

> If subkey is "state", return String.class — the WebID state is also stored as a String.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // state type is String (subkey="state") [-> "state" = metadata state flag] |

**Block 4** — [RETURN] (L213)

> No matching property type found — return null. This is the default case when the key is not "WEBID" or when the subkey doesn't match recognized values.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // no matching property type exists [-> DEFAULT: null for unrecognized keys] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `typeModelData` | Method | Data type resolution — returns the `Class<?>` of a UI field's data type for the view framework |
| `key` | Parameter | Item name — the identifier of a UI data field in the screen's data model |
| `subkey` | Parameter | Sub-key — additional qualifier for field access (e.g., "value" for the data itself, "state" for metadata) |
| WEBID | Item Name | Web ID — internal item identifier (`l2_web_id`) that uniquely identifies a web UI element within the screen |
| `l2_web_id` | Field | Layer 2 Web ID — the technical field name for the WebID, used in the data layer to track element identity |
| separaterPoint | Variable | Slash separator position — the index of the first `/` in the key string, used for nested key path parsing |
| DBean | Abbreviation | Data Bean — a bean implementing `X33VDataTypeBeanInterface` that provides type information for UI fields |
| X33VDataTypeBeanInterface | Interface | Data type bean interface — the contract that all DBeans must implement for the view framework's type introspection |
| value | Subkey | Actual data value — when used as subkey, requests the type of the field's actual content |
| state | Subkey | Metadata state flag — when used as subkey, requests the type of the field's state metadata |
