# Business Logic — CRW03407SF02DBean.typeModelData() [52 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.CRW03407SF.CRW03407SF02DBean` |
| Layer | Controller / Screen Data Bean (Presentation layer — Web MVC DBean) |
| Module | `CRW03407SF` (Package: `eo.web.webview.CRW03407SF`) |

## 1. Role

### CRW03407SF02DBean.typeModelData()

This method acts as a **data-type lookup router** for the CRW03407SF screen (a service contract/change operation screen in the telecom order fulfillment system). Given a business item name (`key`) and a sub-property identifier (`subkey`), it returns the Java `Class<?>` that represents the data type of that sub-property. This enables the framework's data-type binder (which uses `X33VDataTypeBeanInterface`) to perform runtime type checking, validation, and UI rendering decisions.

The method implements a **dispatch/routing design pattern** — it branches on the `key` parameter to determine which business concept is being queried (tab code, tab name, or screen ID), then dispatches to a sub-property check on the `subkey`. Each branch supports three standard sub-properties: `value` (the data value's type), `enable` (the editable-flag type), and `state` (the UI state status type). All three return `String.class` for `value` and `state`, while `enable` returns `Boolean.class`.

This method is a **shared utility within the DBean hierarchy** for the CRW03407SF screen. It does not perform any CRUD operations, external I/O, or business-rule processing — it is purely a metadata resolver. It mirrors the pattern used by sibling DBeans (`CRW03407SF01DBean` through `CRW03407SF09DBean`), each of which defines its own set of routable keys. The parent `CRW03407SFBean` delegates to these per-DBean `typeModelData` methods for list-element type queries, making this method one node in a tree of type-resolvers across the screen's bean hierarchy.

If no matching key-subkey combination is found, the method returns `null`, signaling to the caller that no typed model data is registered for that path.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> CHECK_NULL["Check: key or subkey is null?"]
    CHECK_NULL -->|Yes| RET_NULL_1["Return null"]
    CHECK_NULL -->|No| COMPUTE_SEP["Compute: separaterPoint = key.indexOf('/')"]

    COMPUTE_SEP --> BRANCH_A["Check: key equals \"tabs_code\" (\"タブコード\")"]

    BRANCH_A -->|"Yes (Tab Code, l1_tab_cd)"| SUB_A["Check subkey (case-insensitive)"]
    SUB_A -->|"value"| RET_STRING_A["Return String.class"]
    SUB_A -->|"enable"| RET_BOOL_A["Return Boolean.class"]
    SUB_A -->|"state"| RET_STRING_A2["Return String.class"]
    SUB_A -->|"else"| RET_NULL_2["Return null"]

    BRANCH_A -->|"No"| BRANCH_B["Check: key equals \"tab_name\" (\"タブ名称\")"]

    BRANCH_B -->|"Yes (Tab Name, l1_tab_nm)"| SUB_B["Check subkey (case-insensitive)"]
    SUB_B -->|"value"| RET_STRING_B["Return String.class"]
    SUB_B -->|"enable"| RET_BOOL_B["Return Boolean.class"]
    SUB_B -->|"state"| RET_STRING_B2["Return String.class"]
    SUB_B -->|"else"| RET_NULL_3["Return null"]

    BRANCH_B -->|"No"| BRANCH_C["Check: key equals \"screen_id\" (\"画面ID\")"]

    BRANCH_C -->|"Yes (Screen ID, l1_pg_id)"| SUB_C["Check subkey (case-insensitive)"]
    SUB_C -->|"value"| RET_STRING_C["Return String.class"]
    SUB_C -->|"enable"| RET_BOOL_C["Return Boolean.class"]
    SUB_C -->|"state"| RET_STRING_C2["Return String.class"]
    SUB_C -->|"else"| RET_NULL_4["Return null"]

    BRANCH_C -->|"No"| RET_NULL_5["Return null"]

    RET_NULL_1 --> END(["End"])
    RET_STRING_A --> END
    RET_BOOL_A --> END
    RET_STRING_A2 --> END
    RET_NULL_2 --> END
    RET_STRING_B --> END
    RET_BOOL_B --> END
    RET_STRING_B2 --> END
    RET_NULL_3 --> END
    RET_STRING_C --> END
    RET_BOOL_C --> END
    RET_STRING_C2 --> END
    RET_NULL_4 --> END
    RET_NULL_5 --> END
```

**Branch Summary:**

| Branch | Condition | Key (Business Meaning) | Subkey | Returns |
|--------|-----------|----------------------|--------|---------|
| A | `key.equals("tabs_code")` | Tab Code (Item ID: `l1_tab_cd`) | `value` / `enable` / `state` | `String.class` / `Boolean.class` / `String.class` |
| B | `key.equals("tab_name")` | Tab Name (Item ID: `l1_tab_nm`) | `value` / `enable` / `state` | `String.class` / `Boolean.class` / `String.class` |
| C | `key.equals("screen_id")` | Screen ID (Item ID: `l1_pg_id`) | `value` / `enable` / `state` | `String.class` / `Boolean.class` / `String.class` |
| Default | No match | — | — | `null` |

**Processing notes:**
- Lines 335–338: **Null guard** — Returns `null` if either `key` or `subkey` is `null` (日本語コメント: 「key,subkeyがnullの場合、nullを返す」 — "If key or subkey is null, return null").
- Line 340: Computes the position of the first `/` character in `key` (unused by this DBean's own logic but retained for inheritance).
- Lines 343–360: **Branch A** — Tab Code (`タブコード`), mapped to the screen field `l1_tab_cd`.
- Lines 364–381: **Branch B** — Tab Name (`タブ名称`), mapped to the screen field `l1_tab_nm`.
- Lines 382+: **Branch C** — Screen ID (`画面ID`), mapped to the screen field `l1_pg_id`.
- Final line (384): **Default** — Returns `null` if no key matches (日本語コメント: 「条件に一致するプロパティが存在しない場合は、nullを返す」 — "If no property matches the condition, return null").

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business item identifier. Represents a named screen property such as "tabs_code" (tab code for level-1 navigation), "tab_name" (tab display label), or "screen_id" (screen/page ID). Determines which routing branch the method executes. Values are Japanese-literal keys (`"tabs_code"`, `"tab_name"`, `"screen_id"`) that map to internal item IDs (`l1_tab_cd`, `l1_tab_nm`, `l1_pg_id`). |
| 2 | `subkey` | `String` | The sub-property selector within a key's scope. Tells the method *which* attribute of the item is being queried. Accepts case-insensitive values: `"value"` (the data type of the property's value), `"enable"` (the editable state — always `Boolean`), and `"state"` (the UI rendering state — always `String`). Determines the return type within each key branch. |

**Instance fields / external state read:** None. This method is stateless — it reads only its two parameters and returns a type based purely on the dispatch logic.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no external services, CBS, or SC methods**. It is a pure, in-memory type-resolver with zero side effects.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | (none) | — | — | This method has no data access. It returns only Java `Class` objects for type-binding metadata. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:CRW03407SF (via CRW03407SFBean) | `CRW03407SFBean.typeModelData(key, subkey)` — parent DBean delegates to specific DBean instances for type queries within list items | — (no downstream calls) |
| 2 | Screen:CRW03407SF (via sibling DBeans) | `CRW03407SF01DBean` / `04DBean` / `05DBean` / `06DBean` / `07DBean` / `08DBean` / `09DBean` all define their own `typeModelData` variants; these siblings call `typeModelData` on their contained list elements (e.g., `X33VDataTypeStringBean`, `X33VDataTypeBeanInterface`) | — |

**Notes on call graph:**
- `CRW03407SFBean` (lines 14631–14642) defines the canonical `typeModelData(String key, String subkey)` which serves as the entry point for the screen's type-resolution framework. It delegates to specific DBeans for items stored in `X33VDataTypeList`.
- The `CRW03407SFBean` also processes special key formats (e.g., `//sharedInfoKey` for common-info beans, or `item/index/subProperty` for list-indexed access) by extracting `keyElement` and delegating to the appropriate DBean's `typeModelData`.
- No callers were found that directly invoke `CRW03407SF02DBean.typeModelData` by its fully qualified path. It is accessed indirectly through polymorphism via `X33VDataTypeBeanInterface` and `X33VDataTypeStringBean` contracts.

## 6. Per-Branch Detail Blocks

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

> Guard clause: If either `key` or `subkey` is `null`, return `null` immediately. (Original Japanese: 「key,subkeyがnullの場合、nullを返す」 — "If key or subkey is null, return null")

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if (key == null || subkey == null)` |
| 2 | RETURN | `return null;` |

### Block 2 — EXEC (separator computation) (L340)

> Computes the index of the first `/` character in `key`. This value is stored in a local variable but is **not used** in this DBean's own routing logic (it is retained for potential inheritance or future use).

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

### Block 3 — ELSE-IF (Branch A: Tab Code) (L344)

> The first business branch. Handles the tab-code property (`タブコード`), which maps to item ID `l1_tab_cd` — the code value for the first-level tab in the screen's navigation.
> (Original Japanese: 「データタイプのStringの項目"タブコード"(項目ID:l1_tab_cd)」 — "String data type item 'tab_code' (item ID: l1_tab_cd)")

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if (key.equals("tabs_code"))` |
| 2 | ELSE-IF | **Block 3.1** — `subkey.equalsIgnoreCase("value")` → `return String.class;` [L346] |
| 3 | ELSE-IF | **Block 3.2** — `subkey.equalsIgnoreCase("enable")` → `return Boolean.class;` [L349] |
| 4 | ELSE-IF | **Block 3.3** — `subkey.equalsIgnoreCase("state")` → `return String.class;` [L352] (Original: 「subkeyが"state"の場合、ステータスを返す」 — "When subkey is 'state', return status") |
| 5 | ELSE | Falls through to default return `null` [L384] |

#### Block 3.1 — ELSE-IF (subkey = "value") (L346)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

#### Block 3.2 — ELSE-IF (subkey = "enable") (L349)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return Boolean.class;` |

#### Block 3.3 — ELSE-IF (subkey = "state") (L352)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

### Block 4 — ELSE-IF (Branch B: Tab Name) (L364)

> The second business branch. Handles the tab-name property (`タブ名称`), which maps to item ID `l1_tab_nm` — the display label for the first-level tab.
> (Original Japanese: 「データタイプのStringの項目"タブ名称"(項目ID:l1_tab_nm)」 — "String data type item 'tab_name' (item ID: l1_tab_nm)")

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if (key.equals("tab_name"))` |
| 2 | ELSE-IF | **Block 4.1** — `subkey.equalsIgnoreCase("value")` → `return String.class;` [L366] |
| 3 | ELSE-IF | **Block 4.2** — `subkey.equalsIgnoreCase("enable")` → `return Boolean.class;` [L369] |
| 4 | ELSE-IF | **Block 4.3** — `subkey.equalsIgnoreCase("state")` → `return String.class;` [L372] (Same comment as Block 3.3) |
| 5 | ELSE | Falls through to default return `null` [L384] |

#### Block 4.1 — ELSE-IF (subkey = "value") (L366)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

#### Block 4.2 — ELSE-IF (subkey = "enable") (L369)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return Boolean.class;` |

#### Block 4.3 — ELSE-IF (subkey = "state") (L372)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

### Block 5 — ELSE-IF (Branch C: Screen ID) (L382)

> The third and final business branch. Handles the screen-ID property (`画面ID`), which maps to item ID `l1_pg_id` — the screen/page identifier.
> (Original Japanese: 「データタイプのStringの項目"画面ID"(項目ID:l1_pg_id)」 — "String data type item 'screen_id' (item ID: l1_pg_id)")

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if (key.equals("screen_id"))` |
| 2 | ELSE-IF | **Block 5.1** — `subkey.equalsIgnoreCase("value")` → `return String.class;` [L384] |
| 3 | ELSE-IF | **Block 5.2** — `subkey.equalsIgnoreCase("enable")` → `return Boolean.class;` [L387] |
| 4 | ELSE-IF | **Block 5.3** — `subkey.equalsIgnoreCase("state")` → `return String.class;` [L390] (Same comment as Blocks 3.3 and 4.3) |

#### Block 5.1 — ELSE-IF (subkey = "value") (L384)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

#### Block 5.2 — ELSE-IF (subkey = "enable") (L387)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return Boolean.class;` |

#### Block 5.3 — ELSE-IF (subkey = "state") (L390)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

### Block 6 — RETURN (default / no-match) (L384)

> If no key matches any of the three branches (`"tabs_code"`, `"tab_name"`, `"screen_id"`), return `null` to indicate no registered type model data exists for the given key-subkey pair.
> (Original Japanese: 「条件に一致するプロパティが存在しない場合は、nullを返す」 — "If no property matches the condition, return null")

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `l1_tab_cd` | Field | Level-1 Tab Code — internal identifier for the first-level navigation tab's code value |
| `l1_tab_nm` | Field | Level-1 Tab Name — display label text for the first-level navigation tab |
| `l1_pg_id` | Field | Level-1 Page ID — the screen/page identifier within the application's navigation hierarchy |
| `key` | Parameter | Business item identifier — the named property whose type is being queried (e.g., tab code, tab name, screen ID) |
| `subkey` | Parameter | Sub-property selector — specifies which attribute of the item to resolve (`value` for the data, `enable` for editability, `state` for UI state) |
| DBean | Acronym | Data Bean — a presentation-layer bean in the MVC architecture that holds screen data, manages UI state, and delegates to CBS/SC components |
| CRW03407SF | Module | Service Contract Change — a screen module for managing changes to existing service contracts in the telecom order fulfillment system |
| X33VDataTypeBeanInterface | Interface | Data type bean interface — the contract that all type-resolvable screen beans implement, enabling framework-level type introspection |
| X33VDataTypeList | Class | Data type list — a list container holding screen view items that implement `X33VDataTypeBeanInterface`, enabling per-item type queries |
| X33VDataTypeStringBean | Class | Data type string bean — a DBean variant for String-type list items that provides type resolution for string fields |
| CBS | Acronym | Common Business Service — a component in the architecture that handles shared business logic and screen-level workflows |
| SC | Acronym | Service Component — a lower-level component that interfaces with the data access layer (DAO/SQL) |
| MVC | Acronym | Model-View-Controller — the architectural pattern used by the web application framework |
