# Business Logic — KKW00816SF02DBean.typeModelData() [43 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SF02DBean` |
| Layer | Utility (Data Bean — part of the X33V data type bean layer in the web presentation framework) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SF02DBean.typeModelData()

This method serves as a **data type resolver** for option service contract fields within the K-Opticom web application's screen bean framework. Its primary business purpose is to tell the presentation layer what Java type a given field (identified by `key`) and sub-property (identified by `subkey`) should be rendered as. In the telecom domain, this screen module (`KKW00816SF`) handles **Option Service Contract** operations — the ability to view, add, modify, and cancel supplementary services attached to a customer's base internet (FTTH) contract.

The method implements a **routing/dispatch design pattern**: it branches on the Japanese-display label of each field (`key`) and, within each field, dispatches based on the sub-property (`subkey`) — either `"value"` (the actual data content) or `"state"` (the editability/validation state of the field). Every recognized field/subkey combination returns `String.class`, indicating all three fields in this bean are string-typed data. This allows the X33V framework to instantiate the correct `X33VDataType` wrapper (e.g., `X33VDataTypeStringBean`) for each repeatable list item.

As a shared utility within the data bean hierarchy, `typeModelData` is called by the parent screen bean (`KKW00816SFBean`) when managing the **"Option Service Contract List"** (`オプションサービス契約リスト`, item ID: `op_svc_kei_list`) — a repeating list component on the screen. Each row in the list is an instance of `KKW00816SF02DBean`, and the framework queries `typeModelData` to understand the data types of each sub-field for validation, binding, and UI rendering.

The method handles **three option service contract fields**, each with two sub-properties (`value` and `state`):
1. **Option Service Contract Number** (`オプションサービス契約番号`, field ID: `op_svc_kei_no`) — the unique contract number for each option service line item.
2. **Option Service Contract Status** (`オプションサービス契約ステータス`, field ID: `op_svc_kei_stat`) — the current status of the option service contract (e.g., active, suspended, cancelled).
3. **Option Service Code** (`オプションサービスコード`, field ID: `op_svc_cd`) — the code identifying the specific type of option service.

If the `key` matches none of the recognized fields, the method returns `null`, signaling to the framework that no data type is defined for that field.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    START --> COND_NULL["key == null OR subkey == null"]
    COND_NULL -- true --> RET_NULL(["return null"])
    COND_NULL -- false --> CHECK_KEY["key equals オプションサービス契約番号"]
    CHECK_KEY -- true --> SUBKEY_CHECK["subkey.equalsIgnoreCase value"]
    SUBKEY_CHECK -- true --> RET_STRING1(["return String.class"])
    SUBKEY_CHECK -- false --> SUBKEY_STATE["subkey.equalsIgnoreCase state"]
    SUBKEY_STATE -- true --> RET_STRING2(["return String.class"])
    SUBKEY_STATE -- false --> CHECK_KEY2["key equals オプションサービス契約ステータス"]
    CHECK_KEY -- false --> CHECK_KEY2
    CHECK_KEY2 -- true --> SUBKEY_CHECK2["subkey.equalsIgnoreCase value"]
    SUBKEY_CHECK2 -- true --> RET_STRING3(["return String.class"])
    SUBKEY_CHECK2 -- false --> SUBKEY_STATE2["subkey.equalsIgnoreCase state"]
    SUBKEY_STATE2 -- true --> RET_STRING4(["return String.class"])
    SUBKEY_STATE2 -- false --> CHECK_KEY3["key equals オプションサービスコード"]
    CHECK_KEY2 -- false --> CHECK_KEY3
    CHECK_KEY3 -- true --> SUBKEY_CHECK3["subkey.equalsIgnoreCase value"]
    SUBKEY_CHECK3 -- true --> RET_STRING5(["return String.class"])
    SUBKEY_CHECK3 -- false --> SUBKEY_STATE3["subkey.equalsIgnoreCase state"]
    SUBKEY_STATE3 -- true --> RET_STRING6(["return String.class"])
    SUBKEY_STATE3 -- false --> RET_FINAL(["return null"])
    CHECK_KEY3 -- false --> RET_FINAL
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese display label of the field whose type is being queried. This corresponds to a business entity field in the option service contract management screen. It identifies which of the three tracked fields the caller is asking about: "オプションサービス契約番号" (Option Service Contract Number), "オプションサービス契約ステータス" (Option Service Contract Status), or "オプションサービスコード" (Option Service Code). If the key does not match any recognized field, the method returns null. |
| 2 | `subkey` | `String` | The sub-property selector within the field. Takes values `"value"` (requesting the data type of the field's content) or `"state"` (requesting the type of the field's UI state/edits flag). Both return `String.class`. The comparison is case-insensitive (`equalsIgnoreCase`), allowing flexibility in how the framework passes this parameter. |

**Instance fields read by this method:** None directly. Note that `separaterPoint` (line 295) is computed but never used in this method — it appears to be dead code (possibly a remnant from a previous version that intended to parse keys containing "/" delimiters).

## 4. CRUD Operations / Called Services

This method performs **no database operations and no service component calls**. It is a pure type-resolver utility that examines parameters and returns a `Class<?>` value. There are no SC (Service Component) calls, no CBS (Common Business Service) calls, and no entity/table access.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | — | — | — | No CRUD operations — this is a pure in-memory type lookup utility with no I/O side effects. |

## 5. Dependency Trace

`typeModelData` is a leaf method in the bean hierarchy — it is called by the parent screen bean and implements an interface method from `X33VDataTypeBeanInterface`. No downstream services or database operations are triggered from this method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW00816SFBean | `KKW00816SFBean.getDataTypeName` -> `KKW00816SF02DBean.typeModelData` | N/A (no downstream calls) |
| 2 | Screen Framework (X33V) | `X33VDataTypeBeanInterface.typeModelData` (interface callback) -> `KKW00816SF02DBean.typeModelData` | N/A (interface implementation) |

**Context:** The `KKW00816SF` module is a web screen module for Option Service Contract management (adding, modifying, cancelling option services on customer FTTH contracts). The screen bean `KKW00816SFBean` manages a repeating list of option service contract lines, each represented as a `KKW00816SF02DBean` instance. When the X33V framework needs to determine the data type of a field within a list row, it invokes `typeModelData(key, subkey)`.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `key == null OR subkey == null` (L293)

> Null guard: returns null if either parameter is null, preventing null pointer exceptions in subsequent comparisons.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // key,subkeyがnullの場合、nullを返す (Return null if key and/or subkey is null) |

---

**Block 2** — [SET] `separaterPoint` computed (L295)

> Computes the index of "/" in the key. This variable is **never used** in this method — dead code, likely a remnant from a version that planned to parse composite keys.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // dead code — value never read |

---

**Block 3** — [IF/ELSE-IF/ELSE] Key dispatch for option service fields (L298–L329)

> Branches on the three recognized option service contract field labels, each with nested `value`/`state` sub-property checks.

**Block 3.1** — [IF] `key.equals("オプションサービス契約番号")` [Option Service Contract Number] (L299)

> Handles the Option Service Contract Number field (field ID: `op_svc_kei_no`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `if(key.equals("オプションサービス契約番号"))` // データタイプがStringの項目"オプションサービス契約番号" (Field with data type String: "Option Service Contract Number") |

**Block 3.1.1** — [IF] `subkey.equalsIgnoreCase("value")` (L300)

> The `value` sub-property of the contract number field returns `String.class`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

**Block 3.1.2** — [ELSE-IF] `subkey.equalsIgnoreCase("state")` (L303)

> The `state` sub-property of the contract number field also returns `String.class`.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status type) |

**Block 3.2** — [ELSE-IF] `key.equals("オプションサービス契約ステータス")` [Option Service Contract Status] (L308)

> Handles the Option Service Contract Status field (field ID: `op_svc_kei_stat`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `else if(key.equals("オプションサービス契約ステータス"))` // データタイプがStringの項目"オプションサービス契約ステータス" (Field with data type String: "Option Service Contract Status") |

**Block 3.2.1** — [IF] `subkey.equalsIgnoreCase("value")` (L309)

> Returns `String.class` for the status value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

**Block 3.2.2** — [ELSE-IF] `subkey.equalsIgnoreCase("state")` (L312)

> Returns `String.class` for the status state flag.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status type) |

**Block 3.3** — [ELSE-IF] `key.equals("オプションサービスコード")` [Option Service Code] (L317)

> Handles the Option Service Code field (field ID: `op_svc_cd`).

| # | Type | Code |
|---|------|------|
| 1 | SET | `else if(key.equals("オプションサービスコード"))` // データタイプがStringの項目"オプションサービスコード" (Field with data type String: "Option Service Code") |

**Block 3.3.1** — [IF] `subkey.equalsIgnoreCase("value")` (L318)

> Returns `String.class` for the service code value.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` |

**Block 3.3.2** — [ELSE-IF] `subkey.equalsIgnoreCase("state")` (L321)

> Returns `String.class` for the service code state flag.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return String.class;` // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return the status type) |

**Block 3.4** — [ELSE — default return null] (L326)

> If none of the three recognized field labels match, returns null. This signals to the X33V framework that no data type is defined for the queried field.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // 条件に一致するプロパティが存在しない場合は、nullを返す (Return null if no matching property exists) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `オプションサービス契約番号` | Japanese field label | Option Service Contract Number — the display label for the unique contract number of an option service line item. Internal field ID: `op_svc_kei_no`. |
| `オプションサービス契約ステータス` | Japanese field label | Option Service Contract Status — the display label for the current operational status of an option service contract (e.g., active, suspended, cancelled). Internal field ID: `op_svc_kei_stat`. |
| `オプションサービスコード` | Japanese field label | Option Service Code — the display label for the code identifying the specific type of option service offered. Internal field ID: `op_svc_cd`. |
| `オプションサービス契約リスト` | Japanese screen label | Option Service Contract List — a repeating list component on the screen where customers can have multiple option service lines added to their base FTTH contract. Item ID: `op_svc_kei_list`. |
| `value` | Sub-key | Requests the data type of the field's actual content value. |
| `state` | Sub-key | Requests the type of the field's UI state / editability flag. Used by the X33V framework to determine whether the field is display-only, editable, or error-flagged. |
| `op_svc_kei_no` | Field ID | Option Service Contract Number field identifier in the bean's messaging map. |
| `op_svc_kei_stat` | Field ID | Option Service Contract Status field identifier in the bean's messaging map. |
| `op_svc_cd` | Field ID | Option Service Code field identifier in the bean's messaging map. |
| FTTH | Business term | Fiber To The Home — the primary broadband internet service offered by K-Opticom; option services are supplementary features attached to FTTH contracts. |
| Option Service (オプションサービス) | Business term | Supplementary services (e.g., security packages, additional bandwidth, TV bundles) that can be added to or removed from a customer's base FTTH contract. |
| X33V | Framework | Fujitsu Futurity Web Client Framework v33 — the presentation-layer MVC framework used for K-Opticom's web screens. The `X33VDataTypeBeanInterface` is the contract for data type beans that describe their field types to the framework. |
| X33VDataTypeBeanInterface | Interface | The framework interface implemented by `KKW00816SF02DBean`, requiring `typeModelData()` to resolve data types for each field/subkey pair. |
| X33VListedBeanInterface | Interface | The framework interface implemented by `KKW00816SF02DBean`, requiring methods for managing the bean as a listed/repeatable data item (e.g., `listKoumokuIds`). |
| X33VDataTypeStringBean | Framework class | The X33V framework class wrapping string-type data fields in repeatable lists. |
| KKW00816SF | Module | K-Opticom Option Service Contract management screen module — handles viewing, adding, modifying, and cancelling option services on customer contracts. |
| DBean | Naming convention | "Data Bean" — a bean class that defines the structure, data types, and list management for a repeatable screen field. |
