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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00844SF.KKW00844SF01DBean` |
| Layer | Utility / Data Bean (Web Client Data Bean, part of the X33 framework) |
| Module | `KKW00844SF` (Package: `eo.web.webview.KKW00844SF`) |

## 1. Role

### KKW00844SF01DBean.removeElementFromListData()

This method performs **conditional list element removal** within the web data bean (DBean) used by the KKW00844SF screen. It provides a centralized, key-based dispatch mechanism for removing items from two distinct business data lists: the "Move Reason Code" list (異動理由コード) and the "Option Service Contract Number" list (オプションサービス契約番号). These lists are used to capture dynamic, multi-line service modification data — specifically, the reason codes explaining why a service is being moved or changed, and the optional service contract numbers tied to the modification.

The method implements a **routing/dispatch pattern** based on the string `key` parameter: the key value determines which internal `X33VDataTypeList` is targeted for removal. If the key does not match any of the two defined list names (or is `null`), the method performs a no-op and returns silently.

This is a **shared utility method** defined in the base DBean class (`KKW00844SF01DBean`) and inherited by the main bean (`KKW00844SFBean` via `super.removeElementFromListData(key, index)`). It serves as a reusable data manipulation utility called throughout the screen's processing to handle user-initiated removal of dynamic table rows (e.g., when a user removes a reason code entry or an option service line from a multi-row form).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData key index"])
    CHECK_NULL{key is not null?}
    CHECK_RSN{key equals IdoRsnCd?}
    REMOVE_RSN["ido_rsn_cd_list.remove index"]
    BOUNDS_RSN{0 <= index < list size?}
    RSN_DONE["Reason code removed"]
    CHECK_OP{key equals OpSvcKeiNo?}
    BOUNDS_OP{0 <= index < list size?}
    REMOVE_OP["op_svc_kei_no_list.remove index"]
    OP_DONE["Option service number removed"]
    NULL_DONE["No-op key is null"]
    END_NODE(["Return Next"])

    START --> CHECK_NULL
    CHECK_NULL -->|false| NULL_DONE
    NULL_DONE --> END_NODE
    CHECK_NULL -->|true| CHECK_RSN
    CHECK_RSN -->|true| BOUNDS_RSN
    BOUNDS_RSN -->|true| REMOVE_RSN
    REMOVE_RSN --> RSN_DONE
    RSN_DONE --> END_NODE
    BOUNDS_RSN -->|false| RSN_DONE
    CHECK_RSN -->|false| CHECK_OP
    CHECK_OP -->|true| BOUNDS_OP
    BOUNDS_OP -->|true| REMOVE_OP
    REMOVE_OP --> OP_DONE
    OP_DONE --> END_NODE
    BOUNDS_OP -->|false| OP_DONE
    CHECK_OP -->|false| END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The list identifier that determines which data list to remove from. Two valid values are recognized: `"異動理由コード"` (Move Reason Code — the reason code list for service changes) and `"オプションサービス契約番号"` (Option Service Contract Number — the optional service contract number list). If `null` or an unrecognized value, the method is a no-op. |
| 2 | `index` | `int` | The zero-based index of the element to remove from the target list within the identified list. If out of bounds (less than 0 or greater than or equal to the list size), the removal is skipped silently — no exception is thrown for invalid indices. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `ido_rsn_cd_list` | `X33VDataTypeList` | List of move reason code entries (異動理由コード) — tracks the codes explaining why a service modification is occurring |
| `op_svc_kei_no_list` | `X33VDataTypeList` | List of option service contract numbers (オプションサービス契約番号) — tracks the optional service contract lines associated with the modification |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `X33VDataTypeList.remove(int index)` | N/A | N/A (in-memory list) | Removes an element at the specified index from an in-memory `X33VDataTypeList` — this is a local data-structure mutation, not a database operation |

**Note:** This method operates entirely on in-memory data structures (`X33VDataTypeList` instances) and does **not** call any SC (Service Component) or CBS (Component Service). There are no database or entity interactions at this level. The lists `ido_rsn_cd_list` and `op_svc_kei_no_list` hold screen-level transient data bound to the web view.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW00844 | `KKW00844SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` -> `KKW00844SF01DBean.removeElementFromListData` | `X33VDataTypeList.remove [U] (in-memory)` |

**Notes on callers:**
- `KKW00844SFBean` (same module) overrides this method and delegates to `super.removeElementFromListData(key, index)`, effectively re-exporting the base behavior.
- No other classes in the KKW00844SF module were found calling this method directly.
- The method is inherited by `KKW00844SFBean` via the X33 framework's inheritance pattern, making it available to the screen's backing bean for use in row-removal scenarios (e.g., removing a reason code row from a dynamic table).

## 6. Per-Branch Detail Blocks

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

> Check that the key is not null before proceeding with any list operations. If key is null, skip all processing and return immediately (no-op).

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `if (key != null)` // Guard against null key; proceed only if key has a value |
| 2 | SET | `// Enter processing block` |

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

> First dispatch branch: handles removal from the reason code list (異動理由コード / item ID: ido_rsn_cd). This list holds the codes that describe why a service is being moved or changed.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `if (key.equals("異動理由コード"))` // Check if key matches reason code list identifier [-> "異動理由コード" = "Move Reason Code"] |
| 2 | SET | `// 配列要素 "異動理由コード" (String型。項目ID:ido_rsn_cd)` // Array element "Move Reason Code" (String type. Item ID: ido_rsn_cd) |

**Block 1.1.1** — IF `[bounds check for ido_rsn_cd_list]` (L812)

> Bounds check: verify the index is within the current list size. If valid, remove the element at that index from the reason code list. If the index is out of bounds, skip the removal silently.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `if (index >= 0 && index < ido_rsn_cd_list.size())` // Check if specified index is within current list range |
| 2 | EXEC | `ido_rsn_cd_list.remove(index);` // Remove the content at that index [-> in-memory list mutation] |

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

> Second dispatch branch: handles removal from the option service contract number list (オプションサービス契約番号). This list holds the optional service contract line numbers associated with the service modification.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `else if (key.equals("オプションサービス契約番号"))` // Check if key matches option service contract number list identifier [-> "オプションサービス契約番号" = "Option Service Contract Number"] |
| 2 | SET | `// 配列要素 "オプションサービス契約番号" (String型。項目ID:op_svc_kei_no)` // Array element "Option Service Contract Number" (String type. Item ID: op_svc_kei_no) |

**Block 1.2.1** — IF `[bounds check for op_svc_kei_no_list]` (L818)

> Bounds check: verify the index is within the current list size. If valid, remove the element at that index from the option service number list. If the index is out of bounds, skip the removal silently.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `if (index >= 0 && index < op_svc_kei_no_list.size())` // Check if specified index is within current list range |
| 2 | EXEC | `op_svc_kei_no_list.remove(index);` // Remove the content at that index [-> in-memory list mutation] |

**Block 2** — ELSE (implicit — key does not match any known list name) (L821)

> If the key is not null but does not match either `"異動理由コード"` or `"オプションサービス契約番号"`, the method reaches the closing brace and returns with no operation. This acts as a safe no-op for unrecognized keys.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `異動理由コード` | Field | Move Reason Code — the code describing why a service is being modified or moved; stored as a String item with internal ID `ido_rsn_cd` |
| `ido_rsn_cd` | Field | Item ID abbreviation for 異動理由コード (Move Reason Code); the internal identifier used in the bean's list data structure |
| `オプションサービス契約番号` | Field | Option Service Contract Number — the contract number for an optional service line item; stored as a String item with internal ID `op_svc_kei_no` |
| `op_svc_kei_no` | Field | Item ID abbreviation for オプションサービス契約番号 (Option Service Contract Number); the internal identifier for the option service list |
| DBean | Acronym | Data Bean — a Java class in the X33 web framework that holds screen-level data, provides getter/setter methods, and manages in-memory list structures for web view rendering |
| X33VDataTypeList | Type | A framework-provided list class that holds typed data elements (e.g., String, Boolean, Long) for web view data binding |
| X33SException | Type | The exception class thrown by X33 framework methods when a runtime error occurs |
| X33 | Acronym | Fujitsu Futurity X33 — the web application framework used for building enterprise screen beans in this codebase |
| KK_T_ | Prefix | Table name prefix used for database entity tables (not directly referenced in this method, but relevant to other methods in the module) |
| SC Code | Acronym | Service Component Code — a unique identifier for a service component (e.g., `EKK0361A010SC`) that handles business logic or data access |
