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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW00114SF.FUW00114SF03DBean` |
| Layer | Service / Data Bean (View data provider layer) |
| Module | `FUW00114SF` (Package: `eo.web.webview.FUW00114SF`) |

## 1. Role

### FUW00114SF03DBean.loadModelData()

This method serves as a **shared data retrieval dispatcher** within the customer mail detail management subsystem of the K-Opticom telecom order management system. It provides a uniform key-based lookup interface for two distinct data types: **Mail Detail Code** (`メール明細コード`, item ID: `mail_dtl_cd`) and **Detail Body Non-Standard Replacement Character** (`明細本文非定型置換文字`, item ID: `dtl_text_htk_ckam_moji`). The method implements a **routing/dispatch design pattern** that routes incoming key-subkey pairs to the appropriate getter method, effectively acting as an in-memory facade over multiple data sources. It is a key component of the data-type-bean infrastructure: screen beans instantiate `FUW00114SF03DBean` instances as items in `X33VDataTypeList` collections, and the framework calls `loadModelData()` to retrieve values during screen rendering. This enables reusable data access without tightly coupling screen logic to specific getter implementations. The method handles two data branches — each supporting `value` and `state` subkeys — and returns `null` for unknown keys, subkeys, or null inputs.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData key, subkey"])

    START --> CheckNull{key or subkey null?}

    CheckNull -->|Yes| RETURN_NULL1["Return null"]

    CheckNull -->|No| ComputeSep["Compute separaterPoint"]

    ComputeSep --> CheckKey1{key equals メール明細コード?}

    CheckKey1 -->|Yes| CheckSubVal1{subkey equals value?}
    CheckKey1 -->|No| CheckKey2{key equals 明細本文非定型置換文字?}

    CheckSubVal1 -->|Yes| CallMailValue["Call getMail_dtl_cd_value"]
    CheckSubVal1 -->|No| CheckSubState1{subkey equals state?}

    CheckSubState1 -->|Yes| CallMailState["Call getMail_dtl_cd_state"]
    CheckSubState1 -->|No| RETURN_NULL2["Return null"]

    CheckKey2 -->|Yes| CheckSubVal2{subkey equals value?}
    CheckKey2 -->|No| RETURN_NULL3["Return null"]

    CheckSubVal2 -->|Yes| CallDtlValue["Call getDtl_text_htk_ckam_moji_value"]
    CheckSubVal2 -->|No| CheckSubState2{subkey equals state?}

    CheckSubState2 -->|Yes| CallDtlState["Call getDtl_text_htk_ckam_moji_state"]
    CheckSubState2 -->|No| RETURN_NULL4["Return null"]

    CallMailValue --> END_NODE(["Return / Next"])
    CallMailState --> END_NODE
    CallDtlValue --> END_NODE
    CallDtlState --> END_NODE
    RETURN_NULL1 --> END_NODE
    RETURN_NULL2 --> END_NODE
    RETURN_NULL3 --> END_NODE
    RETURN_NULL4 --> END_NODE
```

**CRITICAL — Constant Resolution:**
This method uses literal Japanese string constants directly (no `*Const*` class references):
- `"メール明細コード"` = "Mail Detail Code" — the item name for customer mail detail code data (item ID: `mail_dtl_cd`)
- `"明細本文非定型置換文字"` = "Detail Body Non-Standard Replacement Character" — the item name for custom replacement character data (item ID: `dtl_text_htk_ckam_moji`)
- `"value"` = the subkey requesting the actual data value
- `"state"` = the subkey requesting the data state/status

**Requirements:**
- The `key.indexOf("/")` computation at line 133 is stored but never used (dead code — likely a remnant from a future feature or a partial refactor).
- All comparisons use `equalsIgnoreCase()` for subkeys, making the matching case-insensitive.
- Null-guard at line 131-133 is the first processing step, ensuring the method is defensive against null inputs.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (項目名) that identifies what category of data to retrieve. It determines which branch of data routing the method takes. Can take one of two valid values: `"メール明細コード"` (Mail Detail Code — customer mail service detail codes) or `"明細本文非定型置換文字"` (Detail Body Non-Standard Replacement Character — custom replacement characters for invoice body text). Any other value results in `null` return. |
| 2 | `subkey` | `String` | The sub-key that further refines the data retrieval within the key category. It determines whether the caller wants the actual data value or the data state. Valid values are `"value"` (returns the actual data) and `"state"` (returns the state/status). Case-insensitive matching is applied. Any other value results in `null` return. |

**Additional fields / external state:**
- No instance fields or external state are read by this method. It is stateless — all data is sourced from calls to other methods within `FUW00114SF03DBean`.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `FUW00114SF03DBean.getMail_dtl_cd_value` | FUW00114SF03DBean | - | Retrieves the mail detail code value (data content for customer mail details) |
| R | `FUW00114SF03DBean.getMail_dtl_cd_state` | FUW00114SF03DBean | - | Retrieves the mail detail code state (status metadata for customer mail details) |
| R | `FUW00114SF03DBean.getDtl_text_htk_ckam_moji_value` | FUW00114SF03DBean | - | Retrieves the detail body non-standard replacement character value (custom replacement string for invoice body text) |
| R | `FUW00114SF03DBean.getDtl_text_htk_ckam_moji_state` | FUW00114SF03DBean | - | Retrieves the detail body non-standard replacement character state (status metadata) |

**CRUD Classification Summary:**
- All four called methods are **Read (R)** operations — they retrieve data from internal bean state, likely backing fields set during screen initialization or data binding.
- No SC Code (Service Component) or DB table references are present because this method operates entirely within the view/data-bean layer and does not invoke any service components or data access layers.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: FUW00114SFBean (Customer Mail Detail Management) | `FUW00114SFBean` (via data-type-bean framework) -> `FUW00114SF03DBean.loadModelData(key, subkey)` | `getMail_dtl_cd_value[R]`, `getMail_dtl_cd_state[R]`, `getDtl_text_htk_ckam_moji_value[R]`, `getDtl_text_htk_ckam_moji_state[R]` |

**Caller Context:**
- `FUW00114SFBean` is the main bean for the **Customer Mail Detail Management Screen** (お客様向けメール明細管理画面). It instantiates `FUW00114SF03DBean` as a data-type-bean item in the `cust_mail_dtl_cd_list` collection (Customer Mail Detail List — お客様向けメール明細一覧リスト). The framework calls `loadModelData(key, subkey)` on each bean instance during screen data binding to populate field values and states.
- This method is a **leaf utility** — it is not called by any other intermediate service or CBS components. It is accessed directly by the screen bean's data-type-bean infrastructure.

## 6. Per-Branch Detail Blocks

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

> Null guard: if either parameter is null, return null immediately. This prevents NPE and handles the case where the framework passes null for unknown item lookups.

| # | Type | Code |
|---|------|------|
| 1 | SET | `separaterPoint = key.indexOf("/")` // Compute position of separator in key (unused — dead code) [L133] |
| 2 | RETURN | `return null` // Early return when key or subkey is null [L132] |

**Block 2** — [IF] `(key.equals("メール明細コード"))` — i.e., key equals "Mail Detail Code" (L136)

> Branch for retrieving customer mail detail code data. This is the primary data type handled by this bean — mail detail codes identify the specific mail service types configured for customers.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (subkey.equalsIgnoreCase("value"))` // Check if caller requests the data value [L137] |
|   | 2.1 | **Block 2.1** — [IF body] (subkey equals "value", case-insensitive) (L138) |
|   |   | > Return the actual mail detail code value from the bean's internal state. |
|   |   | | # | Type | Code |
|   |   | |---|------|------|
|   |   | | 1 | CALL | `getMail_dtl_cd_value()` // Retrieve mail detail code value [L139] |
|   |   | | 2 | RETURN | `return getMail_dtl_cd_value()` // Return the value to caller |
|   | 2.2 | **Block 2.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` — subkey equals "state" (L141) |
|   |   | > Return the state/status of the mail detail code. Japanese comment: `//subkeyが"state"の場合、ステータスを返す。` (When subkey is "state", returns the status.) |
|   |   | | # | Type | Code |
|   |   | |---|------|------|
|   |   | | 1 | CALL | `getMail_dtl_cd_state()` // Retrieve mail detail code state [L143] |
|   |   | | 2 | RETURN | `return getMail_dtl_cd_state()` // Return the state to caller |
|   | 2.3 | **Block 2.3** — [ELSE] (subkey is neither "value" nor "state") (L140-144) |
|   |   | > Falls through to the final `return null` at line 146. |

**Block 3** — [ELSE-IF] `(key.equals("明細本文非定型置換文字"))` — i.e., key equals "Detail Body Non-Standard Replacement Character" (L147)

> Branch for retrieving custom replacement character data used in invoice body text. This allows customers to configure how certain placeholder characters in billing detail text should be replaced. Japanese comment: `//データタイプがStringの項目"明細本文非定型置換文字"(項目ID:dtl_text_htk_ckam_moji)` (Data type is String item "Detail Body Non-Standard Replacement Character" (item ID: dtl_text_htk_ckam_moji)).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (subkey.equalsIgnoreCase("value"))` // Check if caller requests the data value [L148] |
|   | 3.1 | **Block 3.1** — [IF body] (subkey equals "value", case-insensitive) (L149) |
|   |   | > Return the actual replacement character value. |
|   |   | | # | Type | Code |
|   |   | |---|------|------|
|   |   | | 1 | CALL | `getDtl_text_htk_ckam_moji_value()` // Retrieve replacement character value [L150] |
|   |   | | 2 | RETURN | `return getDtl_text_htk_ckam_moji_value()` // Return the value to caller |
|   | 3.2 | **Block 3.2** — [ELSE-IF] `(subkey.equalsIgnoreCase("state"))` — subkey equals "state" (L152) |
|   |   | > Return the state of the replacement character data. Japanese comment: `//subkeyが"state"の場合、ステータスを返す。` (When subkey is "state", returns the status.) |
|   |   | | # | Type | Code |
|   |   | |---|------|------|
|   |   | | 1 | CALL | `getDtl_text_htk_ckam_moji_state()` // Retrieve replacement character state [L154] |
|   |   | | 2 | RETURN | `return getDtl_text_htk_ckam_moji_state()` // Return the state to caller |
|   | 3.3 | **Block 3.3** — [ELSE] (subkey is neither "value" nor "state") (L151-155) |
|   |   | > Falls through to the final `return null` at line 146. |

**Block 4** — [ELSE] (no matching key found) (L156)

> No matching data type was found for the given key. Japanese comment: `// 条件に合致するプロパティが存在しない場合は、nullを返す。` (If no property matches the condition, return null.)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return null` // Default return for unmatched key values [L156] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `メール明細コード` | Field (Japanese) | Mail Detail Code — the item name for customer mail service detail codes. Identifies which mail service type is configured for a customer's billing details. |
| `mail_dtl_cd` | Field (English ID) | Mail Detail Code — the internal item ID referenced in data structures for mail detail code fields. |
| `明細本文非定型置換文字` | Field (Japanese) | Detail Body Non-Standard Replacement Character — the item name for custom replacement characters used in invoice/billing detail body text. |
| `dtl_text_htk_ckam_moji` | Field (English ID) | Detail Text for Customer Replacement Character — the internal item ID for the replacement character data field. `htk` = "for customer" (お客様向け), `ckam` = replacement (置換), `moji` = character (文字). |
| `value` | Subkey | Request type that retrieves the actual data value from a field. |
| `state` | Subkey | Request type that retrieves the state/status metadata of a field (e.g., whether it has been set, its validity, or editability). |
| `cust_mail_dtl_cd_list` | Field | Customer Mail Detail Code List — an `X33VDataTypeList` collection in the screen bean that holds multiple `FUW00114SF03DBean` instances for list rendering. |
| `FUW00114SF` | Module | Customer Mail Detail Management screen module. Part of the K-Opticom telecom order management system. |
| `X33VDataTypeList` | Class | A generic data-type list container used in the screen framework to hold multiple data-type-bean instances. |
| `X33VDataTypeBeanInterface` | Interface | The contract that data-type beans like `FUW00114SF03DBean` implement, providing `loadModelData()` and `storeModelData()` methods. |
| `separaterPoint` | Field | Local variable storing the index of "/" in the key string. Computed but never used — likely dead code from an incomplete feature or refactoring. |
| K-Opticom | Business term | K-Opticom — a Japanese broadband telecom service provider (fiber-optic internet service). The system being documented is the K-Opticom order management platform. |
