# Business Logic — KKW01033SF01DBean.typeModelData() [131 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01033SF.KKW01033SF01DBean` |
| Layer | Utility / Data Bean (Web-layer type introspection) |
| Module | `KKW01033SF` (Package: `eo.web.webview.KKW01033SF`) |

## 1. Role

### KKW01033SF01DBean.typeModelData()

This method serves as the **central type-introspection router** for the KKW01033SF screen's data-binding framework. Given a field name (`key`) and a sub-key (`subkey`), it returns the Java `Class<?>` type that the UI framework should use to interpret the data associated with that field. It enables the screen's generic UI engine to resolve field types at runtime without hard-coding type information in the view layer.

The method implements a **dispatch/routing design pattern**: it branches on a fixed set of known field names (written in Japanese as display labels) and returns `String.class` for all scalar fields and `Integer.class` for list-count queries on the "transfer reason code" (異動理由コード) field. It also delegates to a nested bean's own `typeModelData` method when the sub-key references a specific element within the transfer reason code list, enabling hierarchical type introspection.

In the broader system, this method acts as a **shared utility** called by the screen's data-binding infrastructure (e.g., the generic UI renderer or form population logic). It abstracts away field-type resolution so that the UI layer can query any supported field's type uniformly via a single `typeModelData(key, subkey)` call, rather than maintaining type mappings across multiple UI classes.

The method handles **10 field categories**: SYSID (system ID), service contract number, service contract detail number, transfer classification (異動区分), transfer reason code (異動理由コード), application number (申込番号), application detail number (申込明細番号), popup mode (ポップアップモード), transfer classification screen transition pattern (異動区分選択画面遷移パターン), and external system code (外部システムコード). All fields except transfer reason code return `String.class` for both "value" and "state" sub-keys. The transfer reason code field is a special compound case: it supports an index query (via `key.substring(separaterPoint + 1)`) that can return `Integer.class` for list size (`*`) or delegate to individual list element type introspection.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> IS_NULL{"key == null<br/>|| subkey == null"}
    IS_NULL -->|true| R_NULL(["return null"])
    IS_NULL -->|false| PROCESS["Resolve key branch by branch"]

    PROCESS --> BR1["Branch 1: key = SYSID"]
    BR1 --> BR1_SUB{"subkey"}
    BR1_SUB -->|"value"| BR1_R1["return String.class"]
    BR1_SUB -->|"state"| BR1_R2["return String.class"]
    BR1_SUB -->|"other"| BR1_R3["continue"]

    PROCESS --> BR2["Branch 2: key = サービス契約番号"]
    BR2 --> BR2_SUB{"subkey"}
    BR2_SUB -->|"value"| BR2_R1["return String.class"]
    BR2_SUB -->|"state"| BR2_R2["return String.class"]
    BR2_SUB -->|"other"| BR2_R3["continue"]

    PROCESS --> BR3["Branch 3: key = サービス契約内訳番号"]
    BR3 --> BR3_SUB{"subkey"}
    BR3_SUB -->|"value"| BR3_R1["return String.class"]
    BR3_SUB -->|"state"| BR3_R2["return String.class"]
    BR3_SUB -->|"other"| BR3_R3["continue"]

    PROCESS --> BR4["Branch 4: key = 異動区分"]
    BR4 --> BR4_SUB{"subkey"}
    BR4_SUB -->|"value"| BR4_R1["return String.class"]
    BR4_SUB -->|"state"| BR4_R2["return String.class"]
    BR4_SUB -->|"other"| BR4_R3["continue"]

    PROCESS --> BR5["Branch 5: key = 異動理由コード"]
    BR5 --> BR5_SUB["key = key.substring<br/>after /"]
    BR5_SUB --> BR5_STAR{"key equals *"}
    BR5_STAR -->|true| BR5_INT["return Integer.class"]
    BR5_STAR -->|false| BR5_IDX["Integer.valueOf key"]
    BR5_IDX --> BR5_NFE["NumberFormatException"]
    BR5_NFE --> R_NULL_2["return null"]
    BR5_IDX --> BR5_CHECK{"index valid?"}
    BR5_CHECK -->|no| R_NULL_3["return null"]
    BR5_CHECK -->|yes| BR5_DELEGATE["X33VDataTypeStringBean<br/>.typeModelData subkey"]

    PROCESS --> BR6["Branch 6: key = 申込番号"]
    BR6 --> BR6_SUB{"subkey"}
    BR6_SUB -->|"value"| BR6_R1["return String.class"]
    BR6_SUB -->|"state"| BR6_R2["return String.class"]
    BR6_SUB -->|"other"| BR6_R3["continue"]

    PROCESS --> BR7["Branch 7: key = 申込明細番号"]
    BR7 --> BR7_SUB{"subkey"}
    BR7_SUB -->|"value"| BR7_R1["return String.class"]
    BR7_SUB -->|"state"| BR7_R2["return String.class"]
    BR7_SUB -->|"other"| BR7_R3["continue"]

    PROCESS --> BR8["Branch 8: key = ポップアップモード"]
    BR8 --> BR8_SUB{"subkey"}
    BR8_SUB -->|"value"| BR8_R1["return String.class"]
    BR8_SUB -->|"state"| BR8_R2["return String.class"]
    BR8_SUB -->|"other"| BR8_R3["continue"]

    PROCESS --> BR9["Branch 9: key = 異動区分選択画面遷移パターン"]
    BR9 --> BR9_SUB{"subkey"}
    BR9_SUB -->|"value"| BR9_R1["return String.class"]
    BR9_SUB -->|"state"| BR9_R2["return String.class"]
    BR9_SUB -->|"other"| BR9_R3["continue"]

    PROCESS --> BR10["Branch 10: key = 外部システムコード"]
    BR10 --> BR10_SUB{"subkey"}
    BR10_SUB -->|"value"| BR10_R1["return String.class"]
    BR10_SUB -->|"state"| BR10_R2["return String.class"]
    BR10_SUB -->|"other"| BR10_R3["continue"]

    R_NULL_2 --> R_NULL_5(["return null"])
    R_NULL_3 --> R_NULL_5
    R_NULL --> R_NULL_5
    BR1_R3 --> R_NULL_5
    BR2_R3 --> R_NULL_5
    BR3_R3 --> R_NULL_5
    BR4_R3 --> R_NULL_5
    BR6_R3 --> R_NULL_5
    BR7_R3 --> R_NULL_5
    BR8_R3 --> R_NULL_5
    BR9_R3 --> R_NULL_5
    BR10_R3 --> R_NULL_5
    BR5_DELEGATE --> R_NULL_5
```

**Processing flow:**

1. **Null guard** (L658-L661): If either `key` or `subkey` is `null`, return `null` immediately. This prevents `NullPointerException` in subsequent string comparisons.

2. **Separator index resolution** (L663): Compute `separaterPoint` as the index of the first `/` character in `key`. This is only used in the transfer reason code branch to extract an index or wildcard from the key string (e.g., `"異動理由コード/0"` or `"異動理由コード/*"`).

3. **Branch dispatch** (L665-L780): For each of the 10 field categories, the method checks if `key` matches the expected Japanese display label. If it matches:
   - If `subkey` is `"value"` (case-insensitive) or `"state"` (case-insensitive), return `String.class`. These sub-keys represent the data value and a UI state flag, respectively.
   - If `subkey` is something else, the method falls through to the next `else-if` branch (which ultimately reaches the final `return null`).

4. **Special branch — Transfer Reason Code (異動理由コード)** (L696-L732): This is the only field that supports index-based access. After the initial `key.equals` match:
   - The key is re-sliced via `substring` to extract the portion after the `/` separator.
   - If the extracted key is `*`, return `Integer.class` (indicating the caller wants the list size).
   - Otherwise, attempt to parse the extracted key as an `int` index. If parsing fails (`NumberFormatException`), return `null`.
   - Validate that the index is within bounds (`0 <= index < list.size()`). If out of bounds, return `null`.
   - Otherwise, retrieve the `X33VDataTypeStringBean` at the given index from `ido_rsn_cd_list` and delegate to its own `typeModelData(subkey)` method.

5. **Fallback** (L784): If no key branch matches, return `null`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name (display label in Japanese) of the data element whose type is being queried. Possible values correspond to one of 10 known field labels: `SYSID` (system identifier), `サービス契約番号` (service contract number), `サービス契約内訳番号` (service contract detail number), `異動区分` (transfer classification), `異動理由コード` (transfer reason code — may include a suffix `/0`, `/1`, ..., `/*` for list element access), `申込番号` (application number), `申込明細番号` (application detail number), `ポップアップモード` (popup mode), `異動区分選択画面遷移パターン` (transfer classification selection screen transition pattern), or `外部システムコード` (external system code). The value of `key` determines which branch of type resolution is executed. |
| 2 | `subkey` | `String` | The property of the field being queried. Accepted values are `"value"` (to get the data type for the field's value) and `"state"` (to get the data type for a UI state flag associated with the field). Both resolve to `String.class`. This parameter is case-insensitive. For the transfer reason code branch, `subkey` is passed through to the delegated `X33VDataTypeStringBean.typeModelData(subkey)` call. |

**Instance fields / external state read:**

| No | Field Name | Type | Business Description |
|----|-----------|------|---------------------|
| 1 | `ido_rsn_cd_list` | `X33VDataTypeList` | The list of transfer reason code entries. Used in the transfer reason code branch to access individual elements by index. Each element is an `X33VDataTypeStringBean` providing type introspection for that list item. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeStringBean.typeModelData` | KKW01033SF01DBean | - | Delegates type introspection to a nested list element's `typeModelData(String)` method for the transfer reason code sub-index. |

This method performs **no direct database operations** (no CRUD). It is a pure type-resolution utility. Its only method call is a delegation to `X33VDataTypeStringBean.typeModelData(subkey)`, which is a same-layer data bean method (not an SC or CBS).

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Utility:KKW01033SF01DBean.typeModelData | `KKW01033SF01DBean.typeModelData(String key, String subkey)` | N/A — this method is the leaf type-introspection utility |

Note: The pre-computed caller analysis shows that this method is called directly from `KKW01033SF01DBean.typeModelData()` (a self-reference likely from the code graph's intra-class call tracking). The method is not directly called by any visible screen class or CBS in the current code base scope. It is used internally by the screen's data-binding framework, which queries this method to resolve field types generically. The `addListDataInstance(String key)` method in the same class interacts with the same `ido_rsn_cd_list` data structure but does not call `typeModelData` directly.

## 6. Per-Branch Detail Blocks

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

> Guard clause: if either parameter is null, return null to prevent NPE in subsequent comparisons.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key or subkey is null, cannot resolve type |

**Block 2** — EXEC (separator index resolution) `key.indexOf("/")` (L663)

> Compute the position of the first "/" in the key string. Used only by the transfer reason code branch to extract an index or wildcard suffix.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // position of first slash separator |

**Block 3** — IF-ELSE-IF (field dispatch) `(key.equals("SYSID"))` (L665)

> First branch: system identifier field (SYSID). Supports "value" and "state" sub-keys, both returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("SYSID")` // Field ID: sysid — system identifier |
| 1.1 | IF-ELSE | `subkey.equalsIgnoreCase("value")` (L667) |
| 1.1.1 | RETURN | `return String.class;` // SYSID value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L670) |
| 1.2.1 | RETURN | `return String.class;` // SYSID state is a string (state flag) |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 4** — ELSE-IF (service contract number) `(key.equals("サービス契約番号"))` (L675)

> Second branch: service contract number (サービス契約番号). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス契約番号")` // Field ID: svc_kei_no — service contract number |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L676) |
| 1.1.1 | RETURN | `return String.class;` // service contract number value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L679) |
| 1.2.1 | RETURN | `return String.class;` // service contract number state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 5** — ELSE-IF (service contract detail number) `(key.equals("サービス契約内訳番号"))` (L683)

> Third branch: service contract detail number (サービス契約内訳番号). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス契約内訳番号")` // Field ID: svc_kei_ucwk_no — service contract detail number |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L684) |
| 1.1.1 | RETURN | `return String.class;` // service contract detail number value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L687) |
| 1.2.1 | RETURN | `return String.class;` // service contract detail number state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 6** — ELSE-IF (transfer classification) `(key.equals("異動区分"))` (L691)

> Fourth branch: transfer classification (異動区分). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("異動区分")` // Field ID: ido_div — transfer classification |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L692) |
| 1.1.1 | RETURN | `return String.class;` // transfer classification value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L695) |
| 1.2.1 | RETURN | `return String.class;` // transfer classification state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 7** — ELSE-IF (transfer reason code — compound index branch) `(key.equals("異動理由コード"))` (L698)

> Fifth branch: transfer reason code (異動理由コード). This is the only field supporting list element access. The key includes a `/index` suffix. Supports wildcard `*` for list size and integer index for element-level type introspection.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("異動理由コード")` // Field ID: ido_rsn_cd — transfer reason code |
| 1.1 | SET | `key = key.substring(separaterPoint + 1);` // Extract portion after "/" — e.g., "0" from "異動理由コード/0" [-> extracts the index or wildcard] |
| 1.2 | IF | `key.equals("*")` (L703) // Wildcard: request list count |
| 1.2.1 | RETURN | `return Integer.class;` // List size is an integer |
| 1.3 | TRY-CATCH | `Integer.valueOf(key)` (L707) |
| 1.3.1 | SET | `tmpIndexInt = Integer.valueOf(key);` // Parse extracted key as integer index |
| 1.3.2 | CATCH | `NumberFormatException e` (L711) |
| 1.3.2.1 | RETURN | `return null;` // Key is not a valid numeric string, cannot resolve index |
| 1.4 | IF | `tmpIndexInt == null` (L714) |
| 1.4.1 | RETURN | `return null;` // Parsed index is null |
| 1.5 | IF | `tmpIndex < 0 || tmpIndex >= ido_rsn_cd_list.size()` (L718) |
| 1.5.1 | RETURN | `return null;` // Index out of bounds — list does not contain this position |
| 1.6 | CALL | `((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).typeModelData(subkey);` // Delegate to element bean's typeModelData |

**Block 8** — ELSE-IF (application number) `(key.equals("申込番号"))` (L736)

> Sixth branch: application number (申込番号). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("申込番号")` // Field ID: mskm_no — application number |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L737) |
| 1.1.1 | RETURN | `return String.class;` // Application number value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L740) |
| 1.2.1 | RETURN | `return String.class;` // Application number state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 9** — ELSE-IF (application detail number) `(key.equals("申込明細番号"))` (L744)

> Seventh branch: application detail number (申込明細番号). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("申込明細番号")` // Field ID: mskm_dtl_no — application detail number |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L745) |
| 1.1.1 | RETURN | `return String.class;` // Application detail number value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L748) |
| 1.2.1 | RETURN | `return String.class;` // Application detail number state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 10** — ELSE-IF (popup mode) `(key.equals("ポップアップモード"))` (L752)

> Eighth branch: popup mode (ポップアップモード). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("ポップアップモード")` // Field ID: popup_mode — popup mode flag |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L753) |
| 1.1.1 | RETURN | `return String.class;` // Popup mode value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L756) |
| 1.2.1 | RETURN | `return String.class;` // Popup mode state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 11** — ELSE-IF (transfer classification screen transition pattern) `(key.equals("異動区分選択画面遷移パターン"))` (L761)

> Ninth branch: transfer classification selection screen transition pattern (異動区分選択画面遷移パターン). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("異動区分選択画面遷移パターン")` // Field ID: ido_div_seni_ptn — transfer classification selection screen transition pattern |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L762) |
| 1.1.1 | RETURN | `return String.class;` // Transition pattern value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L765) |
| 1.2.1 | RETURN | `return String.class;` // Transition pattern state is a string |
| 1.3 | ELSE | (fall-through to next else-if) |

**Block 12** — ELSE-IF (external system code — ANK-2693-00-00 update) `(key.equals("外部システムコード"))` (L770)

> Tenth branch: external system code (外部システムコード). Added via ANK-2693-00-00 ordering project (STEP 2). Same value/state pattern returning String.class.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("外部システムコード")` // Field ID: syscd — external system code (ANK-2693-00-00 STEP 2) |
| 1.1 | IF | `subkey.equalsIgnoreCase("value")` (L771) |
| 1.1.1 | RETURN | `return String.class;` // External system code value is a string |
| 1.2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` (L774) |
| 1.2.1 | RETURN | `return String.class;` // External system code state is a string |
| 1.3 | ELSE | (fall-through to final return null) |

**Block 13** — RETURN (fallback) (L784)

> No matching field was found. Return null to indicate the field is not a recognized data element.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching property found for the given key |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `SYSID` | Field | System Identifier — internal system-level unique identifier for a record |
| `svc_kei_no` | Field | Service Contract Number — the primary key identifying a service contract |
| `svc_kei_ucwk_no` | Field | Service Contract Detail Number — sub-level identifier for service contract line items |
| `ido_div` | Field | Transfer Classification — categorizes the type of service change/movement (e.g., activation, deactivation, modification) |
| `ido_rsn_cd` | Field | Transfer Reason Code — the reason code for a service transfer/movement; stored as a list (`ido_rsn_cd_list`) supporting multi-element access |
| `ido_rsn_cd_list` | Field | Transfer Reason Code List — an `X33VDataTypeList` containing `X33VDataTypeStringBean` elements, each representing one transfer reason code entry |
| `ido_div_seni_ptn` | Field | Transfer Classification Selection Screen Transition Pattern — determines how the UI navigates to the transfer classification selection screen |
| `mskm_no` | Field | Application Number — the identifier for a customer application/order |
| `mskm_dtl_no` | Field | Application Detail Number — sub-level identifier for application line items |
| `popup_mode` | Field | Popup Mode — a flag controlling popup window behavior in the UI |
| `syscd` | Field | External System Code — identifier for an external system integration point |
| `X33VDataTypeStringBean` | Class | String data type bean — a nested data bean providing type introspection (via `typeModelData`) for individual string-typed list elements |
| `X33VDataTypeList` | Class | Typed list container — a generic list wrapper holding `X33VDataTypeStringBean` elements |
| ANK-2693-00-00 | Project | Ordering project (STEP 2) — an internal project code referencing the ordering enhancement that added the external system code field |
| `value` | Sub-key | Requested property: the data value type of the field |
| `state` | Sub-key | Requested property: the UI state flag type of the field |
