# Business Logic — KKW05501SF03DBean.clearListDataInstance() [18 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW05501SF.KKW05501SF03DBean` |
| Layer | View / Data Bean (webview layer, extends X33VViewBaseBean) |
| Module | `KKW05501SF` (Package: `eo.web.webview.KKW05501SF`) |

## 1. Role

### KKW05501SF03DBean.clearListDataInstance()

This method provides row-level clearing of list-bound UI data within the KKW05501SF (Hikidashi / Retrieval screen data bean). It is the central dispatch mechanism for selectively clearing individual list fields without wiping the entire bean state. When a screen operation requires resetting a single row's worth of data for a specific field — such as a move reason code, an option service contract number, or a simultaneous application service contract number — this method is invoked to clear only the relevant list container while leaving all other fields intact.

The method implements a **key-based dispatch pattern**: it receives a Japanese label string as the key, compares it against a hardcoded set of field identifiers, and clears the corresponding `X33VDataTypeList` instance. It is not a CRUD operation against any database or service component; rather, it is a pure **in-memory data manipulation** utility within the view bean layer.

Because the key values are Japanese display labels (not internal field IDs), this method is intended to be called from the presentation tier where the screen's column labels are available. The null-safety guard (checking `key != null` before comparing) allows the method to be called safely in scenarios where the calling code has not yet determined which field to clear. The method has no external side effects — it does not invoke services, write to a database, or trigger notifications. Its sole responsibility is to reset a single list data instance to an empty state.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["clearListDataInstance"])
    COND_NULL["key is null?"]
    DISCARD(["Discard key and return"])
    COND_EQ1["key equals<br/>異動理由コード<br/>(Move reason code)?"]
    CLEAR1["hktgi_ido_rsn_cd_list.clear()"]
    COND_EQ2["key equals<br/>オプションサービス契約番号<br/>(Option service contract number)?"]
    CLEAR2["hktgi_op_svc_kei_no_list.clear()"]
    COND_EQ3["key equals<br/>同時申請サービス契約番号<br/>(Simultaneous application service contract number)?"]
    CLEAR3["hktgi_mskm_svc_kei_no_list.clear()"]
    ELSE_BRANCH["No match - discard key and return"]
    END_NODE(["Return / Next"])

    START --> COND_NULL
    COND_NULL -->|null| DISCARD
    DISCARD --> END_NODE
    COND_NULL -->|not null| COND_EQ1
    COND_EQ1 -->|true| CLEAR1
    COND_EQ1 -->|false| COND_EQ2
    CLEAR1 --> END_NODE
    COND_EQ2 -->|true| CLEAR2
    COND_EQ2 -->|false| COND_EQ3
    CLEAR2 --> END_NODE
    COND_EQ3 -->|true| CLEAR3
    CLEAR3 --> END_NODE
    COND_EQ3 -->|false| ELSE_BRANCH
    ELSE_BRANCH --> END_NODE
```

**Processing Flow:**

1. **Null Guard** — The method first checks whether the `key` parameter is null. If null, it discards the call and returns immediately (no-op).

2. **Branch 1 — Move Reason Code** — If `key` equals the Japanese string "異動理由コード" (Move Reason Code), the method calls `clear()` on `hktgi_ido_rsn_cd_list`, an `X33VDataTypeList` that holds move/reason code data for a retrieved list row.

3. **Branch 2 — Option Service Contract Number** — If `key` equals "オプションサービス契約番号" (Option Service Contract Number), the method calls `clear()` on `hktgi_op_svc_kei_no_list`, an `X33VDataTypeList` that stores option service contract numbers.

4. **Branch 3 — Simultaneous Application Service Contract Number** — If `key` equals "同時申請サービス契約番号" (Simultaneous Application Service Contract Number), the method calls `clear()` on `hktgi_mskm_svc_kei_no_list`, an `X33VDataTypeList` for simultaneous application service contracts.

5. **No Match** — If the key does not match any of the three known field labels, the method discards the call and returns (no-op). No exception is thrown.

**Conditional Branch Summary:**

| Branch | Condition | Action | Business Meaning |
|--------|-----------|--------|------------------|
| Null Guard | `key == null` | Return immediately | Safety: skip if no key provided |
| Branch 1 | `key.equals("異動理由コード")` | `hktgi_ido_rsn_cd_list.clear()` | Clear the move reason code row |
| Branch 2 | `key.equals("オプションサービス契約番号")` | `hktgi_op_svc_kei_no_list.clear()` | Clear the option service contract number row |
| Branch 3 | `key.equals("同時申請サービス契約番号")` | `hktgi_mskm_svc_kei_no_list.clear()` | Clear the simultaneous application service contract number row |
| No Match | None of the above | Return immediately | Unknown key — ignore silently |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The Japanese display label of the list field whose data instance should be cleared. This string acts as a **field selector** — it matches against hardcoded Japanese column labels to determine which `X33VDataTypeList` to clear. Valid values are: `"異動理由コード"` (Move Reason Code), `"オプションサービス契約番号"` (Option Service Contract Number), or `"同時申請サービス契約番号"` (Simultaneous Application Service Contract Number). If the value is null or does not match any known label, the method performs a no-op. |
| — | `hktgi_ido_rsn_cd_list` | `X33VDataTypeList` | (Instance field) Holds move reason code data for a list row. Each element is an `X33VDataTypeStringBean` containing a string reason code. Cleared when key matches "異動理由コード". |
| — | `hktgi_op_svc_kei_no_list` | `X33VDataTypeList` | (Instance field) Holds option service contract numbers for a list row. Each element is an `X33VDataTypeStringBean`. Cleared when key matches "オプションサービス契約番号". |
| — | `hktgi_mskm_svc_kei_no_list` | `X33VDataTypeList` | (Instance field) Holds simultaneous application service contract numbers for a list row. Each element is an `X33VDataTypeStringBean`. Cleared when key matches "同時申請サービス契約番号". |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X33VDataTypeList.clear` | - | - (In-memory list) | Calls `clear()` on `X33VDataTypeList` — empties the list in memory; no database interaction. |

This method performs **no database operations** and calls **no service components (SC/CBS)**. It operates exclusively on in-memory `X33VDataTypeList` collections that are part of the bean's own state. The `clear()` method on `X33VDataTypeList` is a standard collection operation that removes all elements from the list without persisting or querying any data.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:FUW00901SF | `FUW00901SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 2 | Screen:FUW00902SF | `FUW00902SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 3 | Screen:FUW00903SF | `FUW00903SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 4 | Screen:FUW00907SF | `FUW00907SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 5 | Screen:FUW00908SF | `FUW00908SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 6 | Screen:FUW00909SF | `FUW00909SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 7 | Screen:FUW00912SF | `FUW00912SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 8 | Screen:FUW00913SF | `FUW00913SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 9 | Screen:FUW00914SF | `FUW00914SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 10 | Screen:FUW00915SF | `FUW00915SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 11 | Screen:FUW00916SF | `FUW00916SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 12 | Screen:FUW00917SF | `FUW00917SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 13 | Screen:FUW00918SF | `FUW00918SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 14 | Screen:FUW00919SF | `FUW00919SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |
| 15 | Screen:FUW00921SF | `FUW00921SFBean.clearListDataInstance(key)` → `super.clearListDataInstance(key)` → `KKW05501SF03DBean.clearListDataInstance(key)` | N/A (in-memory only) |

**Notes:**
- All callers are **Screen beans** (matching `FUW009*SF` pattern) in the `koptWebR` package.
- The calling pattern is consistent: each subclass overrides `clearListDataInstance(String)` and invokes `super.clearListDataInstance(key)` to delegate to this base implementation, likely adding its own subclass-specific clearing logic before or after the base call.
- Direct invocations of `KKW05501SF03DBean.clearListDataInstance()` (without `super` chaining) were not found in the codebase — the method is accessed through the inheritance chain.
- No external entry points (Controllers, CBS, Batches) were identified as direct callers.

## 6. Per-Branch Detail Blocks

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

> Guard clause: if key is null, skip all processing and return immediately.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key != null)` // null safety guard — skip if key is null [L1414-L1427] |

---

**Block 1.1** — IF (field selector — move reason code) `(key.equals("異動理由コード"))` (L1416)

> When key matches the Japanese label for "Move Reason Code" (項目ID: hktgi_ido_rsn_cd), clear the corresponding list data instance.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (key.equals("異動理由コード"))` // 配置項目 "異動理由コード" (String型, 項目ID:hktgi_ido_rsn_cd) [L1416] |
| 2 | CALL | `hktgi_ido_rsn_cd_list.clear()` // Clear the move reason code list [L1417] |

---

**Block 1.2** — ELSE-IF (field selector — option service contract number) `(key.equals("オプションサービス契約番号"))` (L1419)

> When key matches the Japanese label for "Option Service Contract Number" (項目ID: hktgi_op_svc_kei_no), clear the corresponding list data instance.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `else if (key.equals("オプションサービス契約番号"))` // 配置項目 "オプションサービス契約番号" (String型, 項目ID:hktgi_op_svc_kei_no) [L1419] |
| 2 | CALL | `hktgi_op_svc_kei_no_list.clear()` // Clear the option service contract number list [L1420] |

---

**Block 1.3** — ELSE-IF (field selector — simultaneous application service contract number) `(key.equals("同時申請サービス契約番号"))` (L1422)

> When key matches the Japanese label for "Simultaneous Application Service Contract Number" (項目ID: hktgi_mskm_svc_kei_no), clear the corresponding list data instance.

| # | Type | Code |
|---|------|------|
| 1 | ELSE_IF | `else if (key.equals("同時申請サービス契約番号"))` // 配置項目 "同時申請サービス契約番号" (String型, 項目ID:hktgi_mskm_svc_kei_no) [L1422] |
| 2 | CALL | `hktgi_mskm_svc_kei_no_list.clear()` // Clear the simultaneous application service contract number list [L1423] |

---

**Block 1.4** — ELSE-ELSE (no match, implicit fall-through)

> If the key does not match any of the three known field labels, the method implicitly falls through and returns without any action. No explicit else clause is present.

| # | Type | Code |
|---|------|------|
| 1 | FALLTHROUGH | No matching branch — implicit no-op return [L1425] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hktgi_ido_rsn_cd` | Field | Hikidashi Idou Reason Code — a string field storing the reason code for a move/change in a retrieved list row. "Hikidashi" means retrieval/display, "idou" means move/transfer, "rsn" is abbreviation for reason, "cd" for code. |
| `hktgi_op_svc_kei_no` | Field | Hikidashi Option Service Keiyaku Number — the contract number of an optional service associated with a retrieved service line item. "Op" = option, "svc" = service, "kei" = keiyaku (contract), "no" = number. |
| `hktgi_mskm_svc_kei_no` | Field | Hikidashi Moushikomi Service Keiyaku Number — the contract number of a service applied for simultaneously with another service in the same batch request. "Mskm" = moushikomi (application/submission). |
| X33VDataTypeList | Class | A framework-provided list bean from the Fujitsu Futurity X33 web framework. A typed collection that holds elements of a specific data type (e.g., String, Boolean, Long). Cleared via `clear()` to remove all elements from the list. |
| X33VDataTypeStringBean | Class | A framework wrapper around a `String` value within the X33 framework. Each element in the `X33VDataTypeList` is a `X33VDataTypeStringBean` containing a single string value. |
| DBean | Suffix | Data Bean — a Java class that holds UI-bound data for a web screen. Implements `Serializable` and framework-specific interfaces (`X33VDataTypeBeanInterface`, `X33VListedBeanInterface`). |
| 異動理由コード | Japanese string | "Move Reason Code" — the Japanese display label for the column that stores reason codes for moves/changes in the retrieval screen. |
| オプションサービス契約番号 | Japanese string | "Option Service Contract Number" — the Japanese display label for the column that stores optional service contract numbers. |
| 同時申請サービス契約番号 | Japanese string | "Simultaneous Application Service Contract Number" — the Japanese display label for the column that stores contract numbers for services applied for simultaneously. |
| FUW009*SF | Module | Hikidashi (Retrieval) Screen Family — a family of retrieval/search screens in the koptWebR module. These screen beans extend `KKW05501SF03DBean` via `super.clearListDataInstance()` to inherit its list-clearing behavior. |
