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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW00156SF.FUW00156SF01DBean` |
| Layer | Web WebView (Data Bean / View Data Type) |
| Module | `FUW00156SF` (Package: `eo.web.webview.FUW00156SF`) |

## 1. Role

### FUW00156SF01DBean.typeModelData()

This method is a **data type resolver** within the web survey/intake form module FUW00156SF. It serves as a runtime type-introspection utility that maps a business item name (`key`) and a property sub-key (`subkey`) to a Java `Class<?>` representing the data type of that property. Specifically, it handles the "Account Number" (アカウント番号) survey field — a core data element in the K-Opticom web survey intake flow used for collecting customer enrollment information.

The method implements a **lookup/dispatch pattern**: it receives a two-level key path (`key` / `subkey`) and returns the corresponding Java type for each property. For the item "Account Number" (item ID: `enquete_no`), it maps:

- `value` -> `String.class` (the actual account number string)
- `enable` -> `Boolean.class` (whether the field is enabled/editable)
- `state` -> `String.class` (the display/validation state of the field)

If the key does not match "Account Number" or the subkey is unrecognized, it returns `null`.

This method is called from **two levels**:

1. **FUW00156SFBean.typeModelData(String key, String subkey)** - the parent bean delegates to `FUW00156SF01DBean.listKoumokuIds()` for the "Data Retrieval Account Number" (データ取得用アンケート番号) field's column IDs, and delegates per-row type resolution to `FUW00156SF01DBean.typeModelData(keyElement, subkey)` when iterating the `key_enquete_no_list`.
2. **Other DBean subclasses within FUW00156SF** (02DBean through 07DBean) - each implements their own `typeModelData`, but the parent `FUW00156SFBean` dispatches to each based on the key element, following the same pattern.

The method plays a critical role in the **dynamic form binding** system - enabling the view layer to dynamically determine field types (String vs Boolean vs Integer) at runtime without hardcoding metadata. It is part of the `X33VDataTypeBeanInterface` contract used by the K-Opticom web client framework for data binding.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["typeModelData key, subkey"])
    COND_NULL["key == null<br>or subkey == null?"]
    RETURN_NULL_1(["return null"])
    FIND_SLASH["key.indexOf('/')<br>--> separaterPoint"]
    COND_KEY["key.equals<br>'アカウント番号'?"]
    COND_VALUE["subkey.equalsIgnoreCase('value')?"]
    RETURN_STRING_1(["return String.class"])
    COND_ENABLE["subkey.equalsIgnoreCase('enable')?"]
    RETURN_BOOLEAN(["return Boolean.class"])
    COND_STATE["subkey.equalsIgnoreCase('state')?"]
    RETURN_STRING_2(["return String.class"])
    RETURN_NULL_2(["return null"])
    END_RETURN(["Return / Next"])

    START --> COND_NULL
    COND_NULL -->|Yes| RETURN_NULL_1
    RETURN_NULL_1 --> END_RETURN
    COND_NULL -->|No| FIND_SLASH
    FIND_SLASH --> COND_KEY
    COND_KEY -->|Yes| COND_VALUE
    COND_KEY -->|No| RETURN_NULL_2
    COND_VALUE -->|Yes| RETURN_STRING_1
    COND_VALUE -->|No| COND_ENABLE
    COND_ENABLE -->|Yes| RETURN_BOOLEAN
    COND_ENABLE -->|No| COND_STATE
    COND_STATE -->|Yes| RETURN_STRING_2
    COND_STATE -->|No| RETURN_NULL_2
    RETURN_STRING_1 --> END_RETURN
    RETURN_BOOLEAN --> END_RETURN
    RETURN_STRING_2 --> END_RETURN
    RETURN_NULL_2 --> END_RETURN
```

**Processing Summary:**

1. **Null check**: If `key` or `subkey` is `null`, return `null` immediately. (Comment: key, subkey that is null -> return null / key, subkeyがnullの場合、nullを返す)
2. **Slash detection**: Compute `separaterPoint` by finding the first '/' in `key`. This value is computed but not used in this method (likely intended for future expansion).
3. **Key branch - Account Number**: If `key` equals "アカウント番号" (Account Number), check `subkey` cases:
   - `subkey.equalsIgnoreCase("value")` -> return `String.class`
   - `subkey.equalsIgnoreCase("enable")` -> return `Boolean.class`
   - `subkey.equalsIgnoreCase("state")` -> return `String.class` (Comment: when subkey is "state", return status / subkeyが"state"の場合、ステータスを返す)
4. **Fallback**: If no condition matches, return `null`. (Comment: if no matching property exists, return null / 条件に合致するプロパティが存在しない場合は、nullを返す。)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business item name (項目名) - identifies which survey/data field to resolve. For this method, the expected value is "アカウント番号" (Account Number), which is the item ID for the survey account number field. |
| 2 | `subkey` | `String` | The property sub-key - identifies which property of the item to resolve. Valid values are `"value"` (the actual data value), `"enable"` (editability flag), and `"state"` (display/validation state). |

**Instance fields / external state read:** None. This method is purely stateless - it uses only its parameters and returns a type class.

## 4. CRUD Operations / Called Services

This method performs **no database operations, no service calls, and no CRUD operations**. It is a pure type-resolution utility with no side effects.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | - | - | - | No CRUD operations. Pure in-memory type lookup. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: FUW00156SF (Parent Bean) | `FUW00156SFBean.typeModelData(key, subkey)` -> delegates to `FUW00156SF01DBean.typeModelData(keyElement, subkey)` for the "データ取得用アンケート番号" (Data Retrieval Account Number) list items | N/A (type resolution only) |

**Note:** The method is referenced across the FUW00156SF module in `FUW00156SFBean.java` (line 1283) where the parent bean iterates over `key_enquete_no_list` and dispatches `typeModelData(keyElement, subkey)` to each element's `X33VDataTypeBeanInterface` implementation - of which `FUW00156SF01DBean` is one.

## 6. Per-Branch Detail Blocks

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

> Null guard: if either input is null, return null immediately.
> Original comment: key, subkeyがnullの場合、nullを返す (If key or subkey is null, return null)

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // Compute slash position [unused in current flow] |
| 2 | RETURN | `return null;` // Early exit on null input |

**Block 2** — [IF] `(key.equals("アカウント番号"))` [Key: "Account Number"] (L218)

> This is the only meaningful business branch. It handles the survey account number field.
> Original comment: 項目ごとに処理を入れる。(Process handling per item.)

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(subkey.equalsIgnoreCase("value"))` [Subkey: "value" - the actual data value] |
| 2 | SET | `int separaterPoint = key.indexOf("/");` // Computed but not consumed |

**Block 2.1** — [IF-TRUE] `(subkey.equalsIgnoreCase("value"))` (L219)

> Returns String.class - the account number is stored as a string value.

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

**Block 2.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("enable"))` (L221)

> Returns Boolean.class - the enable flag is a boolean indicating whether the field is editable.

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

**Block 2.3** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` [Subkey: "state" - field state] (L223)

> Returns String.class - the state/flag of the field (e.g., valid, invalid, required).
> Original comment: subkeyが"state"の場合、ステータスを返す。(When subkey is "state", return the status.)

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

**Block 3** — [ELSE / FALLBACK] (no matching key or subkey) (L230)

> If the key is not "アカウント番号" or the subkey is not recognized, return null.
> Original comment: 条件に合致するプロパティが存在しない場合は、nullを返す。(If no matching property exists, return null.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null;` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Parameter | Item name (項目名) - identifies a specific data field in the survey form |
| `subkey` | Parameter | Sub-key (サブキー) - identifies a property within the item (value, enable, state) |
| アカウント番号 | Field (Japanese) | Account Number - the survey field for entering a customer account number; mapped to `enquete_no` as the item ID |
| `enquete_no` | Field | Survey number (アンケート番号) - internal item ID for the account number survey field |
| `key_enquete_no` | Field | Data retrieval account number (データ取得用アンケート番号) - the parent list item ID that wraps the FUW00156SF01DBean data type resolver |
| `X33VDataTypeBeanInterface` | Interface | Data Type Bean Interface - the framework contract that `typeModelData` implements, enabling dynamic type resolution for form fields |
| DBean | Acronym | Data Bean - a view-layer data holder class that manages form field data and type metadata |
| FUW00156SF | Module | Survey/Intake Form Module - a web screen module for customer survey and service intake operations |
| `value` | Subkey | The actual data value of a field |
| `enable` | Subkey | Boolean flag indicating whether a field is enabled/editable |
| `state` | Subkey | String flag representing the display or validation state of a field (e.g., valid, disabled, error) |
