# Business Logic — KKW00801SF01DBean.addListDataInstance() [32 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW00801SF.KKW00801SF01DBean` |
| Layer | Controller / View Bean (presentation-layer data binding) |
| Module | `KKW00801SF` (Package: `eo.web.webview.KKW00801SF`) |

## 1. Role

### KKW00801SF01DBean.addListDataInstance()

This method is a factory/dispatch utility that creates and registers list-item data beans on demand for the KKW00801SF screen (a mail settings management screen at K-Opticom's telecom web platform). It receives a key string identifying which **data-type item list** the caller wants to extend, then instantiates the appropriate container list (if not yet created) and appends a new `KKW00801SF02DBean` element to it. The method implements a **routing-dispatch pattern**: it inspects the key value to determine which business data type is being referenced, and returns the index of the newly appended element. Two service categories are supported: (1) **Email Mail Capacity Selection List** (`mlbox_cap_op_list`) — used to let end users choose their email storage capacity option; (2) **Virus Check Selection List** (`virus_chk_op_list`) — used to let end users choose their antivirus/malware protection option. This is a shared data-binding utility called by the screen's backing bean and by numerous subclasses across related web screens (e.g. FUW009xxSF families), meaning it is a **cross-screen shared component** that standardizes how list-type UI controls are populated in the X33 view framework.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addListDataInstance(String key)"])
    CHECK_NULL{key is null?}
    RETURN_Neg1["Return -1 (no matching key)"]
    CHECK_MLBOX{Key is mail capacity selection list?}
    MLBOX_INIT{mlbox_cap_op_list_list is null?}
    CREATE_MLBOX_LIST["Create new X33VDataTypeList"]
    CREATE_MLBOX_BEAN["Create new KKW00801SF02DBean instance"]
    ADD_MLBOX["Add bean to mlbox_cap_op_list_list"]
    RETURN_MLBOX["Return list index (size - 1)"]
    CHECK_VIRUS{Key is virus check selection list?}
    VIRUS_INIT{virus_chk_op_list_list is null?}
    CREATE_VIRUS_LIST["Create new X33VDataTypeList"]
    CREATE_VIRUS_BEAN["Create new KKW00801SF02DBean instance"]
    ADD_VIRUS["Add bean to virus_chk_op_list_list"]
    RETURN_VIRUS["Return list index (size - 1)"]

    START --> CHECK_NULL
    CHECK_NULL -->|Yes| RETURN_Neg1
    CHECK_NULL -->|No| CHECK_MLBOX
    CHECK_MLBOX -->|Yes| MLBOX_INIT
    MLBOX_INIT -->|Yes| CREATE_MLBOX_LIST
    MLBOX_INIT -->|No| CREATE_MLBOX_BEAN
    CREATE_MLBOX_LIST --> CREATE_MLBOX_BEAN
    CREATE_MLBOX_BEAN --> ADD_MLBOX
    ADD_MLBOX --> RETURN_MLBOX
    CHECK_MLBOX -->|No| CHECK_VIRUS
    CHECK_VIRUS -->|Yes| VIRUS_INIT
    VIRUS_INIT -->|Yes| CREATE_VIRUS_LIST
    VIRUS_INIT -->|No| CREATE_VIRUS_BEAN
    CREATE_VIRUS_LIST --> CREATE_VIRUS_BEAN
    CREATE_VIRUS_BEAN --> ADD_VIRUS
    ADD_VIRUS --> RETURN_VIRUS
    CHECK_VIRUS -->|No| RETURN_Neg1
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | A data-type item identifier that tells the method which list to extend. Two recognized values exist: `"メールメール容量選択リスト"` (Mail Capacity Selection List, item ID: `mlbox_cap_op_list`) for configuring email storage options, and `"ウィルスチェック選択リスト"` (Virus Check Selection List, item ID: `virus_chk_op_list`) for configuring antivirus options. An unrecognized key or `null` causes the method to return -1. |
| — | `mlbox_cap_op_list_list` (instance field) | `X33VDataTypeList` | The backing list that holds `KKW00801SF02DBean` elements for mail capacity selection options. Created in the constructor as a new `X33VDataTypeList`. Lazy-initialized (checked for null before use). |
| — | `virus_chk_op_list_list` (instance field) | `X33VDataTypeList` | The backing list that holds `KKW00801SF02DBean` elements for virus check selection options. Created in the constructor as a new `X33VDataTypeList`. Lazy-initialized (checked for null before use). |

## 4. CRUD Operations / Called Services

This method performs **no database operations or service component (SC/CBS) calls**. It is purely an in-memory factory/dispatch method within the presentation layer. All operations are local object manipulations.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| (N/A — No DB/SC calls) | — | — | — | This method only manipulates in-memory `X33VDataTypeList` collections and instantiates `KKW00801SF02DBean` view beans. No service layer or database access is performed. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: FUW00901SF | `FUW00901SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 2 | Screen: FUW00907SF | `FUW00907SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 3 | Screen: FUW00907SF01DBean | `FUW00907SF01DBean.addListDataInstance(key)` (own override, no super call) | (N/A — in-memory only) |
| 4 | Screen: FUW00912SF | `FUW00912SF01DBean.addListDataInstance(key)` (own override, no super call) | (N/A — in-memory only) |
| 5 | Screen: FUW00917SF | `FUW00917SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 6 | Screen: FUW00919SF | `FUW00919SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 7 | Screen: FUW00926SF | `FUW00926SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 8 | Screen: FUW00927SF | `FUW00927SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 9 | Screen: FUW00931SF | `FUW00931SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 10 | Screen: FUW00959SF | `FUW00959SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 11 | Screen: FUW00957SF | `FUW00957SFBean.addListDataInstance(key)` -> `super.addListDataInstance(key)` -> `KKW00801SF01DBean.addListDataInstance(key)` | (N/A — in-memory only) |
| 12 | Screen: FUW00957SF01DBean | `FUW00957SF01DBean.addListDataInstance(key)` (own override, no super call) | (N/A — in-memory only) |
| 13 | Screen: FUW00957SF05DBean | `FUW00957SF05DBean.addListDataInstance(key)` (own override, no super call) | (N/A — in-memory only) |
| 14 | Screen: FUW00964SF | Multiple `FUW00964SF*` subclasses override or delegate to super | (N/A — in-memory only) |
| 15 | Screen: FUW00964SF01DBean, SF04DBean, SF07DBean, SF10DBean | Individual overrides (no super call chain) | (N/A — in-memory only) |

**Note:** Many caller classes implement their own `addListDataInstance(String key)` method, either delegating to `super.addListDataInstance(key)` (which chains down to `KKW00801SF01DBean`), or implementing a fully independent version with their own conditional branches and list types.

## 6. Per-Branch Detail Blocks

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

> Guard clause: rejects null input immediately to avoid NullPointerException.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return -1;` // Returns -1 when key is null // nullの場合、-1で返す |

**Block 2** — [ELSE-IF] `(key.equals("メールメール容量選択リスト"))` (L1302)

> Handles the mail capacity selection list item. Creates a new list container if not yet initialized, instantiates a `KKW00801SF02DBean`, appends it, and returns the index of the new element.
> Data-type item: "メールメール容量選択リスト" (Mail Capacity Selection List, item ID: `mlbox_cap_op_list`)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("メールメール容量選択リスト")` // Checks if key matches mail capacity selection list // データタイプ項目 "メールメール容量選択リスト" |
| 2 | [Block 2.1 — nested IF] `(mlbox_cap_op_list_list == null)` (L1303) |
| 2.1.1 | SET | `mlbox_cap_op_list_list = new X33VDataTypeList();` // Creates new empty list if null // リストがnullの場合、新しく空のインスタンスを生成する |
| 2.2 | SET | `KKW00801SF02DBean tmpBean = new KKW00801SF02DBean();` // Creates a data-type view bean instance // データタイプビューン型で指定したデータタイプビューンのインスタンスを生成する |
| 2.3 | EXEC | `mlbox_cap_op_list_list.add(tmpBean);` // Appends the new bean to the list // Note: データタイプビューンの項目初期値設定は、各データビューン内で定義 |
| 2.4 | RETURN | `return mlbox_cap_op_list_list.size() - 1;` // Returns the 0-based index of the newly added element |

**Block 3** — [ELSE-IF] `(key.equals("ウィルスチェック選択リスト"))` (L1315)

> Handles the virus check selection list item. Same pattern as Block 2 but operates on the virus check list.
> Data-type item: "ウィルスチェック選択リスト" (Virus Check Selection List, item ID: `virus_chk_op_list`)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `key.equals("ウィルスチェック選択リスト")` // Checks if key matches virus check selection list // データタイプ項目 "ウィルスチェック選択リスト" |
| 2 | [Block 3.1 — nested IF] `(virus_chk_op_list_list == null)` (L1316) |
| 3.1.1 | SET | `virus_chk_op_list_list = new X33VDataTypeList();` // Creates new empty list if null // リストがnullの場合、新しく空のインスタンスを生成する |
| 3.2 | SET | `KKW00801SF02DBean tmpBean = new KKW00801SF02DBean();` // Creates a data-type view bean instance // データタイプビューン型で指定したデータタイプビューンのインスタンスを生成する |
| 3.3 | EXEC | `virus_chk_op_list_list.add(tmpBean);` // Appends the new bean to the list // Note: データタイプビューンの項目初期値設定は、各データビューン内で定義 |
| 3.4 | RETURN | `return virus_chk_op_list_list.size() - 1;` // Returns the 0-based index of the newly added element |

**Block 4** — [ELSE — implicit default] (L1326)

> No matching key was found. Returns -1 to indicate failure.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return -1;` // Returns -1 when no matching item exists // 該当する項目がない場合、-1を返す |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `mlbox_cap_op_list` | Field / Item ID | Mail capacity option list — the internal identifier for the email storage capacity selection data-type item |
| `virus_chk_op_list` | Field / Item ID | Virus check option list — the internal identifier for the antivirus/malware protection selection data-type item |
| `mlbox_cap_op_list_list` | Instance Field | Backing `X33VDataTypeList` that holds mail capacity selection option beans |
| `virus_chk_op_list_list` | Instance Field | Backing `X33VDataTypeList` that holds virus check selection option beans |
| `KKW00801SF02DBean` | Class | Data-type view bean — a child bean instantiated to represent a single selectable option within list-type UI controls. Initial value settings are defined internally within this bean class. |
| `X33VDataTypeList` | Class | X33 framework collection type — a typed list data structure that stores `X33VDataTypeBeanInterface` objects, used by the X33 view framework for form data binding |
| `X33VDataTypeBeanInterface` | Interface | Contract that `KKW00801SF01DBean` implements, enabling it to participate in the X33 view data binding system |
| `X33VListedBeanInterface` | Interface | Contract indicating this bean can be used as a listed/listable data element within the X33 framework |
| `KKW00801SF` | Module | Mail settings screen module — a K-Opticom web screen for managing email account settings (mail capacity, virus check, mail alias, etc.) |
| メールメール容量選択リスト | Japanese String Literal | "Mail Capacity Selection List" — the key identifying the mail storage capacity option item |
| ウィルスチェック選択リスト | Japanese String Literal | "Virus Check Selection List" — the key identifying the virus/malware protection option item |
| K-Opticom | Business term | A Japanese telecommunications service provider offering fiber-optic (FTTH) and email services |
| X33 | Technology | Fujitsu Futurity X33 web application framework — a Java-based view framework for building JSF-based enterprise web applications |
| DBean | Naming convention | "Data Bean" — suffix used for view-layer data transfer objects that hold form data and UI state |
| SF | Naming convention | "Screen" suffix — used in screen module names (e.g., KKW00801SF) to identify web screen modules |
