# Business Logic — Mover.setStringArray() [9 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01021SF.Mover` |
| Layer | Utility (Shared Data-Binding Helper in the Web/MVC Screen Layer) |
| Module | `KKW01021SF` (Package: `eo.web.webview.KKW01021SF`) |

## 1. Role

### Mover.setStringArray()

This method is a **shared utility** in the `Mover` helper class that converts a plain Java `String[]` into a type-safe `X31CVector<String>` and writes it into a data bean's message map under a given item key. It is used exclusively in the **Web/MVC screen layer** as part of the `X31` framework's data-binding infrastructure, enabling screens to populate multi-valued fields (arrays) on form beans without exposing raw array types to the view layer.

The method is called by multiple screen logic classes (KKW01024SF, KKW01027SF, KKW01030SF, KKW01031SF, KKA15001SF, KKA15101SF, KKA15201SF) to pass **movement reason codes** (`IDO_RSN_CD`) back to the bean for rendering in UI lists or dropdowns. It implements a simple **wrapper-and-send** pattern: wrap the array, dispatch to the bean, and return void.

There are no conditional branches — the method processes all callers uniformly. It is a **pure transformer** with no database, SC (Service Component), or CBS (Common Business Service) interactions.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setStringArray(bean, item, values)"])
    STEP1["Create X31CVector<String> vector"]

    LOOP_START{for each value in values}
    LOOP_ADD["vector.add(value)"]
    LOOP_END["End for-each"]

    FINAL["bean.sendMessageStringArray(item, DATABEAN_SET_DEF_VALUE, vector)"]
    END(["Return void"])

    START --> STEP1
    STEP1 --> LOOP_START
    LOOP_START --> |"has values"| LOOP_ADD
    LOOP_ADD --> LOOP_START
    LOOP_START --> |"empty"| LOOP_END
    LOOP_END --> FINAL
    FINAL --> END
```

**Constant Resolution:**

| Constant | Actual Value | Business Meaning |
|----------|-------------|------------------|
| `X31CWebConst.DATABEAN_SET_DEF_VALUE` | `"__DEF__"` (framework constant) | Flag indicating the values are default/standard bean entries, as opposed to special error, warning, or transient messages |

**Processing Flow:**

1. **Create empty vector** — Instantiate `X31CVector<String>` (the framework's generic-safe collection type) to hold the string values.
2. **Iterate over input array** — For each `String value` in the `values` array, add it to the vector. If the array is empty, this loop is skipped entirely.
3. **Send to bean** — Call `bean.sendMessageStringArray(...)` with the item key, the `DATABEAN_SET_DEF_VALUE` flag, and the populated vector. This writes the string array into the data bean's message map so the view layer can render it.
4. **Return** — Method returns `void`; the data is now on the bean.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `bean` | `X31SDataBeanAccess` | The screen data bean (data-accessor object) used to pass structured data between the screen logic and the view layer. Holds form fields, messages, and error information for rendering. |
| 2 | `item` | `String` | The key name under which the string array is stored in the bean's message map. In practice, this is always the movement reason code field: `IDO_RSN_CD` ("Movement Reason Code" — 異動理由コード). Identifies which bean field the values populate. |
| 3 | `values` | `String[]` | The array of string values to be transferred into the bean. Represents a set of related string data — typically movement/reason codes that the UI needs to display (e.g., a list of valid reason codes for a dropdown). |

**External state / instance fields read:** None. This method is entirely stateless and uses only its parameters.

## 4. CRUD Operations / Called Services

This method performs **no CRUD operations** and makes no calls to SC (Service Component), CBS (Common Business Service), or any data-access layer. It is a pure in-memory data transformer.

The only method call is `bean.sendMessageStringArray()`, which is a **framework-level bean accessor method** (not a service call) that writes data into the bean's internal message map.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| *(none — in-memory only)* | `X31SDataBeanAccess.sendMessageStringArray()` | *(framework)* | *(in-memory bean map)* | Writes the string vector into the data bean's message map under the given item key, flagged as default value (`DATABEAN_SET_DEF_VALUE`). |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW01027SF | `KKW01027SFLogic.setStringArray(bean, KKW01027SFConst.IDO_RSN_CD, idoRsnCd)` | *(none — pure in-memory)* |
| 2 | Screen:KKW01024SF | `KKW01024SFLogic.setStringArray(bean, KKW01024SFConst.IDO_RSN_CD, idoRsnCds)` | *(none — pure in-memory)* |
| 3 | Screen:KKW01030SF | `KKW01030SFLogic.setStringArray(bean, KKW01030SFConst.IDO_RSN_CD, idoRsnCd)` | *(none — pure in-memory)* |
| 4 | Screen:KKW01031SF | `KKW01031SFLogic.setStringArray(bean, KKW01031SFConst.IDO_RSN_CD, idoRsnCd)` | *(none — pure in-memory)* |
| 5 | Screen:KKW01001SF | `KKW01001SFLogic.setStringArray(...)` (internal helper; calls its own `setStringArray` not `Mover.setStringArray`) | *(none — pure in-memory)* |
| 6 | Screen:KKA15001SF | `KKA15001SFLogic.setStringArray(bean, KKW01027SFConst.IDO_RSN_CD, idoRsnCd)` | *(none — pure in-memory)* |
| 7 | Screen:KKA15101SF | `KKA15101SFLogic.setStringArray(bean, KKW01030SFConst.IDO_RSN_CD, idoRsnCd)` | *(none — pure in-memory)* |
| 8 | Screen:KKA15201SF | `KKA15201SFLogic.setStringArray(bean, KKW01024SFConst.IDO_RSN_CD, idoRsnCds)` | *(none — pure in-memory)* |

**Summary:** Called by 7 distinct screen logic classes across web projects `koptWebA` and `koptWebB`. All callers pass the `IDO_RSN_CD` constant as the item key and a `String[]` of movement/reason codes. No downstream SC/CBS/DB calls exist from this method.

## 6. Per-Branch Detail Blocks

**Block 1** — [ASSIGNMENT] (L1199)

> Initialize the typed vector container.

| # | Type | Code |
|---|------|------|
| 1 | SET | `vector = new X31CVector<String>();` // Create empty generic-safe string vector |

**Block 2** — [FOR-EACH LOOP] `(String value : values)` (L1200)

> Iterate over each element of the input string array and copy it into the vector. If the array is empty (null-handling depends on caller), the loop body is skipped.

| # | Type | Code |
|---|------|------|
| 1 | SET | `value` = current element from `values` array |
| 2 | EXEC | `vector.add(value)` // Add the string value to the vector (framework collection type) |

**Block 3** — [METHOD CALL] (L1203)

> Write the populated vector into the data bean's message map using the framework's typed array message method. The `DATABEAN_SET_DEF_VALUE` flag indicates these are default/standard values (not error or warning messages).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `bean.sendMessageStringArray(item, X31CWebConst.DATABEAN_SET_DEF_VALUE, vector)` // Write string array to bean message map as default values |

**Block 4** — [RETURN] (L1204)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return;` // void method; data is now on the bean |
