# Business Logic — KKW01023SF03DBean.typeModelData() [117 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01023SF.KKW01023SF03DBean` |
| Layer | Web View Bean / Data Binding (Web layer — package `eo.web.webview.KKW01023SF`) |
| Module | `KKW01023SF` (Package: `eo.web.webview.KKW01023SF`) |

## 1. Role

### KKW01023SF03DBean.typeModelData()

This method serves as a **data type routing dispatcher** for the service contract detail edit screen (KKW01023SF). It is responsible for determining the Java runtime type (`Class<?>`) of a UI-bound data field based on a composite key/subkey pair, enabling dynamic form field type resolution for the web framework's data binding layer.

The method handles **8 distinct service contract/fee information fields**: Item ID (番号), Work Content Details (内容内容), Service Type Code (種別コード), Service Type Code Name (種別コード名称), Discount Application Count (割引適用回数), First Discount Application Date (初回割引適用年月日), Service Charge Start Date (サービス課金開始年月日), and Service Charge End Date (サービス課金終了年月日). Each field supports 3 subkeys — `value` (data value, returns `String.class`), `enable` (field enabled/disabled state, returns `Boolean.class`), and `state` (display state, returns `String.class`).

The method implements a **routing/dispatch pattern** (also known as a type model lookup), acting as a shared metadata provider called by the parent screen bean (`KKW01023SFBean`) and sibling DBeans via the `X33VDataTypeBeanInterface` contract. It plays the role of a **type-level configuration table** — rather than storing type information in annotations or external config files, the type model is embedded directly in the bean's conditional logic, allowing the framework to resolve field types at runtime for form rendering, validation metadata, and edit-state management.

There are **no external method calls or database interactions** — this is a pure in-memory type resolution method. If the key/subkey combination does not match any known field or subkey, the method returns `null`, signaling to the caller that the field is unrecognized.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key subkey"])
    START --> NULL_CHECK{key or subkey null?}
    NULL_CHECK -->|Yes| RETURN_NULL["Return null"]
    NULL_CHECK -->|No| SEPARATOR["Parse key with indexOf('/')"]

    SEPARATOR --> KEI_NO{key is 番号}
    KEI_NO -->|Yes| KEI_NO_SUB{subkey is value enable state?}
    KEI_NO -->|No| NAIYO{key is 内容内容}
    NAIYO -->|Yes| NAIYO_SUB{subkey is value enable state?}
    NAIYO -->|No| SBT_CD{key is 種別コード}
    SBT_CD -->|Yes| SBT_CD_SUB{subkey is value enable state?}
    SBT_CD -->|No| SBT_CD_NM{key is 種別コード名称}
    SBT_CD_NM -->|Yes| SBT_CD_NM_SUB{subkey is value enable state?}
    SBT_CD_NM -->|No| WRIB_APPLY{key is 割引適用回数}
    WRIB_APPLY -->|Yes| WRIB_SUB{subkey is value enable state?}
    WRIB_APPLY -->|No| FIRST_WRIB{key is 初回割引適用年月日}
    FIRST_WRIB -->|Yes| FIRST_SUB{subkey is value enable state?}
    FIRST_WRIB -->|No| SVC_CHRG_STAY{key is サービス課金開始年月日}
    SVC_CHRG_STAY -->|Yes| STAY_SUB{subkey is value enable state?}
    SVC_CHRG_STAY -->|No| SVC_CHRG_ENDY{key is サービス課金終了年月日}
    SVC_CHRG_ENDY -->|Yes| ENDY_SUB{subkey is value enable state?}
    SVC_CHRG_ENDY -->|No| NO_MATCH["No matching key found"]

    ENDY_SUB -->|Yes| ENDY_VALUE["Return String.class"]
    ENDY_SUB -->|No| ENDY_ENABLE{subkey is enable}
    ENDY_ENABLE -->|Yes| ENDY_ENABLE_RET["Return Boolean.class"]
    ENDY_ENABLE -->|No| ENDY_STATE["Return String.class"]

    STAY_SUB -->|Yes| STAY_VALUE["Return String.class"]
    STAY_SUB -->|No| STAY_ENABLE{subkey is enable}
    STAY_ENABLE -->|Yes| STAY_ENABLE_RET["Return Boolean.class"]
    STAY_ENABLE -->|No| STAY_STATE["Return String.class"]

    FIRST_SUB -->|Yes| FIRST_VALUE["Return String.class"]
    FIRST_SUB -->|No| FIRST_ENABLE{subkey is enable}
    FIRST_ENABLE -->|Yes| FIRST_ENABLE_RET["Return Boolean.class"]
    FIRST_ENABLE -->|No| FIRST_STATE["Return String.class"]

    WRIB_SUB -->|Yes| WRIB_VALUE["Return String.class"]
    WRIB_SUB -->|No| WRIB_ENABLE{subkey is enable}
    WRIB_ENABLE -->|Yes| WRIB_ENABLE_RET["Return Boolean.class"]
    WRIB_ENABLE -->|No| WRIB_STATE["Return String.class"]

    SBT_CD_NM_SUB -->|Yes| SBT_CD_NM_VALUE["Return String.class"]
    SBT_CD_NM_SUB -->|No| SBT_CD_NM_ENABLE{subkey is enable}
    SBT_CD_NM_ENABLE -->|Yes| SBT_CD_NM_ENABLE_RET["Return Boolean.class"]
    SBT_CD_NM_ENABLE -->|No| SBT_CD_NM_STATE["Return String.class"]

    SBT_CD_SUB -->|Yes| SBT_CD_VALUE["Return String.class"]
    SBT_CD_SUB -->|No| SBT_CD_ENABLE{subkey is enable}
    SBT_CD_ENABLE -->|Yes| SBT_CD_ENABLE_RET["Return Boolean.class"]
    SBT_CD_ENABLE -->|No| SBT_CD_STATE["Return String.class"]

    NAIYO_SUB -->|Yes| NAIYO_VALUE["Return String.class"]
    NAIYO_SUB -->|No| NAIYO_ENABLE{subkey is enable}
    NAIYO_ENABLE -->|Yes| NAIYO_ENABLE_RET["Return Boolean.class"]
    NAIYO_ENABLE -->|No| NAIYO_STATE["Return String.class"]

    KEI_NO_SUB -->|Yes| KEI_NO_VALUE["Return String.class"]
    KEI_NO_SUB -->|No| KEI_NO_ENABLE{subkey is enable}
    KEI_NO_ENABLE -->|Yes| KEI_NO_ENABLE_RET["Return Boolean.class"]
    KEI_NO_ENABLE -->|No| KEI_NO_STATE["Return String.class"]

    NO_MATCH --> RETURN_NULL2["Return null"]

    RETURN_NULL --> END(["End"])
    RETURN_NULL2 --> END
    ENDY_VALUE --> END
    ENDY_ENABLE_RET --> END
    ENDY_STATE --> END
    STAY_VALUE --> END
    STAY_ENABLE_RET --> END
    STAY_STATE --> END
    FIRST_VALUE --> END
    FIRST_ENABLE_RET --> END
    FIRST_STATE --> END
    WRIB_VALUE --> END
    WRIB_ENABLE_RET --> END
    WRIB_STATE --> END
    SBT_CD_NM_VALUE --> END
    SBT_CD_NM_ENABLE_RET --> END
    SBT_CD_NM_STATE --> END
    SBT_CD_VALUE --> END
    SBT_CD_ENABLE_RET --> END
    SBT_CD_STATE --> END
    NAIYO_VALUE --> END
    NAIYO_ENABLE_RET --> END
    NAIYO_STATE --> END
    KEI_NO_VALUE --> END
    KEI_NO_ENABLE_RET --> END
    KEI_NO_STATE --> END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The field identifier (項目名) representing a service contract detail item. Maps to one of 8 known fields: 番号 (Item ID: no), 内容内容 (Item ID: ucwk_ny), 種別コード (Item ID: sbt_cd), 種別コード名称 (Item ID: sbt_cd_nm), 割引適用回数 (Item ID: wrib_aply_cnt), 初回割引適用年月日 (Item ID: first_wrib_aply_ymd), サービス課金開始年月日 (Item ID: svc_chrg_staymd), or サービス課金終了年月日 (Item ID: svc_chrg_endymd). The method also computes `indexOf('/')` on the key but does not branch on the separator result — it is calculated but unused in this method. |
| 2 | `subkey` | `String` | The property accessor within a field. One of three values (case-insensitive): `value` for the field's actual data value, `enable` for the field's enabled/disabled state (controls form interactivity), or `state` for the field's display state. |

**Instance fields / external state:** None. This method is purely functional with no dependency on instance variables, static state, or external resources.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and makes **no calls to external services, CBS components, or DAO layers**. It is a pure type-resolution method operating entirely in memory with no side effects.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | — | — | — | No CRUD operations or service calls. Pure in-memory type routing. |

## 5. Dependency Trace

The `KKW01023SF03DBean.typeModelData()` method is part of the DBean (Data Bean) hierarchy within the `KKW01023SF` screen module. It is called through polymorphic dispatch via the `X33VDataTypeBeanInterface` contract, where the parent bean (`KKW01023SFBean`) delegates type lookup to its child DBeans.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW01023 | `KKW01023SFBean.typeModelData(gamenId, key, subkey)` -> `KKW01023SFBean.typeModelData(key, subkey)` -> `KKW01023SF03DBean.typeModelData(key, subkey)` | None — pure type lookup, no CRUD |
| 2 | Screen:KKW01023 | `KKW01023SF01DBean.typeModelData(key, subkey)` (sibling DBean, same interface) | None |
| 3 | Screen:KKW01023 | `KKW01023SF02DBean.typeModelData(key, subkey)` (sibling DBean, same interface) | None |
| 4 | Screen:KKW01023 | `KKW01023SF04DBean.typeModelData(key, subkey)` (sibling DBean, same interface) | None |

**Notes on call chains:**
- The parent bean `KKW01023SFBean` holds `X33VDataTypeBeanInterface` lists (e.g., `campaign_tg_aply_joken_list`, `wrib_svc_kei_ucwk_list`) and dispatches `typeModelData` calls to individual child beans by index.
- This method in `KKW01023SF03DBean` is one leaf in the DBean tree — each sibling DBean handles a different sub-section of the screen's data model.
- No external callers outside the `KKW01023SF` module were found.

## 6. Per-Branch Detail Blocks

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

> Guard clause: If either parameter is null, return null immediately. Prevents NPE on subsequent string operations.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // null key or subkey guard |

**Block 2** — EXEC (separator calculation) (L654)

> Calculates the index of '/' in the key. The result is stored but never used within this method — likely a remnant from a prior design or reserved for future use.

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

**Block 3** — IF-ELSE-IF chain (key routing) `(key.equals("番号"))` (L657)

> Branch: Item ID field — "番号". This field represents a unique numeric identifier for service contract lines. Each subkey returns a distinct type.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("番号")` // 番号 = Item ID (no) [L657] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` // data value property [L658] |
| 3 | RETURN | `return String.class;` // value = String [L659] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` // field enabled state [L660] |
| 5 | RETURN | `return Boolean.class;` // enable = Boolean [L661] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey is "state" — returns status [L662] |
| 7 | RETURN | `return String.class;` // state = String [L663] |

**Block 4** — ELSE-IF `(key.equals("内容内容"))` (L670)

> Branch: Work Content Details field — "内容内容". Item ID: `ucwk_ny`. Represents descriptive content of a service work item. Identical subkey logic to Block 3.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("内容内容")` // 内容内容 = Work Content Details (ucwk_ny) [L670] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L671] |
| 3 | RETURN | `return String.class;` [L672] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L673] |
| 5 | RETURN | `return Boolean.class;` [L674] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // 状態を返す — returns status [L675] |
| 7 | RETURN | `return String.class;` [L676] |

**Block 5** — ELSE-IF `(key.equals("種別コード"))` (L683)

> Branch: Service Type Code field — "種別コード". Item ID: `sbt_cd`. Represents the classification code for a service type (e.g., FTTH, Mail, etc.). Same subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("種別コード")` // 種別コード = Service Type Code (sbt_cd) [L683] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L684] |
| 3 | RETURN | `return String.class;` [L685] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L686] |
| 5 | RETURN | `return Boolean.class;` [L687] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L688] |
| 7 | RETURN | `return String.class;` [L689] |

**Block 6** — ELSE-IF `(key.equals("種別コード名称"))` (L697)

> Branch: Service Type Code Name field — "種別コード名称". Item ID: `sbt_cd_nm`. The human-readable display name corresponding to the type code. Same subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("種別コード名称")` // 種別コード名称 = Service Type Code Name (sbt_cd_nm) [L697] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L698] |
| 3 | RETURN | `return String.class;` [L699] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L700] |
| 5 | RETURN | `return Boolean.class;` [L701] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L702] |
| 7 | RETURN | `return String.class;` [L703] |

**Block 7** — ELSE-IF `(key.equals("割引適用回数"))` (L712)

> Branch: Discount Application Count field — "割引適用回数". Item ID: `wrib_aply_cnt`. Represents how many times a discount has been applied to a service contract. Same subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("割引適用回数")` // 割引適用回数 = Discount Application Count (wrib_aply_cnt) [L712] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L713] |
| 3 | RETURN | `return String.class;` [L714] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L715] |
| 5 | RETURN | `return Boolean.class;` [L716] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L717] |
| 7 | RETURN | `return String.class;` [L718] |

**Block 8** — ELSE-IF `(key.equals("初回割引適用年月日"))` (L726)

> Branch: First Discount Application Date field — "初回割引適用年月日". Item ID: `first_wrib_aply_ymd`. The date when the first discount was applied to the service contract. Same subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("初回割引適用年月日")` // 初回割引適用年月日 = First Discount Application Date (first_wrib_aply_ymd) [L726] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L727] |
| 3 | RETURN | `return String.class;` [L728] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L729] |
| 5 | RETURN | `return Boolean.class;` [L730] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L731] |
| 7 | RETURN | `return String.class;` [L732] |

**Block 9** — ELSE-IF `(key.equals("サービス課金開始年月日"))` (L740)

> Branch: Service Charge Start Date field — "サービス課金開始年月日". Item ID: `svc_chrg_staymd`. The date when billing for the service contract starts. Same subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス課金開始年月日")` // サービス課金開始年月日 = Service Charge Start Date (svc_chrg_staymd) [L740] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L741] |
| 3 | RETURN | `return String.class;` [L742] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L743] |
| 5 | RETURN | `return Boolean.class;` [L744] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L745] |
| 7 | RETURN | `return String.class;` [L746] |

**Block 10** — ELSE-IF `(key.equals("サービス課金終了年月日"))` (L754)

> Branch: Service Charge End Date field — "サービス課金終了年月日". Item ID: `svc_chrg_endymd`. The date when billing for the service contract ends. Same subkey pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス課金終了年月日")` // サービス課金終了年月日 = Service Charge End Date (svc_chrg_endymd) [L754] |
| 2 | IF-ELSE-IF | `subkey.equalsIgnoreCase("value")` [L755] |
| 3 | RETURN | `return String.class;` [L756] |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` [L757] |
| 5 | RETURN | `return Boolean.class;` [L758] |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L759] |
| 7 | RETURN | `return String.class;` [L760] |

**Block 11** — RETURN (no match) (L764)

> Final fallback: No matching key was found among the 8 defined fields. Returns null, signaling the framework that the field is unrecognized.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // プロパティが存在しない場合 — No matching property found, return null |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| 番号 | Field | Item ID (`no`) — Unique numeric identifier for a service contract line item |
| 内容内容 | Field | Work Content Details (`ucwk_ny`) — Descriptive content of a service work item; "ucwk" is short for "work" (作業), "ny" is short for "entry" (入力) |
| 種別コード | Field | Service Type Code (`sbt_cd`) — Classification code identifying the type of service (e.g., FTTH, Mail, ENUM); "sbt" is short for "sort" (種類), "cd" is "code" (コード) |
| 種別コード名称 | Field | Service Type Code Name (`sbt_cd_nm`) — Human-readable display name corresponding to a service type code |
| 割引適用回数 | Field | Discount Application Count (`wrib_aply_cnt`) — Number of times a discount has been applied to the service contract; "wrib" is short for "write-off" (割引), "aply" for "apply" (適用), "cnt" for "count" (回数) |
| 初回割引適用年月日 | Field | First Discount Application Date (`first_wrib_aply_ymd`) — The calendar date (year/month/day) when the first discount was applied; "ymd" for year-month-day |
| サービス課金開始年月日 | Field | Service Charge Start Date (`svc_chrg_staymd`) — The date when billing for the service contract begins; "svc" for service, "chrg" for charge, "stay" likely for "stay/start" |
| サービス課金終了年月日 | Field | Service Charge End Date (`svc_chrg_endymd`) — The date when billing for the service contract ends; "endymd" for end year/month/day |
| `value` | Subkey | Data value property — Returns `String.class`; represents the actual data content of the field |
| `enable` | Subkey | Field enabled/disabled property — Returns `Boolean.class`; controls whether the UI field is interactive or read-only |
| `state` | Subkey | Display state property — Returns `String.class`; represents the visual/status state of the field (e.g., normal, error, warning) |
| X33VDataTypeBeanInterface | Interface | Data type bean contract — Defines the type model lookup pattern (`typeModelData`) that all DBeans implement for framework-driven form binding |
| DBean | Acronym | Data Bean — A view-layer bean that provides data type and metadata information for the web framework's form rendering and validation system |
| KKW01023SF | Module | Screen module identifier — Service contract detail edit screen |
| `separaterPoint` | Field | Separator position index — Stores the index of '/' in the key; computed but not used in this method (potential future use or remnant code) |
| String.class | Java type | The Java String class — Returned as the data type for field values, state, and most subkey properties |
| Boolean.class | Java type | The Java Boolean class — Returned as the data type for field enabled/disabled properties |
