# Business Logic — KKW01034SF04DBean.typeModelData() [93 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01034SF.KKW01034SF04DBean` |
| Layer | Utility (webview data type bean, part of the X33VDataType framework) |
| Module | `KKW01034SF` (Package: `eo.web.webview.KKW01034SF`) |

## 1. Role

### KKW01034SF04DBean.typeModelData()

This method is a **data type resolution utility** that maps business field names (items / 項目) and their sub-properties (subkeys) to their corresponding Java runtime types. It serves as part of the X33VDataType framework — a webview data binding system used across multiple screens in the K-Opticom telecom billing and contract management platform. The method implements a **routing/dispatch pattern**: given a key (item name in Japanese) and a subkey (property selector), it returns the appropriate `Class<?>` that the framework uses to instantiate typed data beans for each field.

The method handles **eight distinct business data categories**, all of which are string-typed fields: (1) Item number (通番 / no), (2) Target contract identification code (対象契約識別コード / tg_kei_skbt_cd), (3) Service contract number (サービス契約番号 / svc_kei_no), (4) Service contract detail number (サービス契約内訳番号 / svc_kei_ucwk_no), (5) Option service contract number (オプションサービス契約番号 / op_svc_kei_no), (6) Sub-option service contract number (サブオプションサービス契約番号 / sbop_svc_kei_no), (7) Equipment-provided service contract number (機器提供サービス契約番号 / kktk_svc_kei_no), and (8) Discount-service-target service code (割引サービス対象サービスコード / wrib_svc_trgt_svc_cd). Each category supports two subkeys: `"value"` (the field's actual data value) and `"state"` (the field's display state/status).

Its **role in the larger system** is as a shared type-dispatcher consumed by the screen-level bean (`KKW01034SFBean`) during list data initialization and dynamic field rendering. When a screen needs to add or query typed list items (e.g., "Target Contract List"), it delegates type resolution to this method to determine which Java type to use for each field — enabling generic, type-safe data binding without hardcoded type switches in each screen.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> NULL_CHECK["Null Check:
key == null || subkey == null"]
    NULL_CHECK -->|true| RETURN_NULL_1(["Return null"])
    NULL_CHECK -->|false| SEPARATOR["Find '/' in key
key.indexOf('/')"]

    SEPARATOR --> CHK1["Check: key.equals
'通番'"]
    CHK1 -->|true| SUB1A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB1A -->|true| RET1A(["Return String.class"])
    SUB1A -->|false| SUB1B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB1B -->|true| RET1B(["Return String.class"])
    SUB1B -->|false| SKIP1["Skip branch"]

    CHK1 -->|false| CHK2["Check: key.equals
'対象契約識別コード'"]
    CHK2 -->|true| SUB2A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB2A -->|true| RET2A(["Return String.class"])
    SUB2A -->|false| SUB2B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB2B -->|true| RET2B(["Return String.class"])
    SUB2B -->|false| SKIP2["Skip branch"]

    CHK2 -->|false| CHK3["Check: key.equals
'サービス契約番号'"]
    CHK3 -->|true| SUB3A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB3A -->|true| RET3A(["Return String.class"])
    SUB3A -->|false| SUB3B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB3B -->|true| RET3B(["Return String.class"])
    SUB3B -->|false| SKIP3["Skip branch"]

    CHK3 -->|false| CHK4["Check: key.equals
'サービス契約内訳番号'"]
    CHK4 -->|true| SUB4A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB4A -->|true| RET4A(["Return String.class"])
    SUB4A -->|false| SUB4B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB4B -->|true| RET4B(["Return String.class"])
    SUB4B -->|false| SKIP4["Skip branch"]

    CHK4 -->|false| CHK5["Check: key.equals
'オプションサービス契約番号'"]
    CHK5 -->|true| SUB5A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB5A -->|true| RET5A(["Return String.class"])
    SUB5A -->|false| SUB5B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB5B -->|true| RET5B(["Return String.class"])
    SUB5B -->|false| SKIP5["Skip branch"]

    CHK5 -->|false| CHK6["Check: key.equals
'サブオプションサービス契約番号'"]
    CHK6 -->|true| SUB6A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB6A -->|true| RET6A(["Return String.class"])
    SUB6A -->|false| SUB6B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB6B -->|true| RET6B(["Return String.class"])
    SUB6B -->|false| SKIP6["Skip branch"]

    CHK6 -->|false| CHK7["Check: key.equals
'機器提供サービス契約番号'"]
    CHK7 -->|true| SUB7A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB7A -->|true| RET7A(["Return String.class"])
    SUB7A -->|false| SUB7B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB7B -->|true| RET7B(["Return String.class"])
    SUB7B -->|false| SKIP7["Skip branch"]

    CHK7 -->|false| CHK8["Check: key.equals
'割引サービス対象サービスコード'"]
    CHK8 -->|true| SUB8A["Check: subkey.equalsIgnoreCase
'value'"]
    SUB8A -->|true| RET8A(["Return String.class"])
    SUB8A -->|false| SUB8B["Check: subkey.equalsIgnoreCase
'state'"]
    SUB8B -->|true| RET8B(["Return String.class"])
    SUB8B -->|false| SKIP8["Skip branch"]

    SKIP1 --> END_NOT_FOUND
    SKIP2 --> END_NOT_FOUND
    SKIP3 --> END_NOT_FOUND
    SKIP4 --> END_NOT_FOUND
    SKIP5 --> END_NOT_FOUND
    SKIP6 --> END_NOT_FOUND
    SKIP7 --> END_NOT_FOUND
    SKIP8 --> END_NOT_FOUND

    CHK8 -->|false| END_NOT_FOUND(["No matching key found
Return null"])

    RET1A --> END_NOT_FOUND
    RET1B --> END_NOT_FOUND
    RET2A --> END_NOT_FOUND
    RET2B --> END_NOT_FOUND
    RET3A --> END_NOT_FOUND
    RET3B --> END_NOT_FOUND
    RET4A --> END_NOT_FOUND
    RET4B --> END_NOT_FOUND
    RET5A --> END_NOT_FOUND
    RET5B --> END_NOT_FOUND
    RET6A --> END_NOT_FOUND
    RET6B --> END_NOT_FOUND
    RET7A --> END_NOT_FOUND
    RET7B --> END_NOT_FOUND
    RET8A --> END_NOT_FOUND
    RET8B --> END_NOT_FOUND
    RETURN_NULL_1 --> END_NOT_FOUND
```

**Branch descriptions:**

- **Null check (L534)**: If either `key` or `subkey` is null, the method returns `null` immediately.
- **Separator computation (L537)**: `key.indexOf("/")` is computed but the result (`separaterPoint`) is unused — likely reserved for future delimiter-based key parsing.
- **Key branch 1 (L540)**: `key.equals("通番")` — matches the item number field.
- **Key branch 2 (L551)**: `key.equals("対象契約識別コード")` — matches the target contract identification code field.
- **Key branch 3 (L562)**: `key.equals("サービス契約番号")` — matches the service contract number field.
- **Key branch 4 (L573)**: `key.equals("サービス契約内訳番号")` — matches the service contract detail number field.
- **Key branch 5 (L584)**: `key.equals("オプションサービス契約番号")` — matches the option service contract number field.
- **Key branch 6 (L595)**: `key.equals("サブオプションサービス契約番号")` — matches the sub-option service contract number field.
- **Key branch 7 (L606)**: `key.equals("機器提供サービス契約番号")` — matches the equipment-provided service contract number field.
- **Key branch 8 (L617)**: `key.equals("割引サービス対象サービスコード")` — matches the discount-service-target service code field.
- **Fallback (L620)**: If none of the key branches match, returns `null`.

Each key branch follows an identical inner structure: it checks `subkey.equalsIgnoreCase("value")` and `subkey.equalsIgnoreCase("state")`, both returning `String.class`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name (項目名)** — a Japanese-language business field identifier. It selects which of the eight supported telecom contract fields to resolve the type for. Valid values: `"通番"` (item number), `"対象契約識別コード"` (target contract identification code), `"サービス契約番号"` (service contract number), `"サービス契約内訳番号"` (service contract detail number), `"オプションサービス契約番号"` (option service contract number), `"サブオプションサービス契約番号"` (sub-option service contract number), `"機器提供サービス契約番号"` (equipment-provided service contract number), `"割引サービス対象サービスコード"` (discount-service-target service code). An unsupported value causes the method to return `null`. |
| 2 | `subkey` | `String` | The **sub-key (サブキー)** — a property selector within the matched field. Determines whether the method returns the type for the field's actual value (`"value"`, case-insensitive) or its display state/status (`"state"`, case-insensitive). Both subkeys resolve to `String.class`. If an unrecognized subkey is passed, the method falls through to the next key branch or ultimately returns `null`. |

**External state:** No instance fields or external state is read by this method. It is a stateless, pure function.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no external services, SC codes, or CBS components**. It is a pure type-resolution function that operates entirely in-memory, returning `java.lang.Class` objects. No database reads, entity access, or service component invocations occur within this method.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A | (none) | N/A | N/A | This method is a pure lookup utility — no data access occurs. |

## 5. Dependency Trace

This method is called indirectly by the screen bean (`KKW01034SFBean`) as part of the X33VDataType framework's list data management. The `KKW01034SFBean` delegates to `KKW01034SF04DBean` for type resolution when handling the "対象契約一覧" (Target Contract List) and "対象契約一覧2" (Target Contract List 2) item types.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW01034SFBean | `KKW01034SFBean.getType` / `KKW01034SFBean.addDataInstance` -> creates `KKW01034SF04DBean` instance -> framework invokes `typeModelData(key, subkey)` | N/A (no terminal — pure in-memory lookup) |

**Note:** The direct invocations of `typeModelData` are not made by explicit Java calls from `KKW01034SFBean` — instead, the X33VDataType framework's reflection-based data binding mechanism calls this method dynamically when initializing typed list beans. The `KKW01034SFBean` registers `KKW01034SF04DBean` as the data bean class for the item keys `"対象契約一覧"` and `"対象契約一覧2"` (see lines 2786/2801, 2866/2902 of `KKW01034SFBean.java`), and the framework invokes `typeModelData` on the bean instance during field type resolution.

## 6. Per-Branch Detail Blocks

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

> If either key or subkey is null, the method returns null immediately.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key == null || subkey == null` // null guard — returns early |
| 2 | RETURN | `return null;` // key or subkey is null, no type info available |

**Block 2** — EXEC `(separator computation)` (L537)

> Computes index of "/" delimiter in key. Result stored in `separaterPoint` but is currently unused — reserved for future key parsing.

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

**Block 3** — IF-ELSE-IF chain `(key-based routing)` — Item Number branch (L540)

> Routes to the "通番" (item number) field type resolution. Both value and state subkeys resolve to String.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("通番")` // Item Number field (item ID: no) [-> キー="通番"] |
| 2 | IF | `(subkey branch)` (L541) |

**Block 3.1** — IF-ELSE-IF `(subkey: "value")` (L541)

> When subkey is "value", the actual data value is requested. Returns String.class.

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` // Case-insensitive check for "value" |
| 2 | RETURN | `return String.class;` // Data value type for item number is String |

**Block 3.2** — ELSE-IF `(subkey: "state")` (L544)

> When subkey is "state", the display state/status is requested. Returns String.class.

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // Case-insensitive check for "state" |
| 2 | RETURN | `return String.class;` // State type for item number is String |

**Block 4** — ELSE-IF `(key: "対象契約識別コード")` (L551)

> Routes to the "対象契約識別コード" (target contract identification code) field type resolution. Both value and state subkeys resolve to String.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("対象契約識別コード")` // Target Contract Identification Code (item ID: tg_kei_skbt_cd) [-> キー="対象契約識別コード"] |
| 2 | IF | `(subkey: "value")` (L552) |

**Block 4.1** — IF `(subkey: "value")` (L552)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 4.2** — ELSE-IF `(subkey: "state")` (L555)

> Returns display state type.

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 5** — ELSE-IF `(key: "サービス契約番号")` (L562)

> Routes to the "サービス契約番号" (service contract number) field type resolution.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("サービス契約番号")` // Service Contract Number (item ID: svc_kei_no) [-> キー="サービス契約番号"] |
| 2 | IF | `(subkey: "value")` (L563) |

**Block 5.1** — IF `(subkey: "value")` (L563)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 5.2** — ELSE-IF `(subkey: "state")` (L566)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 6** — ELSE-IF `(key: "サービス契約内訳番号")` (L573)

> Routes to the "サービス契約内訳番号" (service contract detail number) field type resolution.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("サービス契約内訳番号")` // Service Contract Detail Number (item ID: svc_kei_ucwk_no) [-> キー="サービス契約内訳番号"] |
| 2 | IF | `(subkey: "value")` (L574) |

**Block 6.1** — IF `(subkey: "value")` (L574)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 6.2** — ELSE-IF `(subkey: "state")` (L577)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 7** — ELSE-IF `(key: "オプションサービス契約番号")` (L584)

> Routes to the "オプションサービス契約番号" (option service contract number) field type resolution.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("オプションサービス契約番号")` // Option Service Contract Number (item ID: op_svc_kei_no) [-> キー="オプションサービス契約番号"] |
| 2 | IF | `(subkey: "value")` (L585) |

**Block 7.1** — IF `(subkey: "value")` (L585)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 7.2** — ELSE-IF `(subkey: "state")` (L588)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 8** — ELSE-IF `(key: "サブオプションサービス契約番号")` (L595)

> Routes to the "サブオプションサービス契約番号" (sub-option service contract number) field type resolution.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("サブオプションサービス契約番号")` // Sub-Option Service Contract Number (item ID: sbop_svc_kei_no) [-> キー="サブオプションサービス契約番号"] |
| 2 | IF | `(subkey: "value")` (L596) |

**Block 8.1** — IF `(subkey: "value")` (L596)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 8.2** — ELSE-IF `(subkey: "state")` (L599)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 9** — ELSE-IF `(key: "機器提供サービス契約番号")` (L606)

> Routes to the "機器提供サービス契約番号" (equipment-provided service contract number) field type resolution.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("機器提供サービス契約番号")` // Equipment-Provided Service Contract Number (item ID: kktk_svc_kei_no) [-> キー="機器提供サービス契約番号"] |
| 2 | IF | `(subkey: "value")` (L607) |

**Block 9.1** — IF `(subkey: "value")` (L607)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 9.2** — ELSE-IF `(subkey: "state")` (L610)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 10** — ELSE-IF `(key: "割引サービス対象サービスコード")` (L617)

> Routes to the "割引サービス対象サービスコード" (discount-service-target service code) field type resolution.

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("割引サービス対象サービスコード")` // Discount-Service-Target Service Code (item ID: wrib_svc_trgt_svc_cd) [-> キー="割引サービス対象サービスコード"] |
| 2 | IF | `(subkey: "value")` (L618) |

**Block 10.1** — IF `(subkey: "value")` (L618)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return String.class;` // Data value type is String |

**Block 10.2** — ELSE-IF `(subkey: "state")` (L621)

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("state")` // subkeyが"state"の場合、ステータスを返す。 |
| 2 | RETURN | `return String.class;` // State type is String |

**Block 11** — RETURN `(fallback)` (L625)

> No matching key was found. Returns null to indicate the key is not supported by this data bean.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // 条件に一致するプロパティが存在しない場合、nullを返す。 |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Parameter | Item name (項目名) — a Japanese-language business field identifier used to select which telecom contract field's type to resolve. |
| `subkey` | Parameter | Sub-key (サブキー) — a property selector within a field ("value" for actual data, "state" for display state). |
| `通番` | Field | Item number (no) — the sequence/item number of a line entry in a list. Internal tracking ordinal. |
| `対象契約識別コード` | Field | Target Contract Identification Code (tg_kei_skbt_cd) — identifies the target contract for service modifications or new orders. Distinguishes between existing contracts and new ones. |
| `サービス契約番号` | Field | Service Contract Number (svc_kei_no) — the primary service contract identifier assigned to a customer's service bundle. |
| `サービス契約内訳番号` | Field | Service Contract Detail Number (svc_kei_ucwk_no) — internal work number for service contract line items (detail/sub-items within a parent contract). |
| `オプションサービス契約番号` | Field | Option Service Contract Number (op_svc_kei_no) — the contract number for optional/add-on services attached to a base service. |
| `サブオプションサービス契約番号` | Field | Sub-Option Service Contract Number (sbop_svc_kei_no) — contract number for sub-options (secondary add-ons) beneath an option service. |
| `機器提供サービス契約番号` | Field | Equipment-Provided Service Contract Number (kktk_svc_kei_no) — contract number for equipment rental/provision services (e.g., modem, router). |
| `割引サービス対象サービスコード` | Field | Discount-Service-Target Service Code (wrib_svc_trgt_svc_cd) — identifies which services are eligible for discount pricing. |
| X33VDataType | Framework | The internal webview data type framework for the K-Opticom billing system. Provides typed data beans, list data binding, and dynamic field type resolution for web screens. |
| `value` | Subkey | Requests the data type of the field's actual value. Always resolves to `String.class`. |
| `state` | Subkey | Requests the display state/status type of the field. Used for conditional UI rendering (e.g., enabled/disabled, visible/hidden). Always resolves to `String.class`. |
| KKW01034SF | Module | A screen module (SF = Screen Function) in the K-Opticom web application for telecom contract management. Handles target contract listing and related operations. |
| Data Type Bean (データタイプビーン) | Pattern | A bean that describes the type structure of a list item field. The framework uses these to instantiate typed objects for each row in a data list. |
| List Item (リスト項目) | Concept | A row within a repeating list data structure (e.g., target contract list). Each item has multiple typed fields. |
