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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW22101SF.KKW22101SF01DBean` |
| Layer | View (WebClient DBean / Data Transfer Bean) |
| Module | `KKW22101SF` (Package: `eo.web.webview.KKW22101SF`) |

## 1. Role

### KKW22101SF01DBean.clearListDataInstance()

This method is responsible for clearing (emptying) specific list data item instances within the `KKW22101SF01DBean` data transfer object. It operates as a **targeted list reset utility** invoked during screen lifecycle management — specifically when the WebClient framework needs to reset the state of displayed list components before re-rendering or when transitioning between screen states. The method implements a **discriminated dispatch pattern**, branching on the `key` parameter (a business item name string) to determine which `X33VDataTypeList` instance should be cleared. It handles **two distinct service types** within the same telecom service contract change domain: (1) the **Change Reason Code** list (`異動理由コード`), which stores the reasons for service contract changes (such as transfers, cancellations, or modifications), and (2) the **Option Service Contract Number** list (`オプションサービス契約番号`), which stores associated optional service line items. As a shared utility within the WebClient DBean hierarchy, this method is inherited by the parent bean `KKW22101SFBean` and overridden by subclasses across multiple screens (e.g., `FUW00901SF`, `FUW00912SF`, `FUW00917SF`), making it a foundational data-maintenance method in the broader screen processing pipeline for service contract management.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance(key)"])
    KEY_CHECK{"key != null"}
    BRANCH_1{"key equals '異動理由コード'"}
    PROCESS_1["ido_rsn_cd_list.clear()"]
    BRANCH_2{"key equals 'オプションサービス契約番号'"}
    PROCESS_2["op_svc_kei_no_list.clear()"]
    END_NODE(["Return / Next"])

    START --> KEY_CHECK
    KEY_CHECK -->|false| END_NODE
    KEY_CHECK -->|true| BRANCH_1
    BRANCH_1 -->|true| PROCESS_1
    PROCESS_1 --> BRANCH_2
    BRANCH_1 -->|false| BRANCH_2
    BRANCH_2 -->|true| PROCESS_2
    PROCESS_2 --> END_NODE
    BRANCH_2 -->|false| END_NODE
```

**Branch summary:**

| Branch | Condition | Business Effect |
|--------|-----------|-----------------|
| Null key | `key == null` | Method returns immediately — no list is cleared. This defensive branch prevents `NullPointerException` when the framework passes a null key during certain lifecycle events. |
| Change reason code | `key.equals("異動理由コード")` | Clears the `ido_rsn_cd_list` — the list of change reason codes displayed on the screen. This list holds the `X33VDataTypeStringBean` items representing each row's change reason in a service contract change screen. |
| Option service contract number | `key.equals("オプションサービス契約番号")` | Clears the `op_svc_kei_no_list` — the list of option service contract numbers. This list holds the `X33VDataTypeStringBean` items for option service line items displayed on the screen. |
| Unrecognized key | Neither condition matches | Method returns without error — the key is silently ignored, allowing the method to be called generically without the caller needing to validate which lists exist. |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The **item name** (display label) used to identify which list data instance should be cleared. It corresponds to the human-readable label of a list column on the screen. Valid values are: `"異動理由コード"` (Change Reason Code — the item ID `ido_rsn_cd`) and `"オプションサービス契約番号"` (Option Service Contract Number — the item ID `op_svc_kei_no`). If `null`, the method returns immediately without clearing any list. If the value does not match any known key, the method returns silently (no-op). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | The list of change reason code items displayed on the service contract change screen. Each element is an `X33VDataTypeStringBean` containing a reason code string. |
| `op_svc_kei_no_list` | `X33VDataTypeList` | The list of option service contract number items. Each element is an `X33VDataTypeStringBean` containing a contract number string for optional services. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - (Framework method) | - (Local memory) | Calls `clear()` on `ido_rsn_cd_list` — empties the in-memory list data structure for change reason codes. |
| - | `X33VDataTypeList.clear` | - (Framework method) | - (Local memory) | Calls `clear()` on `op_svc_kei_no_list` — empties the in-memory list data structure for option service contract numbers. |

**Analysis:** This method does **not** perform any database CRUD operations (no C/R/U/D against persistent storage). It operates entirely on **in-memory `X33VDataTypeList` objects** which are framework-managed data structures within the WebClient DBean layer. The `clear()` method is a framework-level list clearing operation (equivalent to Java's `List.clear()`) that removes all elements from the list, effectively resetting the screen-bound data to an empty state. There are **no** service component (SC) calls, no CBS (Common Business Service) invocations, and no entity/DB table operations.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW22101SF | `KKW22101SFBean.clearListDataInstance` -> `KKW22101SF01DBean.clearListDataInstance` (via `super.clearListDataInstance(key)`) | `ido_rsn_cd_list.clear()` (local), `op_svc_kei_no_list.clear()` (local) |

**Notes on caller search:**
- The primary direct caller is the **parent bean** `KKW22101SFBean` at line 4361, which calls `super.clearListDataInstance(key)` to delegate to this method as part of its own override chain.
- The `KKW22101SFBean` itself is called by its corresponding screen/controller (`KKW22101SF` screen) during list data initialization/reset cycles.
- Additionally, numerous **unrelated screen beans** in the `FUW*` package (e.g., `FUW00901SFBean`, `FUW00912SFBean`, `FUW00917SFBean`, `FUW00926SFBean`, `FUW00927SFBean`, `FUW00931SFBean`, `FUW00957SFBean`, `FUW00959SFBean`, `FUW00964SF*`) also define their own `clearListDataInstance` methods that chain to `super.clearListDataInstance(key)`, forming a broad inheritance pattern across the WebClient DBean hierarchy. However, these are **different beans** in different modules and are not callers of `KKW22101SF01DBean.clearListDataInstance` — they are parallel implementations.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `(key != null)` (L1643)

> Guard clause: Verify the key parameter is not null before proceeding. This defensive check prevents null pointer exceptions when the framework passes null during certain lifecycle phases.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `// 配列項目 "異動理由コード"(String型。項目ID:ido_rsn_cd)` // Comment: Array item "Change Reason Code" (String type. Item ID: ido_rsn_cd) |
| 2 | IF | `key.equals("異動理由コード")` → see Block 1.1 |
| 3 | EXEC | `// 配列項目 "オプションサービス契約番号"(String型。項目ID:op_svc_kei_no)` // Comment: Array item "Option Service Contract Number" (String type. Item ID: op_svc_kei_no) |
| 4 | IF | `key.equals("オプションサービス契約番号")` → see Block 1.2 |

**Block 1.1** — [IF] `(key.equals("異動理由コード")) ["異動理由コード" = "Change Reason Code"]` (L1645)

> When the key matches the change reason code item name, clear the associated list that holds the displayed change reason code entries on the service contract change screen.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `ido_rsn_cd_list.clear()` — Clears all elements from the change reason code list. This is an in-memory operation that empties the `X33VDataTypeList` without any DB interaction. |

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

> When the key matches the option service contract number item name, clear the associated list that holds the displayed optional service contract numbers on the screen.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `op_svc_kei_no_list.clear()` — Clears all elements from the option service contract number list. This is an in-memory operation that empties the `X33VDataTypeList` without any DB interaction. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Change Reason Code — the reason code for a service contract change (e.g., transfer, cancellation, modification). Stored as String in `ido_rsn_cd_list`. |
| `ido_div` | Field | Change Division — the classification/category of a service contract change. |
| `op_svc_kei_no` | Field | Option Service Contract Number — the contract number assigned to an optional service line item. Stored as String in `op_svc_kei_no_list`. |
| `svc_kei_no` | Field | Service Contract Number — the primary service contract identifier. |
| `X33VDataTypeList` | Type | WebClient framework list data type — a generic typed list container used by the Fujitsu X33 WebClient framework to hold screen-bound data. Each element can be a typed bean (e.g., `X33VDataTypeStringBean`). |
| `X33VDataTypeStringBean` | Type | Framework bean wrapping a String value for use within an `X33VDataTypeList`. |
| `KKW22101SF` | Module | Service contract change/screen module — a WebClient screen module for managing service contract changes. |
| DBean | Abbreviation | Data Bean — a WebClient pattern for a bean that holds screen data (inputs, outputs, lists) between the view layer and the business logic layer. |
| `異動理由コード` | Japanese field | Change Reason Code — the display label (key) identifying the change reason code list item on the screen. |
| `オプションサービス契約番号` | Japanese field | Option Service Contract Number — the display label (key) identifying the option service contract number list item on the screen. |
| `X33SException` | Type | WebClient framework exception class thrown by DBean methods during screen data processing errors. |
| `X33VViewBaseBean` | Type | Base bean class in the X33 framework that provides common view-layer bean functionality (getter/setter generation, data binding). |
