# Business Logic — KKW22501SFBean.removeElementFromListData() [32 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW22501SF.KKW22501SFBean` |
| Layer | View/Bean (Web Presentation Layer) |
| Module | `KKW22501SF` (Package: `eo.web.webview.KKW22501SF`) |

## 1. Role

### KKW22501SFBean.removeElementFromListData()

This method provides targeted removal of list data entries from the bean's internal list collections, which represent search condition and display items for a service order/registration screen. It acts as a **key-based dispatcher**, routing the removal request to the correct internal list depending on the item type identified by the `key` parameter. The method handles **three distinct list data types**: (1) data extraction item setting condition list for event BP (before-change state), (2) data extraction item setting condition list for event BP (original/pre-change state), and (3) the data extraction item list for the KKSV0004SF02 screen. When the key starts with `//`, it delegates to the parent class's `removeElementFromListData()` method, which handles shared/common information lists managed in the base class layer. This method implements the **delegation and routing design patterns** and serves as a **shared utility** within the bean — any screen handler or controller method that needs to remove a specific item from a keyed list can call this method without knowing which internal list holds that item. It performs **no database or service component calls** — it operates purely in-memory on the bean's state.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData key, index"])
    CHECK_KEY_NON_NULL{"key != null"}
    CHECK_STARTS_SLASH{"key starts with //"}
    PASS_TO_PARENT["Pass to super.removeElementFromListData(key, index)"]
    CHECK_KEY_DT1{"key == データ抽出項目設定条件一覧照会（イベントBP）明细"}
    CHECK_INDEX_VALID1{"index in range of dchskm_sete_jkn_list_list"}
    REMOVE_DT1["dchskm_sete_jkn_list_list.remove(index)"]
    CHECK_KEY_DT2{"key == 変更前データ抽出項目設定条件一覧照会（イベントBP）明细"}
    CHECK_INDEX_VALID2{"index in range of bf_dchskm_sete_jkn_list_list"}
    REMOVE_DT2["bf_dchskm_sete_jkn_list_list.remove(index)"]
    CHECK_KEY_DT3{"key == データ抽出項目一覧照会明细"}
    CHECK_INDEX_VALID3{"index in range of dchskm_list_list"}
    REMOVE_DT3["dchskm_list_list.remove(index)"]
    END_NODE(["Return"])

    START --> CHECK_KEY_NON_NULL
    CHECK_KEY_NON_NULL -->|true| CHECK_STARTS_SLASH
    CHECK_KEY_NON_NULL -->|false| END_NODE
    CHECK_STARTS_SLASH -->|true| PASS_TO_PARENT
    CHECK_STARTS_SLASH -->|false| CHECK_KEY_DT1
    PASS_TO_PARENT --> END_NODE
    CHECK_KEY_DT1 -->|true| CHECK_INDEX_VALID1
    CHECK_KEY_DT1 -->|false| CHECK_KEY_DT2
    CHECK_INDEX_VALID1 -->|true| REMOVE_DT1
    CHECK_INDEX_VALID1 -->|false| CHECK_KEY_DT2
    REMOVE_DT1 --> END_NODE
    CHECK_KEY_DT2 -->|true| CHECK_INDEX_VALID2
    CHECK_KEY_DT2 -->|false| CHECK_KEY_DT3
    CHECK_INDEX_VALID2 -->|true| REMOVE_DT2
    CHECK_INDEX_VALID2 -->|false| CHECK_KEY_DT3
    REMOVE_DT2 --> END_NODE
    CHECK_KEY_DT3 -->|true| CHECK_INDEX_VALID3
    CHECK_KEY_DT3 -->|false| END_NODE
    CHECK_INDEX_VALID3 -->|true| REMOVE_DT3
    CHECK_INDEX_VALID3 -->|false| END_NODE
    REMOVE_DT3 --> END_NODE
```

**CRITICAL — Constant Resolution:**
The three list keys are hardcoded Japanese strings (no constants used):
- `データ抽出項目設定条件一覧照会（イベントBP）明细` — Data extraction item setting condition list for event BP (original/pre-change state)
- `変更前データ抽出項目設定条件一覧照会（イベントBP）明细` — Data extraction item setting condition list for event BP (before-change state)
- `データ抽出項目一覧照会明细` — Data extraction item list

**Processing flow:**
1. **Null check** — If `key` is null, the method returns without performing any operation.
2. **Shared info check** — If the key starts with `//`, delegate to `super.removeElementFromListData()` for common information lists.
3. **List type routing** — Match the key against the three list type strings and remove the element from the corresponding list if the index is valid.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The item name (list type identifier) that determines which internal list the removal targets. It is a human-readable Japanese string that identifies the data type and screen purpose of the list entry. Values starting with `//` indicate shared/common information lists that are managed by the parent class. The key must exactly match one of three supported strings to trigger removal from a bean-managed list. |
| 2 | `index` | `int` | The zero-based index of the list entry to remove. Valid range is `0 <= index < list.size()`. If the index is out of bounds, the removal is silently skipped (no exception is thrown). |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `dchskm_sete_jkn_list_list` | `X33VDataTypeList` | List of data extraction item setting conditions for event BP (original state). Each entry holds a search condition for data extraction on the service order screen. |
| `bf_dchskm_sete_jkn_list_list` | `X33VDataTypeList` | List of data extraction item setting conditions for event BP (before-change state). Maintained when the user modifies existing conditions — this holds the state prior to the change. |
| `dchskm_list_list` | `X33VDataTypeList` | List of data extraction items for display/reference. Each entry represents a searchable data item shown on the screen. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| D | `KKW22501SFBean.removeElementFromListData` | - | - | Calls `removeElementFromListData` in `KKW22501SFBean` |

### Internal method calls within this method:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| D | `KKW22501SFBean.removeElementFromListData` (super) | - | - | Delegates removal to parent class `X33VViewBaseBean` for shared/common information list handling when key starts with `//`. |
| D | `X33VDataTypeList.remove(int)` | - | - | Removes the element at the specified index from the `dchskm_sete_jkn_list_list` collection (in-memory). |
| D | `X33VDataTypeList.remove(int)` | - | - | Removes the element at the specified index from the `bf_dchskm_sete_jkn_list_list` collection (in-memory). |
| D | `X33VDataTypeList.remove(int)` | - | - | Removes the element at the specified index from the `dchskm_list_list` collection (in-memory). |

**Classification summary:**
- This method performs only **Delete (D)** operations — it removes entries from in-memory list collections.
- No database, no SC (Service Component), no CBS (Common Business Service) calls.
- No Create (C), Read (R), or Update (U) operations.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method:KKW22501SFBean.removeElementFromListData() | `KKW22501SFBean.removeElementFromListData(key, index)` | `removeElementFromListData [D] (in-memory list)` |
| 2 | Parent: X33VViewBaseBean.removeElementFromListData | `KKW22501SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` | `super.removeElementFromListData [D] (shared list)` |

**Notes:**
- The pre-computed caller graph shows one direct caller: another `removeElementFromListData` overload within `KKW22501SFBean` (different signature).
- No screen classes (KKSV*) or batch classes were found calling this method directly in the codebase search.
- This method is an internal utility primarily invoked by the bean's own handlers (e.g., `addData`, search result handlers) to remove items from list data during screen processing.

## 6. Per-Branch Detail Blocks

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

> Guard clause: if key is null, the method returns immediately without performing any removal. This prevents NullPointerException and allows callers to invoke this method safely without null checks.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(key != null)` |

**Block 1.1** — IF `(key.startsWith("//"))` (L1347)

> Shared information branch. The `//` prefix is a convention used to identify shared/common information lists that are managed by the parent class (`X33VViewBaseBean`). Instead of routing to bean-specific lists, the removal is delegated upward.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(key.startsWith("//"))` // 共通情報ビューンのリストの場合 (If common info view list) |
| 2 | CALL | `super.removeElementFromListData(key, index)` // 共有情報ビューンリストは基底クラスで処理 (Shared info view list is processed in the base class) |

**Block 1.2** — IF `(key.equals("データ抽出項目設定条件一覧照会（イベントBP）明细"))` (L1351)

> Target: `dchskm_sete_jkn_list_list` — Data extraction item setting condition list for event BP (original/pre-change state). This list holds search condition entries that the user can add/remove when configuring data extraction parameters on the service order screen.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(key.equals("データ抽出項目設定条件一覧照会（イベントBP）明细"))` // データタイプがKKW22501SF01の繰り返し指定項目「データ抽出項目設定条件一覧照会（イベントBP）明细」(項目ID:dchskm_sete_jkn_list) (Data type is repeat item for KKW22501SF01: "Data extraction item setting condition list for event BP details" (Item ID: dchskm_sete_jkn_list)) |
| 2 | CHECK | `if(index >= 0 && index < dchskm_sete_jkn_list_list.size())` // 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 (If the specified index is within the current list range, delete the content at that index) |
| 3 | EXEC | `dchskm_sete_jkn_list_list.remove(index)` |

**Block 1.3** — ELSE-IF `(key.equals("変更前データ抽出項目設定条件一覧照会（イベントBP）明细"))` (L1357)

> Target: `bf_dchskm_sete_jkn_list_list` — Before-change data extraction item setting condition list. This is the snapshot of search conditions **before** a modification, used to support undo/change-tracking scenarios on the screen.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("変更前データ抽出項目設定条件一覧照会（イベントBP）明细"))` // 変更前データ抽出項目設定条件一覧照会（イベントBP）明细 (Before-change data extraction item setting condition list for event BP details) |
| 2 | CHECK | `if(index >= 0 && index < bf_dchskm_sete_jkn_list_list.size())` // 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 (If the specified index is within the current list range, delete the content at that index) |
| 3 | EXEC | `bf_dchskm_sete_jkn_list_list.remove(index)` |

**Block 1.4** — ELSE-IF `(key.equals("データ抽出項目一覧照会明细"))` (L1363)

> Target: `dchskm_list_list` — Data extraction item list for display. This is a generic list of searchable data items used on the KKW22501SF02 screen iteration, showing available items to the end user.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if(key.equals("データ抽出項目一覧照会明细"))` // データ抽出項目一覧照会明细 (Data extraction item list details) |
| 2 | CHECK | `if(index >= 0 && index < dchskm_list_list.size())` // 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 (If the specified index is within the current list range, delete the content at that index) |
| 3 | EXEC | `dchskm_list_list.remove(index)` |

**Block 2** — END (implicit return after if/else chain) (L1371)

> Method returns `void` after executing the selected branch (or doing nothing if `key` was null or the key did not match any of the three known list types).

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `(implicit)` // Return to caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `dchskm_sete_jkn_list_list` | Field | Data extraction item setting condition list (event BP) — in-memory list holding search condition entries for the "data extraction item setting condition" screen. Each entry is an `X33VDataTypeBeanInterface` holding a condition for querying data. |
| `bf_dchskm_sete_jkn_list_list` | Field | Before-change data extraction item setting condition list (event BP) — snapshot of search conditions prior to modification, supporting undo/change-tracking on the screen. "bf" prefix indicates "before [change]". |
| `dchskm_list_list` | Field | Data extraction item list — generic list of searchable data items available for selection/display on the KKSV0004SF02 screen. |
| X33VDataTypeList | Class | Framework list type — a typed collection in the X33 framework holding `X33VDataTypeBeanInterface` objects. Provides `add()`, `get()`, `remove()`, `size()` methods for list manipulation. |
| X33VViewBaseBean | Class | Parent base bean class — framework class that manages common/shared information lists (prefixed with `//`). Provides the base `removeElementFromListData()` implementation for shared list handling. |
| X33VListedBeanInterface | Interface | Framework interface — marks a bean as a listed bean, indicating it supports list-type view data operations. |
| X31CBaseBean | Interface | Framework base bean interface — common base bean contract providing shared functionality across beans. |
| `key` | Parameter | Item name — a human-readable Japanese string that identifies which internal list the removal targets. Keys starting with `//` indicate shared information. |
| `index` | Parameter | Index number — zero-based position of the list entry to remove. |
| 共通情報ビューン | Term | Common information view — shared UI lists managed by the base class, used across multiple screens. Prefixed with `//` in the key. |
| イベントBP | Term | Event Business Partner — a domain concept in the service order system referring to event-driven business partner related data. |
| 変更前 | Term | Before-change — refers to the state of data before a user-initiated modification. Used to maintain undo capability and change tracking. |
| データ抽出 | Term | Data extraction — the process of querying and selecting data items based on user-configured search conditions. |
| 設定条件 | Term | Setting condition — user-configured search/filter criteria applied to data extraction. |
| 照会 | Term | Inquiry/Reference — denotes a screen or operation that displays data for reference (read-only view), as opposed to input or update. |
| 明细 | Term | Details — indicates that the list contains detailed/granular entries as opposed to a summary-level list. |
| X33SException | Class | Framework exception — exception class thrown by X33 framework bean methods for error handling. |
