# Business Logic — KKW14301SF02DBean.typeModelData() [39 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA35101SF.KKW14301SF02DBean` |
| Layer | Utility (Data Bean for X33 framework) |
| Module | `KKA35101SF` (Package: `eo.web.webview.KKA35101SF`) |

## 1. Role

### KKW14301SF02DBean.typeModelData()

This method serves as the **data type resolver** for the X33 View framework's dynamic form rendering infrastructure. Specifically, it maps human-readable item identifiers (`key`) and property descriptors (`subkey`) to their corresponding Java type classes (`Class<?>`). It is invoked by the X33 framework at runtime to determine how to bind, render, and validate individual form fields within lists of **EO TV Tuner (Set-Top Box)** items and **EO Count** items displayed on the visit order information screen (KKW143010PJP).

The method implements the **strategy/routing pattern**: it inspects the `key` parameter to determine which category of service item is being queried (either an EO Light TV Tuner STB item or an EO Count item), then dispatches to a subkey check that returns the appropriate Java type. Each category supports three standard property types — `value` (the display value), `enable` (the editable flag), and `state` (the status indicator).

This is a **shared utility** method defined by the `X33VDataTypeBeanInterface` contract. It is not directly called by screen JSPs; instead, the X33 framework invokes it dynamically whenever it needs to build type information for a listed data bean. The parent bean `KKW14301SFBean` configures this class as the data type provider for the `kcn_tv_tuner_list` list (EO Light TV Tuner List, item ID: `kcn_tv_tuner_list`), enabling the framework to render TV tuner and count fields correctly on the visit order information inquiry screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key subkey"])
    START --> CHECK_NULL["Check if key or subkey is null"]
    CHECK_NULL --> |"key == null || subkey == null"| RETURN_NULL1(["return null"])
    CHECK_NULL --> |"not null"| COMPUTE_SEP["Compute separaterPoint = key.indexOf"]
    COMPUTE_SEP --> CHECK_KEY["key equals N台目 EO光テレビチューナー STB?"]
    CHECK_KEY --> |"yes"| CHECK_SUB1["Check subkey"]
    CHECK_KEY --> |"no"| CHECK_KEY2["key equals N台目 カウント?"]
    CHECK_SUB1 --> |"subkey equals value"| RETURN_STRING1(["return String.class"])
    CHECK_SUB1 --> |"subkey equals enable"| RETURN_BOOLEAN(["return Boolean.class"])
    CHECK_SUB1 --> |"subkey equals state"| RETURN_STRING2(["return String.class"])
    CHECK_KEY2 --> |"yes"| CHECK_SUB2["Check subkey"]
    CHECK_KEY2 --> |"no"| RETURN_NULL2(["return null"])
    CHECK_SUB2 --> |"subkey equals value"| RETURN_STRING3(["return String.class"])
    CHECK_SUB2 --> |"subkey equals enable"| RETURN_BOOLEAN2(["return Boolean.class"])
    CHECK_SUB2 --> |"subkey equals state"| RETURN_STRING4(["return String.class"])
    RETURN_NULL1 --> END_NODE(["End"])
    RETURN_NULL2 --> END_NODE
    RETURN_STRING1 --> END_NODE
    RETURN_STRING2 --> END_NODE
    RETURN_STRING3 --> END_NODE
    RETURN_STRING4 --> END_NODE
    RETURN_BOOLEAN --> END_NODE
    RETURN_BOOLEAN2 --> END_NODE
```

**Processing flow summary:**
1. **Null guard**: If either `key` or `subkey` is null, return `null` immediately. This prevents `NullPointerException` when the framework queries fields that have not been configured.
2. **Separator detection** (side computation): Compute `separaterPoint = key.indexOf("/")`. This value is computed but not used in the current method body — it may be reserved for future expansion.
3. **Key dispatch**: Check if the key matches one of two known business item identifiers:
   - `N台目?EO光テレビチューナー（STB)` (Item ID: `kcn_n_cnt_tv_tuner`) — represents the Nth EO Light TV Tuner (Set-Top Box) device in a multi-device service configuration.
   - `N台目?カウント` (Item ID: `kcn_n_cnt`) — represents the Nth count item for service tracking.
4. **Subkey resolution**: For each matching key, check the subkey (`value`, `enable`, or `state`) and return the corresponding Java type.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The human-readable item label used to identify which form field's type is being requested. It corresponds to a labeled UI element such as "N台目?EO光テレビチューナー（STB)" (Nth EO Light TV Tuner Set-Top Box) or "N台目?カウント" (Nth Count). The framework passes these labels to resolve the Java type for data binding. |
| 2 | `subkey` | `String` | The property name within the item, specifying which aspect of the field's model is being queried. Valid values are: `value` (the display/editable value of the field), `enable` (whether the field is enabled for editing), and `state` (the field's display/status state). Case-insensitive comparison is used. |

**Instance fields read by the method:** None — this method is fully stateless. It does not access any instance fields; it only evaluates its parameters and returns type classes.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | N/A (framework internal) | N/A | N/A | This method performs no database or service-level operations. It is a pure type-resolution utility called by the X33 framework to determine data binding types for listed form fields. |

**Note:** This method is a **read-only type lookup** with zero CRUD side effects. It does not invoke any SC (Service Component) or CBS (Component-Based Service). It solely returns `Class<?>` values (`String.class`, `Boolean.class`, or `null`) to the X33 framework.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW143010PJP | `KKW14301SFBean` (parent bean configures `kcn_tv_tuner_list` with `KKW14301SF02DBean` as data type provider) -> `X33VListedBeanInterface` -> `KKW14301SF02DBean.typeModelData` | N/A (no CRUD) |

**Caller analysis:**
- The method is invoked indirectly by the **X33 View framework** during form rendering. The parent bean `KKW14301SFBean` registers `KKW14301SF02DBean` as the data type bean class for the `kcn_tv_tuner_list` (EO Light TV Tuner List) through its `listKoumokuIds()` method. When the framework renders the visit order information screen (KKW143010PJP) and needs to determine the type of each listed field, it calls `typeModelData()` on this bean.
- The JSP `KKW143010PJP.jsp` references the bean indirectly through the X33 framework's data binding mechanism — it accesses list items like `kcn_tv_tuner_list.get(counter2)` which are instances of `KKW14301SF02DBean`.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key == null || subkey == null)` (L280)

> Null guard: return null if either parameter is null. This prevents exceptions and signals that the field is not configured.

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

---

**Block 2** — [EXEC] `(separator point computation)` (L284)

> Compute the position of the "/" separator in the key. This value is stored but not currently used — likely reserved for future expansion.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // Find position of "/" separator |

---

**Block 3** — [IF-ELSE-IF] `(key equals "N台目?EO光テレビチューナー（STB)")` (L287)

> Branch 1: Handle the EO Light TV Tuner (Set-Top Box) item. This item represents an Nth TV tuner device in a multi-device service configuration (FTTH home networking). The comment indicates the item ID is `kcn_n_cnt_tv_tuner`.

| # | Type | Code |
|---|------|------|
| 1 | IF (nested) | `subkey.equalsIgnoreCase("value")` -> `return String.class;` // The value of the TV tuner field is a String |
| 2 | ELSE-IF (nested) | `subkey.equalsIgnoreCase("enable")` -> `return Boolean.class;` // The enabled state of the TV tuner field is a Boolean |
| 3 | ELSE-IF (nested) | `subkey.equalsIgnoreCase("state")` -> `return String.class;` // subkeyが"state"の場合、ステータスを返す。 (When subkey is "state", returns the status as a String) |

---

**Block 4** — [ELSE-IF] `(key equals "N台目?カウント")` (L299)

> Branch 2: Handle the EO Count item. This item represents a count field used for service tracking. The comment indicates the item ID is `kcn_n_cnt`.

| # | Type | Code |
|---|------|------|
| 1 | IF (nested) | `subkey.equalsIgnoreCase("value")` -> `return String.class;` // The value of the count field is a String |
| 2 | ELSE-IF (nested) | `subkey.equalsIgnoreCase("enable")` -> `return Boolean.class;` // The enabled state of the count field is a Boolean |
| 3 | ELSE-IF (nested) | `subkey.equalsIgnoreCase("state")` -> `return String.class;` // subkeyが"state"の場合、ステータスを返す。 (When subkey is "state", returns the status as a String) |

---

**Block 5** — [RETURN] `(default fallthrough)` (L309)

> Default: No matching property is found. Return null to indicate the field type is unknown or not configured.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // プロパティが存在しない場合は、nullを返す。 (If no matching property exists, return null) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kcn_n_cnt_tv_tuner` | Field | Nth TV Tuner Item — internal field identifier for the Nth EO Light TV Tuner (Set-Top Box) device in a multi-device home networking configuration |
| `kcn_n_cnt_tv_tuner_value` | Field | TV Tuner display value — the string value shown for the Nth TV Tuner device |
| `kcn_n_cnt_tv_tuner_enabled` | Field | TV Tuner edit flag — Boolean indicating whether the TV Tuner field is editable |
| `kcn_n_cnt_tv_tuner_state` | Field | TV Tuner status — the display state string for the TV Tuner field |
| `kcn_n_cnt` | Field | Nth Count Item — internal field identifier for the Nth count field used in service tracking |
| `kcn_n_cnt_value` | Field | Count display value — the string value shown for the Nth count item |
| `kcn_n_cnt_enabled` | Field | Count edit flag — Boolean indicating whether the count field is editable |
| `kcn_n_cnt_state` | Field | Count status — the display state string for the count field |
| `kcn_tv_tuner_list` | Field | EO Light TV Tuner List — a list data structure holding multiple `KKW14301SF02DBean` instances, one per TV tuner device |
| `X33VDataTypeBeanInterface` | Interface | X33 Data Type Bean Interface — Fujitsu Futurity framework interface that defines the `typeModelData` contract for data type resolution |
| `X33VListedBeanInterface` | Interface | X33 Listed Bean Interface — framework interface for beans that can be used in list-based form rendering |
| `N台目?EO光テレビチューナー（STB)` | UI Label | Nth EO Light TV Tuner (STB) — the display label for the Nth Set-Top Box TV tuner device in a multi-device FTTH home networking setup |
| `N台目?カウント` | UI Label | Nth Count — the display label for the Nth count field in the service order information |
| STB | Acronym | Set-Top Box — a hardware device that receives and decodes digital television signals, used in FTTH (Fiber To The Home) home networking |
| EO光 | Business term | EO Light — K-Opticom's fiber-optic broadband internet service brand (Fujitsu EO Hikari) |
| FTTH | Business term | Fiber To The Home — fiber-optic internet service infrastructure |
| KKW14301SF | Screen Function | Visit Order Information Inquiry Service Function — the screen module for searching and retrieving visit order information, migrated from koptWebB to koptWebA (ANK-3158-00-00) |
| KKW14301SF02DBean | Class | Visit Order Info Service Form Data Bean (Version 2) — a data type bean providing type resolution for listed form fields on the visit order screen |
| typeModelData | Method | Data Type Resolution — determines the Java type for a given item key and subkey, enabling X33 framework data binding |
| separaterPoint | Field | Separator Position — the index of "/" within a key (computed but not used in current implementation) |
