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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.CRW03407SF.CRW03407SF01DBean` |
| Layer | Controller (Web Client / View Bean) |
| Module | `CRW03407SF` (Package: `eo.web.webview.CRW03407SF`) |

## 1. Role

### CRW03407SF01DBean.removeElementFromListData()

This method removes a single element at a specified index from one of three internal `ArrayList`-backed lists that store externally connected URL information for correspondence history (対応履歴). The correspondence history tracks a sequence of actions or events, and each entry includes an external URL number, an external URL path, and an external URL display name. These three parallel lists are kept in sync by the view bean during form rendering and user interactions, so when a user removes a URL entry from the displayed list, this method is invoked to delete the matching element from all three corresponding internal data structures.

The method implements a **routing/dispatch pattern** using hardcoded Japanese string literals to match the logical list name (`key`) against the correct internal field, then delegates the actual removal to `java.util.ArrayList.remove(int)`. It is a shared utility called by many screens within the `CRW03407SF` module (and its parent/child beans) that handle correspondence history with external URL connections.

The method performs **no database or service component calls** — it operates purely on in-memory state within the view bean, making it a lightweight, synchronous data manipulation method used for client-side list management.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData(key, index)"])
    CHECK_KEY_NULL{"key != null?"}
    BLOCK_TAILORK_OUT_URL_NO["l0_taiorrk_out_url_no_list.remove(index)"]
    BLOCK_TAILORK_OUT_URL["l0_taiorrk_out_url_list.remove(index)"]
    BLOCK_TAILORK_OUT_URL_NM["l0_taiorrk_out_url_nm_list.remove(index)"]
    END_NODE(["Return / Next"])

    START --> CHECK_KEY_NULL
    CHECK_KEY_NULL --> |true| CHECK_TAILORK_OUT_URL_NO{"key equals 対応履歴外部接続URL番号リスト?"}
    CHECK_KEY_NULL --> |false| END_NODE
    CHECK_TAILORK_OUT_URL_NO --> |true| CHECK_INDEX_NO{"0 <= index < l0_taiorrk_out_url_no_list.size()?"}
    CHECK_TAILORK_OUT_URL_NO --> |false| CHECK_TAILORK_OUT_URL{"key equals 対応履歴外部接続URLリスト?"}
    CHECK_INDEX_NO --> |true| BLOCK_TAILORK_OUT_URL_NO
    CHECK_INDEX_NO --> |false| END_NODE
    BLOCK_TAILORK_OUT_URL_NO --> END_NODE
    CHECK_TAILORK_OUT_URL --> |true| CHECK_INDEX_URL{"0 <= index < l0_taiorrk_out_url_list.size()?"}
    CHECK_TAILORK_OUT_URL --> |false| CHECK_TAILORK_OUT_URL_NM{"key equals 対応履歴外部接続URL名リスト?"}
    CHECK_INDEX_URL --> |true| BLOCK_TAILORK_OUT_URL
    CHECK_INDEX_URL --> |false| END_NODE
    BLOCK_TAILORK_OUT_URL --> END_NODE
    CHECK_TAILORK_OUT_URL_NM --> |true| CHECK_INDEX_URL_NM{"0 <= index < l0_taiorrk_out_url_nm_list.size()?"}
    CHECK_TAILORK_OUT_URL_NM --> |false| END_NODE
    CHECK_INDEX_URL_NM --> |true| BLOCK_TAILORK_OUT_URL_NM
    CHECK_INDEX_URL_NM --> |false| END_NODE
    BLOCK_TAILORK_OUT_URL_NM --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The logical name of the list from which to remove an element. It identifies which of the three parallel URL-related lists to operate on. Values: `"対応履歴外部接続URL番号リスト"` (Correspondence History External Connection URL Number List), `"対応履歴外部接続URLリスト"` (Correspondence History External Connection URL List), or `"対応履歴外部接続URL名リスト"` (Correspondence History External Connection URL Name List). |
| 2 | `index` | `int` | The zero-based index of the element to remove from the identified list. Must be within `[0, list.size())` to actually trigger removal; if out of bounds, the removal is silently skipped. |

**Internal fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `l0_taiorrk_out_url_no_list` | `X33VDataTypeList` | The list storing URL numbers for external connections in correspondence history (items of type `String`, item ID: `l0_taiorrk_out_url_no`). |
| `l0_taiorrk_out_url_list` | `X33VDataTypeList` | The list storing URL paths for external connections in correspondence history (items of type `String`, item ID: `l0_taiorrk_out_url`). |
| `l0_taiorrk_out_url_nm_list` | `X33VDataTypeList` | The list storing display names for URLs in external connections of correspondence history (items of type `String`, item ID: `l0_taiorrk_out_url_nm`). |

## 4. CRUD Operations / Called Services

This method performs no database or service component calls. It operates entirely on in-memory `ArrayList` structures managed by the view bean.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | `ArrayList.remove(int)` | — | — | In-memory list element removal. Deletes the element at the specified index from the identified `X33VDataTypeList` without any persistence operation. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Bean: `CRW03407SFBean` | `CRW03407SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` -> `CRW03407SF01DBean.removeElementFromListData` | `ArrayList.remove(int) [D] in-memory list` |
| 2 | Bean: `CRW03407SF01DBean` | Direct invocation by screen/controller methods within `CRW03407SF01DBean` (e.g., during row deletion from a displayed table of external URL entries) | `ArrayList.remove(int) [D] in-memory list` |

**Notes:**
- `CRW03407SFBean` extends `CRW03407SF01DBean` and overrides `removeElementFromListData` to call `super.removeElementFromListData(key, index)`, delegating to this method.
- This method is called when a user interface action requests removal of an external URL entry from the correspondence history display.

## 6. Per-Branch Detail Blocks

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

> Null guard: If `key` is null, the method returns immediately without performing any operation. This prevents `NullPointerException` on the subsequent `equals` comparison.

| # | Type | Code |
|---|------|------|
| 1 | SET | `// no assignment; fall through to condition check` |

**Block 1.1** — [IF-ELSE-IF] `(key.equals("対応履歴外部接続URL番号リスト"))` — Constant: `対応履歴外部接続URL番号リスト` = "Correspondence History External Connection URL Number List" (L595)

> First dispatch branch: matches when the caller targets the URL number list. If the key matches this exact string, the method proceeds to validate the index range and remove from `l0_taiorrk_out_url_no_list`. The English translation of the Japanese string is "Correspondence History External Connection URL Number List", identifying the list that holds URL numbers (番号) for external connections in correspondence history (対応履歴).

| # | Type | Code |
|---|------|------|
| 1 | SET | `// condition evaluates key.equals("対応履歴外部接続URL番号リスト")` |

**Block 1.1.1** — [IF] `(index >= 0 && index < l0_taiorrk_out_url_no_list.size())` (L596)

> Index bounds validation for the URL number list. If the index is within the valid range `[0, list.size())`, the element at that index is removed. The Japanese comment states: "指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除する" (If the specified index is within the current list range, delete the content at that index).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `l0_taiorrk_out_url_no_list.remove(index)` // Remove element at index from URL number list. Comment: "指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除する" (If the specified index is within the current list range, delete the content at that index) |

**Block 1.1.2** — [ELSE] `(index out of bounds)` (L596)

> The index is out of range. No removal is performed. The method falls through to the end.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `// no-op; silently skip removal` |

**Block 1.2** — [ELSE-IF] `(key.equals("対応履歴外部接続URLリスト"))` — Constant: `対応履歴外部接続URLリスト` = "Correspondence History External Connection URL List" (L601)

> Second dispatch branch: matches when the caller targets the URL path list. If the key matches this exact string, the method validates the index range and removes from `l0_taiorrk_out_url_list`. The Japanese comment states: "対応履歴外部接続URLリスト" (Correspondence History External Connection URL List) — the list that holds URL paths for external connections in correspondence history.

| # | Type | Code |
|---|------|------|
| 1 | SET | `// condition evaluates key.equals("対応履歴外部接続URLリスト")` |

**Block 1.2.1** — [IF] `(index >= 0 && index < l0_taiorrk_out_url_list.size())` (L602)

> Index bounds validation for the URL list. If the index is within range, the element is removed.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `l0_taiorrk_out_url_list.remove(index)` // Remove element at index from URL list. Comment: "指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除する" (If the specified index is within the current list range, delete the content at that index) |

**Block 1.2.2** — [ELSE] `(index out of bounds)` (L602)

> The index is out of range. No removal is performed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `// no-op; silently skip removal` |

**Block 1.3** — [ELSE-IF] `(key.equals("対応履歴外部接続URL名リスト"))` — Constant: `対応履歴外部接続URL名リスト` = "Correspondence History External Connection URL Name List" (L607)

> Third dispatch branch: matches when the caller targets the URL name (display name) list. If the key matches this exact string, the method validates the index range and removes from `l0_taiorrk_out_url_nm_list`. The Japanese comment states: "対応履歴外部接続URL名リスト" (Correspondence History External Connection URL Name List) — the list that holds display names for URLs in external connections of correspondence history.

| # | Type | Code |
|---|------|------|
| 1 | SET | `// condition evaluates key.equals("対応履歴外部接続URL名リスト")` |

**Block 1.3.1** — [IF] `(index >= 0 && index < l0_taiorrk_out_url_nm_list.size())` (L608)

> Index bounds validation for the URL name list. If the index is within range, the element is removed.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `l0_taiorrk_out_url_nm_list.remove(index)` // Remove element at index from URL name list. Comment: "指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除する" (If the specified index is within the current list range, delete the content at that index) |

**Block 1.3.2** — [ELSE] `(index out of bounds)` (L608)

> The index is out of range. No removal is performed.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `// no-op; silently skip removal` |

**Block 2** — [ELSE] `(key == null)` (L592)

> The key is null. The method returns immediately without any operation.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `// method exits; no-op when key is null` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `対応履歴` | Field (Japanese) | Correspondence History — a chronological log of actions, events, or communications related to a customer or service order |
| `外部接続` | Field (Japanese) | External Connection — links to external systems or web resources accessed during correspondence |
| `URL番号` | Field (Japanese) | URL Number — a numeric identifier for an external URL entry within the correspondence history |
| `URL名` | Field (Japanese) | URL Name / Display Name — the human-readable label shown to users for an external URL entry |
| `リスト` | Field (Japanese) | List — an ordered collection (ArrayList) of items |
| `l0_taiorrk_out_url_no_list` | Field | URL Number List — internal `X33VDataTypeList` holding URL number strings; item ID: `l0_taiorrk_out_url_no` |
| `l0_taiorrk_out_url_list` | Field | URL List — internal `X33VDataTypeList` holding URL path strings; item ID: `l0_taiorrk_out_url` |
| `l0_taiorrk_out_url_nm_list` | Field | URL Name List — internal `X33VDataTypeList` holding URL display name strings; item ID: `l0_taiorrk_out_url_nm` |
| `X33VDataTypeList` | Technical | A framework-provided generic list wrapper from the X33 web framework that manages typed data for view beans |
| `CRW03407SF` | Module | Screen module for correspondence history with external URL connections |
| `DBean` | Technical | Data Bean suffix — a view bean that holds data state for a specific screen variant (D = Detail/Detail-type screen) |
| `X33VViewBaseBean` | Technical | Base class from the X33 web framework that provides core view bean functionality |
| `X33VListedBeanInterface` | Technical | Interface from the X33 framework indicating this bean manages listed/tabular data |
| `X33VDataTypeBeanInterface` | Technical | Interface from the X33 framework marking this bean as a data type container |
| `X33SException` | Technical | Exception class from the X33 framework used for screen-level error handling |
| `CRW03407SFBean` | Class | Parent bean that extends `CRW03407SF01DBean` and delegates `removeElementFromListData` via `super` call |
