# Business Logic — KKW02516SF01DBean.removeElementFromListData() [20 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA16801SF.KKW02516SF01DBean` |
| Layer | Web View Bean (Presentation — View data model managed by the JavaServer Faces framework) |
| Module | `KKA16801SF` (Package: `eo.web.webview.KKA16801SF`) |

## 1. Role

### KKW02516SF01DBean.removeElementFromListData()

This method provides a **key-based routing mechanism** to remove a single element from one of several typed lists managed by the web view bean. It implements a **dispatch pattern** where the caller passes a string key identifying which list to modify, and an index specifying which element to remove. The method protects against `IndexOutOfBoundsException` by verifying the index falls within the current bounds of the target list before performing the removal. It serves as a **shared utility method** within the bean hierarchy — subclasses (e.g., `FUW00919SFBean`, `FUW00901SFBean`, `FUW00926SFBean`) inherit this behavior via `super.removeElementFromListData()` or override it to extend functionality. This method supports **dynamic UI row management** for screens that allow users to add or remove line items from tabular data — specifically, "Reason codes for modification" (異動理由コード) and "Option service contract numbers" (オプションサービス契約番号).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData(String key, int index)"])
    CHECK_NULL["key != null ?"]
    CHECK_KEY1["key.equals(異動理由コード)"]
    CHECK_RANGE1["index >= 0 && index <
ido_rsn_cd_list.size()"]
    REMOVE1["ido_rsn_cd_list.remove(index)"]
    CHECK_KEY2["key.equals(オプションサービス契約番号)"]
    CHECK_RANGE2["index >= 0 && index <
op_svc_kei_no_list.size()"]
    REMOVE2["op_svc_kei_no_list.remove(index)"]
    END_NODE(["Return / No-op"])

    START --> CHECK_NULL
    CHECK_NULL -->|false| END_NODE
    CHECK_NULL -->|true| CHECK_KEY1
    CHECK_KEY1 -->|true| CHECK_RANGE1
    CHECK_KEY1 -->|false| CHECK_KEY2
    CHECK_RANGE1 -->|true| REMOVE1
    CHECK_RANGE1 -->|false| END_NODE
    REMOVE1 --> END_NODE
    CHECK_KEY2 -->|true| CHECK_RANGE2
    CHECK_KEY2 -->|false| END_NODE
    CHECK_RANGE2 -->|true| REMOVE2
    CHECK_RANGE2 -->|false| END_NODE
    REMOVE2 --> END_NODE
```

**CRITICAL — Constant Resolution:**

This method uses **literal Japanese string constants** rather than imported constant class fields. The two recognized keys and their business meanings are:

| Constant String (Literal) | English Translation | Business Meaning |
|---------------------------|---------------------|------------------|
| `"異動理由コード"` | "Reason code for modification" | Identifies the `ido_rsn_cd_list` — a list of reason codes explaining why a service line item was modified or deleted |
| `"オプションサービス契約番号"` | "Option service contract number" | Identifies the `op_svc_kei_no_list` — a list of optional service contract numbers associated with the main service |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The list discriminator — a Japanese string literal that identifies which internal list the removal target belongs to. Valid values are `"異動理由コード"` (Reason code for modification, mapping to `ido_rsn_cd_list`) and `"オプションサービス契約番号"` (Option service contract number, mapping to `op_svc_kei_no_list`). If `null`, the method performs no operation. |
| 2 | `index` | `int` | Zero-based index of the element to remove from the target list. If the index is out of bounds (negative or >= list size), the removal is silently skipped — no exception is thrown. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | List of reason codes for service modification — each entry identifies a reason (e.g., cancellation, address change) for a line item alteration |
| `op_svc_kei_no_list` | `X33VDataTypeList` | List of option service contract numbers — each entry represents a bundled optional service (e.g., email, security) attached to the main service contract |

## 4. CRUD Operations / Called Services

This method performs **in-memory list manipulation only** — it does not invoke any SC (Service Component), CBS (Common Business Service), or database operations. The `remove(int index)` calls operate on local `X33VDataTypeList` fields, which are presentation-layer data structures managed by the X33 web framework.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| N/A (In-memory only) | `list.remove(index)` | N/A | N/A (local bean field) | Removes an element from a presentation-layer list at the specified index — no persistence or database interaction occurs |

## 5. Dependency Trace

Search results found **no direct callers** of `KKW02516SF01DBean.removeElementFromListData()` in the `koptWebA` module (the source module for this class). However, the method is **inherited and invoked via `super.removeElementFromListData()`** by at least 20+ bean classes across the `koptWebR` module, indicating it serves as a **shared base-bean utility** in the web framework hierarchy.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Inherited utility — called via `super.removeElementFromListData()` | SubclassBean.removeElementFromListData(...) -> `super.removeElementFromListData(key, index)` [KKW02516SF01DBean] | N/A (in-memory list removal only) |
| 2 | FUW00901SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 3 | FUW00907SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 4 | FUW00917SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 5 | FUW00919SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 6 | FUW00926SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 7 | FUW00927SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 8 | FUW00931SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 9 | FUW00957SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 10 | FUW00959SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 11 | FUW00964SF01DBean | Redefined locally (no super call in this override) | N/A |
| 12 | FUW00964SF04DBean | Redefined locally (no super call in this override) | N/A |
| 13 | FUW00964SF07DBean | Redefined locally (no super call in this override) | N/A |
| 14 | FUW00964SFBean | Superclass override -> `super.removeElementFromListData(key, index)` | N/A |
| 15 | FUW00917SF01DBean | Redefined locally (no super call in this override) | N/A |

**Note:** The classes listed above define their own `removeElementFromListData()` methods, many of which delegate to the base implementation via `super.removeElementFromListData(key, index)`. This confirms the method serves as a **foundation utility in the bean inheritance chain**, providing reusable list-removal capability across multiple screen beans.

## 6. Per-Branch Detail Blocks

> **Block 1** — [IF] `key != null` (L808)
>
> The method first guards against a null key to prevent NullPointerException. If key is null, processing ends immediately with no effect.

| # | Type | Code |
|---|------|------|
| 1 | SET | `if(key != null)` — Null guard; prevents NPE on subsequent `equals()` calls [L808] |

> **Block 1.1** — [IF-ELSE-IF] Key dispatch — `"異動理由コード"` (Reason code for modification) (L810)
>
> When the key matches the literal `"異動理由コード"`, the method targets the `ido_rsn_cd_list` (reason code list for service modifications). It verifies the index is within bounds before removal.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if(key.equals("異動理由コード"))` — Matches reason code list key [-> `"異動理由コード"` = Reason code for modification] (L810) |

> **Block 1.1.1** — [IF] Index bounds check for `ido_rsn_cd_list` (L811)
>
> Ensures the index is non-negative and less than the current list size before attempting removal. This prevents `IndexOutOfBoundsException`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if(index >= 0 && index < ido_rsn_cd_list.size())` — Bounds validation for reason code list [L811] |
| 2 | SET | `ido_rsn_cd_list.remove(index)` — Removes element at the specified index from the reason code list [L812] |

> **Block 1.2** — [ELSE-IF] Key dispatch — `"オプションサービス契約番号"` (Option service contract number) (L817)
>
> When the key matches the literal `"オプションサービス契約番号"`, the method targets the `op_svc_kei_no_list` (option service contract number list). It verifies the index is within bounds before removal.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `else if(key.equals("オプションサービス契約番号"))` — Matches option service contract list key [-> `"オプションサービス契約番号"` = Option service contract number] (L817) |

> **Block 1.2.1** — [IF] Index bounds check for `op_svc_kei_no_list` (L818)
>
> Ensures the index is non-negative and less than the current list size before attempting removal.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `if(index >= 0 && index < op_svc_kei_no_list.size())` — Bounds validation for option service contract list [L818] |
| 2 | SET | `op_svc_kei_no_list.remove(index)` — Removes element at the specified index from the option service contract list [L819] |

> **Block 2** — [END] Return (L825)
>
> After all conditional branches execute (or none match), the method returns void. If the key was null, or did not match either recognized value, or the index was out of bounds, the method returns silently with no effect.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` — Method exits; void return type [L825] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Reason code for modification — a code that identifies why a service line item was altered (e.g., customer requested change, system-initiated update, cancellation) |
| `ido_rsn_cd_list` | Field | List of reason codes for modification — a presentation-layer list holding reason code entries for dynamic UI display |
| `op_svc_kei_no` | Field | Option service contract number — an identifier for an optional service (e.g., additional email, security package) bundled with the main service |
| `op_svc_kei_no_list` | Field | List of option service contract numbers — a presentation-layer list holding option service contract entries |
| 異動理由コード | Japanese field | "Reason code for modification" — the list discriminator key identifying the reason code list |
| オプションサービス契約番号 | Japanese field | "Option service contract number" — the list discriminator key identifying the option service contract list |
| X33VDataTypeList | Technical | A Fujitsu X33 web framework data type wrapper for list collections — provides typed list management for JavaServer Faces view beans |
| X33SException | Technical | Exception class from the Fujitsu X33 web framework — checked exception that may be thrown by bean methods |
| DBean | Abbreviation | Detailed Bean — a view-scoped JavaBean that holds the complete data model for a screen, including lists, form fields, and UI state |
| koptWebA / koptWebR | Abbreviation | Application modules — `koptWebA` is the primary web application module; `koptWebR` is the regional/regulator-derived module with subclassed beans |
