# Business Logic — KKW01023SF01DBean.typeModelData() [111 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01023SF.KKW01023SF01DBean` |
| Layer | Controller / Web Bean (Inferred from package `eo.web.webview`) |
| Module | `KKW01023SF` (Package: `eo.web.webview.KKW01023SF`) |

## 1. Role

### KKW01023SF01DBean.typeModelData()

This method serves as a **data type resolution router** for a web form's dynamic field model system. It maps a combination of a Japanese-labeled field name (the `key` parameter) and a subkey descriptor (the `subkey` parameter) to the corresponding Java type (`Class<?>`) that the frontend framework should use for rendering, validation, and data binding.

The method handles **eight distinct business fields**, each representing a conceptual field in a telecom service order/campaign UI:

| Field Name (Japanese) | English Meaning | Field ID Hint | Data Shape |
|----------------------|-----------------|---------------|------------|
| 照会選択 (Shoukai Sentaku) | Consultation Selection / Choice | `choice` | Boolean (value/enable) or String (state) |
| 番号 (Bangou) | Number | `no` | String (value) or Boolean (enable) or String (state) |
| キャンペーンコード (Kyanpee Koodo) | Campaign Code | `campaign_cd` | String (value) or Boolean (enable) or String (state) |
| キャンペーン名 (Kyanpee Mei) | Campaign Name | `campaign_nm` | String (value) or Boolean (enable) or String (state) |
| タイプコード (Taipu Koodo) | Type Code | `type_cd` | String (value) or String (state) — no enable |
| タイプコード名称 (Taipu Koodo Meishou) | Type Code Name | `type_cd_nm` | String (value) or Boolean (enable) or String (state) |
| 種別コード (Shubetsu Koodo) | Category Code | `sbt_cd` | String (value) or String (state) — no enable |
| 種別コード名称 (Shubetsu Koodo Meishou) | Category Code Name | `sbt_cd_nm` | String (value) or Boolean (enable) or String (state) |

This method implements a **routing/dispatch design pattern** — it inspects the `key` to select one of eight field-handling branches, then inspects the `subkey` (`"value"`, `"enable"`, or `"state"`) within that branch to determine the correct return type. It does **not** perform any database operations, service calls, or external side effects.

Its **role in the larger system** is that of a shared type-introspection utility used by the frontend framework to dynamically determine how to render each field in a campaign or service order screen. The `subkey` values follow a consistent convention: `"value"` resolves the actual data type, `"enable"` resolves whether the field is editable (Boolean), and `"state"` resolves the UI state class (String).

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> CHECK_NULL{"key == null or subkey == null?"}

    CHECK_NULL -->|Yes| NULL_RET1[Return null]
    CHECK_NULL -->|No| CHECK1{key equals 照会選択?}

    CHECK1 -->|Yes| S1C1{subkey equals value?}
    S1C1 -->|Yes| S1R1[Return Boolean.class]
    S1C1 -->|No| S1C2{subkey equals enable?}
    S1C2 -->|Yes| S1R2[Return Boolean.class]
    S1C2 -->|No| S1C3{subkey equals state?}
    S1C3 -->|Yes| S1R3[Return String.class]
    S1C3 -->|No| CHECK2{key equals 番号?}

    CHECK1 -->|No| CHECK2

    CHECK2 -->|Yes| S2C1{subkey equals value?}
    S2C1 -->|Yes| S2R1[Return String.class]
    S2C1 -->|No| S2C2{subkey equals enable?}
    S2C2 -->|Yes| S2R2[Return Boolean.class]
    S2C2 -->|No| S2C3{subkey equals state?}
    S2C3 -->|Yes| S2R3[Return String.class]
    S2C3 -->|No| CHECK3{key equals キャンペーンコード?}

    CHECK3 -->|Yes| S3C1{subkey equals value?}
    S3C1 -->|Yes| S3R1[Return String.class]
    S3C1 -->|No| S3C2{subkey equals enable?}
    S3C2 -->|Yes| S3R2[Return Boolean.class]
    S3C2 -->|No| S3C3{subkey equals state?}
    S3C3 -->|Yes| S3R3[Return String.class]
    S3C3 -->|No| CHECK4{key equals キャンペーン名?}

    CHECK4 -->|Yes| S4C1{subkey equals value?}
    S4C1 -->|Yes| S4R1[Return String.class]
    S4C1 -->|No| S4C2{subkey equals enable?}
    S4C2 -->|Yes| S4R2[Return Boolean.class]
    S4C2 -->|No| S4C3{subkey equals state?}
    S4C3 -->|Yes| S4R3[Return String.class]
    S4C3 -->|No| CHECK5{key equals タイプコード?}

    CHECK5 -->|Yes| S5C1{subkey equals value?}
    S5C1 -->|Yes| S5R1[Return String.class]
    S5C1 -->|No| S5C2{subkey equals state?}
    S5C2 -->|Yes| S5R2[Return String.class]
    S5C2 -->|No| CHECK6{key equals タイプコード名称?}

    CHECK6 -->|Yes| S6C1{subkey equals value?}
    S6C1 -->|Yes| S6R1[Return String.class]
    S6C1 -->|No| S6C2{subkey equals enable?}
    S6C2 -->|Yes| S6R2[Return Boolean.class]
    S6C2 -->|No| S6C3{subkey equals state?}
    S6C3 -->|Yes| S6R3[Return String.class]
    S6C3 -->|No| CHECK7{key equals 種別コード?}

    CHECK7 -->|Yes| S7C1{subkey equals value?}
    S7C1 -->|Yes| S7R1[Return String.class]
    S7C1 -->|No| S7C2{subkey equals state?}
    S7C2 -->|Yes| S7R2[Return String.class]
    S7C2 -->|No| CHECK8{key equals 種別コード名称?}

    CHECK8 -->|Yes| S8C1{subkey equals value?}
    S8C1 -->|Yes| S8R1[Return String.class]
    S8C1 -->|No| S8C2{subkey equals enable?}
    S8C2 -->|Yes| S8R2[Return Boolean.class]
    S8C2 -->|No| S8C3{subkey equals state?}
    S8C3 -->|Yes| S8R3[Return String.class]
    S8C3 -->|No| NULL_RET2[Return null]
```

**Processing Summary:**

1. **Null Guard**: If either `key` or `subkey` is `null`, the method returns `null` immediately. This is a defensive null-check (Japanese comment: "key, subkey ga null no baai, null o kaesu" — Return null if key/subkey is null).
2. **Separator Scan**: `key.indexOf("/")` is computed but the result (`separaterPoint`) is never used — it is an unused local variable.
3. **Field Dispatch Chain**: Eight `if` / `else if` branches match the `key` against hardcoded Japanese field names. Each matching branch then dispatches on `subkey` (case-insensitive via `equalsIgnoreCase`):
   - `"value"` → returns the data type (`Boolean.class` or `String.class`)
   - `"enable"` → returns `Boolean.class` (only available on certain fields)
   - `"state"` → returns `String.class` (UI state class)
4. **No Match**: If none of the eight field names match, the method falls through to `return null`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese-labeled field name of a UI form element. It identifies which of the eight supported fields the caller is querying. Valid values: `照会選択` (Consultation Selection), `番号` (Number), `キャンペーンコード` (Campaign Code), `キャンペーン名` (Campaign Name), `タイプコード` (Type Code), `タイプコード名称` (Type Code Name), `種別コード` (Category Code), `種別コード名称` (Category Code Name). Case-sensitive exact match. |
| 2 | `subkey` | `String` | A descriptor indicating which aspect of the field's type model the caller needs. Valid values: `"value"` (the data type of the field), `"enable"` (whether the field is editable), or `"state"` (the UI state class string). Comparison is case-insensitive (`equalsIgnoreCase`). |

**External State:** This method does not read any instance fields or external state. It is a pure function.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations**. It contains no calls to SC/CBS methods, no database access, and no entity manipulation. It is a pure type-resolution utility with zero side effects.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(None)* | — | — | — | This method is a pure routing/dispatch utility. It reads no external state, calls no services, and writes no data. |

## 5. Dependency Trace

The `typeModelData` method is defined in a DBean (Data Bean) class. No callers were found in the codebase that reference this specific method by name. This is typical for DBean methods that are invoked via reflection, EL (Expression Language) resolution, or framework-introspection mechanisms (e.g., JSF/JSP binding) rather than direct Java method calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | DBean Self-Reference | `KKW01023SF01DBean.typeModelData` (utility, no callers found) | N/A |

**Note:** DBean methods in this architecture are typically invoked through web framework binding (e.g., JSP/JSF expression language like `#{bean.typeModelData['key', 'subkey']}`) or reflection-based introspection. This means static code analysis will not find explicit caller references. The method is consumed by the `KKW01023SF` screen's view layer to resolve field type metadata at runtime.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(null check)` (L621)

> Defensive null guard: If either parameter is null, return null immediately.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key == null || subkey == null)` — Japanese comment: "key, subkey ga null no baai, null o kaesu" (Return null if key or subkey is null) |
| 2 | RETURN | `return null` |

**Block 2** — SET (L624)

> Computes a separator index from key but never uses the result. Dead code.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` — unused local variable |

**Block 3** — ELSE-IF `[key.equals("照会選択")]` (L627) — Field: Consultation Selection (Item ID: `choice`)

> The "照会選択" field supports three subkeys. Its value and enable aspects are Boolean; state is String.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("照会選択")` — Japanese comment: "データタイプがBooleanの項目 照会選択 (項目ID: choice)" (Field whose data type is Boolean: Consultation Selection) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` — Japanese comment: "subkey ga 'value' no baai, true / false wo heni" (If subkey is 'value', return true/false) |
| 3 | RETURN | `return Boolean.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` — Japanese comment: "subkey ga 'enable' no baai, true / false wo heni" (If subkey is 'enable', return true/false) |
| 5 | RETURN | `return Boolean.class` |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` — Japanese comment: "subkey ga 'state' no baai, suteetaasu o kaesu" (If subkey is 'state', return state status) |
| 7 | RETURN | `return String.class` |

**Block 4** — ELSE-IF `[key.equals("番号")]` (L637) — Field: Number (Item ID: `no`)

> The "番号" field supports all three subkeys. Value is String, enable is Boolean, state is String.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("番号")` — Japanese comment: "データタイプがStringの項目 番号 (項目ID: no)" (Field whose data type is String: Number) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` |
| 5 | RETURN | `return Boolean.class` |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` — Japanese comment: "subkey ga 'state' no baai, suteetaasu o kaesu" (If subkey is 'state', return state status) |
| 7 | RETURN | `return String.class` |

**Block 5** — ELSE-IF `[key.equals("キャンペーンコード")]` (L647) — Field: Campaign Code (Item ID: `campaign_cd`)

> The "キャンペーンコード" field supports all three subkeys. Value is String, enable is Boolean, state is String.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("キャンペーンコード")` — Japanese comment: "データタイプがStringの項目 キャンペーンコード (項目ID: campaign_cd)" (Field whose data type is String: Campaign Code) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` |
| 5 | RETURN | `return Boolean.class` |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` |
| 7 | RETURN | `return String.class` |

**Block 6** — ELSE-IF `[key.equals("キャンペーン名")]` (L657) — Field: Campaign Name (Item ID: `campaign_nm`)

> The "キャンペーン名" field supports all three subkeys. Value is String, enable is Boolean, state is String.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("キャンペーン名")` — Japanese comment: "データタイプがStringの項目 キャンペーン名 (項目ID: campaign_nm)" (Field whose data type is String: Campaign Name) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` |
| 5 | RETURN | `return Boolean.class` |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` |
| 7 | RETURN | `return String.class` |

**Block 7** — ELSE-IF `[key.equals("タイプコード")]` (L667) — Field: Type Code (Item ID: `type_cd`)

> The "タイプコード" field supports **only two subkeys** — `value` and `state`. There is no `enable` subkey for this field, meaning it does not expose an editable state toggle in the UI.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("タイプコード")` — Japanese comment: "データタイプがStringの項目 タイプコード (項目ID: type_cd)" (Field whose data type is String: Type Code) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` — Japanese comment: "subkey ga 'state' no baai, suteetaasu o kaesu" (If subkey is 'state', return state status) |
| 5 | RETURN | `return String.class` |

**Block 8** — ELSE-IF `[key.equals("タイプコード名称")]` (L676) — Field: Type Code Name (Item ID: `type_cd_nm`)

> The "タイプコード名称" field supports all three subkeys. Value is String, enable is Boolean, state is String.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("タイプコード名称")` — Japanese comment: "データタイプがStringの項目 タイプコード名称 (項目ID: type_cd_nm)" (Field whose data type is String: Type Code Name) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` |
| 5 | RETURN | `return Boolean.class` |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` |
| 7 | RETURN | `return String.class` |

**Block 9** — ELSE-IF `[key.equals("種別コード")]` (L686) — Field: Category Code (Item ID: `sbt_cd`)

> The "種別コード" field supports **only two subkeys** — `value` and `state`. No `enable` subkey is supported, meaning this field does not expose an editable state toggle.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("種別コード")` — Japanese comment: "データタイプがStringの項目 種別コード (項目ID: sbt_cd)" (Field whose data type is String: Category Code) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` |
| 5 | RETURN | `return String.class` |

**Block 10** — ELSE-IF `[key.equals("種別コード名称")]` (L695) — Field: Category Code Name (Item ID: `sbt_cd_nm`)

> The "種別コード名称" field supports all three subkeys. Value is String, enable is Boolean, state is String.

| # | Type | Code |
|---|------|------|
| 1 | IF | `key.equals("種別コード名称")` — Japanese comment: "データタイプがStringの項目 種別コード名称 (項目ID: sbt_cd_nm)" (Field whose data type is String: Category Code Name) |
| 2 | IF | `subkey.equalsIgnoreCase("value")` |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("enable")` |
| 5 | RETURN | `return Boolean.class` |
| 6 | ELSE-IF | `subkey.equalsIgnoreCase("state")` |
| 7 | RETURN | `return String.class` |

**Block 11** — ELSE (L706) — No Match Default

> If no field name matches any of the eight branches, return null.

| # | Type | Code |
|---|------|------|
| 1 | COMMENT | Japanese comment: "jouken ni gouchi suru puraoputei ga sonzai shinai baai wa, null o kaesu" (If no matching property exists, return null) |
| 2 | RETURN | `return null` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `照会選択` | Field (Japanese) | Consultation Selection — a UI toggle/choice field for inquiry status. Maps to field ID `choice`. Boolean data type. |
| `番号` | Field (Japanese) | Number — a numeric identifier field. Maps to field ID `no`. String data type (formatted number display). |
| `キャンペーンコード` | Field (Japanese) | Campaign Code — the unique code identifying a marketing campaign. Maps to field ID `campaign_cd`. String data type. |
| `キャンペーン名` | Field (Japanese) | Campaign Name — the human-readable name of a marketing campaign. Maps to field ID `campaign_nm`. String data type. |
| `タイプコード` | Field (Japanese) | Type Code — the code classifying the service/offer type. Maps to field ID `type_cd`. String data type. No editable state (`enable` not supported). |
| `タイプコード名称` | Field (Japanese) | Type Code Name — the human-readable name of the service/offer type. Maps to field ID `type_cd_nm`. String data type. |
| `種別コード` | Field (Japanese) | Category Code — the code classifying the sub-category of a service type. Maps to field ID `sbt_cd`. String data type. No editable state (`enable` not supported). |
| `種別コード名称` | Field (Japanese) | Category Code Name — the human-readable name of the service category. Maps to field ID `sbt_cd_nm`. String data type. |
| `DBean` | Acronym | Data Bean — a Java bean class in the web layer that holds data and type metadata for a specific screen. Prefix `KKW01023SF01` indicates screen `KKW01023SF`, detail type `01`. |
| `value` | Subkey | Requests the actual data type of a field (Boolean or String). |
| `enable` | Subkey | Requests the editable-state type of a field (always Boolean). Not all fields support this subkey. |
| `state` | Subkey | Requests the UI state class type (always String) — typically used for CSS state classes (e.g., "active", "disabled"). |
| `IgnoreCase` | Technical | The `subkey` comparison is case-insensitive via `equalsIgnoreCase()`, allowing callers to use "VALUE", "Value", "value", etc. |
| `KKW01023SF` | Screen ID | The screen/module identifier. `KK` = K-Opticom, `W` = Web, `01023` = sequential screen number, `SF` = form/screen type. |
