# Business Logic — KKW01037SF01DBean.typeModelData() [145 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01037SF.KKW01037SF01DBean` |
| Layer | View / Data Type Bean (UI framework integration — X33 VDataType dispatch) |
| Module | `KKW01037SF` (Package: `eo.web.webview.KKW01037SF`) |

## 1. Role

### KKW01037SF01DBean.typeModelData()

This method is a **type-model routing/dispatch** utility that maps business field names (`key`) and their sub-keys (`subkey`) to the corresponding Java `Class<?>` types. It is the contract method required by the Futurity X33 VDataType framework to determine the data type of each UI-bound field at runtime, enabling dynamic rendering of input controls, validation rules, and form serialization.

The method covers **10 referral/introduction screen fields** — all centered around the business domain of customer referral and telemarketing (紹介 — shoukai). Each field supports three sub-keys: `value` (the field's data value), `enable` (whether the field is editable), and `state` (the field's validation/rendering status). For all 10 fields, `value` and `state` resolve to `String.class`, while `enable` resolves to `Boolean.class`.

The design pattern implemented is a **conditional dispatch** (switch-like branching without an actual switch statement). The method evaluates each field category via a chain of `if`/`else-if` conditions, then further dispatches based on `subkey` to return the correct type. It acts as a **shared type resolver** — the parent screen bean (`KKW01037SFBean`) registers `KKW01037SF01DBean` as the data type bean for the "Service Contract List" (サービス契約一覧) repeat item, and the X33 framework invokes `typeModelData` whenever it needs to resolve a field's type during form initialization or AJAX updates.

If the `key` does not match any of the 10 known referral fields, or if `subkey` is not `value`, `enable`, or `state`, the method returns `null`, signaling that the field is unknown to this type model.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    START --> NULL_CHECK["Null Check: key == null || subkey == null"]
    NULL_CHECK -->|Both not null| SEPARATOR["Find '/' in key index"]
    SEPARATOR --> COND_1{"key equals
紹介者お客様ID
(hi_svc_kei_no)"}
    COND_1 -->|true| BRANCH_1_SUB{"subkey equals
value/enable/state"}
    COND_1 -->|false| COND_2{"key equals
紹介者料金グループ名
(hi_prc_grp_nm)"}
    BRANCH_1_SUB -->|value| RET_STRING_1["Return String.class"]
    BRANCH_1_SUB -->|enable| RET_BOOL_1["Return Boolean.class"]
    BRANCH_1_SUB -->|state| RET_STRING_ST_1["Return String.class
(status)"]
    COND_2 -->|true| BRANCH_2_SUB{"subkey equals
value/enable/state"}
    COND_2 -->|false| COND_3{"key equals
紹介者ステータス
(hi_svc_kei_stat)"}
    BRANCH_2_SUB -->|value| RET_STRING_2["Return String.class"]
    BRANCH_2_SUB -->|enable| RET_BOOL_2["Return Boolean.class"]
    BRANCH_2_SUB -->|state| RET_STRING_ST_2["Return String.class
(status)"]
    COND_3 -->|true| BRANCH_3_SUB{"subkey equals
value/enable/state"}
    COND_3 -->|false| COND_4{"key equals
紹介者サービス開始年月日
(hi_svc_sta_ymd)"}
    BRANCH_3_SUB -->|value| RET_STRING_3["Return String.class"]
    BRANCH_3_SUB -->|enable| RET_BOOL_3["Return Boolean.class"]
    BRANCH_3_SUB -->|state| RET_STRING_ST_3["Return String.class
(status)"]
    COND_4 -->|true| BRANCH_4_SUB{"subkey equals
value/enable/state"}
    COND_4 -->|false| COND_5{"key equals
紹介コード
(intr_cd)"}
    BRANCH_4_SUB -->|value| RET_STRING_4["Return String.class"]
    BRANCH_4_SUB -->|enable| RET_BOOL_4["Return Boolean.class"]
    BRANCH_4_SUB -->|state| RET_STRING_ST_4["Return String.class
(status)"]
    COND_5 -->|true| BRANCH_5_SUB{"subkey equals
value/enable/state"}
    COND_5 -->|false| COND_6{"key equals
クーポンコード
(coupon_cd)
[ANK-4416-00-00]"}
    BRANCH_5_SUB -->|value| RET_STRING_5["Return String.class"]
    BRANCH_5_SUB -->|enable| RET_BOOL_5["Return Boolean.class"]
    BRANCH_5_SUB -->|state| RET_STRING_ST_5["Return String.class
(status)"]
    COND_6 -->|true| BRANCH_6_SUB{"subkey equals
value/enable/state"}
    COND_6 -->|false| COND_7{"key equals
紹介者お客様ID
(sho_svc_kei_no)"}
    BRANCH_6_SUB -->|value| RET_STRING_6["Return String.class"]
    BRANCH_6_SUB -->|enable| RET_BOOL_6["Return Boolean.class"]
    BRANCH_6_SUB -->|state| RET_STRING_ST_6["Return String.class
(status)"]
    COND_7 -->|true| BRANCH_7_SUB{"subkey equals
value/enable/state"}
    COND_7 -->|false| COND_8{"key equals
紹介者料金グループ名
(sho_prc_grp_nm)"}
    BRANCH_7_SUB -->|value| RET_STRING_7["Return String.class"]
    BRANCH_7_SUB -->|enable| RET_BOOL_7["Return Boolean.class"]
    BRANCH_7_SUB -->|state| RET_STRING_ST_7["Return String.class
(status)"]
    COND_8 -->|true| BRANCH_8_SUB{"subkey equals
value/enable/state"}
    COND_8 -->|false| COND_9{"key equals
紹介者システムID
(sho_sysid)"}
    BRANCH_8_SUB -->|value| RET_STRING_8["Return String.class"]
    BRANCH_8_SUB -->|enable| RET_BOOL_8["Return Boolean.class"]
    BRANCH_8_SUB -->|state| RET_STRING_ST_8["Return String.class
(status)"]
    COND_9 -->|true| BRANCH_9_SUB{"subkey equals
value/enable/state"}
    COND_9 -->|false| COND_10{"key equals
紹介者契約者名
(sho_cust_nm)"}
    BRANCH_9_SUB -->|value| RET_STRING_9["Return String.class"]
    BRANCH_9_SUB -->|enable| RET_BOOL_9["Return Boolean.class"]
    BRANCH_9_SUB -->|state| RET_STRING_ST_9["Return String.class
(status)"]
    COND_10 -->|true| BRANCH_10_SUB{"subkey equals
value/enable/state"}
    COND_10 -->|false| RET_NULL["Return null
(no matching property)"]
    BRANCH_10_SUB -->|value| RET_STRING_10["Return String.class"]
    BRANCH_10_SUB -->|enable| RET_BOOL_10["Return Boolean.class"]
    BRANCH_10_SUB -->|state| RET_STRING_ST_10["Return String.class
(status)"]
    RET_STRING_1 --> END_NODE(["Return / Next"])
    RET_BOOL_1 --> END_NODE
    RET_STRING_ST_1 --> END_NODE
    RET_STRING_2 --> END_NODE
    RET_BOOL_2 --> END_NODE
    RET_STRING_ST_2 --> END_NODE
    RET_STRING_3 --> END_NODE
    RET_BOOL_3 --> END_NODE
    RET_STRING_ST_3 --> END_NODE
    RET_STRING_4 --> END_NODE
    RET_BOOL_4 --> END_NODE
    RET_STRING_ST_4 --> END_NODE
    RET_STRING_5 --> END_NODE
    RET_BOOL_5 --> END_NODE
    RET_STRING_ST_5 --> END_NODE
    RET_STRING_6 --> END_NODE
    RET_BOOL_6 --> END_NODE
    RET_STRING_ST_6 --> END_NODE
    RET_STRING_7 --> END_NODE
    RET_BOOL_7 --> END_NODE
    RET_STRING_ST_7 --> END_NODE
    RET_STRING_8 --> END_NODE
    RET_BOOL_8 --> END_NODE
    RET_STRING_ST_8 --> END_NODE
    RET_STRING_9 --> END_NODE
    RET_BOOL_9 --> END_NODE
    RET_STRING_ST_9 --> END_NODE
    RET_STRING_10 --> END_NODE
    RET_BOOL_10 --> END_NODE
    RET_STRING_ST_10 --> END_NODE
    RET_NULL --> END_NODE
    NULL_CHECK -->|true| RET_NULL
```

**Processing summary:**

1. **Null guard** (L787–790): If either `key` or `subkey` is `null`, return `null` immediately. (紹介とsubkeyがnullの場合、nullを返す — "If key and subkey are null, return null")
2. **Separator check** (L792): Compute `key.indexOf("/")` — this value is calculated but never used; it appears to be leftover scaffolding from a planned feature that would parse nested key paths.
3. **10 Field categories** evaluated via `else-if` chain (L796–L924). Each category checks `key.equals("Japanese label")`, then dispatches on `subkey.equalsIgnoreCase("value"|"enable"|"state")`.
4. **Final fallback** (L926–927): If no condition matches, return `null`. (条件に一致するプロパティが存在しない場合は、nullを返す — "If no matching property exists, return null")

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business field name (display label in Japanese) representing a referral/screen field. It determines which of the 10 referral data categories is being queried. Possible values: the 10 Japanese field labels listed below, or any other string (which results in `null` being returned). Examples: `"紹介者お客様ID"` (Referrer Customer ID), `"紹介コード"` (Referral Code), `"クーポンコード"` (Coupon Code — added in ANK-4416-00-00). |
| 2 | `subkey` | `String` | The sub-property within the field, identifying which aspect of the field's metadata is requested. Must match one of three case-insensitive values: `value` (the data value itself), `enable` (whether the UI control is enabled/editable), or `state` (the field's validation/rendering state). Any other value results in `null` being returned for that field. |

**Instance fields read by this method:** None. This method is stateless — it performs pure key-to-type lookups without accessing any instance fields.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no external services**. It is a pure type-dispatch utility that returns Java `Class` objects. It does not access databases, invoke service components (SC/CBS), or interact with any persistence layer.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | — | — | — | No database or service calls — pure type lookup |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW01037SF | `KKW01037SFBean.addListDataInstance("サービス契約一覧リスト")` → creates `KKW01037SF01DBean` instance → X33 framework invokes `typeModelData(key, subkey)` on the bean | None (no CRUD) |

**Notes on caller context:**
- `KKW01037SFBean` is the parent screen bean for the **Service Contract List** (サービス契約一覧) screen module. It registers `KKW01037SF01DBean` as the data type bean for the repeat item `"サービス契約一覧リスト"` (Service Contract List).
- The X33 VDataType framework calls `typeModelData()` dynamically during form initialization and AJAX updates to determine the type of each field in the `KKW01037SF01DBean` instance.
- No other classes were found that directly invoke `KKW01037SF01DBean.typeModelData()`. The other `typeModelData` definitions found in the codebase belong to unrelated classes (`FUW00912SF*`, `FUW00926SF*`, etc.) in different modules — they are independent implementations, not callers.

## 6. Per-Branch Detail Blocks

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

> Null guard: If either parameter is null, return null immediately. (key,subkeyがnullの場合、nullを返す)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // Early exit if either parameter is null |

**Block 2** — COMPUTE `(key.indexOf("/"))` (L792)

> Separator position computed but unused. Appears to be leftover scaffolding for a planned nested-key path parsing feature.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Separator index — unused in this method |

**Block 3** — IF/ELSE-IF CHAIN — Field Category Dispatch (L796–L924)

> This is a 10-branch else-if chain, each checking a specific Japanese field label. The comment prefix for each is: データタイプがStringの項目"(Item ID: ...)" — "Field whose data type is String (Item ID: ...)".

### Block 3.1 — ELSE-IF `(key.equals("紹介者お客様ID"))` [hi_svc_kei_no] (L796)

> Referrer Customer ID — the service detail number of the referrer.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.2 — ELSE-IF `(key.equals("紹介者料金グループ名"))` [hi_prc_grp_nm] (L809)

> Referrer Pricing Group Name — the pricing group associated with the referrer.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.3 — ELSE-IF `(key.equals("紹介者ステータス"))` [hi_svc_kei_stat] (L822)

> Referrer Service Status — the current status of the referrer's service.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.4 — ELSE-IF `(key.equals("紹介者サービス開始年月日"))` [hi_svc_sta_ymd] (L835)

> Referrer Service Start Date (Year/Month/Day) — the date when the referrer's service began.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.5 — ELSE-IF `(key.equals("紹介コード"))` [intr_cd] (L848)

> Referral Code — the code identifying the referral source/channel.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.6 — ELSE-IF `(key.equals("クーポンコード"))` [coupon_cd] (L862) — ANK-4416-00-00

> Coupon Code — the code for a coupon/discount. Added in change ticket ANK-4416-00-00 to support simultaneous entry of referral codes and partner enterprise entry codes. (紹介コード、提携先企業向けエントリーコード同時入力対応)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.7 — ELSE-IF `(key.equals("紹介者お客様ID"))` [sho_svc_kei_no] (L875)

> Referred Customer ID — the service detail number of the customer being referred (shoukai = introduction/referral).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.8 — ELSE-IF `(key.equals("紹介者料金グループ名"))` [sho_prc_grp_nm] (L888)

> Referred Customer Pricing Group Name — the pricing group of the referred customer.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.9 — ELSE-IF `(key.equals("紹介者システムID"))` [sho_sysid] (L901)

> Referred Customer System ID — the internal system identifier of the referred customer.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

### Block 3.10 — ELSE-IF `(key.equals("紹介者契約者名"))` [sho_cust_nm] (L914)

> Referred Customer Contract Name — the name of the referred customer's contract.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` → `return String.class;` |
| 2 | ELSE-IF | `else if(subkey.equalsIgnoreCase("enable"))` → `return Boolean.class;` |
| 3 | ELSE-IF | `else if(subkey.equalsIgnoreCase("state"))` → `return String.class;` // subkeyが"state"の場合、ステータスを返す |

**Block 4** — FINAL FALLBACK `return null;` (L926)

> If no matching property exists, return null. (条件に一致するプロパティが存在しない場合は、nullを返す。)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching field key was found |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hi_svc_kei_no` | Field | Referrer Service Detail Number — internal tracking ID for the service contract line item of the referrer (introducer) |
| `hi_prc_grp_nm` | Field | Referrer Pricing Group Name — the pricing/discount group associated with the referrer's service |
| `hi_svc_kei_stat` | Field | Referrer Service Status — current status of the referrer's service (e.g., active, suspended, completed) |
| `hi_svc_sta_ymd` | Field | Referrer Service Start Date (Year/Month/Day) — the date when the referrer's service commenced |
| `intr_cd` | Field | Referral Code — the code identifying the referral source or channel that introduced the customer |
| `coupon_cd` | Field | Coupon Code — the code for a coupon or discount offer (added in ANK-4416-00-00) |
| `sho_svc_kei_no` | Field | Referred Customer Service Detail Number — service contract line item ID of the customer being referred |
| `sho_prc_grp_nm` | Field | Referred Customer Pricing Group Name — pricing group of the referred customer |
| `sho_sysid` | Field | Referred Customer System ID — internal system identifier of the referred customer |
| `sho_cust_nm` | Field | Referred Customer Contract Name — name on the referred customer's service contract |
| 紹介者 (shoukai-sha) | Japanese term | Referrer / Introducer — the party who refers an new customer |
| 紹介 (shoukai) | Japanese term | Introduction / Referral — the act of referring or introducing |
| お客様 (okyaku-sama) | Japanese term | Customer — the end user or client |
| 料金グループ名 (ryoukin guruhuumu_mei) | Japanese term | Pricing Group Name — a grouping of pricing/discount tiers |
| ステータス (sutetcasu) | Japanese term | Status — the current state of an entity |
| サービス開始年月日 (saabisu kaishi nengetsubi) | Japanese term | Service Start Date (Year/Month/Day) |
| 契約者名 (keiyakushamei) | Japanese term | Contract Name — the name on a service contract |
| クーポンコード (kuapon koodo) | Japanese term | Coupon Code |
| 紹介コード (shoukai koodo) | Japanese term | Referral Code |
| ANK-4416-00-00 | Change ticket | Change request for simultaneous entry of referral codes and partner enterprise entry codes (紹介コード、提携先企業向けエントリーコード同時入力対応) |
| X33 | Acronym | Futurity X33 — the web application framework (com.fujitsu.futurity.web.x33) providing VDataType beans for UI data binding |
| VDataType | Acronym | View Data Type — the X33 framework's data binding model where beans expose field metadata (value, enabled, state) to the UI layer |
| DBean | Acronym | Data Bean — a view-layer bean implementing X33VDataTypeBeanInterface, responsible for exposing field metadata (type, value, enabled, state) to the UI |
| KKW01037SF | Module | The Service Contract List (サービス契約一覧) screen module — a referral/telemarketing screen handling customer referral data entry and display |
| `value` | Sub-key | The data value of a field — what the user sees and enters |
| `enable` | Sub-key | Whether the field is enabled for editing — a boolean toggle controlling UI interactivity |
| `state` | Sub-key | The field's validation/rendering status — a string describing the current state of the field (e.g., error, warning, normal) |
