# Business Logic — KKW01601SF03DBean.removeElementFromListData() [27 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA15301SF.KKW01601SF03DBean` |
| Layer | View / Bean (Web Client Data Binding Layer) |
| Module | `KKA15301SF` (Package: `eo.web.webview.KKA15301SF`) |

## 1. Role

### KKW01601SF03DBean.removeElementFromListData()

This method provides a unified, key-driven mechanism for removing an element at a specified index from one of several internal list data structures used in the service contract transfer (異動, "idou") screen. It implements a dispatch-by-key routing pattern: the `key` parameter acts as a business discriminator that maps a human-readable label to a specific typed list field on the bean, allowing callers to remove items from different data collections without needing to know which list they are operating on. The method handles three distinct business data categories — Transfer Reason Code (異動理由コード), Option Service Contract Number (オプションサービス契約番号), and Simultaneous Application Service Contract Number (同時申込サービス契約番号) — each representing a different aspect of a telecom service contract transfer operation. This is a shared utility method within the View/Bean layer, acting as a declarative data-mutation interface. It performs purely in-memory list mutation with no external service calls, database access, or persistence operations. Its role is to enable screen controllers to synchronize list state changes (e.g., when a user deletes a row from a grid) with the underlying bean's data model, ensuring that the view layer remains consistent with user actions.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData key, index"])
    CHECK_NULL["key not null ?"]

    START --> CHECK_NULL

    CHECK_NULL -->|No| END_EXIT(["Return / Exit"])

    CHECK_NULL -->|Yes| DIAMOND1{"key matches"}

    DIAMOND1 -->|Transfer Reason Code| BRANCH1["hktgi_ido_rsn_cd_list.remove index"]
    DIAMOND1 -->|Option Service Contract No| BRANCH2["hktgi_op_svc_kei_no_list.remove index"]
    DIAMOND1 -->|Simultaneous App Contract No| BRANCH3["hktgi_mskm_svc_kei_no_list.remove index"]
    DIAMOND1 -->|No match| NOOP["No operation"]

    BRANCH1 --> BOUND1["index >= 0 AND index < list.size() ?"]
    BRANCH2 --> BOUND2["index >= 0 AND index < list.size() ?"]
    BRANCH3 --> BOUND3["index >= 0 AND index < list.size() ?"]
    NOOP --> END_EXIT

    BOUND1 -->|Yes| REMOVE1["Remove element at index from hktgi_ido_rsn_cd_list"]
    BOUND1 -->|No| SKIP1["Out of range - skip"]
    BOUND2 -->|Yes| REMOVE2["Remove element at index from hktgi_op_svc_kei_no_list"]
    BOUND2 -->|No| SKIP2["Out of range - skip"]
    BOUND3 -->|Yes| REMOVE3["Remove element at index from hktgi_mskm_svc_kei_no_list"]
    BOUND3 -->|No| SKIP3["Out of range - skip"]

    REMOVE1 --> END_EXIT
    SKIP1 --> END_EXIT
    REMOVE2 --> END_EXIT
    SKIP2 --> END_EXIT
    REMOVE3 --> END_EXIT
    SKIP3 --> END_EXIT
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | A human-readable display label that identifies which internal list to operate on. It acts as a business discriminator mapping a user-facing label to a specific list field. Valid values are: "異動理由コード" (Transfer Reason Code), "オプションサービス契約番号" (Option Service Contract No.), and "同時申込サービス契約番号" (Simultaneous Application Service Contract No.). |
| 2 | `index` | `int` | The zero-based position within the target list from which to remove the element. Must be within [0, list.size()-1] for removal to occur. If the index is out of bounds, the removal is silently skipped. |

**Instance fields / external state read:**
| # | Field | Type | Business Description |
|---|-------|------|---------------------|
| 1 | `hktgi_ido_rsn_cd_list` | `X33VDataTypeList` | List of transfer reason codes — codes explaining why a service contract was transferred or modified |
| 2 | `hktgi_op_svc_kei_no_list` | `X33VDataTypeList` | List of option service contract numbers — IDs for optional add-on service contracts |
| 3 | `hktgi_mskm_svc_kei_no_list` | `X33VDataTypeList` | List of simultaneous application service contract numbers — IDs for services applied for concurrently with the main contract |

## 4. CRUD Operations / Called Services

This method performs purely in-memory list mutation. There are no external service calls, database operations, or persistent state changes.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `X33VDataTypeList.remove(int)` | N/A | N/A (in-memory list) | Removes an element at the given index from the target `X33VDataTypeList`, mutates the list in place |

## 5. Dependency Trace

This method is defined in `KKW01601SF03DBean` and is overridden by subclasses in the same package hierarchy. No other classes call this specific `KKW01601SF03DBean` version directly — instead, callers invoke the method polymorphically through the parent `KKW01601SFBean` class, which delegates via `super.removeElementFromListData(key, index)` to the subclass implementation.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean:KKW01601SF01DBean | `KKW01601SF01DBean.removeElementFromListData(key, index)` [overrides; handles different key strings: "初期設定コード", "コードタイプコード値リスト"] | `list.remove(index) [U] in-memory list` |
| 2 | Bean:KKW01601SFBean | `KKW01601SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` -> `KKW01601SF03DBean.removeElementFromListData(key, index)` | `list.remove(index) [U] in-memory list` |

**Notes:**
- `KKW01601SF01DBean` (another subclass) has its own override of `removeElementFromListData` handling different key strings ("初期設定コード", "コードタイプコード値リスト"). It does NOT call `super.removeElementFromListData`, so its branches do not reach this method.
- `KKW01601SFBean` delegates unmatched cases (including those starting with `"//"`) to `super.removeElementFromListData(key, index)`, which ultimately resolves to `KKW01601SF03DBean.removeElementFromListData` at runtime due to Java polymorphism.

## 6. Per-Branch Detail Blocks

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

> Null-guard: only proceed if the key is not null; otherwise return immediately with no side effects.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if (key != null)` // Null check guard — skip processing if key is null [-> Javadoc: @param key 項目名] |

**Block 1.1** — `IF-ELSE-IF` `(key.equals("異動理由コード"))` — Transfer Reason Code [L1501]

> Route to the transfer reason code list for removal. The Japanese label "異動理由コード" identifies the list containing reason codes for service contract transfers.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if (key.equals("異動理由コード"))` // Match: Transfer Reason Code [-> Javadoc: @param key 項目名] |
| 1.1 | `IF` `(index >= 0 && index < hktgi_ido_rsn_cd_list.size())` — Bounds check [L1502] |
| 1.1.1 | SET | `hktgi_ido_rsn_cd_list.remove(index);` // Remove element at index — if the specified index is within the current list range, remove its content [-> Javadoc: @param index 削除対象のインデックス番号] |
| 1.1.2 | SET | (implicit) return from void method |
| 1.2 | EXEC | (implicit) else — index out of range, skip silently |

**Block 1.2** — `ELSE-IF` `(key.equals("オプションサービス契約番号"))` — Option Service Contract No. [L1507]

> Route to the option service contract number list for removal. The Japanese label "オプションサービス契約番号" identifies optional add-on service contract IDs.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `else if (key.equals("オプションサービス契約番号"))` // Match: Option Service Contract Number |
| 1.1 | `IF` `(index >= 0 && index < hktgi_op_svc_kei_no_list.size())` — Bounds check [L1508] |
| 1.1.1 | SET | `hktgi_op_svc_kei_no_list.remove(index);` // Remove element at index — if the specified index is within the current list range, remove its content |
| 1.1.2 | SET | (implicit) return from void method |
| 1.2 | EXEC | (implicit) else — index out of range, skip silently |

**Block 1.3** — `ELSE-IF` `(key.equals("同時申込サービス契約番号"))` — Simultaneous Application Service Contract No. [L1513]

> Route to the simultaneous application service contract number list for removal. The Japanese label "同時申込サービス契約番号" identifies service contract IDs for services applied for concurrently.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `else if (key.equals("同時申込サービス契約番号"))` // Match: Simultaneous Application Service Contract Number |
| 1.1 | `IF` `(index >= 0 && index < hktgi_mskm_svc_kei_no_list.size())` — Bounds check [L1514] |
| 1.1.1 | SET | `hktgi_mskm_svc_kei_no_list.remove(index);` // Remove element at index — if the specified index is within the current list range, remove its content |
| 1.1.2 | SET | (implicit) return from void method |
| 1.2 | EXEC | (implicit) else — index out of range, skip silently |

**Block 2** — `ELSE` (implicit) — No matching key [L1519]

> If none of the three key strings matched, no operation is performed. The method simply returns after the outer `if (key != null)` block closes.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hktgi_ido_rsn_cd` | Field | Transfer reason code — internal code describing why a service contract was transferred or modified |
| `hktgi_op_svc_kei_no` | Field | Option service contract number — unique identifier for an optional add-on service contract |
| `hktgi_mskm_svc_kei_no` | Field | Simultaneous application service contract number — unique identifier for services applied for concurrently with the main contract |
| `hktgi` | Abbreviation | Contract/Service data prefix — internal naming convention for contract-related fields |
| `ido` (異動) | Japanese term | Transfer / change — refers to modifying or transferring a service contract |
| `mskm` (同時申込) | Japanese abbreviation | Simultaneous application — services applied for at the same time as the main contract |
| `X33VDataTypeList` | Type | X33 framework typed list — a generic typed collection used in the X33 web framework for view-layer data binding |
| `DBean` | Abbreviation | Data Bean — a view-layer bean class that holds data for a specific screen variant (the "03" variant handles transfer-related data) |
| "異動理由コード" | Japanese label | Transfer Reason Code — display label for the list of reason codes explaining contract transfer reasons |
| "オプションサービス契約番号" | Japanese label | Option Service Contract Number — display label for optional add-on service contract IDs |
| "同時申込サービス契約番号" | Japanese label | Simultaneous Application Service Contract Number — display label for concurrently applied service contract IDs |
| KKA15301SF | Module | Service Function module — the telecom service contract transfer screen module |
