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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02701SF.KKW02701SF01DBean` |
| Layer | View/Bean Component (Web Client tier) |
| Module | `KKW02701SF` (Package: `eo.web.webview.KKW02701SF`) |

## 1. Role

### KKW02701SF01DBean.clearListDataInstance()

This method is a **list-clearing utility** that selectively clears individual list fields within the data bean based on a string key that identifies the target list item. It implements a **key-based dispatch pattern**: the caller passes a human-readable label (e.g., "Option Service Contract Number" or "Reason for Modification Code") and the method routes to the corresponding `X33VDataTypeList` field to perform a `.clear()` operation. The method serves as a **shared base utility** called by dozens of UI bean subclasses (in `FUW00xxxSF` screen packages) which either invoke it via `super.clearListDataInstance(key)` during their own initialization/reset flows, or call it directly when a UI action requires clearing a specific list segment. It plays a critical role in **page reset and form reinitialization** — ensuring stale data from a previous screen load does not leak into subsequent operations. If the key is `null` or does not match any known list item label, the method performs a safe no-op, making it safe to call with derived or dynamic keys without risking `NullPointerException`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance(String key)"])
    CHECK_NULL{"key != null?"}
    CHECK_RSN{"key equals \"異動理由コード\" (Reason for Modification Code)"}
    CHECK_SVC{"key equals \"オプションサービス契約番号\" (Option Service Contract Number)"}
    CLEAR_RSN["hktgi_ido_rsn_cd_list.clear()"]
    CLEAR_SVC["hktgi_op_svc_kei_no_list.clear()"]
    DO_NOTHING["No matching list - no-op"]
    END_NODE(["Return void / Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|false| DO_NOTHING
    DO_NOTHING --> END_NODE
    CHECK_NULL -->|true| CHECK_RSN
    CHECK_RSN -->|true| CLEAR_RSN
    CHECK_RSN -->|false| CHECK_SVC
    CHECK_SVC -->|true| CLEAR_SVC
    CHECK_SVC -->|false| DO_NOTHING
    CLEAR_RSN --> END_NODE
    CLEAR_SVC --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | A human-readable label that identifies which list field to clear. This string is compared against predefined Japanese UI display names to determine the target list. The value `"異動理瀆コード"` (Reason for Modification Code) clears the modification reason code list, and `"オプションサービス契約番号"` (Option Service Contract Number) clears the option service contract number list. If `null` or unrecognized, the method performs a safe no-op. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `hktgi_ido_rsn_cd_list` | `X33VDataTypeList` | List of reason for modification codes — stores the reasons (e.g., contract termination, service change) when a customer modifies their service contract. Items are of type `X33VDataTypeStringBean` containing `String` values. |
| `hktgi_op_svc_kei_no_list` | `X33VDataTypeList` | List of option service contract numbers — stores the contract numbers for add-on/option services attached to the primary service. Items are of type `X33VDataTypeStringBean` containing `String` values. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - | - | Calls `clear()` on an `X33VDataTypeList` instance to remove all elements (internal collection operation, not a DB call) |

This method does not invoke any Service Component (SC), Business Service (CBS), or database operations. It operates purely on in-memory `X33VDataTypeList` collections managed by the bean's state.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW02701SF01DBean (base) | (self-defined) | No external calls |
| 2 | Bean:FUW00901SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 3 | Bean:FUW00907SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 4 | Bean:FUW00912SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 5 | Bean:FUW00917SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 6 | Bean:FUW00919SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 7 | Bean:FUW00927SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 8 | Bean:FUW00931SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 9 | Bean:FUW00957SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 10 | Bean:FUW00964SFBean | `super.clearListDataInstance(key)` (parent class delegation) | No external calls |
| 11 | Bean:FUW00912SF01DBean | (own override - no super call) | No external calls |
| 12 | Bean:FUW00964SF10DBean | (own override - no super call) | No external calls |
| 13 | Bean:FUW00964SF04DBean | (own override - no super call) | No external calls |
| 14 | Bean:FUW00964SF07DBean | (own override - no super call) | No external calls |
| 15 | Bean:FUW00964SF01DBean | (own override - no super call) | No external calls |

**Notes:**
- The method is defined in the base bean `KKW02701SF01DBean` and inherited by numerous subclasses across `FUW00xxxSF` screen packages.
- Some subclasses override the method and call `super.clearListDataInstance(key)` to clear base lists before clearing their own additional lists.
- Other subclasses override the method without calling super, providing fully custom implementations.

## 6. Per-Branch Detail Blocks

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

> Guard clause: if `key` is `null`, the method exits without performing any operation, preventing `NullPointerException`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key != null)` // Guard against null key — safe no-op if null |

**Block 1.1** — ELSE-IF `(key.equals("異動理由コード"))` [異動理由コード = "Reason for Modification Code"] (L1533)

> When the key matches the display label for the "Reason for Modification Code" list item, clear the `hktgi_ido_rsn_cd_list` collection. This is used to reset the list of reasons associated with service contract modifications (e.g., termination, suspension, address change).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("異動理由コード"))` // List item "Reason for Modification Code" (String type, Item ID: hktgi_ido_rsn_cd) |
| 2 | EXEC | `hktgi_ido_rsn_cd_list.clear()` // Clear all elements from the modification reason codes list |

**Block 1.2** — ELSE-IF `(key.equals("オプションサービス契約番号"))` [オプションサービス契約番号 = "Option Service Contract Number"] (L1536)

> When the key matches the display label for the "Option Service Contract Number" list item, clear the `hktgi_op_svc_kei_no_list` collection. This is used to reset the list of add-on service contract numbers that may have been cached from a previous page load.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if (key.equals("オプションサービス契約番号"))` // List item "Option Service Contract Number" (String type, Item ID: hktgi_op_svc_kei_no) |
| 2 | EXEC | `hktgi_op_svc_kei_no_list.clear()` // Clear all elements from the option service contract numbers list |

**Block 2** — ELSE-ELSE (implicit fall-through) `(key not recognized)`

> When `key` is not `null` but does not match any of the two defined list item labels, the method performs no operation — no list is cleared and no exception is thrown. This is a safe no-op design pattern.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | (implicit) // No matching list item label — silent no-op |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hktgi_ido_rsn_cd_list` | Field | Reason for modification code list — stores the reasons (e.g., contract termination, service change) when a customer modifies their service contract line item |
| `hktgi_op_svc_kei_no_list` | Field | Option service contract number list — stores the contract numbers for add-on/option services attached to the primary service |
| `hktgi_ido_rsn_cd` | Field ID | Reason for modification code — the item identifier for the modification reason data element |
| `hktgi_op_svc_kei_no` | Field ID | Option service contract number — the item identifier for the option service contract number data element |
| 異動理由コード | Japanese label | Reason for Modification Code — the human-readable UI label for the modification reason list item |
| オプションサービス契約番号 | Japanese label | Option Service Contract Number — the human-readable UI label for the option service contract number list item |
| `X33VDataTypeList` | Class | Fujitsu Futurity X33 framework list type — a generic typed list container used in the web client framework to hold lists of data bean values |
| X33 | Acronym | Futurity X33 — Fujitsu's web application framework used for building the K-Opticom web client screens |
| KKW02701SF | Module | Internal module code — the base screen/module for which this data bean is generated |
