# Business Logic — KKW02516SF01DBean.typeModelData() [137 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA16801SF.KKW02516SF01DBean` |
| Layer | CC/Common Component (Data Bean within Web View layer) |
| Module | `KKA16801SF` (Package: `eo.web.webview.KKA16801SF`) |

## 1. Role

### KKW02516SF01DBean.typeModelData()

This method implements a **type routing and dispatch** pattern for the KKA16801SF screen's data model metadata system. Given a field name (`key`) and a metadata attribute (`subkey`), it returns the Java `Class<?>` that represents the data type for that field — enabling the screen framework to understand the type signature of each input field without hardcoding type information.

The method handles **nine distinct business field categories**: system ID (`sysid`), service contract number (`サービス契約番号`), transfer classification (`異動区分`), transfer reason code (`異動理由コード`), transfer reason memo (`異動理由メモ`), option service contract number (`オプションサービス契約番号`), processing classification (`処理区分`), application number (`申請番号`), and application detail number (`申請明細番号`). Each category supports standard metadata queries via the `subkey` parameter — specifically requesting `"value"` to get the primary data type, or `"state"` to get the status type (both resolve to `String.class` for simple fields).

For **indexed list fields** — `異動理由コード` (Transfer Reason Code) and `オプションサービス契約番号` (Option Service Contract Number) — the method supports additional routing: if `subkey` is `"*"` it returns `Integer.class` (indicating the list's element count type); if `subkey` is a numeric string it delegates to the individual list item's `typeModelData()` method via `X33VDataTypeStringBean`, enabling per-element type introspection. This two-tier type lookup pattern allows the framework to query both the overall field type and the type of a specific list entry.

The method serves as a **shared metadata dispatcher** within the `KKA16801SF` screen's data bean layer. It is the type-equivalent of a `loadModelData` / `storeModelData` dispatch method, providing the screen's MVC framework with the information needed to bind HTML form inputs to the correct Java types during page rendering and form submission.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> CHECK_NULL["Check: key == null or subkey == null?"]
    CHECK_NULL -->|Both non-null| FIND_SEP["Find '/' in key"]
    CHECK_NULL -->|null check| NULL_RETURN["Return null"]

    FIND_SEP --> SYSID["Key == 'sysid'?"]
    SYSID -->|No| SVC_KEI["Key == 'サービス契約番号'?"]
    SYSID -->|Yes| SYSID_VALUE["subkey == 'value' or 'state'?"]
    SYSID_VALUE -->|Yes| STRING_RET1["Return String.class"]

    SVC_KEI -->|No| IDO_DIV["Key == '異動区分'?"]
    SVC_KEI -->|Yes| SVC_VALUE["subkey == 'value' or 'state'?"]
    SVC_VALUE -->|Yes| STRING_RET2["Return String.class"]

    IDO_DIV -->|No| IDO_RSN_CD["Key == '異動理由コード'?"]
    IDO_DIV -->|Yes| IDO_VALUE["subkey == 'value' or 'state'?"]
    IDO_VALUE -->|Yes| STRING_RET3["Return String.class"]

    IDO_RSN_CD -->|No| IDO_RSN_MEMO["Key == '異動理由メモ'?"]
    IDO_RSN_CD -->|Yes| EXTRACT_INDEX["Extract index from key"]
    EXTRACT_INDEX --> CHECK_ASTERISK["Index == '*' ?"]
    CHECK_ASTERISK -->|Yes| INTEGER_RET["Return Integer.class"]
    CHECK_ASTERISK -->|No| PARSE_INDEX["Parse index as Integer"]
    PARSE_INDEX --> PARSE_ERROR["NumberFormatException ?"]
    PARSE_ERROR -->|Yes| NULL_RET1["Return null"]
    PARSE_ERROR -->|No| BOUNDS_CHECK["Index within list bounds?"]
    BOUNDS_CHECK -->|No| NULL_RET2["Return null"]
    BOUNDS_CHECK -->|Yes| DELEGATE1["DelegatedBean.typeModelData subkey"]
    DELEGATE1 --> X33_RET["Return X33VDataTypeStringBean.result"]

    IDO_RSN_MEMO -->|No| OP_SVC["Key == 'オプションサービス契約番号'?"]
    IDO_RSN_MEMO -->|Yes| IDO_MEMO_VALUE["subkey == 'value' or 'state'?"]
    IDO_MEMO_VALUE -->|Yes| STRING_RET4["Return String.class"]

    OP_SVC -->|No| TRAN_DIV["Key == '処理区分'?"]
    OP_SVC -->|Yes| EXTRACT_INDEX2["Extract index from key"]
    EXTRACT_INDEX2 --> CHECK_ASTERISK2["Index == '*' ?"]
    CHECK_ASTERISK2 -->|Yes| INTEGER_RET2["Return Integer.class"]
    CHECK_ASTERISK2 -->|No| PARSE_INDEX2["Parse index as Integer"]
    PARSE_INDEX2 --> PARSE_ERROR2["NumberFormatException ?"]
    PARSE_ERROR2 -->|Yes| NULL_RET3["Return null"]
    PARSE_ERROR2 -->|No| BOUNDS_CHECK2["Index within list bounds?"]
    BOUNDS_CHECK2 -->|No| NULL_RET4["Return null"]
    BOUNDS_CHECK2 -->|Yes| DELEGATE2["DelegatedBean.typeModelData subkey"]
    DELEGATE2 --> X33_RET2["Return X33VDataTypeStringBean.result"]

    TRAN_DIV -->|No| MSKM_NO["Key == '申請番号'?"]
    TRAN_DIV -->|Yes| TRAN_VALUE["subkey == 'value' or 'state'?"]
    TRAN_VALUE -->|Yes| STRING_RET5["Return String.class"]

    MSKM_NO -->|No| MSKM_DTL["Key == '申請明細番号'?"]
    MSKM_NO -->|Yes| MSKM_VALUE["subkey == 'value' or 'state'?"]
    MSKM_VALUE -->|Yes| STRING_RET6["Return String.class"]

    MSKM_DTL -->|Yes| MSKM_DTL_VALUE["subkey == 'value' or 'state'?"]
    MSKM_DTL_VALUE -->|Yes| STRING_RET7["Return String.class"]
    MSKM_DTL -->|No| NO_MATCH["Return null"]
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field name (項目名) used to identify which screen field's type metadata is being queried. Can be a plain field name (e.g., `"sysid"`, `"サービス契約番号"`) or an indexed reference for list fields using the `fieldName/index` format (e.g., `"異動理由コード/0"`, `"オプションサービス契約番号/*"`). The value determines which conditional branch is taken. |
| 2 | `subkey` | `String` | The metadata attribute being requested for the field. Typically `"value"` to request the primary data type, `"state"` to request the state type, `"*"` for list fields to request the element count type (returns `Integer.class`), or a numeric index string for list fields to request a specific element's type. Can also be any arbitrary string when delegating to `X33VDataTypeStringBean.typeModelData()`. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `List<X33VDataTypeStringBean>` | List of transfer reason code items (異動理由コード). Each element is a typed string bean holding a single transfer reason entry. Used when querying indexed access to the transfer reason code field. |
| `op_svc_kei_no_list` | `List<X33VDataTypeStringBean>` | List of option service contract number items (オプションサービス契約番号). Each element is a typed string bean holding a single option service contract entry. Used when querying indexed access to the option service contract field. |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKAdEditCC.substring` | JKKAdEditCC | - | Calls `substring` in `JKKAdEditCC` |
| - | `JKKAdEdit.substring` | JKKAdEdit | - | Calls `substring` in `JKKAdEdit` |
| - | `JKKTelnoInfoAddMapperCC.substring` | JKKTelnoInfoAddMapperCC | - | Calls `substring` in `JKKTelnoInfoAddMapperCC` |
| - | `JDKejbStringEdit.substring` | JDKejbStringEdit | - | Calls `substring` in `JDKejbStringEdit` |
| - | `KKW02516SF01DBean.typeModelData` | KKW02516SF01DBean | - | Calls `typeModelData` in `KKW02516SF01DBean` |

**Note:** This method performs **pure metadata lookup** — it does not execute any database reads, creates, updates, or deletes. Its only external calls are:

| SC / CBS | Operation Description |
|----------|----------------------|
| `X33VDataTypeStringBean.typeModelData(subkey)` | Internal delegation to list item type metadata query. Invoked on individual beans within `ido_rsn_cd_list` or `op_svc_kei_no_list` to retrieve the data type for a specific subkey of a list entry. |

## 5. Dependency Trace

The code graph indicates this method is called within the same class (`KKW02516SF01DBean`). This is consistent with the method's role as a metadata dispatcher — other methods within the same bean (such as `loadModelData`, `storeModelData`, or field initialization methods) would call `typeModelData()` to determine the type signature of screen fields during data binding operations.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Internal: `KKW02516SF01DBean` | Within same bean (metadata dispatcher — called by other bean methods) | Internal type lookup (no SC / CRUD / Entity) |
| 2 | Internal: List item beans | `X33VDataTypeStringBean.typeModelData(subkey)` (called from this method on list entries) | Internal type lookup (no SC / CRUD / Entity) |

**Note:** No external screens (KKSV*) or CBS components were identified as direct callers in the code graph. The method operates as an internal type-resolution utility within the `KKA16801SF` screen bean.

## 6. Per-Branch Detail Blocks

### Block 1 — IF (null check) (L627)

> If either `key` or `subkey` is `null`, return `null` immediately. This is a guard clause to prevent `NullPointerException` on subsequent string operations.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key == null \|\| subkey == null` // Guard clause [-> Both must be non-null to proceed] |
| 2 | RETURN | `return null` // No type metadata for null input |

### Block 2 — EXEC (separator extraction) (L631)

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // Find position of "/" separator for potential indexed list key parsing |

### Block 3 — ELSE-IF [sysid field] (L634)

> The system ID field (`sysid`) — a simple string field. Supports `subkey` values `"value"` and `"state"`, both returning `String.class`.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("sysid")` [-> 項目ID: sysid] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 4 — ELSE-IF [サービス契約番号 field] (L643)

> Service Contract Number — a simple string field used to identify service contracts in the system.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("サービス契約番号")` [-> 項目ID: svc_kei_no] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 5 — ELSE-IF [異動区分 field] (L652)

> Transfer Classification — a string field indicating the type of transfer/change operation.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("異動区分")` [-> 項目ID: ido_div] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 6 — ELSE-IF [異動理由コード field — indexed list] (L661)

> Transfer Reason Code — an **indexed list field**. Each element is a `X33VDataTypeStringBean`. Supports three modes:
> - `subkey == "*"`: returns the list element count type (`Integer.class`)
> - `subkey == "<number>"`: parses the number as an index, validates bounds, then delegates to the individual list item
> - `subkey == "value"` or `"state"`: returns `String.class`

#### Block 6.1 — Key re-extraction (L665)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // 最初の"より後を取得 — Extract everything after the first "/" [-> "異動理由コード/0" yields "0"] |

#### Block 6.2 — Asterisk check (list element count) (L667)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("*")` [-> Wildcard: caller wants list element count type] |
| 2 | RETURN | `return Integer.class` [-> List elements are indexed by Integer] |

#### Block 6.3 — Index parsing (L671–L680)

> Attempt to parse the key as an integer index. On failure, return `null`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = null` [-> Initialize nullable Integer] |
| 2 | TRY — SET | `tmpIndexInt = Integer.valueOf(key)` [-> Parse key string as integer index] |
| 3 | CATCH — RETURN | `return null` [-> インデックス値が数値文字列でない場合 — Index value is not a numeric string] |
| 4 | CHECK | `tmpIndexInt == null` [-> Double-check for null after parse] |
| 5 | RETURN | `return null` |

#### Block 6.4 — Bounds check and delegation (L681–L685)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndex = tmpIndexInt.intValue()` [-> Unbox Integer to int] |
| 2 | CHECK | `tmpIndex < 0 \|\| tmpIndex >= ido_rsn_cd_list.size()` [-> インデックス値がリスト個数-1を超える場合 — Index exceeds list size] |
| 3 | RETURN | `return null` |
| 4 | CAST | `(X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)` [-> Get specific list item at index] |
| 5 | CALL | `.typeModelData(subkey)` [-> Delegate to list item for its type metadata] |
| 6 | RETURN | `return ((X33VDataTypeStringBean)ido_rsn_cd_list.get(tmpIndex)).typeModelData(subkey)` [-> Return list item's type result] |

### Block 7 — ELSE-IF [異動理由メモ field] (L689)

> Transfer Reason Memo — a simple string field for free-text transfer reason notes.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("異動理由メモ")` [-> 項目ID: ido_rsn_memo] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 8 — ELSE-IF [オプションサービス契約番号 field — indexed list] (L698)

> Option Service Contract Number — an **indexed list field**. Same pattern as Block 6: supports `"*"` for list count type, numeric index for individual elements, and `"value"`/`"state"` for simple type info.

#### Block 8.1 — Key re-extraction (L702)

| # | Type | Code |
|---|------|------|
| 1 | SET | `key = key.substring(separaterPoint + 1)` // 最初の"より後を取得 — Extract after first "/" |

#### Block 8.2 — Asterisk check (L704)

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("*")` [-> Wildcard: request list element count type] |
| 2 | RETURN | `return Integer.class` |

#### Block 8.3 — Index parsing (L708–L717)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndexInt = null` [-> Initialize nullable Integer] |
| 2 | TRY — SET | `tmpIndexInt = Integer.valueOf(key)` [-> Parse key as integer index] |
| 3 | CATCH — RETURN | `return null` [-> インデックス値が数値文字列でない場合 — Index is not numeric] |
| 4 | CHECK | `tmpIndexInt == null` [-> Null safety check] |
| 5 | RETURN | `return null` |

#### Block 8.4 — Bounds check and delegation (L718–L722)

| # | Type | Code |
|---|------|------|
| 1 | SET | `tmpIndex = tmpIndexInt.intValue()` [-> Unbox Integer to int] |
| 2 | CHECK | `tmpIndex < 0 \|\| tmpIndex >= op_svc_kei_no_list.size()` [-> インデックス値がリスト個数-1を超える場合 — Index exceeds list size] |
| 3 | RETURN | `return null` |
| 4 | CAST | `(X33VDataTypeStringBean)op_svc_kei_no_list.get(tmpIndex)` [-> Get list item at index] |
| 5 | CALL | `.typeModelData(subkey)` [-> Delegate to list item] |
| 6 | RETURN | `return ((X33VDataTypeStringBean)op_svc_kei_no_list.get(tmpIndex)).typeModelData(subkey)` |

### Block 9 — ELSE-IF [処理区分 field] (L726)

> Processing Classification — a string field indicating the type of processing operation.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("処理区分")` [-> 項目ID: tran_div] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 10 — ELSE-IF [申請番号 field] (L735)

> Application Number — a string field for application/claim identifiers.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("申請番号")` [-> 項目ID: mskm_no] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 11 — ELSE-IF [申請明細番号 field] (L744)

> Application Detail Number — a string field for application line item identifiers.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `key.equals("申請明細番号")` [-> 項目ID: mskm_dtl_no] |
| 2 | ELSE-IF [subkey == "value"] | `subkey.equalsIgnoreCase("value")` [-> Request primary type] |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF [subkey == "state"] | `subkey.equalsIgnoreCase("state")` // 状態値を返す [-> Request state type] |
| 5 | RETURN | `return String.class` |

### Block 12 — ELSE (no matching key) (L754)

> No field name matched any known key. Return `null` to signal that no type metadata is available for the given key.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `sysid` | Field | System ID — internal system identifier for a record or entity |
| `サービス契約番号` | Field | Service Contract Number — identifies a service contract line item (項目ID: svc_kei_no) |
| `異動区分` | Field | Transfer Classification — categorizes the type of transfer/change operation performed (項目ID: ido_div) |
| `異動理由コード` | Field | Transfer Reason Code — code indicating the reason for a transfer operation (項目ID: ido_rsn_cd). Implemented as an indexed list field supporting per-element type queries. |
| `異動理由メモ` | Field | Transfer Reason Memo — free-text note explaining a transfer reason (項目ID: ido_rsn_memo) |
| `オプションサービス契約番号` | Field | Option Service Contract Number — identifies an optional/add-on service contract (項目ID: op_svc_kei_no). Implemented as an indexed list field. |
| `処理区分` | Field | Processing Classification — categorizes the type of processing step (項目ID: tran_div) |
| `申請番号` | Field | Application Number — identifier for an application/claim (項目ID: mskm_no) |
| `申請明細番号` | Field | Application Detail Number — identifier for a specific line item within an application (項目ID: mskm_dtl_no) |
| `key` | Parameter | Field name (項目名) used to identify which screen field's type metadata to retrieve |
| `subkey` | Parameter | Metadata attribute name — typically `"value"` for primary type, `"state"` for state type, `"*"` for list element count type, or a numeric string for indexed list access |
| `ido_rsn_cd_list` | Field | List of transfer reason code entries, each as a `X33VDataTypeStringBean` |
| `op_svc_kei_no_list` | Field | List of option service contract number entries, each as a `X33VDataTypeStringBean` |
| `X33VDataTypeStringBean` | Class | X33 framework data bean for typed string values. Provides `typeModelData(subkey)` for per-element type metadata introspection. Used for list item delegation. |
| `typeModelData` | Method | Type model data query — returns the Java `Class<?>` representing the data type for a given field attribute. Part of the X33 framework's data binding contract. |
| `loadModelData` | Method | Load model data — the complementary method that retrieves the actual value for a field attribute (as opposed to type metadata). |
| `storeModelData` | Method | Store model data — the complementary method that sets the value of a field attribute. |
| `"value"` | Subkey | Request the primary data type for a field (e.g., `String.class`) |
| `"state"` | Subkey | Request the state/status type for a field (e.g., `String.class`) |
| `"*"` | Subkey | Request the element count type for an indexed list field (returns `Integer.class`) |
