---

# Business Logic — KKW00846SF03DBean.typeModelData() [103 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA18001SF.KKW00846SF03DBean` |
| Layer | Utility (DTO/Bean data type routing helper in the webview layer) |
| Module | `KKA18001SF` (Package: `eo.web.webview.KKA18001SF`) |

## 1. Role

### KKW00846SF03DBean.typeModelData()

This method serves as a **data type dispatcher** (routing/dispacth pattern) within the webview bean framework for the Option Service Contract detail screen (KKW00846SF). Its purpose is to return the Java type of a field value based on the field's business name (`key`) and sub-property (`subkey`), enabling the generic X33V data type binding system to dynamically resolve whether a given model field should be rendered as a `String` or another type.

The method covers **9 business item categories** related to **option service contracts** — including contract number, contract status, service code, service code name, service start date, reservation effective date, service start date, service billing start date, and first billing calculation date. For each category, it supports two sub-keys: `"value"` (the actual field value type) and `"state"` (the field state indicator type, such as editability or validation status). Every matching branch returns `String.class`, indicating that all option service contract detail fields are modelled as strings in the view layer.

This method implements a **routing/dispatch design pattern**: it branches on the `key` parameter to identify the business item category, then branches again on the `subkey` to distinguish between the field's data value and its state metadata. It has **no external side effects** — no database access, no service calls, no mutable state modification. It is a pure, stateless utility method called by the parent bean (`KKW00846SFBean`) during dynamic view binding for the "Option Service Contract List Details" screen component.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    NULL_CHECK{"key == null
or subkey == null"}
    SEPARATE(["separaterPoint = key.indexOf('/')"])
    KEY1["key = 'オプションサービス契約番号'
(OP_SVC_KENO_NO)"]
    SUB1_V{"subkey.equalsIgnoreCase('value')"}
    SUB1_S{"subkey.equalsIgnoreCase('state')"}
    KEY2["key = 'オプションサービス契約ステータス'
(OP_SVC_KENO_STAT)"]
    SUB2_V{"subkey.equalsIgnoreCase('value')"}
    SUB2_S{"subkey.equalsIgnoreCase('state')"}
    KEY3["key = 'オプションサービスコード'
(OP_SVC_CD)"]
    SUB3_V{"subkey.equalsIgnoreCase('value')"}
    SUB3_S{"subkey.equalsIgnoreCase('state')"}
    KEY4["key = 'オプションサービスコード名称'
(OP_SVC_CD_NM)"]
    SUB4_V{"subkey.equalsIgnoreCase('value')"}
    SUB4_S{"subkey.equalsIgnoreCase('state')"}
    KEY5["key = 'サービス利用開始希望年月日'
(SVC_USE_STA_KIBO_YMD)"]
    SUB5_V{"subkey.equalsIgnoreCase('value')"}
    SUB5_S{"subkey.equalsIgnoreCase('state')"}
    KEY6["key = '予約適用年月日'
(RSV_APY_YMD)"]
    SUB6_V{"subkey.equalsIgnoreCase('value')"}
    SUB6_S{"subkey.equalsIgnoreCase('state')"}
    KEY7["key = 'サービス開始年月日'
(SVC_STA_YMD)"]
    SUB7_V{"subkey.equalsIgnoreCase('value')"}
    SUB7_S{"subkey.equalsIgnoreCase('state')"}
    KEY8["key = 'サービス課金開始年月日'
(SVC_CHRG_STAYMD)"]
    SUB8_V{"subkey.equalsIgnoreCase('value')"}
    SUB8_S{"subkey.equalsIgnoreCase('state')"}
    KEY9["key = '初回料金計算日'
(FIRST_PRG_CALC_YMD)"]
    SUB9_V{"subkey.equalsIgnoreCase('value')"}
    SUB9_S{"subkey.equalsIgnoreCase('state')"}
    NULL_RET["return null"]
    END_RET(["return String.class / null"])

    START --> NULL_CHECK
    NULL_CHECK -->|false| SEPARATE
    NULL_CHECK -->|true| NULL_RET
    SEPARATE --> KEY1
    KEY1 --> SUB1_V
    SUB1_V -->|true| END_RET
    SUB1_V -->|false| SUB1_S
    SUB1_S -->|true| END_RET
    SUB1_S -->|false| KEY2
    KEY2 --> SUB2_V
    SUB2_V -->|true| END_RET
    SUB2_V -->|false| SUB2_S
    SUB2_S -->|true| END_RET
    SUB2_S -->|false| KEY3
    KEY3 --> SUB3_V
    SUB3_V -->|true| END_RET
    SUB3_V -->|false| SUB3_S
    SUB3_S -->|true| END_RET
    SUB3_S -->|false| KEY4
    KEY4 --> SUB4_V
    SUB4_V -->|true| END_RET
    SUB4_V -->|false| SUB4_S
    SUB4_S -->|true| END_RET
    SUB4_S -->|false| KEY5
    KEY5 --> SUB5_V
    SUB5_V -->|true| END_RET
    SUB5_V -->|false| SUB5_S
    SUB5_S -->|true| END_RET
    SUB5_S -->|false| KEY6
    KEY6 --> SUB6_V
    SUB6_V -->|true| END_RET
    SUB6_V -->|false| SUB6_S
    SUB6_S -->|true| END_RET
    SUB6_S -->|false| KEY7
    KEY7 --> SUB7_V
    SUB7_V -->|true| END_RET
    SUB7_V -->|false| SUB7_S
    SUB7_S -->|true| END_RET
    SUB7_S -->|false| KEY8
    KEY8 --> SUB8_V
    SUB8_V -->|true| END_RET
    SUB8_V -->|false| SUB8_S
    SUB8_S -->|true| END_RET
    SUB8_S -->|false| KEY9
    KEY9 --> SUB9_V
    SUB9_V -->|true| END_RET
    SUB9_V -->|false| SUB9_S
    SUB9_S -->|true| END_RET
    SUB9_S -->|false| NULL_RET
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business item name (field label) of the option service contract detail. It identifies which field the caller is querying the data type for. Valid values are 9 Japanese strings representing option service contract fields: "オプションサービス契約番号" (Option Service Contract Number), "オプションサービス契約ステータス" (Option Service Contract Status), "オプションサービスコード" (Option Service Code), "オプションサービスコード名称" (Option Service Code Name), "サービス利用開始希望年月日" (Service Start Date Requested), "予約適用年月日" (Reservation Effective Date), "サービス開始年月日" (Service Start Date), "サービス課金開始年月日" (Service Billing Start Date), "初回料金計算日" (First Billing Calculation Date). |
| 2 | `subkey` | `String` | The sub-property selector within each field. Two values are supported: `"value"` (returns the data type of the field's actual value) and `"state"` (returns the data type of the field's state/metadata, such as editability or validation flags). Comparison is case-insensitive via `equalsIgnoreCase()`. |

**Instance/External State Read:** None. This method is entirely stateless — it does not read any instance fields or rely on external mutable state.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and calls **no external services**. It is a pure routing function with no data access, no side effects, and no state mutation.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (none) | — | — | — | This method is a pure data-type resolver with no database or service calls. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW00846SFBean | `KKW00846SFBean.getDataBean(key, subkey)` -> `new KKW00846SF03DBean()` -> `typeModelData(key, subkey)` | N/A (no DB) |
| 2 | Bean:KKW00846SFBean | `KKW00846SFBean.listKoumokuIds()` -> references `KKW00846SF03DBean.listKoumokuIds()` | N/A (metadata only) |
| 3 | Bean:KKW00846SFBean | `KKW00846SFBean.removeElementFromListData(key, index)` -> for `key = "オプションサービス契約一覧照会明細"` (Option Service Contract List Details) -> `op_svc_kei_list_list` contains `KKW00846SF03DBean` instances | N/A (no DB) |

**How callers use this method:** The parent bean `KKW00846SFBean` instantiates `KKW00846SF03DBean` as a data-type-bean for the "Option Service Contract List Details" (`オプションサービス契約一覧照会明細`) repeating item (`op_svc_kei_list`). When the X33V view framework needs to bind a field in this repeating section, it calls `typeModelData(key, subkey)` on the bean instance to determine the correct Java type for the model.

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) (L579)

> Null check: If either parameter is null, return null immediately. This is the fail-fast guard that prevents NPE during string comparison downstream.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key == null || subkey == null)` // Guard against null parameters |
| 2 | RETURN | `return null` // Return null if either parameter is null |

---

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

> Calculate the position of "/" in the key string. This value is computed but not used anywhere in the method body — it appears to be dead code / leftover from a prior design.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` // Compute separator index (not subsequently used) |

---

**Block 3** — IF-ELSE IF chain (key = "オプションサービス契約番号", L588)

> Data type is String for item "Option Service Contract Number" (Field ID: op_svc_kei_no).

| # | Type | Code |
|---|------|------|
| 1 | IF-ELSE IF | `key.equals("オプションサービス契約番号")` // Field: op_svc_kei_no |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 4** — IF-ELSE IF chain (key = "オプションサービス契約ステータス", L600)

> Data type is String for item "Option Service Contract Status" (Field ID: op_svc_kei_stat).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("オプションサービス契約ステータス")` // Field: op_svc_kei_stat |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 5** — IF-ELSE IF chain (key = "オプションサービスコード", L612)

> Data type is String for item "Option Service Code" (Field ID: op_svc_cd).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("オプションサービスコード")` // Field: op_svc_cd |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 6** — IF-ELSE IF chain (key = "オプションサービスコード名称", L624)

> Data type is String for item "Option Service Code Name" (Field ID: op_svc_cd_nm).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("オプションサービスコード名称")` // Field: op_svc_cd_nm |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 7** — IF-ELSE IF chain (key = "サービス利用開始希望年月日", L636)

> Data type is String for item "Service Start Date Requested" (Field ID: svc_use_sta_kibo_ymd).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス利用開始希望年月日")` // Field: svc_use_sta_kibo_ymd |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 8** — IF-ELSE IF chain (key = "予約適用年月日", L648)

> Data type is String for item "Reservation Effective Date" (Field ID: rsv_aply_ymd).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("予約適用年月日")` // Field: rsv_aply_ymd |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 9** — IF-ELSE IF chain (key = "サービス開始年月日", L660)

> Data type is String for item "Service Start Date" (Field ID: svc_sta_ymd).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス開始年月日")` // Field: svc_sta_ymd |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 10** — IF-ELSE IF chain (key = "サービス課金開始年月日", L672)

> Data type is String for item "Service Billing Start Date" (Field ID: svc_chrg_staymd).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("サービス課金開始年月日")` // Field: svc_chrg_staymd |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 11** — IF-ELSE IF chain (key = "初回料金計算日", L684)

> Data type is String for item "First Billing Calculation Date" (Field ID: first_prc_calc_ymd).

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `key.equals("初回料金計算日")` // Field: first_prc_calc_ymd |
| 2 | IF | `subkey.equalsIgnoreCase("value")` // subkey = "value" |
| 3 | RETURN | `return String.class` |
| 4 | ELSE-IF | `subkey.equalsIgnoreCase("state")` // subkey = "state" |
| 5 | RETURN | `return String.class` |

---

**Block 12** — ELSE (no match) (L691)

> No matching property found. Return null.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | `return null` // No matching property exists; return null |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `op_svc_kei_no` | Field | Option service contract number — the unique identifier for an option service contract line item |
| `op_svc_kei_stat` | Field | Option service contract status — the current lifecycle state of the contract (e.g., active, cancelled, pending) |
| `op_svc_cd` | Field | Option service code — the code identifying the specific option service (e.g., backup service, security add-on) |
| `op_svc_cd_nm` | Field | Option service code name — the human-readable name of the option service code |
| `svc_use_sta_kibo_ymd` | Field | Service usage start requested date — the date the customer requests service activation |
| `rsv_aply_ymd` | Field | Reservation effective date — the date from which a reservation becomes active |
| `svc_sta_ymd` | Field | Service start date — the actual date the service began |
| `svc_chrg_staymd` | Field | Service charge start date — the date from which billing for the service begins |
| `first_prc_calc_ymd` | Field | First price calculation date — the date the initial billing amount is calculated |
| `subkey="value"` | Sub-key | Requests the data type of the field's actual value |
| `subkey="state"` | Sub-key | Requests the data type of the field's state/metadata (e.g., editability, validation status) |
| X33V | Framework | View framework for dynamic data binding in K-Opticom web screens |
| DBean | Pattern | Data Bean — a class holding view data and type metadata for X33V data type binding |
| KKSV* | Screen | K-Opticom Screen class naming convention (KKSVxxxx = screen ID) |
| `KKW00846SF03DBean` | Class | Data type bean for Option Service Contract List Details (オプションサービス契約一覧照会明細) |
| KKW00846SF | Module | Option Service Contract detail screen module |
| K-Opticom | Company | NTT K-Opticom — Japanese telecom operator providing FTTH and business communication services |

---
