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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW05501SF.KKW05501SF03DBean` |
| Layer | DBean / Screen (View data transfer bean in the web presentation layer) |
| Module | `KKW05501SF` (Package: `eo.web.webview.KKW05501SF`) |

## 1. Role

### KKW05501SF03DBean.removeElementFromListData()

This method provides a **unified entry point for removing a single element** from one of three data-bound `X33VDataTypeList` collections used by the KKW05501SF screen. It operates as a **key-based routing utility** — the incoming `key` string acts as a discriminator that selects which internal list should have an element removed at the given `index`. The three supported lists correspond to business data points on a service contract modification screen: (1) movement/reason codes for service changes, (2) option service contract numbers, and (3) simultaneous application service contract numbers.

This method follows a **delegation / dispatch pattern** where a single public method routes to one of three target lists based on string comparison. It is called from overriding subclasses (e.g., `KKW05501SFBean`, `KKW05501SF01DBean`) via `super.removeElementFromListData(key, index)`, making it a shared utility within the KKW05501SF screen's DBean inheritance hierarchy. The method itself performs no database or service component interaction — it is a pure in-memory list manipulation utility used during screen data lifecycle management, such as removing a line item from a repeating section when the user cancels or deletes a row.

All three branches perform the same logical operation (validate index bounds, then remove) on different lists. There are no conditional side effects, no external calls, and no transactional behavior.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData(key, index)"])

    START --> CheckNull{"key != null?"}

    CheckNull -->|No| END_NODE(["Return / Next"])

    CheckNull -->|Yes| Branch1{"key equals
'異動理由コード'?"}

    Branch1 -->|Yes| BOUNDS1{"0 <= index <
hktgi_ido_rsn_cd_list.size()?"}
    Branch1 -->|No| Branch2{"key equals
'オプションサービス契約番号'?"}

    BOUNDS1 -->|Yes| REMOVE1["hktgi_ido_rsn_cd_list.remove(index)"]
    BOUNDS1 -->|No| Branch2
    REMOVE1 --> Branch2

    Branch2 -->|Yes| BOUNDS2{"0 <= index <
hktgi_op_svc_kei_no_list.size()?"}
    Branch2 -->|No| Branch3{"key equals
'同時申込サービス契約番号'?"}

    BOUNDS2 -->|Yes| REMOVE2["hktgi_op_svc_kei_no_list.remove(index)"]
    BOUNDS2 -->|No| Branch3
    REMOVE2 --> Branch3

    Branch3 -->|Yes| BOUNDS3{"0 <= index <
hktgi_mskm_svc_kei_no_list.size()?"}
    Branch3 -->|No| END_NODE

    BOUNDS3 -->|Yes| REMOVE3["hktgi_mskm_svc_kei_no_list.remove(index)"]
    BOUNDS3 -->|No| END_NODE
    REMOVE3 --> END_NODE
```

**Conditional branch summary:**

| Branch | Condition (Java) | Key Literal (Business Meaning) | Action |
|--------|-----------------|-------------------------------|--------|
| 1 | `key.equals("異動理由コード")` | "Movement Reason Code" (hktgi_ido_rsn_cd) | Remove from `hktgi_ido_rsn_cd_list` |
| 2 | `key.equals("オプションサービス契約番号")` | "Option Service Contract Number" (hktgi_op_svc_kei_no) | Remove from `hktgi_op_svc_kei_no_list` |
| 3 | `key.equals("同時申込サービス契約番号")` | "Simultaneous Application Service Contract Number" (hktgi_mskm_svc_kei_no) | Remove from `hktgi_mskm_svc_kei_no_list` |

**CRITICAL — Constant Resolution:**
This method uses **literal string comparisons** rather than named constants. The key values are hardcoded in Japanese and must match the `SelectItem` labels defined elsewhere in the UI binding layer. There are no constant file references (e.g., `*CC*`, `*Const*`) used in this method.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business identifier (label text) of the list type to modify. Must exactly match one of three Japanese string literals: `"異動理由コード"` (Movement Reason Code), `"オプションサービス契約番号"` (Option Service Contract Number), or `"同時申込サービス契約番号"` (Simultaneous Application Service Contract Number). Acts as a routing discriminator. |
| 2 | `index` | `int` | The zero-based position of the element to remove from the target list. Valid range: `0` to `list.size() - 1`. If the index is out of bounds, the removal is silently skipped (no exception is thrown). |

**Instance fields / external state read by this method:**

| Field | Type | Business Meaning |
|-------|------|-----------------|
| `hktgi_ido_rsn_cd_list` | `X33VDataTypeList` | List of movement/reason codes for service contract line item changes (e.g., addition, deletion, modification) |
| `hktgi_op_svc_kei_no_list` | `X33VDataTypeList` | List of option service contract numbers — additional services subscribed alongside the primary contract |
| `hktgi_mskm_svc_kei_no_list` | `X33VDataTypeList` | List of simultaneous application service contract numbers — services applied for together in a bundled application |

**Instance fields potentially affected (written):**

| Field | Operation |
|-------|-----------|
| `hktgi_ido_rsn_cd_list` | Element removed via `remove(index)` when key matches |
| `hktgi_op_svc_kei_no_list` | Element removed via `remove(index)` when key matches |
| `hktgi_mskm_svc_kei_no_list` | Element removed via `remove(index)` when key matches |

## 4. CRUD Operations / Called Services

This method performs **pure in-memory list manipulation** only. It does not invoke any Service Component (SC), Call Back Service (CBS), database query, or persistence layer.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | — | — | — | This method calls no external services or data access components. It directly mutates `java.util.List` objects held as instance fields in the bean. |

**Note:** The `X33VDataTypeList.remove(int)` method modifies an internal Java `ArrayList` — it is not a database delete. The effective data change is the removal of one entry from a screen-bound list model, which is typically synchronized back to the database on the next screen save/submit operation (handled by a separate method, not this one).

## 5. Dependency Trace

This method is defined in `KKW05501SF03DBean` and is **overridden and delegated to by subclasses** through inheritance. The callers identified are subclasses in the same screen module that extend or wrap this behavior.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW05501SF (KKW05501SF01DBean) | `KKW05501SF01DBean.removeElementFromListData(key, index)` — overrides, does not call `super` | In-memory: hktgi_ido_rsn_cd_list, hktgi_op_svc_kei_no_list, hktgi_mskm_svc_kei_no_list |
| 2 | Screen:KKW05501SF (KKW05501SFBean) | `KKW05501SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` | In-memory: hktgi_ido_rsn_cd_list, hktgi_op_svc_kei_no_list, hktgi_mskm_svc_kei_no_list |

**Additional callers in other screen modules (FUW* series):**

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 3 | Screen:FUW00912SF (FUW00912SF01DBean) | `FUW00912SF01DBean.removeElementFromListData(key, index)` — overrides, does not call `super` | In-memory: module-specific list data |
| 4 | Screen:FUW00926SF (FUW00926SFBean) | `FUW00926SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` | In-memory: module-specific list data |
| 5 | Screen:FUW00959SF (FUW00959SFBean) | `FUW00959SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` | In-memory: module-specific list data |
| 6 | Screen:FUW00964SF (FUW00964SF01DBean) | `FUW00964SF01DBean.removeElementFromListData(key, index)` — overrides, does not call `super` | In-memory: module-specific list data |
| 7 | Screen:FUW00964SF (FUW00964SF04DBean) | `FUW00964SF04DBean.removeElementFromListData(key, index)` — overrides, does not call `super` | In-memory: module-specific list data |
| 8 | Screen:FUW00964SF (FUW00964SF07DBean) | `FUW00964SF07DBean.removeElementFromListData(key, index)` — overrides, does not call `super` | In-memory: module-specific list data |
| 9 | Screen:FUW00964SF (FUW00964SF10DBean) | `FUW00964SF10DBean.removeElementFromListData(key, index)` — overrides, does not call `super` | In-memory: module-specific list data |
| 10 | Screen:FUW00964SF (FUW00964SFBean) | `FUW00964SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` | In-memory: module-specific list data |
| 11 | Screen:FUW00927SF (FUW00927SFBean) | `FUW00927SFBean.removeElementFromListData(key, index)` -> `super.removeElementFromListData(key, index)` | In-memory: module-specific list data |

**Note:** The FUW* screen modules inherit from a common base class that provides the same `removeElementFromListData` pattern, but with different target list fields. The KKW05501SF03DBean is the **original source** of this method in its defined list types.

## 6. Per-Branch Detail Blocks

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

> Null check on the key parameter. If `key` is null, the method returns immediately without performing any operation. This is a defensive guard against null pointer exceptions.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key != null)` // Defensive null check on list identifier key. Returns if null. |

---

**Block 2** — [ELSE-IF] `(key.equals("異動理由コード"))` `[異動理由コード = "異動理由コード" (Movement Reason Code)]` (L1385)

> This branch handles removal from the movement/reason code list. The Japanese string `"異動理由コード"` identifies this list. The corresponding internal field ID is `hktgi_ido_rsn_cd`. This list holds reason codes for why a service contract line item was changed (added, deleted, or modified).

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(key.equals("異動理由コード"))` // Matches "異動理由コード" — Movement Reason Code list |
| 2 | SET | `// target list: hktgi_ido_rsn_cd_list` // Corresponds to field ID hktgi_ido_rsn_cd |

---

**Block 2.1** — [IF (nested)] `(index >= 0 && index < hktgi_ido_rsn_cd_list.size())` (L1387)

> Bounds check: ensures the given index falls within the current size of the movement reason code list. If the index is out of range, the removal is silently skipped — no exception is thrown. This prevents `IndexOutOfBoundsException` on invalid input.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(index >= 0 && index < hktgi_ido_rsn_cd_list.size())` // Validates index is within list bounds |
| 2 | EXEC | `hktgi_ido_rsn_cd_list.remove(index);` // Removes element at specified index // 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 (If specified index is within current list range, remove content at that index) |

---

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

> This branch handles removal from the option service contract number list. The Japanese string `"オプションサービス契約番号"` identifies this list. The corresponding internal field ID is `hktgi_op_svc_kei_no`. This list holds contract numbers for optional services subscribed alongside the main service.

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if(key.equals("オプションサービス契約番号"))` // Matches "オプションサービス契約番号" — Option Service Contract Number list |
| 2 | SET | `// target list: hktgi_op_svc_kei_no_list` // Corresponds to field ID hktgi_op_svc_kei_no |

---

**Block 3.1** — [IF (nested)] `(index >= 0 && index < hktgi_op_svc_kei_no_list.size())` (L1394)

> Bounds check for the option service contract number list. Same pattern: if out of bounds, silently skip.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(index >= 0 && index < hktgi_op_svc_kei_no_list.size())` // Validates index is within option service list bounds |
| 2 | EXEC | `hktgi_op_svc_kei_no_list.remove(index);` // Removes element at specified index // 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 (If specified index is within current list range, remove content at that index) |

---

**Block 4** — [ELSE-IF] `(key.equals("同時申込サービス契約番号"))` `[同時申込サービス契約番号 = "同時申込サービス契約番号" (Simultaneous Application Service Contract Number)]` (L1399)

> This branch handles removal from the simultaneous application service contract number list. The Japanese string `"同時申込サービス契約番号"` identifies this list. The corresponding internal field ID is `hktgi_mskm_svc_kei_no`. This list holds contract numbers for services applied for simultaneously in a bundled application.

| # | Type | Code |
|---|------|------|
| 1 | IF | `else if(key.equals("同時申込サービス契約番号"))` // Matches "同時申込サービス契約番号" — Simultaneous Application Service Contract Number list |
| 2 | SET | `// target list: hktgi_mskm_svc_kei_no_list` // Corresponds to field ID hktgi_mskm_svc_kei_no |

---

**Block 4.1** — [IF (nested)] `(index >= 0 && index < hktgi_mskm_svc_kei_no_list.size())` (L1401)

> Bounds check for the simultaneous application service contract number list. Same pattern: if out of bounds, silently skip.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if(index >= 0 && index < hktgi_mskm_svc_kei_no_list.size())` // Validates index is within simultaneous application service list bounds |
| 2 | EXEC | `hktgi_mskm_svc_kei_no_list.remove(index);` // Removes element at specified index // 指定のインデックスが現在のリストの範囲内なら、そのインデックスの内容を削除 (If specified index is within current list range, remove content at that index) |

---

**Block 5** — [ELSE-IMPLICIT] (No matching key) (L1405)

> If the `key` does not match any of the three known list identifiers, the method returns without performing any action. This is the implicit else branch of the if/else-if chain. No error is raised — it is a no-op.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `hktgi_ido_rsn_cd` | Field ID | Movement reason code — the reason why a service contract line item was changed (e.g., addition, deletion, modification of a line item) |
| `hktgi_op_svc_kei_no` | Field ID | Option service contract number — the contract number for an optional/add-on service subscribed alongside the main service |
| `hktgi_mskm_svc_kei_no` | Field ID | Simultaneous application service contract number — the contract number for a service applied for in the same application as another service (bundled order) |
| 異動理由コード | Japanese field label | Movement Reason Code — a human-readable label for the `hktgi_ido_rsn_cd` list item type |
| オプションサービス契約番号 | Japanese field label | Option Service Contract Number — a human-readable label for the `hktgi_op_svc_kei_no` list item type |
| 同時申込サービス契約番号 | Japanese field label | Simultaneous Application Service Contract Number — a human-readable label for the `hktgi_mskm_svc_kei_no` list item type |
| X33VDataTypeList | Class | A Fujitsu Futurity X33 framework data type container that wraps a typed list (typically `ArrayList`) for binding to JSF UI components. Supports serialization and view-state management. |
| DBean | Abbreviation | Data Bean — a screen-level JavaBean that holds and manipulates view data between the JSF presentation layer and the business logic layer. Extends `X33VViewBaseBean` and implements `X33VListedBeanInterface`. |
| KKW05501SF | Screen code | A Fujitsu screen identification code for a service contract management screen in the K-Opticom telecom billing/fulfillment system. The "SF" suffix typically indicates a form/screen type. |
| hktgi | Prefix | Likely stands for "Hikita" (a place or company code) or is an internal module code prefix. Used consistently across field names in this bean. |
| `index` | Parameter | Zero-based array/list position — the numeric position of an element within a list. 0 refers to the first element. |
| X33SException | Class | A runtime exception type from the Fujitsu X33 framework, thrown when a critical error occurs in a screen component or bean method. |
