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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA17701SF.KKW00129SF01DBean` |
| Layer | Web View Bean (Controller/View component — part of the Fujitsu Futurity X33 web framework) |
| Module | `KKA17701SF` (Package: `eo.web.webview.KKA17701SF`) |

## 1. Role

### KKW00129SF01DBean.removeElementFromListData()

This method provides a **key-based list item removal** service for the KKA17701SF screen's data bean. In the K-Opticom telecom service provisioning system, the screen manages multiple tab-based data grids, each backed by an `X33VDataTypeList` (a framework-specific typed list that holds `SelectItem` objects for dropdowns and repeater tables). This method dispatches on a string `key` parameter to identify which internal list should have an element removed at a given `index`.

Specifically, this override handles **three view-specific list types** used by the KKW00129SF01 sub-screen: the **Initial Setup Code List** (`default_cd_list_list`), the **Code List** (`cd_div_cd_list_list`), and the **Code Name List** (`cd_div_nm_list_list`). It acts as a **shared utility method** within the bean, called by the parent screen bean (`KKW00129SFBean`) which coordinates multi-tab screen state across seven sub-screens (KKW00129SF01 through SF09). The dispatch pattern (string comparison against hardcoded Japanese literal keys) is the standard X33 bean approach for routing view-state mutations without requiring callers to hold references to individual list fields.

The method implements a **safe removal guard**: before removing any element, it validates that the index is within bounds (`0 <= index < list.size()`). If the index is out of range, the operation is silently no-ops, preventing `IndexOutOfBoundsException`. If `key` is `null`, the method also exits without action.

This method does NOT interact with any database, service component (SC), or business entity — it is a pure view-state manipulation utility. It overrides the base class `removeElementFromListData` which handles many more keys; this bean only needs its own three list types, leaving the remaining keys to be handled by the base class `super.removeElementFromListData(key, index)` in the parent screen bean (KKW00129SFBean).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["removeElementFromListData"])

    START --> KEY_NOT_NULL["key is not null"]

    KEY_NOT_NULL -->|yes| CHECK_KEY["Compare key value"]
    KEY_NOT_NULL -->|no| END_NODE(["End - no action"])

    CHECK_KEY --> INIT_SET["key matches Initial Setup Code List"]
    CHECK_KEY --> CODE_LIST["key matches Code List"]
    CHECK_KEY --> CODE_NAME["key matches Code Name List"]
    CHECK_KEY --> DEFAULT["No match - exit"]

    INIT_SET --> IDX_CHECK1["index in valid range"]
    CODE_LIST --> IDX_CHECK2["index in valid range"]
    CODE_NAME --> IDX_CHECK3["index in valid range"]

    IDX_CHECK1 -->|yes| REMOVE1["Remove from default_cd_list_list"]
    IDX_CHECK1 -->|no| END_A["End - out of bounds"]

    IDX_CHECK2 -->|yes| REMOVE2["Remove from cd_div_cd_list_list"]
    IDX_CHECK2 -->|no| END_B["End - out of bounds"]

    IDX_CHECK3 -->|yes| REMOVE3["Remove from cd_div_nm_list_list"]
    IDX_CHECK3 -->|no| END_C["End - out of bounds"]

    REMOVE1 --> END_NODE
    REMOVE2 --> END_NODE
    REMOVE3 --> END_NODE
    END_A --> END_NODE
    END_B --> END_NODE
    END_C --> END_NODE
    DEFAULT --> END_NODE
```

**Processing description:**

1. **Null guard** — If `key` is `null`, the method returns immediately with no side effects.
2. **Key dispatch** — The method compares `key` against three hardcoded Japanese string literals using `equals()`:
   - `"初期設定コードリスト"` (Initial Setup Code List) — route to `default_cd_list_list`
   - `"コードリスト"` (Code List) — route to `cd_div_cd_list_list`
   - `"コード名リスト"` (Code Name List) — route to `cd_div_nm_list_list`
3. **Index validation** — For each matched branch, the method checks `index >= 0 && index < list.size()`.
4. **Removal** — If the index is valid, the element at that index is removed from the corresponding `X33VDataTypeList` via the `List.remove(int)` call.
5. **No match** — If none of the three keys match, the method simply exits without action (this is the intended behavior; other list types are handled by the parent bean's override).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The business identifier (item name) for the target list. Must be one of the three hardcoded values: `"初期設定コードリスト"` (Initial Setup Code List — contains default setup code `SelectItem` entries for the code dropdown), `"コードリスト"` (Code List — contains code type category entries), or `"コード名リスト"` (Code Name List — contains code name entries). Used to dispatch to the correct internal list. |
| 2 | `index` | `int` | The zero-based positional index of the element to remove within the identified list. Must be in the range `[0, list.size())`. If out of bounds, the method silently no-ops. |

**Instance fields read by this method:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `default_cd_list_list` | `X33VDataTypeList` | Initial setup code list — contains default code `SelectItem` entries used to populate the code dropdown on the screen. Item ID: `default_cd_list`. |
| `cd_div_cd_list_list` | `X33VDataTypeList` | Code type list — contains code category/division entries. Item ID: `cd_div_cd_list`. |
| `cd_div_nm_list_list` | `X33VDataTypeList` | Code name list — contains code name entries for display. Item ID: `cd_div_nm_list`. |

## 4. CRUD Operations / Called Services

This method performs **pure view-state mutation** only. It does not call any Service Component (SC), Common Business Service (CBS), or data access layer. The internal `remove(int)` call operates on in-memory `ArrayList` collections (wrapped by `X33VDataTypeList`).

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none)* | — | — | — | This method manipulates only in-memory view bean list state. No database or service-tier interaction occurs. |

**Note:** The called method `X33VDataTypeList.remove(int index)` is a framework-provided list utility that performs an in-memory `ArrayList` removal operation. It is equivalent to a **U** (Update) on the view-state collection, but it does not persist to any database table.

## 5. Dependency Trace

This method is an **override** of the base class method in `KKW00129SFBean`. The base class contains a much larger dispatch table with ~15+ list keys covering sub-screens SF01 through SF10. The `KKW00129SF01DBean` override narrows this to only its own three list types.

**Direct callers of `KKW00129SF01DBean.removeElementFromListData()`:**

No direct callers were found in the codebase. The `removeElementFromListData` method on this specific bean (`KKW00129SF01DBean`) has no inbound call chains. This is because this method is typically invoked indirectly — the parent screen bean (`KKW00129SFBean`) defines its own `removeElementFromListData` override which handles the full dispatch table including delegate calls to sub-bean instances via a `listKoumokuIds()` lookup mechanism. When the screen framework needs to remove an element, it routes through the parent bean rather than directly targeting this DBean.

**Method call chain (caller -> this method):**

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | *(no direct callers found)* | *(none)* | *(none)* |

**Called services (downstream):**

| # | Method Called | Category | Description |
|---|--------------|----------|-------------|
| 1 | `default_cd_list_list.remove(index)` | View-state U | Removes element at index from the initial setup code list (in-memory) |
| 2 | `cd_div_cd_list_list.remove(index)` | View-state U | Removes element at index from the code type list (in-memory) |
| 3 | `cd_div_nm_list_list.remove(index)` | View-state U | Removes element at index from the code name list (in-memory) |

## 6. Per-Branch Detail Blocks

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

> Null guard: if key is null, exit immediately. Otherwise, proceed to key dispatch.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key != null` // null check on item name parameter |
| 2 | SET | *(implicit)* // if null, method falls through to close brace (no action) |

**Block 1.1** — ELSE-IF `(key.equals("初期設定コードリスト"))` [INITIAL_SETUP_CODE_LIST_LITERAL] (L742)

> Business meaning: Dispatches to the Initial Setup Code List when the item name matches the hardcoded Japanese string for initial setup codes. This list holds `SelectItem` default code entries used in the screen's code dropdown.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("初期設定コードリスト")` // Compare key against initial setup code list literal |
| 2 | IF | `index >= 0 && index < default_cd_list_list.size()` // Validate index is within bounds of initial setup code list (L743) |
| 3 | EXEC | `default_cd_list_list.remove(index)` // Remove element at index from the initial setup code list (L744) |
| 4 | SET | *(no-op if index out of bounds — condition prevents removal)* |

**Block 1.2** — ELSE-IF `(key.equals("コードリスト"))` [CODE_LIST_LITERAL] (L749)

> Business meaning: Dispatches to the Code List when the item name matches the hardcoded Japanese string for code list entries. This list holds code type/category `SelectItem` entries. Item ID: `cd_div_cd_list`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("コードリスト")` // Compare key against code list literal |
| 2 | IF | `index >= 0 && index < cd_div_cd_list_list.size()` // Validate index is within bounds of code type list (L750) |
| 3 | EXEC | `cd_div_cd_list_list.remove(index)` // Remove element at index from the code type list (L751) |
| 4 | SET | *(no-op if index out of bounds)* |

**Block 1.3** — ELSE-IF `(key.equals("コード名リスト"))` [CODE_NAME_LIST_LITERAL] (L756)

> Business meaning: Dispatches to the Code Name List when the item name matches the hardcoded Japanese string for code name entries. This list holds code name `SelectItem` entries for display. Item ID: `cd_div_nm_list`.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("コード名リスト")` // Compare key against code name list literal |
| 2 | IF | `index >= 0 && index < cd_div_nm_list_list.size()` // Validate index is within bounds of code name list (L757) |
| 3 | EXEC | `cd_div_nm_list_list.remove(index)` // Remove element at index from the code name list (L758) |
| 4 | SET | *(no-op if index out of bounds)* |

**Block 1.4** — DEFAULT (no matching key branch) (L739-763)

> When none of the three keys match, the method exits without performing any operation. This is intentional: other list types handled by the base class `KKW00129SFBean` are not within the scope of this sub-screen's DBean override.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | *(implicit void return — method ends at closing brace L764)* |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `初期設定コードリスト` | Field/Key | Initial Setup Code List — the display name key for the default code list that holds preset code `SelectItem` entries for the screen's code dropdown. Item ID: `default_cd_list`. |
| `コードリスト` | Field/Key | Code List — the display name key for the code type/category list. Item ID: `cd_div_cd_list`. |
| `コード名リスト` | Field/Key | Code Name List — the display name key for the code name list. Item ID: `cd_div_nm_list`. |
| `default_cd_list_list` | Field | Internal backing list for initial setup codes — an `X33VDataTypeList` containing `SelectItem` objects representing default code values used in dropdown components. |
| `cd_div_cd_list_list` | Field | Internal backing list for code type categories — contains code division/category entries displayed as selectable options. |
| `cd_div_nm_list_list` | Field | Internal backing list for code names — contains code name entries used for display in repeater tables and dropdowns. |
| `X33VDataTypeList` | Framework class | Fujitsu Futurity X33 framework class wrapping an `ArrayList` with typed data access. Used by the X33 view framework to manage list-based UI components (repeater tables, dropdowns). |
| `X33SException` | Framework exception | X33 framework runtime exception. Declared in method signature but not thrown by this specific implementation. |
| KKA17701SF | Module/Screen | Telecommunications service contract management screen — part of the K-Opticom web provisioning system for managing service agreements. |
| KKW00129SF | Sub-module | Service contract detail screen group (SF01-SF10) — manages service contract line items, codes, pricing, and fees. |
| DBean | Architecture term | Data Bean — a view-level bean in the X33 MVC pattern that holds screen state (form fields, lists, flags) for a specific screen tab/sub-screen. |
| `SelectItem` | Framework class | JSF `javax.faces.model.SelectItem` — represents a single selectable option in dropdown/select components. |
