# Business Logic — KKW00844SF01DBean.clearListDataInstance() [14 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00844SF.KKW00844SF01DBean` |
| Layer | View Data Bean (Web Client / X33 framework, data presentation layer) |
| Module | `KKW00844SF` (Package: `eo.web.webview.KKW00844SF`) |

## 1. Role

### KKW00844SF01DBean.clearListDataInstance()

This method provides selective clearing of individual list-bound UI data fields within a web screen data bean. In the K-Opticom web application framework (X33), screen data beans manage list-type fields that bind to UI component controls (such as dropdown lists, table columns, or radio button groups). The `clearListDataInstance` method serves as a targeted reset mechanism — when the UI framework needs to refresh or reset a specific list field without clearing all fields, it invokes this method with the field's display label as the key. The method resolves the display label to the corresponding internal data structure and calls `.clear()` on that `X33VDataTypeList` instance, effectively wiping all stored items so the next render re-fetches fresh data. This is a shared utility method on the data bean, used across screen transitions and validation error re-displays to prevent stale UI state from persisting.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance key"])
    CHECK_NULL{key is null?}
    CHECK_RSN{異動理由コード?}
    CLEAR_RSN["Clear ido_rsn_cd_list"]
    CHECK_OP{オプションサービス契約番号?}
    CLEAR_OP["Clear op_svc_kei_no_list"]
    END_NODE(["Return Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|true| CHECK_RSN
    CHECK_NULL -->|false| END_NODE
    CHECK_RSN -->|true| CLEAR_RSN
    CLEAR_RSN --> END_NODE
    CHECK_RSN -->|false| CHECK_OP
    CHECK_OP -->|true| CLEAR_OP
    CLEAR_OP --> END_NODE
    CHECK_OP -->|false| END_NODE
```

**CRITICAL — Constant Resolution:**

The method branches on literal string values (Japanese display labels). No constant file is needed — the keys are embedded as literal strings in the source:

| Branch Key | Japanese Label | English Meaning | Internal Field ID |
|------------|---------------|-----------------|--------------------|
| `"異動理由コード"` | "異動理由コード" (Reason code for change/migration) | `ido_rsn_cd` |
| `"オプションサービス契約番号"` | "オプションサービス契約番号" (Option service contract number) | `op_svc_kei_no` |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The UI display label (in Japanese) identifying which list data field to clear. This key maps a user-visible item name to a specific list data instance within the data bean. It acts as a dispatch selector that determines which internal `X33VDataTypeList` field should be reset. If `null`, the method returns without performing any action (no-op). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | List data for "Reason code for change/migration" — stores selectable items for the deviation/migration reason code field (item ID: `ido_rsn_cd`) |
| `op_svc_kei_no_list` | `X33VDataTypeList` | List data for "Option service contract number" — stores selectable items for the option service contract number field (item ID: `op_svc_kei_no`) |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | X33 Framework | - | Calls `clear()` on `X33VDataTypeList` instance to remove all elements from the list |

This method does not interact with any backend SC/CBS, database, or entity. It operates purely within the X33 View framework's data bean layer, calling the `clear()` method on `X33VDataTypeList` objects. These are client-side in-memory list containers that hold UI rendering data (such as SelectItem options). No database or service layer operations occur.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Web Client X33 Framework | Screen Controller -> DataBean.clearListDataInstance(key) | `X33VDataTypeList.clear [N/A] in-memory list` |
| 2 | Web Client (manual invocation) | Custom screen code -> `KKW00844SF01DBean.clearListDataInstance(key)` | `X33VDataTypeList.clear [N/A] in-memory list` |

**Notes:**
- No direct callers were found within the `KKW00844SF` module codebase.
- This method follows a pattern observed across many screen beans in the codebase (e.g., `FUW00912SF01DBean`, `FUW00926SFBean`) where `clearListDataInstance(String key)` is called by the X33 View framework during screen refresh cycles, or manually by screen logic when specific list fields need to be reset (e.g., after a data mutation that affects dependent dropdown options).
- The method has no upstream SC/CBS dependency and no terminal CRUD endpoints.

## 6. Per-Branch Detail Blocks

**Block 1** — IF `(key != null)` (L837)

> Guard clause: if `key` is `null`, the method returns immediately without clearing any fields. This prevents `NullPointerException` when the framework passes an unqualified key.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key != null)` // Guard against null key parameter |

**Block 1.1** — ELSE-IF `(key.equals("異動理由コード"))` [異動理由コード="異動理由コード" (Reason code for change/migration)] (L840)

> When the key matches the display label for the "Reason code for change/migration" field, clear its associated list data. This field (item ID: `ido_rsn_cd`) is used in the UI to display selectable reason codes for service migration/changes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ido_rsn_cd_list.clear()` // Clear list items for "異動理由コード" (Reason code for change/migration) |

**Block 1.2** — ELSE-IF `(key.equals("オプションサービス契約番号"))` [オプションサービス契約番号="オプションサービス契約番号" (Option service contract number)] (L843)

> When the key matches the display label for the "Option service contract number" field, clear its associated list data. This field (item ID: `op_svc_kei_no`) is used in the UI to display selectable option service contract numbers.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `op_svc_kei_no_list.clear()` // Clear list items for "オプションサービス契約番号" (Option service contract number) |

**Block 2** — ELSE (implicit, no matching key) (L845)

> If the key does not match any known field label, the method silently returns without performing any operation. This is a safe no-op for unknown/unrecognized keys.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | (implicit `void` return) // No action for unrecognized key |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Reason code for change/migration — an internal field identifier for the list of selectable reason codes used when recording service migration or account changes |
| `op_svc_kei_no` | Field | Option service contract number — internal field identifier for the list of available option service contract numbers |
| `ido_rsn_cd_list` | Field | X33 view data list bean — the in-memory list container holding UI-selectable items for the reason code field |
| `op_svc_kei_no_list` | Field | X33 view data list bean — the in-memory list container holding UI-selectable items for the option service contract number field |
| 異動理由コード | Japanese label | "Reason code for change/migration" — the Japanese UI display label for the migration reason code dropdown/list field |
| オプションサービス契約番号 | Japanese label | "Option service contract number" — the Japanese UI display label for the option service contract number dropdown/list field |
| X33VDataTypeList | Technical | X33 framework data type list — a view-layer container class that holds selectable items (e.g., `SelectItem` options) for UI data binding |
| X33 Framework | Technical | Fujitsu's X33 web application framework — the enterprise MVC framework used by K-Opticom for building web screens |
| DBean | Technical | Data Bean — a screen-level data container class in the X33 framework that holds all UI state for a single screen |
| KKW00844SF | Module | Screen module ID — the internal code for a K-Opticom web service screen dealing with service contract/migration operations |
| key | Parameter | UI display label used as a dispatch key to identify which list field to clear |
