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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01034SF.KKW01034SF01DBean` |
| Layer | Web View / DBean (Data Bean) — View-tier data holder |
| Module | `KKW01034SF` (Package: `eo.web.webview.KKW01034SF`) |

## 1. Role

### KKW01034SF01DBean.clearListDataInstance()

This method provides a targeted clearing mechanism for list-bound data elements held within the DBean's internal state. In the K-Opticom telecom billing and service contract system, DBeans (Data Beans) serve as view-tier containers that hold form data exchanged between JSP screens and the business logic layer. The `clearListDataInstance()` method acts as a shared utility that allows a calling screen (specifically the parent `KKW01034SFBean`, which coordinates multi-tab or multi-section data) to selectively reset individual list fields by their business key name — rather than clearing the entire bean state at once.

The method implements a **routing/dispatch pattern**: it examines the string `key` parameter to determine which internal list field to clear. Currently, it supports one specific data type: the "Move Reason Code" list (`ido_rsn_cd_list`), which tracks codes explaining why a service contract line item was moved or transferred. This method is a child override of the parent class `KKW01034SFBean.clearListDataInstance()`, extending the clearing capabilities with module-specific list fields. It has no external CRUD interactions — it is purely an in-memory state mutation utility called during screen data lifecycle management (e.g., when switching between tabs or re-rendering a section of a form).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance String key"])
    CHECK_NULL{key is not null}
    CHECK_KEY{key equals 異動理由コード}
    CLEAR["ido_rsn_cd_list.clear()"]
    END_NODE(["Return"])
    START --> CHECK_NULL
    CHECK_NULL -->|false| END_NODE
    CHECK_NULL -->|true| CHECK_KEY
    CHECK_KEY -->|true| CLEAR
    CHECK_KEY -->|false| END_NODE
    CLEAR --> END_NODE
```

**Processing Description:**

1. **Null Guard** — The method first checks whether the `key` parameter is non-null. If `key` is `null`, the method returns immediately with no side effects (a defensive no-op).
2. **Key Routing** — If `key` is non-null, the method compares it against the hardcoded business key string `"異動理由コード"` (Move Reason Code). This is a string-literal comparison (not a constant reference) that identifies the specific list field to clear.
3. **Targeted Clear** — If the key matches, the method calls `ido_rsn_cd_list.clear()`, which empties the `X33VDataTypeList` holding all move reason code entries for this DBean instance.
4. **Fallthrough** — If the key does not match (or is null), the method returns without any state change.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (project name) used to identify which list data field should be cleared. It serves as a routing key that the method matches against internal business data type names. Currently supports the value `"異動理由コード"` (Move Reason Code) which corresponds to the `ido_rsn_cd_list` field. |

**Instance Fields Read:**

| Field | Type | Usage |
|-------|------|-------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | The list field targeted for clearing when `key` matches. Contains move reason code entries (a list of objects tracking the reasons why a service contract line item was moved/transferred). |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - | - | Calls `clear()` on the `ido_rsn_cd_list` instance to remove all elements from the in-memory list. No database or remote interaction. |

This method performs **no database or remote service operations**. It is a pure in-memory state mutation that clears a list held in the DBean's local state.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | View (KKW01034SFBean) | `KKW01034SFBean` (parent) → invokes `super.clearListDataInstance(key)` → `KKW01034SF01DBean.clearListDataInstance` | No external CRUD — in-memory only |

**Notes:** The caller search for `clearListDataInstance` within the `KKW01034SF` module found only the method definition in `KKW01034SF01DBean` and its parent override in `KKW01034SFBean`. The parent class `KKW01034SFBean` delegates to `super.clearListDataInstance(key)` (which chains further up the inheritance hierarchy). The method is part of a DBean inheritance chain and is typically invoked indirectly when the parent bean clears list data for a specific item key. No direct screen or batch callers were found in this search scope.

## 6. Per-Branch Detail Blocks

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

> Null guard: prevents NPE if key is null. If null, the method exits immediately without any state change.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if (key != null)` |

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

> The method checks if the key matches the hardcoded business item name "異動理由コード" (Move Reason Code), which identifies the `ido_rsn_cd_list` field as the target. This is a string-literal comparison — no constant file reference is used for this key.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ido_rsn_cd_list.clear()` // Clears all move reason code entries from the list — no new objects created, existing list is emptied |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Move Reason Code — the code that records why a service contract line item (課目) was moved or transferred. The list holds all entries for the current form section. |
| `ido_rsn_cd_list` | Field | Move Reason Code List — an `X33VDataTypeList` (type-safe typed list) containing move reason code entries. |
| `ido_rsn_memo` | Field | Move Reason Memo — a free-text memo field associated with the move reason code. |
| 異動理由コード | Field | Japanese field label — "Move Reason Code". The business item name used as a key to identify the `ido_rsn_cd_list` DBean field. |
| DBean | Abbreviation | Data Bean — a view-tier Java bean that holds form data, implements `X33VDataTypeBeanInterface` and `X33VListedBeanInterface`, and is used to pass data between JSP screens and business logic. |
| KKW01034SF | Module | A screen module in the K-Opticom telecom billing system, likely related to service contract management (SF = Screen Flow). |
| X33VDataTypeList | Type | A type-safe list implementation from the X33 framework, used in DBeans to hold list-bound form data elements with proper type handling. |
| ANK-2755 | Ticket | A JIRA/work ticket (added 2016/08/10) that replaced the scalar `ido_rsn_cd` fields with the list-based `ido_rsn_cd_list` structure in this DBean. |
