# Business Logic — KKW01033SF01DBean.getJsflist_ido_rsn_cd() [9 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01033SF.KKW01033SF01DBean` |
| Layer | Service Form (SF) — Data Bean / View Model |
| Module | `KKW01033SF` (Package: `eo.web.webview.KKW01033SF`) |

## 1. Role

### KKW01033SF01DBean.getJsflist_ido_rsn_cd()

This method is a JSP-friendly list getter that converts an internal data list of "Change Reason Codes" (異動理由コード, `ido_rsn_cd`) into a display-ready format of `javax.faces.model.SelectItem` objects, suitable for rendering in an HTML `<h:selectOneListbox>` or `<h:selectManyListbox>` component. It acts as a **binding adapter** — a common pattern in JSF-based enterprise applications where the view layer expects `SelectItem` collections but the backing bean stores data in its own typed list structure (`X33VDataTypeList` of `X33VDataTypeStringBean` items). The method iterates over the `ido_rsn_cd_list` collection, extracts each item's string value, and pairs it with its zero-based index as the selection value. This enables the UI dropdown to carry both a human-readable label and a machine-readable index for each reason code. It is a shared utility within the `KKW01033SF` screen module, which handles customer contract change processing (顧客契約引継, customer contract handover/transfer).

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> INIT["Create ArrayList<SelectItem> ary"]

    INIT --> CHECK_LIST{"ido_rsn_cd_list == null?"}

    CHECK_LIST -->|No| FOR_HEAD["For loop: i = 0; i < list.size()"]

    CHECK_LIST -->|Yes| SKIP_LOOP["Skip loop (empty result)"]

    FOR_HEAD --> CHECK_IDX{"i < list.size()?"}

    CHECK_IDX -->|No| RETURN_ARY["Return ary"]

    CHECK_IDX -->|Yes| GET_ITEM["Get list.get(i), cast to X33VDataTypeStringBean"]

    GET_ITEM --> EXTRACT_VAL["Extract value via getValue() -> itemValue"]

    EXTRACT_VAL --> CREATE_ITEM["Create SelectItem: label=itemValue, value=i.toString()"]

    CREATE_ITEM --> ADD_LIST["ary.add(item)"]

    ADD_LIST --> INCREMENT["i++"]

    INCREMENT --> CHECK_IDX

    SKIP_LOOP --> RETURN_ARY
```

**Processing overview:**
- The method initializes an empty `ArrayList<SelectItem>`.
- It then enters a for-loop iterating over the internal `ido_rsn_cd_list` (a list of `X33VDataTypeStringBean` objects).
- For each element, it casts the item to `X33VDataTypeStringBean`, extracts the string value, and creates a `SelectItem` where the **value** is the zero-based index (as a String) and the **label** is the extracted reason code string.
- Each `SelectItem` is added to the result list, and the loop continues until all elements are processed.
- The resulting list is returned to the caller for use in a JSF dropdown component.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | - |

### Instance Fields Read

| No | Field Name | Type | Business Description |
|----|-----------|------|---------------------|
| 1 | `ido_rsn_cd_list` | `X33VDataTypeList` | The internal list of change reason code values. Each element is an `X33VDataTypeStringBean` wrapping a string reason code. This list is populated by the framework (X33) during data binding from the view layer, and may contain multiple reason codes if the user selected multiple items. |

## 4. CRUD Operations / Called Services

No external CRUD operations are performed. This method is a pure view-model adapter with no database, SC (Service Component), or CBS (Business Service) interactions.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | - | - | - | No database or service calls — pure in-memory data transformation |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JSP: KKW010330PJP | `KKW01033SFBean` -> `cust_kei_hktgi_list_list.get(0)` -> `KKW01033SF01DBean` -> `getJsflist_ido_rsn_cd` | N/A (no external calls) |

**Notes:**
- The `KKW01033SF01DBean` is instantiated as part of the `KKW01033SFBean` form bean hierarchy (as a child bean within `cust_kei_hktgi_list_list`).
- The method is invoked by the JSP page `KKW010330PJP.jsp` via EL/ scripting expressions to populate a dropdown list for "Change Reason Code" (異動理由コード).
- No other callers were found across the codebase that directly invoke this method on `KKW01033SF01DBean`.

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] `(line 194)`

Initialize the result list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ary = new ArrayList<SelectItem>()` // Create empty result list for SelectItem objects |

**Block 2** — [FOR LOOP] `(line 195)`

Iterate over each element in the internal `ido_rsn_cd_list`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` // Loop index initialization |
| 2 | EXEC | `ido_rsn_cd_list.size()` // Evaluate list size as loop bound |
| 3 | SET | `ary[i] = processed item` // Accumulate result in ary |
| 4 | EXEC | `i++` // Increment loop counter |

**Block 2.1** — [LOOP BODY: GET AND CAST] `(line 196)`

Retrieve the current list element and cast it to the expected type.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ido_rsn_cd_list.get(i)` // Get element at index i from list |
| 2 | SET | Cast `X33VDataTypeList` element to `X33VDataTypeStringBean` |

**Block 2.2** — [LOOP BODY: EXTRACT VALUE] `(line 196)`

Extract the actual string value from the typed bean wrapper.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `((X33VDataTypeStringBean) item).getValue()` // Extract wrapped string value -> `itemValue` |

**Block 2.3** — [LOOP BODY: CREATE SELECTITEM] `(line 197)`

Construct a JSF SelectItem with index as value and reason code as label.

| # | Type | Code |
|---|------|------|
| 1 | SET | `SelectItem item = new SelectItem(i.toString(), itemValue)` // value=index, label=reason code |

**Block 2.4** — [LOOP BODY: ADD TO RESULT] `(line 198)`

Append the prepared SelectItem to the result list.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `ary.add(item)` // Add to result list |

**Block 3** — [RETURN] `(line 200)`

Return the fully populated list of SelectItems to the view layer.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return ary` // Return ArrayList<SelectItem> to caller |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd` | Field | Change Reason Code (異動理由コード) — the reason code explaining why a customer contract was changed, transferred, or moved. Used during customer contract handover processing. |
| `ido_rsn_cd_list` | Field | List of change reason code values — internal typed list storage (X33VDataTypeList) that holds `X33VDataTypeStringBean` items, each wrapping a string reason code. |
| `SelectItem` | Class | JSF model class (`javax.faces.model.SelectItem`) used for populating dropdown/list components. Holds a display label and a hidden value. |
| `X33VDataTypeStringBean` | Class | Fujitsu X33 framework typed data wrapper for String values. Provides type-safe value access via `getValue()`. |
| `X33VDataTypeList` | Class | Fujitsu X33 framework typed list container. Holds a list of `X33VDataTypeBeanInterface` items and provides typed access via `get(index)`. |
| `KKW01033SF` | Module | Customer Contract Change Screen module — handles customer contract handover/transfer (顧客契約引継ぎ) operations. |
| `KKW01033SF01DBean` | Class | Detail data bean for the KKW01033SF screen. Holds per-line-item data for the "Customer Contract Handover List" (顧客契約引継リスト). |
| `KKW010330PJP` | JSP | The JSP page for the customer contract change screen. It instantiates the bean and calls methods like `getJsflist_ido_rsn_cd()` to populate form fields. |
| SF | Acronym | Service Form — a screen-level form bean that coordinates view data for a single screen. Part of the X33 web framework's MVC pattern. |
| JSF | Acronym | JavaServer Faces — Oracle's component-based UI framework for Java web applications. Uses `SelectItem` for dropdown/list components. |
| `cust_kei_hktgi_list` | Field | Customer Contract Handover List (顧客契約引継リスト) — the primary data table on the screen, stored as a list of `KKW01033SF01DBean` items within the parent `KKW01033SFBean`. |
