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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.FUW07101SF.FUW07101SF02DBean` |
| Layer | View / Data Binding Bean (Web Layer — part of the X33 view-data binding framework) |
| Module | `FUW07101SF` (Package: `eo.web.webview.FUW07101SF`) |

## 1. Role

### FUW07101SF02DBean.addListDataInstance()

This method is a data-binding factory that creates and appends new element instances into repeat-item lists used by the X33 web framework's view-data binding system. It implements the `X33VListedBeanInterface.addListDataInstance()` contract, enabling the framework to dynamically extend tabular or list-type UI components at runtime. Specifically, it supports two repeat-item categories: **"申込台数名リスト" (Order Terminal Name List)** and **"申込台数値リスト" (Order Terminal Value List)**, both of which hold `String`-typed data via `X33VDataTypeStringBean` instances. The method follows a **routing/dispatch pattern**, branching on the `key` parameter to determine which internal `X33VDataTypeList` field to mutate. In the larger system, it serves as a shared utility within the service order/terminal registration screen (`FUW07101SF`), allowing the UI layer to add new rows to order terminal name and value lists as users interact with the form. If the key does not match any supported repeat-item, or if the key is null, the method returns `-1` to signal failure.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["addListDataInstance(String key)"])
    START --> CHECK_NULL{"key == null?"}

    CHECK_NULL -->|true| RETURN_NEG1["return -1"]
    RETURN_NEG1 --> END_N["End"]

    CHECK_NULL -->|false| CHECK_NM{"key equals
申込台数名リスト?"}

    CHECK_NM -->|true| INIT_NM{"nm_list_list == null?"}
    INIT_NM -->|true| CREATE_NM_LIST["nm_list_list = new X33VDataTypeList()"]
    INIT_NM -->|false| CREATE_NM_BEAN
    CREATE_NM_LIST --> CREATE_NM_BEAN["new X33VDataTypeStringBean()"]
    CREATE_NM_BEAN --> ADD_NM["nm_list_list.add(tmpBean)"]
    ADD_NM --> RETURN_NM["return nm_list_list.size() - 1"]

    CHECK_NM -->|false| CHECK_VAL{"key equals
申込台数値リスト?"}

    CHECK_VAL -->|true| INIT_VAL{"val_list_list == null?"}
    INIT_VAL -->|true| CREATE_VAL_LIST["val_list_list = new X33VDataTypeList()"]
    INIT_VAL -->|false| CREATE_VAL_BEAN
    CREATE_VAL_LIST --> CREATE_VAL_BEAN["new X33VDataTypeStringBean()"]
    CREATE_VAL_BEAN --> ADD_VAL["val_list_list.add(tmpBean)"]
    ADD_VAL --> RETURN_VAL["return val_list_list.size() - 1"]

    CHECK_VAL -->|false| RETURN_DEFAULT["return -1"]

    RETURN_NM --> END_N
    RETURN_VAL --> END_N
    RETURN_DEFAULT --> END_N
    END_N(["End"])
```

**Branch summary:**

| Branch | Condition | Business Action |
|--------|-----------|----------------|
| 1 | `key == null` | Return `-1` immediately — no instance created. |
| 2 | `key.equals("申込台数名リスト")` | (Order Terminal Name List) Initialize `nm_list_list` if `null`, create a new `X33VDataTypeStringBean`, append it, and return its index. |
| 3 | `key.equals("申込台数値リスト")` | (Order Terminal Value List) Initialize `val_list_list` if `null`, create a new `X33VDataTypeStringBean`, append it, and return its index. |
| 4 | All other keys | Return `-1` — unsupported repeat-item type. |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `key` | `String` | The repeat-item identifier that determines which list to append to. Two supported values: `"申込台数名リスト"` (Order Terminal Name List, item ID: `nm_list`) and `"申込台数値リスト"` (Order Terminal Value List, item ID: `val_list`). The value controls which internal `X33VDataTypeList` field is mutated. |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `nm_list_list` | `X33VDataTypeList` | The list holding order terminal name entries. Null-checked before mutation; initialized on first add if `null`. |
| `val_list_list` | `X33VDataTypeList` | The list holding order terminal value entries. Null-checked before mutation; initialized on first add if `null`. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| — | `new X33VDataTypeList()` | — | — | Object instantiation — creates a new X33 view-data type list container (in-memory, no DB interaction). |
| — | `new X33VDataTypeStringBean()` | — | — | Object instantiation — creates a new string-type data bean element within the repeat list. |
| — | `X33VDataTypeList.add()` | — | — | In-memory list mutation — appends a new element to the view-data binding list. |

**Classification rationale:** This method performs **no database or service component calls**. It operates entirely within the X33 view-data binding framework's in-memory object model, creating and mutating `X33VDataTypeList` and `X33VDataTypeStringBean` objects. There are no SC (Service Component) codes, CBS (Common Business Service) calls, or DB table operations involved.

## 5. Dependency Trace

This method is called indirectly through the X33 framework's bean management system. The `FUW07101SF02DBean` class implements `X33VListedBeanInterface`, and the framework invokes `addListDataInstance(key)` when dynamically managing repeat-item (repeat-row) UI components on the screen. There are no direct callers identified in the codebase that explicitly reference this method by name — it is invoked through interface dispatch by the X33 web framework's view-data binding engine.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen: FUW07101SF (X33 Framework) | Framework `X33VListedBeanInterface.addListDataInstance(key)` dispatch | In-memory `X33VDataTypeList` mutation (no DB) |

## 6. Per-Branch Detail Blocks

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

> If the key parameter is null, the method returns immediately with `-1`. No processing is performed.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `if(key == null)` |
| 2 | RETURN | `return -1;` // If null, return -1 (nullの場合、-1で返す) |

**Block 2** — [ELSE-IF] `(key.equals("申込台数名リスト")) [Order Terminal Name List]` (L427)

> This branch handles the repeat-item for the order terminal name list (`nm_list`). It ensures the backing list exists, creates a new `X33VDataTypeStringBean` instance, appends it, and returns the zero-based index of the newly added element.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if( key.equals("申込台数名リスト") )` // Repeat item: Order Terminal Name List (String type, item ID: nm_list) (各繰り返し項目の固定要素数指定への処理。配列項目 "申込台数名リスト"(String型、項目ID:nm_list)) |
| 2 | CHECK | `if( nm_list_list == null )` // If the list is null, create a new empty instance (リストがnullの場合、新しい空のインスタンスを生成する) |
| 3 | SET | `nm_list_list = new X33VDataTypeList();` // Initialize the list container (リストがnullの場合、新しい空のインスタンスを生成する) |
| 4 | EXEC | `X33VDataTypeStringBean tmpBean = new X33VDataTypeStringBean();` // Create a new instance of the specified data type bean (データタイプビュービー型で指定したデータタイプのビュービーンのインスタンスを生成する) |
| 5 | CALL | `nm_list_list.add(tmpBean);` // Append the bean to the list (データタイプビュービーンの要素初期値設定は、各データビューン内部で定義) |
| 6 | RETURN | `return nm_list_list.size() - 1;` // Return the zero-based index of the added element (追加された要素のインデックス番号) |

**Block 3** — [ELSE-IF] `(key.equals("申込台数値リスト")) [Order Terminal Value List]` (L437)

> This branch handles the repeat-item for the order terminal value list (`val_list`). It mirrors Block 2 but operates on the `val_list_list` field instead of `nm_list_list`.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `else if( key.equals("申込台数値リスト") )` // Repeat item: Order Terminal Value List (String type, item ID: val_list) (各繰り返し項目の固定要素数指定への処理。配列項目 "申込台数値リスト"(String型、項目ID:val_list)) |
| 2 | CHECK | `if( val_list_list == null )` // If the list is null, create a new empty instance (リストがnullの場合、新しい空のインスタンスを生成する) |
| 3 | SET | `val_list_list = new X33VDataTypeList();` // Initialize the list container (リストがnullの場合、新しい空のインスタンスを生成する) |
| 4 | EXEC | `X33VDataTypeStringBean tmpBean = new X33VDataTypeStringBean();` // Create a new instance of the specified data type bean (データタイプビュービー型で指定したデータタイプのビュービーンのインスタンスを生成する) |
| 5 | CALL | `val_list_list.add(tmpBean);` // Append the bean to the list (データタイプビュービーンの要素初期値設定は、各データビューン内部で定義) |
| 6 | RETURN | `return val_list_list.size() - 1;` // Return the zero-based index of the added element (追加された要素のインデックス番号) |

**Block 4** — [ELSE/FALL-THROUGH] `(all other keys)` (L447)

> If the key does not match any supported repeat-item identifier, return `-1` to indicate no matching item was found.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `nm_list_list` | Field | Order Terminal Name List — internal list holding terminal name entries for service orders |
| `val_list_list` | Field | Order Terminal Value List — internal list holding terminal value entries for service orders |
| `nm_list` | Field | Item ID for the order terminal name repeat list |
| `val_list` | Field | Item ID for the order terminal value repeat list |
| `X33VDataTypeBeanInterface` | Interface | X33 view-data type bean interface — defines getter/setter contracts for view-data bound fields |
| `X33VListedBeanInterface` | Interface | X33 listed bean interface — defines methods for managing repeat-item (list) data binding, including `addListDataInstance()` |
| `X33VDataTypeList` | Class | X33 view-data type list — a container for holding multiple instances of typed view-data beans |
| `X33VDataTypeStringBean` | Class | X33 string-type view-data bean — a single-element bean holding a String value, used as an element within `X33VDataTypeList` |
| `X33SException` | Class | X33 service exception — checked exception thrown by X33 framework methods |
| `FUW07101SF` | Module | Service order / terminal registration screen module — the web screen responsible for registering and managing service orders with terminal equipment |
| "申込台数名リスト" | Japanese key | Order Terminal Name List — a repeat-item whose elements are terminal name strings |
| "申込台数値リスト" | Japanese key | Order Terminal Value List — a repeat-item whose elements are terminal value strings |
| 繰り返しま項目 | Japanese comment | Repeat item — a UI concept for tabular/row-based data entry where each row is an instance of a data bean |
| 固定要素数指定 | Japanese comment | Fixed element count specification — refers to managing repeat lists where the number of rows is determined dynamically at runtime |
| ビュービーン | Japanese comment | View Bean — a Java bean bound to a UI view component in the X33 framework |
| 要素初期値設定 | Japanese comment | Element initial value setting — initialization of default values defined within each data bean's internal logic |
| 追加された要素のインデックス番号 | Japanese javadoc | Index number of the added element — the zero-based position of the newly appended item in the list |
