# Business Logic — CRW02702SF02DBean.loadModelData() [23 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.CRW02702SF.CRW02702SF02DBean` |
| Layer | Utility / Data Bean (Web Controller layer) |
| Module | `CRW02702SF` (Package: `eo.web.webview.CRW02702SF`) |

## 1. Role

### CRW02702SF02DBean.loadModelData()

This method serves as a **dynamic data accessor** implementing the `X33VDataTypeBeanInterface` contract for the `CRW02702SF02DBean` data bean. It is part of the Futurity X33 Web Framework's data-loading mechanism, enabling screens to retrieve field values from a bean using string-based keys rather than direct method calls — a pattern commonly used when screen fields are rendered from lists (e.g., option lists, pricing tables) where the specific field to load is determined at runtime. The method acts as a **routing/dispatch hub**: it receives a `key` identifying a data type (currently only `"WEBID"`, which maps to the internal `l2_web_id` field) and a `subkey` specifying which aspect of that data to return (`"value"` for the actual field value, or `"state"` for a state/status indicator). For the `CRW02702SF` screen context, `l2_web_id` represents the Level-2 Web ID — an internal tracking identifier for service contract line items (ISP service agreements) managed on this screen. If the requested key/subkey pair is not recognized or either parameter is null, the method gracefully returns null, allowing the caller to handle the absence of data. This method is a **shared utility** within the bean, invoked by the X33 framework and by list-rendering code in the parent screen bean (`CRW02702SFBean`) when populating dynamic UI components.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["loadModelData(key, subkey)"])
    CHECK_NULL{"key or subkey is null?"}
    CHECK_WEBID{"key equals WEBID?"}
    CHECK_VALUE{"subkey equals 'value' (case-insensitive)?"}
    CHECK_STATE{"subkey equals 'state' (case-insensitive)?"}
    RET_STATE[("Return getL2_web_id_state()")]
    RET_VALUE[("Return getL2_web_id_value()")]
    RET_NULL[("Return null")]
    END_NODE(["Return / Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| RET_NULL
    CHECK_NULL -->|No| CHECK_WEBID
    CHECK_WEBID -->|No| RET_NULL
    CHECK_WEBID -->|Yes| CHECK_VALUE
    CHECK_VALUE -->|Yes| RET_VALUE
    CHECK_VALUE -->|No| CHECK_STATE
    CHECK_STATE -->|Yes| RET_STATE
    CHECK_STATE -->|No| RET_NULL
    RET_VALUE --> END_NODE
    RET_STATE --> END_NODE
    RET_NULL --> END_NODE
```

This method implements a **conditional dispatch pattern** with three processing branches:
1. **Null guard** — If either `key` or `subkey` is null, immediately return null (no further processing).
2. **WEBID lookup** — If `key` equals the literal string `"WEBID"` (the data type for `l2_web_id`, the Level-2 Web ID field), delegate further based on `subkey`:
   - If `subkey` equals `"value"` (case-insensitive), return the current value of `l2_web_id_value` via `getL2_web_id_value()`.
   - If `subkey` equals `"state"` (case-insensitive), return the current state of `l2_web_id_state` via `getL2_web_id_state()`.
3. **Fallback** — If no matching data type is found, return null.

The `separaterPoint` variable is computed but never used — it is dead code (likely a remnant of a planned path-based key format like `"WEBID/..."`).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The data type identifier (item name / 項目名). Specifies which field to access. Currently only accepts the literal `"WEBID"` which maps to the `l2_web_id` (Level-2 Web ID) field — an internal tracking ID for service contract line items on the CRW02702SF screen. |
| 2 | `subkey` | `String` | The sub-identifier (sub key / サブキー) specifying which aspect of the requested data to return. Valid values are `"value"` (returns the actual field data) and `"state"` (returns a status indicator for the field). Case-insensitive comparison. |

**Instance fields read by this method:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `l2_web_id_value` | `String` | The current value of the Level-2 Web ID field, initialized to `""`. Represents the web ID value for ISP service agreement details. |
| `l2_web_id_state` | `String` | The state/status of the Level-2 Web ID field, initialized to `""`. Used to track field validation or processing state. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `CRW02702SF02DBean.getL2_web_id_value` | CRW02702SF02DBean | - | Returns the value of the `l2_web_id_value` instance field (in-memory getter, no database access) |
| R | `CRW02702SF02DBean.getL2_web_id_state` | CRW02702SF02DBean | - | Returns the value of the `l2_web_id_state` instance field (in-memory getter, no database access) |

**Note:** This method performs **no database CRUD operations**. It only reads from in-memory instance fields via local getter methods. The actual data population of `l2_web_id_value` and `l2_web_id_state` occurs elsewhere (likely via the parent screen bean or CBS calls that populate the bean before this method is invoked).

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:CRW02702SF (indirect) | `CRW02702SFBean` creates `CRW02702SF02DBean` -> X33 Framework invokes `loadModelData` via `X33VDataTypeBeanInterface` | `getL2_web_id_value [R] l2_web_id_value (in-memory)`, `getL2_web_id_state [R] l2_web_id_state (in-memory)` |

**Caller Details:**
- The `CRW02702SFBean` (parent screen bean for screen CRW02702SF) instantiates `CRW02702SF02DBean` objects for list-type fields (e.g., `"オプションサービス契約＜ISP＞一括照会明細"` — Option Service Contract <ISP> Bulk Inquiry Details).
- The X33V framework calls `loadModelData()` on these bean instances during view rendering, when the screen needs to dynamically fetch field values for data-type beans within a list.
- No other direct callers of `CRW02702SF02DBean.loadModelData()` were found in the codebase.

## 6. Per-Branch Detail Blocks

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

> Null guard: if either parameter is null, return null immediately.
> Java: `key,subkeyがnullの場合、nullを返す` (If key and subkey are null, return null)

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

**Block 2** — [EXEC] Compute separator position (L107)

> Computes the index of '/' in key. Variable is unused (dead code).
> Java: `項目ごとに処理を入れる。` (Insert processing per item.)

| # | Type | Code |
|---|------|------|
| 1 | SET | `int separaterPoint = key.indexOf("/");` |

**Block 3** — [IF] `key.equals("WEBID")` (L110)

> Checks if the requested data type is WEBID (the data type for the Level-2 Web ID field, l2_web_id).
> Java: `データタイプがStringの項目"WEBID"(項目ID:l2_web_id)` (Data type is the String item "WEBID" (item ID: l2_web_id))

| # | Type | Code |
|---|------|------|
| 1 | COND | `key.equals("WEBID")` |

**Block 3.1** — [IF-ELSE] Subkey dispatch (L111)

> Inside the WEBID branch: dispatch based on subkey.

| # | Type | Code |
|---|------|------|
| 1 | COND | `subkey.equalsIgnoreCase("value")` |
| 2 | RETURN | `return getL2_web_id_value();` |
| 3 | COND | `subkey.equalsIgnoreCase("state")` |
| 4 | RETURN | `return getL2_web_id_state();` |

**Block 3.1.1** — [IF] `subkey.equalsIgnoreCase("value")` (L111)

> When subkey is "value", return the current value of the l2_web_id field.
> Returns the actual web ID string stored in `l2_web_id_value`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getL2_web_id_value()` |
| 2 | RETURN | `return getL2_web_id_value();` // subkeyが"value"の場合、値を返す |

**Block 3.1.2** — [ELSE-IF] `subkey.equalsIgnoreCase("state")` (L113)

> When subkey is "state", return the state/status of the l2_web_id field.
> Java: `subkeyが"state"の場合、ステータスを返す。` (When subkey is "state", return the status.)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `getL2_web_id_state()` |
| 2 | RETURN | `return getL2_web_id_state();` // subkeyが"state"の場合、ステータスを返す |

**Block 4** — [RETURN] Fallback (L118)

> No matching data type or subkey found — return null.
> Java: `条件に一致するプロパティが存在しない場合は、nullを返す。` (If no matching property exists, return null.)

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `l2_web_id` | Field | Level-2 Web ID — an internal tracking identifier used in the K-Opticom web system for service contract line items. This is a screen-specific field on the CRW02702SF screen for ISP service agreement management. |
| `l2_web_id_value` | Field | The actual string value stored in the Level-2 Web ID field. Initialized to empty string. |
| `l2_web_id_state` | Field | The validation/processing state of the Level-2 Web ID field. Initialized to empty string. |
| WEBID | Constant/Literal | Data type identifier string — the only supported key value in this method. Maps to the `l2_web_id` field. |
| value | Subkey | Request sub-key meaning "return the actual field data/value". |
| state | Subkey | Request sub-key meaning "return the field status/indicator". |
| CRW02702SF | Screen | Screen code for ISP service contract bulk inquiry details — a telecom service management screen for K-Opticom customers. |
| DBean | Pattern | "Data Bean" — a bean implementing `X33VDataTypeBeanInterface` used by the X33 framework to model UI field data. The "02" in CRW02702SF02DBean indicates it is the second (detail) data bean variant for screen CRW02702SF. |
| X33VDataTypeBeanInterface | Framework | Fujitsu Futurity X33 Framework interface that beans implement to support dynamic data loading via `loadModelData(String key, String subkey)`. |
| X33 Framework | Framework | Fujitsu Futurity Web Client tool framework for building JavaServer Faces-based enterprise web applications. |
| ISP | Business term | Internet Service Provider — the type of broadband internet service managed on this screen. |
| 項目名 (Koumoku-me) | Japanese term | Item name / field identifier — the business name of a screen field, used as the `key` parameter. |
| サブキー (Sabu-kii) | Japanese term | Sub-key — an additional identifier that qualifies the data type requested (e.g., value vs. state). |
