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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW22301SF.KKW22301SF03DBean` |
| Layer | Utility / View Bean (Web Client Display Bean) |
| Module | `KKW22301SF` (Package: `eo.web.webview.KKW22301SF`) |

## 1. Role

### KKW22301SF03DBean.removeElementFromListData()

This method is a **list-item removal utility** used in the K-Opticom web application framework's view bean layer. It removes a single element at a specified index from one of three synchronized string-type list data structures that manage the display-state of the service-contract-line-item screen (KKW22301SF03).

The method functions as a **routing/dispatch utility**: it receives a string key that identifies which of the three list collections to modify, then removes the element at the given index. The three supported lists correspond to:

- **コードリスト (Code List)** — the service-type classification codes (item ID: `cd_div_list`)
- **コード名リスト (Code Name List)** — the human-readable service-type labels (item ID: `cd_div_nm_list`)
- **名称リスト (Name List)** — the descriptive service-item labels (item ID: `nm_list`)

Its role in the larger system is to keep these three parallel lists synchronized when a user removes a row from a repeating grid on the KKW22301SF03 screen (the "Search Target" screen). Each time a user removes a service item, this method is called three times — once per list — using the same index, ensuring all three arrays stay in lockstep. The method is a shared utility provided by the X33 framework's `X33VDataTypeBeanInterface` contract, enabling any DBean to expose list-item removal through a uniform key-based API.

The method performs **no database operations, no service component (SC) calls, and no entity transforms**. It is purely an in-memory list manipulation method within the view bean's data-binding layer.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData key, index"])
    CHECK_NULL["key is null"]
    NO_OP["No operation (return)"]

    CHECK_NULL -->|false| ROUTE{"Key dispatch"}

    ROUTE -->|"コードリスト"| CODE_LIST["Key = コードリスト"]
    ROUTE -->|"コード名リスト"| CODE_NAME_LIST["Key = コード名リスト"]
    ROUTE -->|"名称リスト"| NAME_LIST["Key = 名称リスト"]
    ROUTE -->|other| NO_OP

    CODE_LIST --> CHECK_BOUNDS1{"index valid?"}
    CHECK_BOUNDS1 -->|true| REMOVE_CODE["cd_div_list_list.remove(index)"]
    CHECK_BOUNDS1 -->|false| NO_OP

    CODE_NAME_LIST --> CHECK_BOUNDS2{"index valid?"}
    CHECK_BOUNDS2 -->|true| REMOVE_CODE_NAME["cd_div_nm_list_list.remove(index)"]
    CHECK_BOUNDS2 -->|false| NO_OP

    NAME_LIST --> CHECK_BOUNDS3{"index valid?"}
    CHECK_BOUNDS3 -->|true| REMOVE_NAME["nm_list_list.remove(index)"]
    CHECK_BOUNDS3 -->|false| NO_OP

    REMOVE_CODE --> END(["End"])
    REMOVE_CODE_NAME --> END
    REMOVE_NAME --> END
    NO_OP --> END
```

**Processing steps:**

1. **Null guard** — If `key` is null, return immediately without any operation (silent pass-through). This prevents `NullPointerException` on the subsequent string comparisons.
2. **Key dispatch** — Evaluate the string key against three known constants to determine which list to modify. This is a string-equality-based switch (implemented as if/else-if).
3. **Bounds-checked removal** — For each matching list, verify the index falls within `[0, list.size - 1]`. If valid, call `java.util.List.remove(int)` to remove the element at that index.
4. **Silent fail on out-of-bounds** — If the index is invalid, the method returns without error or exception, preserving list integrity.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | A string identifier that selects which of the three synchronized list data structures to modify. It represents the name of a repeating grid column. Possible values are: `"コードリスト"` (Code List — service-type classification codes), `"コード名リスト"` (Code Name List — human-readable service-type labels), or `"名称リスト"` (Name List — descriptive service-item labels). A null value causes immediate return. |
| 2 | `index` | `int` | Zero-based positional index identifying which element to remove from the selected list. Must fall within `[0, list.size - 1]`. When removing a row from a repeating grid, this is the current row's index in the displayed list. Out-of-bounds values are silently ignored (no exception thrown). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `cd_div_list_list` | `X33VDataTypeList` | String-type list holding service-type classification codes (e.g., FTTH, DSL, Mail). Indexed list items correspond to rows in the service-contract-line-item grid. |
| `cd_div_nm_list_list` | `X33VDataTypeList` | String-type list holding human-readable service-type labels (display names for the same service types stored in `cd_div_list_list`). |
| `nm_list_list` | `X33VDataTypeList` | String-type list holding descriptive labels for each service-item line (e.g., "Main office fiber connection"). |

## 4. CRUD Operations / Called Services

This method performs **no database operations, no SC (Service Component) calls, and no CBS (Common Business Service) calls**. It manipulates only in-memory Java `List` collections.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (none) | (none) | (none) | (none) | In-memory list removal only. No persistence layer interaction. |

**Note:** This method delegates to `java.util.List.remove(int)` on local `X33VDataTypeList` instances. No SC Codes or Entity/DB tables are involved.

## 5. Dependency Trace

The method `removeElementFromListData` is a **framework utility method** defined in `KKW22301SF03DBean`. It is called indirectly through the X33 framework's view bean lifecycle rather than being directly invoked by other business classes.

In the KKW22301SF module, the parent bean `KKW22301SFBean` overrides this method and delegates to `super.removeElementFromListData(key, index)`, forwarding calls from higher-level screen processing to the DBean implementation. No direct callers within the `source/koptWebB` directory were found — the method is triggered by the X33 web framework's view model binding mechanism when a user removes a row from the repeating grid on the KKW22301SF03 screen.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW22301SF03 | `X33 framework view binding` -> `KKW22301SF03DBean.removeElementFromListData` | In-memory only (no CRUD) |
| 2 | Screen:KKW22301SF | `KKW22301SFBean.removeElementFromListData` -> `super.removeElementFromListData` -> `KKW22301SF03DBean.removeElementFromListData` | In-memory only (no CRUD) |

## 6. Per-Branch Detail Blocks

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

> Guard clause: prevent processing when key is null. If key is null, skip all branches and return.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key != null)` // Null guard — skip if key is null |
| 2 | BODY | // Proceed to key dispatch |

---

**Block 2** — IF-ELSE-IF `(key.equals("コードリスト"))` (L594)

> Remove from Code List — the list of service-type classification codes (e.g., FTTH codes, DSL codes).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key.equals("コードリスト"))` // String comparison: Code List dispatch |
| 2 | BODY | // コメント: 配列項目 "コードリスト"(String型、項目ID:cd_div_list) → Array item "Code List" (String type, item ID: cd_div_list) |
| 3 | IF | `if(index >= 0 && index < cd_div_list_list.size())` // Bounds check |
| 4 | EXEC | `cd_div_list_list.remove(index)` // Remove element at specified index → コメント: 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 → If the specified index is within the current list range, remove the content at that index |

---

**Block 3** — ELSE-IF `(key.equals("コード名リスト"))` (L601)

> Remove from Code Name List — the list of human-readable service-type labels.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(key.equals("コード名リスト"))` // String comparison: Code Name List dispatch |
| 2 | BODY | // コメント: 配列項目 "コード名リスト"(String型、項目ID:cd_div_nm_list) → Array item "Code Name List" (String type, item ID: cd_div_nm_list) |
| 3 | IF | `if(index >= 0 && index < cd_div_nm_list_list.size())` // Bounds check |
| 4 | EXEC | `cd_div_nm_list_list.remove(index)` // Remove element at specified index → コメント: 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 → If the specified index is within the current list range, remove the content at that index |

---

**Block 4** — ELSE-IF `(key.equals("名称リスト"))` (L608)

> Remove from Name List — the list of descriptive service-item labels.

| # | Type | Code |
|---|------|------|
| 1 | ELSE-IF | `else if(key.equals("名称リスト"))` // String comparison: Name List dispatch |
| 2 | BODY | // コメント: 配列項目 "名称リスト"(String型、項目ID:nm_list) → Array item "Name List" (String type, item ID: nm_list) |
| 3 | IF | `if(index >= 0 && index < nm_list_list.size())` // Bounds check |
| 4 | EXEC | `nm_list_list.remove(index)` // Remove element at specified index → コメント: 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 → If the specified index is within the current list range, remove the content at that index |

---

**Block 5** — IMPLICIT ELSE (key not matching any of the three values) (L590–611)

> No action taken — if the key does not match any of the three known list names, the method simply returns without any operation. This is a safe no-op for unknown keys.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | Implicit: no else clause — method ends |
| 2 | RETURN | Implicit void return → return from method |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `コードリスト` | Field (Japanese) | Code List — the display name key for the service-type classification code list. Items in this list are code values (e.g., "101" for FTTH, "201" for DSL). |
| `コード名リスト` | Field (Japanese) | Code Name List — the display name key for the human-readable service-type labels corresponding to the codes in コードリスト (e.g., "Fiber To The Home", "Digital Subscriber Line"). |
| `名称リスト` | Field (Japanese) | Name List — the display name key for descriptive service-item labels (e.g., "Main office fiber connection", "Branch office broadband"). |
| `cd_div_list` | Field | Code Division List — internal item ID for the service-type classification codes list. The prefix "cd_div" stands for "code division." |
| `cd_div_nm_list` | Field | Code Division Name List — internal item ID for the human-readable service-type labels. "nm" = "name." |
| `nm_list` | Field | Name List — internal item ID for descriptive service-item labels. |
| `X33VDataTypeList` | Type | Fujitsu X33 Framework list data type — a generic typed-list container used in view beans to hold repeated row data (e.g., repeating grid items). |
| `X33VDataTypeBeanInterface` | Interface | X33 Framework interface that DBeans implement to expose data binding methods (`loadModelData`, `storeModelData`, `removeElementFromListData`). |
| DBean | Acronym | Display Bean — a view bean class that manages the display data (form fields, lists) for a specific screen in the X33 web framework. |
| KKW22301SF | Module | Service Contract Line Item screen module — the application module for managing service contract line items in the telecom service order system. |
| KKW22301SF03 | Screen | Search Target screen — the sub-screen within KKW22301SF where users search and configure service item targets. |
| SC Code | Acronym | Service Component Code — an identifier for a service component (typically pattern `[A-Z]{3}\d{4}[A-Z]\d{3}SC`) that mediates between the view layer and data access layer. |
| Index | Field | Zero-based positional index used to identify a specific row within a repeating grid or list data structure. |
| X33 Framework | Acronym | Fujitsu's X33 web application framework — a Model-View-Controller framework for building web forms with data binding, used in the K-Opticom system. |
