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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA15101SF.KKW01030SF01DBean` |
| Layer | View / Data Bean (Web UI Data Holder) |
| Module | `KKA15101SF` (Package: `eo.web.webview.KKA15101SF`) |

## 1. Role

### KKW01030SF01DBean.clearListDataInstance()

This method is a data-bean lifecycle utility that clears the contents of a list-typed UI field identified by the caller-supplied `key` parameter. It is invoked by the X33 web framework (which implements `X33VListedBeanInterface`) during page lifecycle events such as scroll-to-load, row deletion, or screen reset — whenever the framework needs to wipe the current contents of a repeatable list control without resetting the entire bean. In the context of the K-Opticom telecommunications service contract management system, this is part of the "service detail modification" screen (`KKA15101SF`), where end-users interact with lists of contract-related data including status-change reason codes for service items. The method implements a targeted-clear pattern: rather than discarding the entire bean, it selectively empties only the specific list collection whose display key matches the provided identifier. This particular subclass overrides the parent bean's implementation to handle a single dedicated list — the status-change-reason-code list (`ido_rsn_cd_list`) — which stores the reasons why a service item's status was modified (e.g., suspension, cancellation, or change of service type).

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> COND_NULL{key is null}

    COND_NULL -- false --> COND_MATCH{key equals異動理由コード}

    COND_MATCH -- false --> END_RETURN(["Return"])
    COND_MATCH -- true --> CLEAR["ido_rsn_cd_list.clear()"]
    CLEAR --> END_RETURN
    COND_NULL -- true --> END_RETURN
```

**Processing description:**

1. **Null check on key**: The method first verifies that the `key` parameter is not null. If `key` is null, the method returns immediately without performing any operation (defensive programming — the X33 framework should never pass null, but this guards against unexpected calls).

2. **Display key match**: If `key` is non-null, the method checks whether the key matches the display label for the "Status Change Reason Code" list item. In the Japanese UI, this display label is the literal string `"異動理由コード"`, which translates to "Status Change Reason Code". This is the only list handled by this subclass; the parent class `KKW01030SFBean` handles the other lists.

3. **Clear list contents**: When the key matches, the method calls `clear()` on the `ido_rsn_cd_list` field, which is an `X33VDataTypeList` instance. This empties all elements from the list, effectively resetting the status-change reason code data for the current screen state. The X33 framework will then rebuild the list (or display it as empty) on the next render cycle.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The display key (label) of the list field to clear. It carries the human-readable display name of a repeatable list item as defined in the screen's UI configuration. The only value this method recognizes is `"異動理由コード"` (Status Change Reason Code — the label for the list that stores reasons why a service item's status was changed). An empty string, null, or any unrecognized value causes the method to return without effect. |
| 2 | `ido_rsn_cd_list` | `X33VDataTypeList` | (Instance field read/cleared) The list holding status-change reason code entries. Each element represents a reason code string associated with a service item that has had its status modified. This field is initialized in the constructor and cleared when the framework signals that the list data needs to be refreshed (e.g., during scroll-based pagination reload or screen reset). |
| 3 | `index` | `int` | (Instance field present but NOT used in this method) The zero-based row index of the selected list entry. Referenced in the parent bean's `removeListDataInstance()` method for index-specific removal, but not referenced by `clearListDataInstance()`. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - | - | Calls `clear()` on the `X33VDataTypeList` to empty all elements. This is a local in-memory collection operation, not a database or service call. |

**Note:** This method performs **no** database operations, no service component (SC) calls, and no business logic dispatching. It is a pure view-layer data-mutation utility that operates solely on the X33 framework's in-memory list data type. The X33 framework manages the persistence of `X33VDataTypeList` contents across AJAX partial updates automatically.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0229 | `X33VListedBeanInterface.clearListDataInstance(key)` (framework) -> `KKW01030SFBean.clearListDataInstance()` -> `KKW01030SF01DBean.clearListDataInstance()` | Local clear: `ido_rsn_cd_list` |
| 2 | Screen:KKSV0240 | `X33VListedBeanInterface.clearListDataInstance(key)` (framework) -> `KKW01030SFBean.clearListDataInstance()` -> `KKW01030SF01DBean.clearListDataInstance()` | Local clear: `ido_rsn_cd_list` |

**Call chain details:**
- The X33 Futurity framework invokes `clearListDataInstance()` on the `X33VListedBeanInterface` as part of its page lifecycle management. This happens when the user performs actions that require refreshing list data on the view layer — such as scrolling to load more rows in a paginated list, or when the screen is reset.
- The `KKW01030SFBean` (parent) receives the framework call and routes the dispatch via its own `clearListDataInstance()` method using an if/else chain on the display key. For the key `"異動理由コード"`, the parent delegates to `KKW01030SF01DBean` (via the list type mapping) where this subclass implementation executes.
- Related screens KKSV0229 and KKSV0240 are the "Service Detail Modification" and "Service Detail Modification (Campaign)" screens respectively, which share the same data bean hierarchy under the `KKA15101SF` module.

## 6. Per-Branch Detail Blocks

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

> Defensive null check. If the framework passes null (which should not happen under normal X33 operation), the method exits early to prevent `NullPointerException`.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | EXEC | `key != null` | Guard against null key parameter |
| 2 | RETURN | (implicit) | No-op: return immediately when key is null |

**Block 2** — IF / ELSE-IF / ELSE `(key.equals("異動理由コード"))` (L660)

> Branch on display-key match. The string literal `"異動理由コード"` is the Japanese UI label for the "Status Change Reason Code" list item. This is the only branch in this subclass implementation — all other list types are handled by the parent bean `KKW01030SFBean`.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | EXEC | `key.equals("異動理由コード")` | [-> `KEY_ISIDO_GUYI_RIYUU` = "異動理由コード"] Match against status-change-reason-code list display key |
| 2 | CALL | `ido_rsn_cd_list.clear()` | Clear all elements from the in-memory list of status-change reason codes. This resets the list so the X33 framework can repopulate it on the next render (e.g., after a server-side data refresh or pagination reload). |

**Block 2.1** — ELSE (implicit) `(L660 — fall-through)`

> When the key does not match `"異動理由コード"`, the method reaches the closing braces and returns without effect. Other key values (e.g., `"顧客契約引継リスト"`, `"契約番号リスト"`, `"キャンペーン一覧"`) are handled by the parent `KKW01030SFBean.clearListDataInstance()` method, which contains additional if/else branches for those list types.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | RETURN | (implicit) | No-op: key did not match any handled list type in this subclass. Parent bean handles other keys. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Status Change Reason Code — the code indicating why a service item's status was modified (e.g., suspended, cancelled, changed). Stored in `X33VDataTypeList` on the view bean. |
| `ido_rsn_cd_list` | Field | Status Change Reason Code List — the in-memory list collection holding all reason-code entries for the current screen's service items. Display key: "異動理由コード". |
| `ido_div` | Field | Status Change Classification — categorizes the type of status change applied to a service item. |
| `ido_rsn_memo` | Field | Status Change Memo — free-text field for additional notes on why a status change was made. |
| `異動理由コード` | Japanese UI label | Status Change Reason Code — the display name (label) of the list field in the Japanese UI. Used as the matching key in this method. |
| `KKA15101SF` | Module | Service Detail Modification screen module — the X33 screen for modifying service item details in the K-Opticom customer management system. |
| `KKW01030SF01DBean` | Class | Service Detail Modification Data Bean — the view-layer data holder for the first (primary) data table of the KKW01030SF screen. Holds status-change-related list data. |
| `X33VListedBeanInterface` | Framework Interface | Fujitsu Futurity X33 framework interface for beans that contain repeatable list data. Provides methods like `clearListDataInstance()`, `removeListDataInstance()`, and `typeModelData()` for framework lifecycle management. |
| `X33VDataTypeList` | Framework Class | X33 framework class representing a typed list data structure on the view bean. Supports string elements, manages data binding between server and AJAX-updated client-side lists. |
| `KKSV0229` | Screen | Service Detail Modification screen — main screen for editing service item details including status changes and their reasons. |
| `KKSV0240` | Screen | Service Detail Modification (Campaign) screen — variant of KKSV0229 with campaign-related fields and logic. Shares the same data bean hierarchy. |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband internet service. A core service type in the K-Opticom telecom product catalog. |
| K-Opticom | Business term | Japanese telecommunications carrier providing fiber-optic broadband, mobile, and VoIP services. Internal system name for the customer management platform. |
| SC Code | Technical abbreviation | Service Component Code — a naming convention for service layer components (e.g., `EKK0361A010SC`) that encapsulate business logic and data access. Not used in this method. |
| `X33SException` | Exception Class | X33 framework-checked exception type thrown for view-layer processing errors. Declared in the method signature but not thrown in the current implementation. |
