# Business Logic — KKW01031SF01DBean.clearListDataInstance() [10 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01031SF.KKW01031SF01DBean` |
| Layer | Webview / Data Bean (View Layer — X33 framework data binding) |
| Module | `KKW01031SF` (Package: `eo.web.webview.KKW01031SF`) |

## 1. Role

### KKW01031SF01DBean.clearListDataInstance()

This method performs targeted cleanup of list-type data elements within the KKW01031SF screen's data bean. It implements a key-based dispatch pattern: the caller passes a Japanese item name string as the key, and the method matches it against known list element names to selectively clear the corresponding field's data. Currently, the only registered list element is "異動理由コード" (Reason Code for Transfer/Change — a code that records the reason when a service item is modified or transferred, stored in field `ido_rsn_cd_list`).

The method serves as a shared utility within the X33 web framework's bean lifecycle. It is invoked during data type bean refresh operations (e.g., when the view rebinds data or resets list state between user interactions). Its role in the larger system is to ensure that list-backed fields are properly cleared before reinitialization, preventing stale data from persisting across view cycles.

The method has two branches: (1) a null-safety guard that exits early if the key is null, and (2) a value-matching branch that clears the `ido_rsn_cd_list` when the key matches the expected Japanese item identifier. No further branches are implemented — new list elements can be added by appending additional if-else-if blocks.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance String key"])
    NULL_CHECK{key is not null?}
    EQUAL_CHECK{key equals Abnormality Reason Code?}
    CLEAR["Clear ido_rsn_cd_list"]
    RETURN(["Return / End"])
    START --> NULL_CHECK
    NULL_CHECK -->|No| RETURN
    NULL_CHECK -->|Yes| EQUAL_CHECK
    EQUAL_CHECK -->|Yes| CLEAR
    CLEAR --> RETURN
    EQUAL_CHECK -->|No| RETURN
```

**CRITICAL — Constant Resolution:**
The method compares the key against the literal Japanese string `"異動理由コード"` (Reason Code for Transfer/Change). This value is not defined as a Java constant — it is an inline literal. This is a code smell that should be addressed by extracting it to a constant for maintainability.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese item name used to identify which list element to clear. Currently only `"異動理由コード"` (Reason Code for Transfer/Change) is supported. This key acts as a lookup discriminator — each branch in the method corresponds to a specific list field, and the key determines which field gets cleared. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | List of reason codes for transfer/change operations. This field stores the selectable values for the "異動理由コード" item in the customer contract continuation list screen. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - | - | Calls `clear()` on the `ido_rsn_cd_list` field, which empties the list of all reason code entries. This is a local in-memory operation on the X33 framework's typed list wrapper. |

No SC (Service Component) or CBS (Common Business Service) methods are called. The method operates entirely within the view bean's local state, using only the X33 framework's built-in `X33VDataTypeList.clear()` method. There are no database interactions, entity operations, or cross-service invocations.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `ido_rsn_cd_list.clear()` | - | - | Local in-memory clear of the transfer/change reason code list. No DB table involvement. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW01031SFBean | `KKW01031SFBean` (instantiates KKW01031SF01DBean at L97; uses it for data type bean refresh patterns at L1137, L1172, L1177, L1183) | `ido_rsn_cd_list.clear() [local]` |

**Notes on callers:**
- The method is declared on `KKW01031SF01DBean` and the `KKW01031SFBean` class instantiates it as a data type bean (`tmpBean`). The X33 framework's data type bean refresh mechanism is the primary caller — when the view layer needs to rebind or refresh the list data, it calls `clearListDataInstance()` with the appropriate item key.
- The bean implements `X33VListedBeanInterface` and `X33VDataTypeBeanInterface`, meaning it participates in the X33 framework's automatic list/data binding lifecycle. Calls to `clearListDataInstance` occur as part of this framework-managed lifecycle.
- No explicit direct method calls from other application code were found in the search results. The method is designed to be called by the X33 framework or by other bean classes that hold a reference to this data bean.

## 6. Per-Branch Detail Blocks

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

> Null-safety guard: if the key parameter is null, exit early to avoid a NullPointerException on the subsequent equals() call.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if (key != null)` // Null guard against NPE [-> No constant] |

**Block 1.1** — [IF-ELSE-IF] `(key.equals("異動理由コード"))` `(L661)`

> Matches against the literal Japanese item name for the "Reason Code for Transfer/Change" list element. When matched, clears the corresponding list data.
> The literal `"異動理由コード"` (Reason Code for Transfer/Change) is used directly without a named constant — this should be extracted to a constant for maintainability.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if (key.equals("異動理由コード"))` // Item name match [Literal: "異動理由コード" = Reason Code for Transfer/Change] |
| 2 | EXEC | `ido_rsn_cd_list.clear();` // Clear the transfer/change reason code list [X33VDataTypeList.clear] |

**Block 1.1.1** — [Implicit else — no action] `(L661)`

> If the key is not null but does not match `"異動理由コード"`, the method returns without performing any action. No code is emitted for this branch.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd_list` | Field | Transfer/change reason code list — stores the set of selectable codes that explain why a service item was modified, transferred, or changed. The "ido" prefix abbreviates 異動 (idō), meaning transfer/change/move in a service contract context. |
| `X33VDataTypeList` | Class | X33 framework typed list wrapper — a framework-provided collection type that supports data binding, type safety, and view refresh notification in the X33 web framework. |
| KKW01031SF | Module | Screen module for customer contract continuation list operations — the SF suffix typically denotes a screen (screen form) module in this codebase. |
| DBean | Abbreviation | Data Bean — a view-layer bean class that implements X33 data binding interfaces for carrying view-specific list/element data between the presentation layer and the controller. |
| X33 | Framework | Fujitsu Futurity X33 — an enterprise Java web application framework used for building view-layer components, providing data binding, page navigation, and component lifecycle management. |
| "異動理由コード" | Japanese literal | Reason Code for Transfer/Change — the Japanese item name identifier used as the key to select which list element to clear. "異動" (idō) means transfer/change; "理由" (riyū) means reason; "コード" (kōdo) means code. |
| `cust_kei_hktgi_list` | Field | Customer contract continuation list — the list item in KKW01031SFBean that holds the customer contract continuation list data, which uses KKW01031SF01DBean as its data type bean. |
| X33VListedBeanInterface | Interface | X33 framework interface indicating this bean manages a list-type data element, enabling list-specific data binding and refresh behavior. |
| X33VDataTypeBeanInterface | Interface | X33 framework interface indicating this bean provides data type definitions for individual elements within a listed bean, enabling per-field type-safe binding. |
