# Business Logic — KKW02516SFBean.clearListDataInstance() [21 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA16801SF.KKW02516SFBean` |
| Layer | Controller / Web Component (Package: `eo.web.webview.KKA16801SF`) |
| Module | `KKA16801SF` (Package: `eo.web.webview.KKA16801SF`) |

## 1. Role

### KKW02516SFBean.clearListDataInstance()

This method performs **list data cleanup** for a customer contract continuation screen (screen module KKA16801SF). It clears individual list instances held in the bean based on a business key that identifies which list component should be reset. The method implements a **key-based dispatch pattern**: it examines the key parameter and routes to the appropriate list field for clearing.

The method handles **three categories of list keys**: (1) keys starting with `//` are routed to the parent base class `clearListDataInstance()` for processing as common information view lists (共通情報ビューのリスト), which are handled at the base class / foundation layer (基底クラスで処理); (2) the specific key "Customer Contract Continuation List" (顧客契約延續リスト / item ID: `cust_kei_hktgi_list`) clears the customer contract continuation list (`cust_kei_hktgi_list_list`); and (3) the key "Change Reason List" (異動理由リスト / item ID: `ido_rsn_list`) clears the change reason list (`ido_rsn_list_list`). This method serves as a **shared utility** called by screen logic to reset list state during page navigation, refresh, or error recovery scenarios, ensuring stale data does not persist across screen transitions.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance key"])
    COND_NULL["key != null"]
    COND_SLASH["key starts with //"]
    CALL_SUPER["super.clearListDataInstance(key)"]
    COND_F01["key equals 顧客契約延續リスト"]
    EXEC_F01["cust_kei_hktgi_list_list.clear()"]
    COND_F02["key equals 異動理由リスト"]
    EXEC_F02["ido_rsn_list_list.clear()"]
    END_RETURN(["Return / Next"])

    START --> COND_NULL
    COND_NULL -->|false| END_RETURN
    COND_NULL -->|true| COND_SLASH
    COND_SLASH -->|true| CALL_SUPER
    COND_SLASH -->|false| COND_F01
    CALL_SUPER --> END_RETURN
    COND_F01 -->|true| EXEC_F01
    COND_F01 -->|false| COND_F02
    EXEC_F01 --> END_RETURN
    COND_F02 -->|true| EXEC_F02
    COND_F02 -->|false| END_RETURN
    EXEC_F02 --> END_RETURN
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business item name (項目名) that identifies which list data should be cleared. Can take one of three forms: (a) a key starting with `//` indicating a common information view list (共通情報ビューのリスト) that should be delegated to the base class; (b) the literal string "顧客契約延續リスト" (Customer Contract Continuation List) targeting the `cust_kei_hktgi_list_list` field; or (c) the literal string "異動理由リスト" (Change Reason List) targeting the `ido_rsn_list_list` field. |

**Instance fields read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `cust_kei_hktgi_list_list` | `X33VDataTypeList` | Customer contract continuation list — holds the list of customer contract continuation line items (顧客契約引継リスト) |
| `ido_rsn_list_list` | `X33VDataTypeList` | Change reason list — holds the list of change reasons (異動理由リスト) |

## 4. CRUD Operations / Called Services

Analyze all method calls within this method and classify each as a CRUD operation.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `super.clearListDataInstance` | (inherited) | - | Delegates to base class for common information view list clearing (共通情報ビューのリストの処理) |
| - | `X33VDataTypeList.clear` | JCCcomFileSearch | - | Clears the `cust_kei_hktgi_list_list` list contents in place |
| - | `X33VDataTypeList.clear` | JCCcomFileSearch | - | Clears the `ido_rsn_list_list` list contents in place |

**Note:** This method performs **list clearing (U / Update)** — it resets the contents of in-memory bean list fields. No database or SC-level CRUD operations are invoked directly. The `clear()` calls on `X33VDataTypeList` reset the list in the view layer, which is a standard pattern for screen state management before reloading fresh data.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | KKW02516SFBean | `KKW02516SFBean.clearListDataInstance()` -> `clearListDataInstance(key)` | (delegates based on key — see Section 4) |

**Notes:**
- The only direct caller is `KKW02516SFBean.clearListDataInstance()` (the no-arg overload), which likely iterates over known keys and delegates to this keyed variant to clear each list individually.
- This method is part of the KKA16801SF screen module, which handles customer contract continuation processing (顧客契約引継処理).

## 6. Per-Branch Detail Blocks

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

> Guard clause: only process if the key is non-null to prevent NPE.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if(key != null)` // Guard clause — skip if key is null |

**Block 1.1** — IF `(key.startsWith("//"))` [CONSTANT: prefix="//"] (L2000)

> Common information view list branch (共通情報ビューのリストの場合). Routes to the base class for foundation-layer processing (基底クラスで処理).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.clearListDataInstance(key)` // Common info view list handled at base class (共通情報ビューリストは基底クラスで処理) |

**Block 1.2** — ELSE-IF `(key.equals("顧客契約延續リスト"))` [CONSTANT: key="顧客契約延續リスト", item ID=`cust_kei_hktgi_list`] (L2005)

> Clears the customer contract continuation list (顧客契約引継リスト). This list is used by screen KKW02516SF01 for repeated-item specification of customer contract continuation data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `cust_kei_hktgi_list_list.clear()` // Clear customer contract continuation list (顧客契約引継リスト) |

**Block 1.3** — ELSE-IF `(key.equals("異動理由リスト"))` [CONSTANT: key="異動理由リスト", item ID=`ido_rsn_list`] (L2009)

> Clears the change reason list (異動理由リスト). This list is used by screen KKW02516SF02 for repeated-item specification of change reasons.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ido_rsn_list_list.clear()` // Clear change reason list (異動理由リスト) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Parameter | Item name (項目名) — identifies which list to clear |
| `cust_kei_hktgi_list_list` | Field | Customer contract continuation list — holds list items for customer contract continuation (顧客契約引継) processing |
| `ido_rsn_list_list` | Field | Change reason list — holds list items for recording reasons of changes/alterations (異動理由) |
| 顧客契約延續リスト | Japanese | Customer Contract Continuation List — the list of customer contracts to be continued across service transitions |
| 異動理由リスト | Japanese | Change Reason List — the list of reasons explaining why a service change occurred |
| 共通情報ビュー | Japanese | Common Information View — shared UI component for displaying common/reference data across multiple screens |
| X33VDataTypeList | Type | View data list class — a typed list container used in the X33 framework for view-layer data binding |
| KKA16801SF | Module | Screen module for customer contract continuation processing (顧客契約引継処理) |
| X33SException | Type | X33 framework exception — checked exception thrown by framework methods |
| 基底クラス | Japanese | Base class — the parent class that provides foundational list management functionality |
