# Business Logic — Mover.setBeanMapListForDataBeanArray() [10 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01021SF.Mover` |
| Layer | Service (Webview Logic Layer) |
| Module | `KKW01021SF` (Package: `eo.web.webview.KKW01021SF`) |

## 1. Role

### Mover.setBeanMapListForDataBeanArray()

This method serves as a batch data-conversion utility that transforms a list of `BeanMap` objects into an `X31SDataBeanAccessArray` structure, enabling efficient bulk population of data beans for screen-bound data exchange. In the application's web architecture, `BeanMap` objects represent a flexible key-value data model used internally during processing, while `X31SDataBeanAccessArray` is the typed data structure expected by the framework for screen-to-logic and logic-to-screen data transfer. The method implements the **delegation pattern** — it delegates the per-element conversion logic to `setBeanMapToDataBean`, which handles the nuanced mapping of individual `BeanMap` entries to `X31SDataBeanAccess` instances based on value type resolution (String, Long, Boolean, String arrays, Long arrays, Boolean arrays). Its role in the larger system is as a **shared data-transformer** that bridges the flexible `BeanMap` representation and the strongly-typed `DataBeanAccess` framework, used by other Mover methods such as `setBeanMapToDataBean` to avoid duplicating the bulk conversion loop across multiple callers.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setBeanMapListForDataBeanArray(beanArray, beanMapList)"])
    CLEAR["beanArray.clearArray()"]
    LOOP["for (BeanMap beanMap : beanMapList)"]
    ADD["beanArray.addDataBean() -> bean"]
    CALL["setBeanMapToDataBean(beanMap, bean)"]
    LOOP_END(["Next iteration or exit loop"])
    RETURN(["Return void"])

    START --> CLEAR
    CLEAR --> LOOP
    LOOP --> ADD
    ADD --> CALL
    CALL --> LOOP_END
    LOOP_END --> LOOP
    LOOP_END --> RETURN
```

**Processing Description:**

1. **Clear existing data:** The method begins by calling `clearArray()` on the provided `beanArray` to ensure any pre-existing data beans are discarded, guaranteeing a clean slate for the batch population.
2. **Iterate over BeanMap list:** For each `BeanMap` in the input `beanMapList`, the method performs the following steps:
   - **Add a new data bean:** Calls `addDataBean()` on the `beanArray` to allocate and retrieve a new `X31SDataBeanAccess` instance.
   - **Populate the data bean:** Delegates to `setBeanMapToDataBean(beanMap, bean)`, which iterates over each key-value pair in the `BeanMap` and sets the corresponding field on the `X31SDataBeanAccess` bean, resolving the value type (String, Long, Boolean, array types) to determine the correct setter method.
3. **Return:** After all BeanMaps have been processed, the method returns void — the transformed data is now available in the `beanArray` parameter.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `beanArray` | `X31SDataBeanAccessArray` | A mutable, framework-managed array of data beans that serves as the output container. It holds typed data entries that are passed between the web layer and the business logic layer. This method clears any existing entries before populating it fresh from the input list. |
| 2 | `beanMapList` | `ArrayList<BeanMap>` | A list of key-value maps, where each `BeanMap` represents a single row or record of data to be converted. Each map contains field names as keys and their corresponding values (String, Long, Boolean, or array variants) as values. The list is iterated sequentially — each entry becomes one data bean in the output array. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `X31SDataBeanAccessArray.addDataBean` | X31SFramework | - | Adds a new data bean to the array for each BeanMap in the input list |
| C | `OneStopDataBeanAccessArray.clearArray` | X31SFramework | - | Clears all existing data beans from the array before population |
| C | `Mover.setBeanMapToDataBean` | Mover | - | Populates a single X31SDataBeanAccess instance with values from a BeanMap via type-resolved setters |

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `setBeanMapToDataBean` [-], `addDataBean` [C], `clearArray` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Mover | `setBeanMapToDataBean` -> `setBeanMapListForDataBeanArray` | `setBeanMapToDataBean` [-], `addDataBean` [C], `clearArray` [-] |

## 6. Per-Branch Detail Blocks

**Block 1** — EXEC `(clearArray)` (L1459)

> Clear any pre-existing data beans from the array to ensure a clean slate before batch population.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `beanArray.clearArray();` |

**Block 2** — FOR `(BeanMap beanMap : beanMapList)` (L1460–1465)

> Iterate over each BeanMap in the input list. For each entry, allocate a new data bean and populate it by delegating to `setBeanMapToDataBean`.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (BeanMap beanMap : beanMapList)` |
| 2 | CALL | `X31SDataBeanAccess bean = beanArray.addDataBean();` |
| 3 | CALL | `setBeanMapToDataBean(beanMap, bean);` // 再呼び出しし出し (Recursive call-out / Re-entry invocation) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `BeanMap` | Data Structure | A flexible key-value map representation used internally for passing arbitrary field-value pairs between processing stages. Keys are field names; values are typed objects (String, Long, Boolean, or arrays thereof). |
| `X31SDataBeanAccessArray` | Data Structure | A framework-managed container of typed data bean instances (`X31SDataBeanAccess`) used for data exchange between the web layer and business logic layer in the X31S framework. |
| `X31SDataBeanAccess` | Data Structure | A single typed data bean instance within the X31S framework, holding strongly-typed field values for a single record/row of data. |
| `setBeanMapToDataBean` | Method | Internal utility method that maps key-value pairs from a `BeanMap` to field values on an `X31SDataBeanAccess` instance, resolving value types (String, Long, Boolean, array types) to determine the correct setter. |
| `addDataBean` | Framework Method | Allocates and returns a new `X31SDataBeanAccess` instance within the array, incrementing the internal bean count. |
| `clearArray` | Framework Method | Removes all existing data beans from the array, resetting it to an empty state. |
| `ValueType` | Enum | An enumeration that classifies a value into one of: NULL, STRING, LONG, BOOLEAN, STRINGS (String[]), LONGS (Long[]), BOOLEANS (Boolean[]), used by `setBeanMapToDataBean` to determine the appropriate field setter. |
| `再呼び出しし出し` | Comment | Japanese comment meaning "Re-entry invocation" — indicates this is a recursive or re-entrant call pattern where `setBeanMapToDataBean` is invoked as part of the bulk conversion loop. |
