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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00816SF.KKW00816SFBean` |
| Layer | Service Component (Webview/Bean layer — view data transfer object) |
| Module | `KKW00816SF` (Package: `eo.web.webview.KKW00816SF`) |

## 1. Role

### KKW00816SFBean.clearListDataInstance()

This method is a list-data clearing utility that resets the contents of one or more Java `List` instances held by the `KKW00816SFBean` class, based on a human-readable item name key. It acts as a centralized dispatcher that routes the clear request to the correct list field depending on which screen-specific data list is being targeted. The method supports three distinct categories of lists: (1) common-information screen lists (keys starting with `//`), which are delegated to the parent class for generic handling; (2) the "Customer Contract Succession List" (`顧客契約引継リスト`) used in the KKW00816SF01 repeating-item screen, which clears the `cust_kei_hktgi_list_list` field; and (3) the "Option Service Contract List" (`オプションサービス契約リスト`) used in the KKW00816SF02 repeating-item screen, which clears the `op_svc_kei_list_list` field. In the larger system, this method serves as a shared reset mechanism invoked at screen initialization, reset-button actions, or when transitioning between states where stale list data must be discarded before re-fetching fresh data from the service tier.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance key"])
    CHECK_NULL{key != null}
    CHECK_COMMENT{key starts with //}
    BRANCH_PARENT["super.clearListDataInstance key"]
    CHECK_FK{key equals 顧客契約引継リスト}
    CLEAR_FK["cust_kei_hktgi_list_list.clear"]
    CHECK_OS{key equals オプションサービス契約リスト}
    CLEAR_OS["op_svc_kei_list_list.clear"]
    END_NODE(["Return"])

    START --> CHECK_NULL
    CHECK_NULL -->|false| END_NODE
    CHECK_NULL -->|true| CHECK_COMMENT
    CHECK_COMMENT -->|true| BRANCH_PARENT
    BRANCH_PARENT --> END_NODE
    CHECK_COMMENT -->|false| CHECK_FK
    CHECK_FK -->|true| CLEAR_FK
    CLEAR_FK --> END_NODE
    CHECK_FK -->|false| CHECK_OS
    CHECK_OS -->|true| CLEAR_OS
    CLEAR_OS --> END_NODE
    CHECK_OS -->|false| END_NODE
```

**Branch Summary:**

| Branch | Condition | Business Action |
|--------|-----------|----------------|
| No-op | `key == null` | Return immediately; no operation performed |
| Branch 1 | `key` starts with `//` | Delegate to parent `clearListDataInstance(key)` — handles common-information screen lists in the base class |
| Branch 2 | `key == "顧客契約引継リスト"` (Customer Contract Succession List) | Clears the `cust_kei_hktgi_list_list` instance field (repeating-item list for screen KKW00816SF01) |
| Branch 3 | `key == "オプションサービス契約リスト"` (Option Service Contract List) | Clears the `op_svc_kei_list_list` instance field (repeating-item list for screen KKW00816SF02) |
| No-op | `key` is non-null but unmatched | Return immediately; no matching list found |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | Human-readable item name that identifies which data list to clear. The value determines the routing branch: keys starting with `//` indicate a common-information screen list (delegated to parent); `"顧客契約引継リスト"` targets the customer contract succession list (KKW00816SF01 repeating item, field ID: `cust_kei_hktgi_list`); `"オプションサービス契約リスト"` targets the option service contract list (KKW00816SF02 repeating item, field ID: `op_svc_kei_list`). |
| — | `cust_kei_hktgi_list_list` | `List` (instance field) | The repeating-item list for customer contract succession data, used in screen KKW00816SF01. Cleared when Branch 2 matches. |
| — | `op_svc_kei_list_list` | `List` (instance field) | The repeating-item list for option service contract data, used in screen KKW00816SF02. Cleared when Branch 3 matches. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JCCcomFileSearchUtil.clear` | JCCcomFileSearch | - | Calls `clear` in `JCCcomFileSearchUtil` (inherited via parent) |
| U | `JZMAdEdit.clear` | JZMAdEdit | - | Calls `clear` in `JZMAdEdit` (inherited via parent) |
| U | `KKA17101SFLogic.clear` | KKA17101SFLogic | - | Calls `clear` in `KKA17101SFLogic` (inherited via parent) |
| U | `KKA17401SFLogic.clear` | KKA17401SFLogic | - | Calls `clear` in `KKA17401SFLogic` (inherited via parent) |
| U | `KKA17601SFLogic.clear` | KKA17601SFLogic | - | Calls `clear` in `KKA17601SFLogic` (inherited via parent) |
| U | `KKW00816SFBean.clearListDataInstance` | KKW00816SFBean | - | Recursive/circular call to `clearListDataInstance` in `KKW00816SFBean` (inherited via parent) |
| U | `cust_kei_hktgi_list_list.clear` | - | - | Clears the customer contract succession list in local bean state |
| U | `op_svc_kei_list_list.clear` | - | - | Clears the option service contract list in local bean state |

**Classification rationale:**
- All operations are **U** (Update) / in-place clearing of Java `List` objects. No database writes, no entity creation, no SQL operations are performed. This method operates purely on in-memory bean state.
- Branch 1 delegates to `super.clearListDataInstance(key)`, which triggers a chain of `clear` calls on the parent class's own list fields (common-information screen data). These parent-level clears are not in the scope of this bean's source but are part of the inheritance chain.

## 5. Dependency Trace

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0004 (example) | `clearListDataInstance` -> `KKW00816SFBean.clearListDataInstance` | `clear [U] in-memory list (cust_kei_hktgi_list_list, op_svc_kei_list_list)` |

**Note:** The method is called by `KKW00816SFBean.clearListDataInstance()` (no-argument overload) which acts as a dispatcher to the key-based version. This no-arg variant typically clears all known lists for the current screen context by iterating over a predefined set of item name keys.

**What this method calls (call tree):**
- Branch 1: `super.clearListDataInstance(key)` — parent class dispatches to:
  - `JCCcomFileSearchUtil.clear`
  - `JZMAdEdit.clear`
  - `KKA17101SFLogic.clear`
  - `KKA17401SFLogic.clear`
  - `KKA17601SFLogic.clear`
  - `KKW00816SFBean.clearListDataInstance` (recursive via inheritance chain)
- Branch 2: `cust_kei_hktgi_list_list.clear()` — clears bean-local list
- Branch 3: `op_svc_kei_list_list.clear()` — clears bean-local list

## 6. Per-Branch Detail Blocks

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

> Guard clause: if `key` is null, skip all processing and return. This prevents `NullPointerException` on the subsequent `startsWith` / `equals` calls.

| # | Type | Code |
|---|------|------|
| 1 | SET | N/A (no assignment) |
| 2 | EXEC | `key != null` — null-check guard |
| 3 | RETURN | (implicit, if null — fall through past closing brace) |

**Block 2** — [ELSE-IF] `(key starts with "//")` [COMMON_INFO_SCREEN_KEY_PREFIX="//"] (L2439)

> (共通情報ビューンのリストの場合) — "When the key is for a common-information screen list"
> When the key string starts with `//`, this indicates a common-information screen list. The actual clearing logic is handled by the parent class, which maintains its own set of reusable list fields shared across multiple screens.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.startsWith("//")` — checks if key is a common-information screen list marker |
| 2 | CALL | `super.clearListDataInstance(key)` — delegates to parent class for list clearing |

> (共有情報ビューンリストは基底クラスで処理) — "Common-information screen list processing is done in the base class"

**Block 3** — [ELSE-IF] `(key.equals("顧客契約引継リスト"))` [FK_ITEM_NAME="顧客契約引継リスト"] (L2443)

> (データタイプが KKW00816SF01 の繰り返し指定項目"顧客契約引継リスト"(項目ID:cust_kei_hktgi_list)) — "When the data type is the repeating-item 'Customer Contract Succession List' (item ID: cust_kei_hktgi_list) of KKW00816SF01"
> Clears the customer contract succession list used in screen KKW00816SF01.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("顧客契約引継リスト")` — matches the customer contract succession list item |
| 2 | EXEC | `cust_kei_hktgi_list_list.clear()` — clears all elements from the customer contract succession list |

**Block 4** — [ELSE-IF] `(key.equals("オプションサービス契約リスト"))` [OS_ITEM_NAME="オプションサービス契約リスト"] (L2447)

> (データタイプが KKW00816SF02 の繰り返し指定項目"オプションサービス契約リスト"(項目ID:op_svc_kei_list)) — "When the data type is the repeating-item 'Option Service Contract List' (item ID: op_svc_kei_list) of KKW00816SF02"
> Clears the option service contract list used in screen KKW00816SF02.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("オプションサービス契約リスト")` — matches the option service contract list item |
| 2 | EXEC | `op_svc_kei_list_list.clear()` — clears all elements from the option service contract list |

**Block 5** — [DEFAULT / FALL-THROUGH] (L2450)

> If `key` is non-null but does not match any of the three branches (not a common-info key, not a customer contract list, not an option service contract list), the method falls through to the closing brace and returns without performing any operation. This is a safe no-op that silently ignores unknown keys.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | (implicit — method end, no return statement needed for void) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `key` | Parameter | Item name string used as a lookup key to identify which list to clear. Can be a screen-specific label or a special prefix (`//`) for common-information screens. |
| `cust_kei_hktgi_list_list` | Field | Customer contract succession list — a Java List holding repeating-item rows for customer contract handover/succession data. Used in screen KKW00816SF01. |
| `op_svc_kei_list_list` | Field | Option service contract list — a Java List holding repeating-item rows for option service contract data. Used in screen KKW00816SF02. |
| `//` | Constant | Common-information screen list key prefix — a naming convention where keys starting with `//` indicate shared/common data lists handled by the parent class. |
| 顧客契約引継リスト | Field | Customer Contract Succession List — the repeating-item list name for customer contract succession (contract handover) data. |
| オプションサービス契約リスト | Field | Option Service Contract List — the repeating-item list name for option service contract data. |
| KKW00816SF01 | Screen | Screen variant for customer contract succession processing (KKW00816SF series, item variant 01). |
| KKW00816SF02 | Screen | Screen variant for option service contract processing (KKW00816SF series, item variant 02). |
| 共通情報ビューン | Term | Common-information screen — a shared view/screen category where list data is managed by the parent/base class rather than individual screen beans. |
| 繰り返し指定項目 | Term | Repeating item — a UI construct that renders a repeatable table/row group, allowing multiple entries of the same data structure (e.g., multiple service contract lines). |
| KKW00816SFBean | Class | Screen bean class for the KKW00816SF screen module — holds view-layer data (lists, forms, flags) between the view page and controller logic. |
| X33SException | Exception | Framework exception type thrown by this method's signature, indicating a screen-layer or business-layer error condition. |
