# Business Logic — FUW00116SF03DBean.loadModelData() [33 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW00116SF.FUW00116SF03DBean` |
| Layer | View (Data-Binding Bean) |
| Module | `FUW00116SF` (Package: `eo.web.webview.FUW00116SF`) |

## 1. Role

### FUW00116SF03DBean.loadModelData()

This method is the **data accessor gateway** for a customer mail (送信メール) detail bean within the K-Opticom web application framework. It implements the `X33VDataTypeBeanInterface.loadModelData(String key, String subkey)` contract — the standard method signature used by the X33V data-binding framework to dynamically resolve field values at render time. In business terms, this bean manages two customer mail data types: **Mail Detail Code** (メール明細コード, i.e., the classification code for customer mail message entries) and **Detail Body Non-standard Replacement Characters** (明細本文非定型置換文字, i.e., placeholder/template substitution characters in the body of customer mail). The method routes incoming (key, subkey) pairs to the appropriate internal getter — returning either the `value` (the actual data) or `state` (metadata/status) — following a **dispatch/routing pattern**. It serves as a **shared utility bean** instantiated by the parent bean (`FUW00116SFBean`) via `getItemList()` to populate dynamic lists of customer mail detail entries (`cust_mail_dtl_cd_list_list`), making it a key node in the screen data initialization chain for customer mail management screens.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])
    CHECK_NULL["key == null || subkey == null?"]
    RET_NULL_1["Return null"]
    FIND_SLASH["key.indexOf('/')"]
    CHECK_MAIL["key equals 'メール明細コード'?"]
    CHECK_VALUE["subkey.equalsIgnoreCase('value')?"]
    RET_MAIL_VALUE["Return getMail_dtl_cd_value()"]
    CHECK_STATE["subkey.equalsIgnoreCase('state')?"]
    RET_MAIL_STATE["Return getMail_dtl_cd_state()"]
    CHECK_TEXT["key equals '明細本文非定型置換文字'?"]
    CHECK_TEXT_VALUE["subkey.equalsIgnoreCase('value')?"]
    RET_TEXT_VALUE["Return getDtl_text_htk_ckam_moji_value()"]
    CHECK_TEXT_STATE["subkey.equalsIgnoreCase('state')?"]
    RET_TEXT_STATE["Return getDtl_text_htk_ckam_moji_state()"]
    RET_NULL_2["Return null"]

    START --> CHECK_NULL
    CHECK_NULL -->|true| RET_NULL_1
    CHECK_NULL -->|false| FIND_SLASH
    FIND_SLASH --> CHECK_MAIL
    CHECK_MAIL -->|true| CHECK_VALUE
    CHECK_VALUE -->|true| RET_MAIL_VALUE
    CHECK_VALUE -->|false| CHECK_STATE
    CHECK_STATE -->|true| RET_MAIL_STATE
    CHECK_STATE -->|false| CHECK_TEXT
    CHECK_MAIL -->|false| CHECK_TEXT
    CHECK_TEXT -->|true| CHECK_TEXT_VALUE
    CHECK_TEXT_VALUE -->|true| RET_TEXT_VALUE
    CHECK_TEXT_VALUE -->|false| CHECK_TEXT_STATE
    CHECK_TEXT_STATE -->|true| RET_TEXT_STATE
    CHECK_TEXT_STATE -->|false| RET_NULL_2
    CHECK_TEXT -->|false| RET_NULL_2
```

This method performs **data-type-based routing** (データごと処理を入れる) to resolve field values dynamically:

- **Null-guard**: If either `key` or `subkey` is null, immediately returns `null` (null passthrough for safety).
- **Separator extraction**: Calculates `separaterPoint` via `key.indexOf("/")` — though the result is not currently used in any conditional branch, suggesting this is preparatory or deprecated scaffolding.
- **Branch 1 — Mail Detail Code**: When `key` equals `"メール明細コード"` (Mail Detail Code), routes to either the `value` getter (actual mail detail code string) or the `state` getter (status/metadata) based on `subkey`.
- **Branch 2 — Detail Body Replacement Characters**: When `key` equals `"明細本文非定型置換文字"` (Detail Body Non-standard Replacement Characters), routes to either the `value` getter (actual replacement character string) or the `state` getter (status/metadata) based on `subkey`.
- **Fallback**: If no matching key is found, returns `null` (no matching property in the data type).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (項目名) that identifies which data type to retrieve. Represents a business field identifier in the customer mail domain. Valid values: `"メール明細コード"` (Mail Detail Code — the classification code for customer mail entries) or `"明細本文非定型置換文字"` (Detail Body Non-standard Replacement Characters — placeholder characters used in customer mail body templates). Case-sensitive comparison (`equals()`). Can contain a `/` separator (computed via `indexOf("/")` but not currently used). |
| 2 | `subkey` | `String` | The sub-key (サブキー) that specifies which attribute of the data type to return. Acts as a property selector within the identified data type. Case-insensitive comparison (`equalsIgnoreCase()`). Valid values: `"value"` (returns the actual data value stored in the bean) or `"state"` (returns the status/metadata string associated with the field). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `mail_dtl_cd_value` | `String` | The actual mail detail code value, initialized to `""` |
| `mail_dtl_cd_state` | `String` | The state/status of the mail detail code, initialized to `""` |
| `dtl_text_htk_ckam_moji_value` | `String` | The actual replacement character string for detail body, initialized to `""` |
| `dtl_text_htk_ckam_moji_state` | `String` | The state/status of the replacement characters, initialized to `""` |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `getMail_dtl_cd_value` | FUW00116SF03DBean | - | Returns the `mail_dtl_cd_value` instance field (customer mail detail code data). Pure data accessor — no DB or external call. |
| R | `getMail_dtl_cd_state` | FUW00116SF03DBean | - | Returns the `mail_dtl_cd_state` instance field (mail detail code status). Pure data accessor — no DB or external call. |
| R | `getDtl_text_htk_ckam_moji_value` | FUW00116SF03DBean | - | Returns the `dtl_text_htk_ckam_moji_value` instance field (detail body replacement character data). Pure data accessor — no DB or external call. |
| R | `getDtl_text_htk_ckam_moji_state` | FUW00116SF03DBean | - | Returns the `dtl_text_htk_ckam_moji_state` instance field (detail body replacement character status). Pure data accessor — no DB or external call. |

All called methods are **internal data accessors** — pure getters on instance fields within this bean. No service component (SC), CBS, or database interaction occurs. This method is a **read-only data routing layer** that does not perform any CRUD operations on persistent storage.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean: FUW00116SFBean | `FUW00116SFBean` (list initialization) -> `getItemList()` creates `cust_mail_dtl_cd_list_list` entries of type `FUW00116SF03DBean` -> `loadModelData(key, subkey)` | `getMail_dtl_cd_value [R] mail_dtl_cd_value field`<br>`getMail_dtl_cd_state [R] mail_dtl_cd_state field` |
| 2 | Screen: FUW00116SF | `FUW00116SFBean` -> `getItemList()` for key `"お客様向けメール明細一覧リスト"` (Customer Mail Detail List) -> `cust_mail_dtl_cd_list_list.add(FUW00116SF03DBean)` -> `loadModelData(key, subkey)` | `getMail_dtl_cd_value [R] mail_dtl_cd_value field`<br>`getDtl_text_htk_ckam_moji_value [R] dtl_text_htk_ckam_moji_value field` |

**Additional context on call chain:**
- `FUW00116SFBean.java` (lines 8523-8528) instantiates `FUW00116SF03DBean` as data-type-bean instances for the list item `"お客様向けメール明細一覧リスト"` (Customer Mail Detail List). Each bean in this list responds to `loadModelData()` calls to provide dynamic field values at render time.
- The framework's X33V data-binding system calls `loadModelData` on each list item to resolve `value` and `state` fields during screen rendering.
- Other `FUW00116SF*DBean` classes have similar `loadModelData` implementations, but this method is specific to the `FUW00116SF03DBean` (index 03) data type bean.

## 6. Per-Branch Detail Blocks

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

> Null guard: If either parameter is null, return null immediately. This prevents NullPointerException and follows defensive programming for the X33V framework contract.

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

**Block 2** — [EXEC] `(separator calculation)` (L131)

> Calculates the position of the first `/` character in key. The result is stored but not currently used in any branch — likely scaffolding for future extensibility.

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` // データタイプがStringの項目 (Data type is String item) |

**Block 3** — [IF-ELSEIF] `(key.equals("メール明細コード"))` (L134)

> First major branch: handles the Mail Detail Code data type. When the key matches this value, the method resolves the actual mail detail code value or its state based on the subkey parameter.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` [L135] (case-insensitive check for "value") |
| 1.1 | RETURN | `return getMail_dtl_cd_value();` // Returns the mail detail code data value |
| 2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L137] // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return status) |
| 2.1 | RETURN | `return getMail_dtl_cd_state();` // Returns the mail detail code state |

**Block 4** — [ELSE-IF] `(key.equals("明細本文非定型置換文字"))` (L141)

> Second major branch: handles the Detail Body Non-standard Replacement Characters data type. This is for template/placholder character substitution in customer mail body text.

| # | Type | Code |
|---|------|------|
| 1 | IF | `subkey.equalsIgnoreCase("value")` [L142] (case-insensitive check for "value") |
| 1.1 | RETURN | `return getDtl_text_htk_ckam_moji_value();` // Returns the replacement character data value |
| 2 | ELSE-IF | `subkey.equalsIgnoreCase("state")` [L144] // subkeyが"state"の場合、ステータスを返す (If subkey is "state", return status) |
| 2.1 | RETURN | `return getDtl_text_htk_ckam_moji_state();` // Returns the replacement character state |

**Block 5** — [RETURN] `(fallback)` (L148)

> Final catch-all: if no key matches any known data type, return null. Indicates that the requested property is not supported by this bean.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mail_dtl_cd` | Field | Mail Detail Code — classification code for customer mail message entries. Used to categorize and identify different types of customer mail communications. |
| `dtl_text_htk_ckam_moji` | Field | Detail Body Customer Replacement Characters — placeholder characters used in the body text of customer mail for template substitution. |
| `mail_dtl_cd_update` | Field | Mail Detail Code Update Flag — tracks whether the mail detail code has been modified. |
| `dtl_text_htk_ckam_moji_update` | Field | Detail Body Replacement Characters Update Flag — tracks whether the replacement characters have been modified. |
| `x33v` | Framework | Fujitsu Futurity Web 33V — the enterprise web application framework used for screen development. Provides bean interfaces for data binding. |
| `X33VDataTypeBeanInterface` | Interface | X33V Data Type Bean Interface — standard interface for beans that support dynamic data loading via `loadModelData()`. |
| `X33VListedBeanInterface` | Interface | X33V Listed Bean Interface — standard interface for beans that participate in list-based data structures. |
| `X33VDataTypeList` | Class | X33V Data Type List — a specialized list container for data-type-bean instances used in screen rendering. |
| `cust_mail_dtl_cd_list_list` | Field | Customer Mail Detail Code List List — the parent bean's list holding `FUW00116SF03DBean` instances for customer mail detail entries. |
| FUW00116SF | Module | Customer Mail Management Service Module (番号 FUW00116SF) — the screen module responsible for customer mail (送信メール) creation, editing, and management operations. |
| メール明細コード | Japanese field | Mail Detail Code — the item name key for accessing customer mail detail classification data. |
| 明細本文非定型置換文字 | Japanese field | Detail Body Non-standard Replacement Characters — the item name key for accessing template substitution character data in customer mail body. |
| お客様向けメール明細一覧リスト | Japanese field | Customer Mail Detail List — the list item ID for customer mail detail entries, used in the parent bean's `getItemList()` routing. |
| value | Subkey | Requests the actual data value of a field (as opposed to metadata or status). |
| state | Subkey | Requests the state/status metadata of a field (e.g., validity flag, processing status). |
| X31CBaseBean | Framework class | X31 Common Base Bean — the base class inherited by X33V beans, providing common initialization and utility methods. |
