# Business Logic - KKW00844SF02DBean.typeModelData() [33 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00844SF.KKW00844SF02DBean` |
| Layer | Bean (Data Binding / Web View) |
| Module | `KKW00844SF` (Package: `eo.web.webview.KKW00844SF`) |

## 1. Role

### KKW00844SF02DBean.typeModelData()

This method implements the data type resolution contract for the X33V framework's typed data binding system. In the K-Opticom smart link premium registration confirmation screen (KKW00844), complex form data is structured as nested lists where each row in a repeating section is an instance of a typed bean. The `typeModelData` method serves as the type query endpoint that the X33V framework calls at runtime to determine which Java class a given field should be instantiated as — enabling the framework's automatic data binding, rendering, and validation.

Specifically, this method handles the **movement reason list** (`異動理由リスト`, item ID: `ido_rsn_list`) data type. The movement reason is a repeatable section on the screen where users can enter one or more reasons why a service contract was changed, suspended, or moved. For each row in this list, the bean holds three fields: `ido_rsn_cd` (movement reason code), `ido_rsn_cd_value` (the display value), `ido_rsn_cd_state` (input state/validation status), `ido_rsn_memo` (movement reason memo/notes), `ido_rsn_memo_value`, and `ido_rsn_memo_state`. All of these fields resolve to `String.class`.

The method follows the **routing/dispatch pattern**: it receives a hierarchical key name and subkey name, then branches through a cascade of conditional checks to return the appropriate Java type. It implements the `X33VDataTypeBeanInterface` contract, which is a core interface in the Fujitsu Futurity X33 framework for typed list data binding. It does NOT perform any CRUD operations, service calls, or business logic beyond type resolution — it is a pure utility method that supports the framework's data binding infrastructure. If no matching field is found, it returns `null`, signaling that the field is not part of this bean's model.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(key, subkey)"])
    NULL_CHECK{"key == null<br/>|| subkey == null"}
    RETURN_NULL(["return null"])
    SEPARATOR["int separaterPoint = key.indexOf('/')"]
    KEY_1{"key equals<br/>\"異動理由コード\""}
    SUBKEY_VALUE{"subkey equalsIgnoreCase<br/>\"value\""}
    RETURN_S1(["return String.class"])
    SUBKEY_STATE{"subkey equalsIgnoreCase<br/>\"state\""}
    RETURN_S2(["return String.class"])
    KEY_2{"key equals<br/>\"異動理由メモ\""}
    SUBKEY_VALUE_2{"subkey equalsIgnoreCase<br/>\"value\""}
    RETURN_S3(["return String.class"])
    SUBKEY_STATE_2{"subkey equalsIgnoreCase<br/>\"state\""}
    RETURN_S4(["return String.class"])
    RETURN_NULL_2(["return null"])

    START --> NULL_CHECK
    NULL_CHECK -->|true| RETURN_NULL
    NULL_CHECK -->|false| SEPARATOR
    SEPARATOR --> KEY_1
    KEY_1 -->|true| SUBKEY_VALUE
    KEY_1 -->|false| KEY_2
    SUBKEY_VALUE -->|true| RETURN_S1
    SUBKEY_VALUE -->|false| SUBKEY_STATE
    SUBKEY_STATE -->|true| RETURN_S2
    SUBKEY_STATE -->|false| KEY_2
    KEY_2 -->|true| SUBKEY_VALUE_2
    KEY_2 -->|false| RETURN_NULL_2
    SUBKEY_VALUE_2 -->|true| RETURN_S3
    SUBKEY_VALUE_2 -->|false| SUBKEY_STATE_2
    SUBKEY_STATE_2 -->|true| RETURN_S4
    SUBKEY_STATE_2 -->|false| RETURN_NULL_2
    RETURN_S1 --> END_NODE(["Return Class"])
    RETURN_S2 --> END_NODE
    RETURN_S3 --> END_NODE
    RETURN_S4 --> END_NODE
    RETURN_NULL --> END_NODE
    RETURN_NULL_2 --> END_NODE
```

**Branch Summary:**

| Branch | Condition | Subkey | Returns |
|--------|-----------|--------|---------|
| Guard | `key` or `subkey` is null | N/A | `null` |
| 1A | `key` = "異動理由コード" (Movement Reason Code) | `"value"` | `String.class` |
| 1B | `key` = "異動理由コード" (Movement Reason Code) | `"state"` | `String.class` |
| 2A | `key` = "異動理由メモ" (Movement Reason Memo) | `"value"` | `String.class` |
| 2B | `key` = "異動理由メモ" (Movement Reason Memo) | `"state"` | `String.class` |
| Default | No match found | N/A | `null` |

**Note:** The `separaterPoint` variable is computed but never used — it appears to be a vestige from a version that supported hierarchical key paths (e.g., `"parent/child"`), but the current implementation does not utilize it.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name (item name) within the bean's data model. It identifies which business field the caller is querying. For this method, valid values are `"異動理由コード"` (Movement Reason Code) and `"異動理由メモ"` (Movement Reason Memo). The key is case-sensitive and must match the Japanese string exactly. |
| 2 | `subkey` | `String` | The sub-field specifier that distinguishes between the value, state, and other properties of the field identified by `key`. For both supported keys, valid subkey values are `"value"` (the data value) and `"state"` (the input state/validation flag). The subkey comparison is case-insensitive (`equalsIgnoreCase`). |

**Instance fields read by this method:** None. The method is stateless — it reads only the parameters and returns a type based on conditionals. It does not access any protected instance fields (`ido_rsn_cd_update`, `ido_rsn_cd_value`, `ido_rsn_cd_state`, `ido_rsn_memo_update`, `ido_rsn_memo_value`, `ido_rsn_memo_state`, `index`).

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It is a pure type-resolution utility with no external dependencies, no service component (SC) calls, no CBS calls, and no database access. It does not read from or write to any entity or table.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A | N/A | N/A | N/A | No CRUD operations — pure type resolution utility method |

## 5. Dependency Trace

This method is called by the X33V framework's data binding infrastructure when the `KKW00844SFBean` processes the "異動理由リスト" (Movement Reason List) data type. It is not directly called by any screen or CBS class in the codebase — instead, it is invoked through the framework's typed data binding mechanism.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00844 | `KKW00844SFBean` (framework typed data binding dispatch) -> `KKW00844SF02DBean.typeModelData` | N/A (no CRUD) |

**Notes on call chain:**
- The parent bean `KKW00844SFBean` is the main screen data bean for the "Smart Link Premium Registration Confirmation" screen (KKW00844).
- When the framework needs to determine the type of a field within the "異動理由リスト" (Movement Reason List) repeating section, it invokes `typeModelData()` on the bean instances.
- No direct callers were found via source-level code search — the invocation is handled by the X33V framework's runtime data binding dispatcher.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) `(key == null || subkey == null)` (L245)

> Null guard: if either parameter is null, return null immediately. This prevents NullPointerException in subsequent string operations.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key or subkey is null — no type to resolve |

**Block 2** — EXEC (separator computation) (L248)

> Computes the position of "/" in the key string. This variable is assigned but never used — likely a vestige from a hierarchical key path implementation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Unused — reserved for hierarchical key parsing |

**Block 3** — IF/ELSE-IF (field routing) `(key checks)` (L251)

> Routes to the appropriate field's type resolution based on the `key` parameter value. Two field types are supported: "異動理由コード" (Movement Reason Code) and "異動理由メモ" (Movement Reason Memo). Each field has two subkeys: "value" and "state".

### Block 3.1 — IF (`key.equals("異動理由コード")`) `"異動理由コード" = "Movement Reason Code"` (L251)

> Handles the movement reason code field (corresponds to item ID `ido_rsn_cd`). This is the classification code that determines what type of change/movement was made to the service contract.

#### Block 3.1.1 — IF (`subkey.equalsIgnoreCase("value")`) (L252)

> Returns `String.class` for the movement reason code's display value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // Movement Reason Code value field |

#### Block 3.1.2 — ELSE-IF (`subkey.equalsIgnoreCase("state")`) (L255)

> Returns `String.class` for the movement reason code's input state. The state field tracks whether the input is valid, modified, or in a validation error state.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // Movement Reason Code state field |

### Block 3.2 — ELSE-IF (`key.equals("異動理由メモ")`) `"異動理由メモ" = "Movement Reason Memo"` (L260)

> Handles the movement reason memo field (corresponds to item ID `ido_rsn_memo`). This is a free-text field where users can enter additional notes about why a service contract was changed.

#### Block 3.2.1 — IF (`subkey.equalsIgnoreCase("value")`) (L261)

> Returns `String.class` for the movement reason memo's text value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // Movement Reason Memo value field |

#### Block 3.2.2 — ELSE-IF (`subkey.equalsIgnoreCase("state")`) (L264)

> Returns `String.class` for the movement reason memo's input state.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // Movement Reason Memo state field |

**Block 4** — RETURN (default case) (L268)

> No matching field was found for the given key. Return null to signal that this bean does not handle the requested field.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property — field not supported by this bean |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `異動理由コード` | Field | Movement Reason Code — classifies the type of change or movement made to a service contract |
| `異動理由メモ` | Field | Movement Reason Memo — free-text field for additional notes about a service contract change |
| `ido_rsn_cd` | Field | Movement Reason Code item ID — internal field name for the movement reason code |
| `ido_rsn_cd_value` | Field | Movement Reason Code value — the display/displayed value of the movement reason code |
| `ido_rsn_cd_state` | Field | Movement Reason Code state — tracks input/validation state of the movement reason code field |
| `ido_rsn_memo` | Field | Movement Reason Memo item ID — internal field name for the movement reason memo |
| `ido_rsn_memo_value` | Field | Movement Reason Memo value — the text content of the movement reason memo |
| `ido_rsn_memo_state` | Field | Movement Reason Memo state — tracks input/validation state of the movement reason memo field |
| `ido_rsn_list` | Field | Movement Reason List item ID — the repeating list that contains movement reason entries |
| KKW00844 | Screen ID | Smart Link Premium Registration Confirmation screen — the screen that uses this bean |
| X33V | Acronym | Fujitsu Futurity X33 Value — the web application framework providing typed data binding |
| X33VDataTypeBeanInterface | Interface | Framework interface that requires `typeModelData()` for typed data binding resolution |
| X33VListedBeanInterface | Interface | Framework interface that requires list management methods (`addListDataInstance`, etc.) |
| Data Type Bean | Pattern | A bean that implements `X33VDataTypeBeanInterface` to serve as a row type in a repeating list |
| Smart Link | Business term | A bundled telecommunications service offering (fiber internet + mobile + TV) from K-Opticom |
| premium | Business term | The premium-tier registration/confirmation screen for Smart Link bundled services |
| subkey | Parameter | The sub-field specifier ("value" or "state") that distinguishes properties of a field |
| value | Subkey | Indicates the data value property of a field |
| state | Subkey | Indicates the input validation/display state property of a field |
| separatedPoint | Local var | Unused variable — computes "/" position in key for potential hierarchical key path support |
