# Business Logic — FUW00156SF01DBean.typeModelData() [26 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW00156SF.FUW00156SF01DBean` |
| Layer | Service / Data Bean (webview package — type-model routing utility) |
| Module | `FUW00156SF` (Package: `eo.web.webview.FUW00156SF`) |

## 1. Role

### FUW00156SF01DBean.typeModelData()

This method serves as a **data type routing and dispatch utility** for the webview framework. Its business purpose is to determine the Java runtime type (`Class<?>`) of data values associated with a given form field (`key`) and sub-property (`subkey`). It implements a **strategy/routing pattern** — the method inspects the `key` string to identify which business entity's data model should apply, then dispatches to the appropriate type mapping based on the `subkey`.

The method currently handles a single service type: **Survey/Questionnaire data** (`アンケート番号` / "Questionnaire Number"). For this entity, it resolves three sub-properties: `value` (the raw answer string), `enable` (editability flag), and `state` (display/state metadata). Each sub-property maps to a specific Java type — `String.class` for value and state, `Boolean.class` for enable.

This method follows a **delegation pattern** commonly used across the FUW module hierarchy: each DBean (Data Bean) overrides this method to define its own field-to-type mappings. The base implementation in `FUW00156SF01DBean` handles survey-type fields, while related DBeans (e.g., `FUW00912SF01DBean`, `FUW00926SF01DBean`) override it to handle their own domains (billing, TV/STB pricing, etc.). It is called by the generic `FUWBean.typeModelData(String, String, String)` dispatchers which iterate over typed lists and delegate to the element's `typeModelData` method.

The method acts as a **shared utility** within the webview layer — it is not tied to a single screen but is used dynamically by generic list-rendering code to build type-safe UI model objects at runtime.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData(params)"])

    START --> COND1{"key == null
OR subkey == null?"}

    COND1 -->|"Yes"| R1["Return null"]
    COND1 -->|"No"| SEP["int separaterPoint = key.indexOf('/')"]

    SEP --> COND2{"key.equals('アンケート番号')
(Questionnaire Number)"}

    COND2 -->|"Yes"| SUB1{"subkey.equalsIgnoreCase('value')?"}
    COND2 -->|"No"| R2["Return null"]

    SUB1 -->|"Yes"| R3["Return String.class"]
    SUB1 -->|"No"| SUB2{"subkey.equalsIgnoreCase('enable')?"}

    SUB2 -->|"Yes"| R4["Return Boolean.class"]
    SUB2 -->|"No"| SUB3{"subkey.equalsIgnoreCase('state')?"}

    SUB3 -->|"Yes"| R5["Return String.class"]
    SUB3 -->|"No"| R2
```

The method's conditional branches are based on **literal string comparisons** (no named constant files are referenced). The key literal `"アンケート番号"` (Questionnaire Number) identifies the survey data entity. The subkey literals `"value"`, `"enable"`, and `"state"` identify the sub-property within that entity. These are resolved from the source code directly and do not require external constant resolution.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | **Item/Field name** — identifies which business entity or form field the data belongs to. In the current implementation, only `"アンケート番号"` (Questionnaire Number) is recognized, which corresponds to a survey/questionnaire data item. The method also computes `key.indexOf("/")` (stored in `separaterPoint`) which suggests the broader framework may use slash-delimited composite keys (e.g., `entity/property`), though this specific DBean does not yet leverage that pattern. |
| 2 | `subkey` | `String` | **Sub-property key** — identifies which property of the entity to resolve. For the questionnaire item, valid values are `"value"` (the answer string), `"enable"` (whether the field is editable), and `"state"` (the display state). The comparison is case-insensitive (`equalsIgnoreCase`). |

**Instance fields / external state read:** None. This method is fully stateless — it uses only its parameters and local variables.

## 4. CRUD Operations / Called Services

This method does **not** call any external services, CBS (Common Business Service) components, or SC (Service Component) methods. It performs pure in-memory type routing with no data access operations.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | — | — | — | No CRUD or service calls — this is a pure in-memory type lookup method |

## 5. Dependency Trace

This method is **overridden** by many related DBeans across the FUW module hierarchy (e.g., `FUW00912SF01DBean`, `FUW00926SF01DBean`, `FUW00959SF01DBean`, `FUW00964SF01DBean`, etc.), which is a common inheritance pattern in this codebase. These are not callers — they are subclasses providing their own `typeModelData` implementations for different domain types.

The method is also invoked as `typeModelData(subkey)` from the parent `FUWBean` classes (e.g., `FUW00912SFBean`, `FUW00926SFBean`, `FUW00959SFBean`, `FUW00964SFBean`) which dispatch from a three-argument overload (`gamenId`, `key`, `subkey`) by delegating to the two-argument version. These parent beans iterate over typed lists and call `typeModelData(subkey)` on each list element to determine the type of individual items.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: Generic FUW Dispatcher | `FUWBean.typeModelData(gamenId, key, subkey)` -> `FUW00156SF01DBean.typeModelData(key, subkey)` | None (type lookup only) |
| 2 | Screen: Generic FUW Dispatcher | `FUWBean` iterates over typed list -> calls `element.typeModelData(subkey)` -> `FUW00156SF01DBean.typeModelData(key, subkey)` | None (type lookup only) |
| 3 | Override: FUW00912SF01DBean | `FUW00912SF01DBean.typeModelData(key, subkey)` overrides base implementation | None (overrides base) |
| 4 | Override: FUW00926SF01DBean | `FUW00926SF01DBean.typeModelData(key, subkey)` overrides base implementation | None (overrides base) |
| 5 | Override: FUW00959SF01DBean | `FUW00959SF01DBean.typeModelData(key, subkey)` overrides base implementation | None (overrides base) |
| 6 | Override: FUW00964SF01DBean | `FUW00964SF01DBean.typeModelData(key, subkey)` overrides base implementation | None (overrides base) |

## 6. Per-Branch Detail Blocks

**Block 1** — IF (null guard) `(key == null || subkey == null)` (L210–213)

> Guard clause: If either parameter is null, return null immediately. This is a null-safety check that prevents NullPointerException in subsequent string operations.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if(key == null || subkey == null)` // Null guard: both key and subkey must be non-null [-> literal null check] |
| 2 | RETURN | `return null;` // Return null if either parameter is null |

**Block 2** — SET (string position lookup) (L215)

> Computes the index of the "/" delimiter in the key. This suggests the broader framework supports compound keys (e.g., `"entity/subkey"`), though this specific implementation does not yet use the result.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/")` // Find position of "/" delimiter in key [-> `String.indexOf()`] |

**Block 3** — IF-ELSE-IF-IF-IF (key dispatch) `(key.equals("アンケート番号"))` (L218–230)

> Main routing block: Dispatches to type mappings based on the key's business entity and the subkey's property. The key literal `"アンケート番号"` means "Questionnaire Number" — this is the survey/questionnaire data entity.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if(key.equals("アンケート番号"))` // Match Questionnaire Number field [-> literal "アンケート番号"] |

**Block 3.1** — IF-ELSE-IF-IF (subkey dispatch) `(subkey.equalsIgnoreCase("value"))` (L219–222)

> Sub-property: `value` — the actual answer/content of the questionnaire item. Returns `String.class` indicating the value is stored as a string.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if(subkey.equalsIgnoreCase("value"))` // Match value sub-property [-> literal "value", case-insensitive] |
| 2 | RETURN | `return String.class;` // Answer value is a String |

**Block 3.2** — ELSE-IF `(subkey.equalsIgnoreCase("enable"))` (L223–225)

> Sub-property: `enable` — whether the questionnaire field is enabled/editable. Returns `Boolean.class` indicating the value is a true/false flag.

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if(subkey.equalsIgnoreCase("enable"))` // Match enable sub-property [-> literal "enable", case-insensitive] |
| 2 | RETURN | `return Boolean.class;` // Editability flag is a Boolean |

**Block 3.3** — ELSE-IF `(subkey.equalsIgnoreCase("state"))` (L226–228)

> Sub-property: `state` — the display/state metadata of the questionnaire item. Returns `String.class` indicating the state is stored as a string. Japanese comment: `// subkeyが"state"の場合、ステータスを返す。` (When subkey is "state", return the status.)

| # | Type | Code |
|---|------|------|
| 1 | COND | `else if(subkey.equalsIgnoreCase("state"))` // Match state sub-property [-> literal "state", case-insensitive] |
| 2 | RETURN | `return String.class;` // State/status is a String |

**Block 4** — ELSE-DEFAULT (no match) (L231–232)

> Fallback: If no key/subkey combination matches, return null. Japanese comment: `// 条件に合致するプロパティが存在しない場合は、nullを返す。` (If no matching property exists, return null.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` // No matching key/subkey pair — return null [-> Japanese: 条件に合致するプロパティが存在しない場合は、nullを返す。] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `アンケート番号` | Literal | Questionnaire Number — a survey/questionnaire data field identifier. This is the key value that triggers the survey-type type routing. |
| `value` | Subkey | The actual answer or content value of a questionnaire item. Returns `String.class`. |
| `enable` | Subkey | Whether a questionnaire field is enabled (editable) or disabled. Returns `Boolean.class`. |
| `state` | Subkey | The display or processing state of a questionnaire item (e.g., active, completed, archived). Returns `String.class`. |
| `separaterPoint` | Field | Separator position index — stores the result of `key.indexOf("/")`, suggesting the framework supports compound keys (though not yet used in this DBean). |
| `typeModelData` | Method | Data type model lookup — a framework method that determines the Java runtime type of a field/sub-property pair for type-safe UI rendering. |
| DBean | Acronym | Data Bean — a data model class in the webview layer that defines field types and data mappings for a specific screen or domain. |
| FUW | Acronym | Fujitsu Web (framework name) — the webview application framework used for telecom service management screens. |
| `gamenId` | Parameter | Screen/Gamen ID — the screen identifier used to select which DBean implementation to delegate to. |
| `key` | Parameter | Item/Field name — identifies which business field or entity the data belongs to. |
| `subkey` | Parameter | Sub-property key — identifies which property within a field/entity to resolve (e.g., "value", "enable", "state"). |
| X33VDataTypeBeanInterface | Interface | Generic data type interface — the common interface that all DBeans implement for `typeModelData`. |
| X33VDataTypeStringBean | Class | String-type data bean — a base class for DBeans whose data items are all String-typed. |
