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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SF01DBean` |
| Layer | View / Screen Bean (Detail Bean) — part of the X33V framework's view-layer data binding components |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`)

## 1. Role

### KKW00816SF01DBean.clearListDataInstance()

This method is a **list data clearing utility** within the K-Opticom web application's view-layer bean architecture. Its business purpose is to selectively clear the contents of a specific list-type data field on the screen by matching a human-readable item label against a known constant.

The method implements a **routing/dispatch pattern**: it accepts a single string parameter representing a Japanese field name (項目名), compares it against predefined item identifiers, and dispatches the appropriate `clear()` operation on the matching `X33VDataTypeList` field. In this implementation, only one list type — the mutation reason code list (`ido_rsn_cd_list`) — is registered for clearing.

Within the larger K-Opticom system, this method serves as a **shared view-model maintenance routine**. The bean class `KKW00816SF01DBean` is a Detail Bean (DBean) used in the KKW00816SF screen module, which handles **service contract mutation / change order processing** (変更命令処理). The mutation reason code list holds a collection of reason codes selected by users during a service mutation workflow. When the screen needs to reset this list — for example, when the user navigates away, cancels an operation, or reinitializes the form — this method provides the mechanism to wipe the selected items.

Multiple downstream screen beans in other modules (FUW009xxSF family) inherit from this base class and either override `clearListDataInstance()` to add their own clearing logic, or delegate to `super.clearListDataInstance(key)` to retain this behavior.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance String key"])

    START --> CHK_NULL{key is null}

    CHK_NULL -->|null| END_NODE(["Return"])
    CHK_NULL -->|not null| CHK_KEY{key equals mutation reason code}

    CHK_KEY -->|match| CLEAR["ido_rsn_cd_list.clear"]
    CHK_KEY -->|no match| END_NODE
    CLEAR --> END_NODE
```

**Conditional branches:**

| Branch | Condition | Business Meaning |
|--------|-----------|-----------------|
| 1 | `key == null` | No item label provided — method exits immediately, safe no-op |
| 2 | `key.equals("変動理由コード")` | The key matches the mutation reason code item label — clears the `ido_rsn_cd_list` |
| 3 | `key` does not match any registered label | The key refers to a field not registered for clearing — method exits silently |

**CRITICAL — Constant Resolution:**

The condition `key.equals("変動理由コード")` uses a hardcoded Japanese string rather than a constant. This string translates to **"Mutation Reason Code"** — it is the human-readable display label for the field whose internal identifier is `ido_rsn_cd`. The constant `IDO_RSN_CD` (defined across multiple constant classes such as `JKKPauseChgRsvClConstCC` and `JKKChkBmpInfChgConstCC` as `"ido_rsn_cd"`) represents the parameter key used in API requests, while `"変動理由コード"` is the UI-facing display label used in this view-layer method.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The human-readable Japanese display label of a screen item field. Used as a dispatch key to identify which list-type field should be cleared. In this method, the only supported value is `"変動理由コード"` (Mutation Reason Code), which is the UI label for the mutation reason code selection list. If `null`, the method returns immediately as a defensive no-op. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | The mutable list holding reason code entries (each entry is an `X33VDataTypeStringBean` with a `value` string) for the mutation reason code selection field on the service mutation screen. Initialized as a new empty list in the constructor. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - | - | Clears all elements in the in-memory list (`ido_rsn_cd_list`). No database operation — this is a pure view-model reset. |

**Notes:**
- This method performs **no create, read, update, or delete operations** against any database or external service.
- It operates solely on **in-memory view state** — the `X33VDataTypeList` that backs a screen component.
- The `X33VDataTypeList.clear()` call is a framework-level list clearing operation from the X33 web framework, not a business-service call.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00816SF01 (KKW00816SFBean) | `KKW00816SFBean.clearListDataInstance` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 2 | Screen:FUW00912SFBean | `FUW00912SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 3 | Screen:FUW00926SFBean | `FUW00926SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 4 | Screen:FUW00959SFBean | `FUW00959SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 5 | Screen:FUW00964SFBean | `FUW00964SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 6 | Screen:FUW00927SFBean | `FUW00927SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 7 | Screen:FUW00901SFBean | `FUW00901SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 8 | Screen:FUW00919SFBean | `FUW00919SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 9 | Screen:FUW00931SFBean | `FUW00931SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 10 | Screen:FUW00917SFBean | `FUW00917SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 11 | Screen:FUW00907SFBean | `FUW00907SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 12 | Screen:FUW00957SFBean | `FUW00957SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 13 | Screen:FUW00961SFBean | `FUW00961SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 14 | Screen:FUW00947SFBean | `FUW00947SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |
| 15 | Screen:FUW00946SFBean | `FUW00946SFBean.clearListDataInstance` -> `super.clearListDataInstance(key)` -> `KKW00816SF01DBean.clearListDataInstance` | `ido_rsn_cd_list.clear [no DB]` |

**Notes:**
- The `KKW00816SF01DBean` class is a **base/detail bean** that is extended by other screen beans in the FUW009xxSF module family.
- These downstream beans call `super.clearListDataInstance(key)` to inherit the parent's list-clearing behavior.
- Direct callers within the KKW00816SF module exist in `KKW00816SFBean`, which overrides the method and delegates to `super.clearListDataInstance(key)`.
- Some subclasses (e.g., `FUW00912SF01DBean`, `FUW00964SF10DBean`) provide their own implementations without calling `super`, meaning they do **not** inherit this clearing behavior.

## 6. Per-Branch Detail Blocks

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

> Defensive null-check: prevents NullPointerException if the caller passes a null key. This is a common pattern in X33 view beans where the framework or calling code may invoke this method with an unset parameter.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if(key != null)` // Null guard — skip clearing if no item label provided |

**Block 1.1** — [IF] `(key.equals("変動理由コード"))` (L543)

> Conditional dispatch: matches the Japanese display label "変動理由コード" (Mutation Reason Code) against the incoming key. If the key matches, this branch clears the associated reason code list. This is the only registered item type in the current implementation. The constant `IDO_RSN_CD` = `"ido_rsn_cd"` is the internal parameter key, while `"変動理由コード"` is the user-facing label.

| # | Type | Code |
|---|------|------|
| 1 | COND | `if(key.equals("変動理由コード"))` // [変動理由コード = "Mutation Reason Code", the Japanese display label for the ido_rsn_cd field] |
| 2 | EXEC | `ido_rsn_cd_list.clear()` // [IDO_RSN_CD = "ido_rsn_cd"] Clears all reason code entries from the mutation reason code list |

**Block 2** — [ELSE/DEFAULT] `key` does not match any registered label (implicit) (L538–547)

> If the key is null or does not equal `"変動理由コード"`, the method returns without performing any operation. No error is thrown — unmatched keys are silently ignored. This design allows callers to pass a key unconditionally without needing to pre-validate it against a whitelist.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // implicit return — no action taken for null or unrecognized keys |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Mutation Reason Code — the internal parameter key for the reason code field used in service mutation/change order workflows |
| `ido_rsn_cd_list` | Field | Mutation Reason Code List — the in-memory list holding selected reason code entries, each stored as an `X33VDataTypeStringBean` |
| "変動理由コード" | Label | Mutation Reason Code — the Japanese UI display label for the mutation reason code field; used as the dispatch key in this method |
| DBean | Technical | Detail Bean — an X33 framework bean class that holds detailed/complex view data for a single screen component, implementing `X33VDataTypeBeanInterface` |
| X33V | Framework | Fujitsu's X33 web framework (View layer) — the enterprise Java web application framework used to build K-Opticom's customer-facing screens |
| X33VDataTypeList | Framework Type | A typed list container in the X33V framework that holds elements of a specific data type; used here to manage a collection of mutation reason codes |
| X33SException | Framework Type | X33 Service Exception — the checked exception type thrown by framework methods for service-layer errors |
| KKW00816SF | Module | K-Opticom Screen Module for service mutation / change order processing — the K-Opticom customer web portal screen for handling service contract modifications |
| Mutation (変動) | Business term | A service contract change or mutation — in the K-Opticom domain, this refers to any modification of an existing service contract (e.g., adding features, changing plans, suspending service) |
