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

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW01021SF.KKW01021SF01DBean` |
| Layer | Web View (DataBean / Presentation — `eo.web.webview` package, implements `X33VDataTypeBeanInterface` and `X33VListedBeanInterface`) |
| Module | `KKW01021SF` (Package: `eo.web.webview.KKW01021SF`) |

## 1. Role

### KKW01021SF01DBean.getJsflist_ido_rsn_cd()

This method is a view-data transformer in the K-Opticom customer core system (`eo` system). It converts the internal `ido_rsn_cd_list` (異動理由コード明細 — change reason code details) data list into a format suitable for rendering an HTML `<select>` dropdown on the web UI. The method iterates over `X33VDataTypeList` entries, each holding a `X33VDataTypeStringBean` with a reason code string, and produces an `ArrayList<SelectItem>` where each item's value is its list index (as a string) and its label is the actual reason code text.

This is a standard **data adapter pattern** used across the X33 web framework: every DBean in this application that needs a dropdown selection list implements an almost-identical `getJsflist_*` method. The same pattern is replicated across 30+ DBeans (e.g., `KKW02516SF01DBean`, `KKW00825SFBean`, `KKW01027SF01DBean`, `KKW03204SF01DBean`) across many screen modules (`KKA15xxx`, `KKA16xxx`, `KKA17xxx` series).

The method plays the role of a **shared UI preparation utility** within the `KKW01021SF` discount service contract screen module. It bridges the application's internal `X33VDataTypeList` data structure (used for form state management and validation) and JSF's `<h:selectOneMenu>` component (which consumes `SelectItem`). It has no external dependencies, no service calls, and no business logic beyond this data transformation.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["getJsflist_ido_rsn_cd()"])
    STEP1["Create empty ArrayList&lt;SelectItem&gt;"]
    STEP2["i = 0"]
    STEP3["i &lt; ido_rsn_cd_list.size()?"]
    STEP4["Cast item to X33VDataTypeStringBean"]
    STEP5["Extract String value via getValue()"]
    STEP6["Create SelectItem with index (String) as value, string as label"]
    STEP7["Add item to list"]
    STEP8["i++"]
    STEP9["Return ArrayList&lt;SelectItem&gt;"]

    START --> STEP1 --> STEP2 --> STEP3
    STEP3 -- "true" --> STEP4 --> STEP5 --> STEP6 --> STEP7 --> STEP8 --> STEP3
    STEP3 -- "false" --> STEP9
```

The method performs a straightforward linear transformation with no conditional branches. Each iteration extracts a reason code string from the typed data list wrapper and pairs it with its positional index. This index becomes the submitted form value, enabling the backing logic to identify which row the user selected regardless of the text content.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This is a no-argument getter method. |
| 1 | `ido_rsn_cd_list` (instance field) | `X33VDataTypeList` | Change reason code detail list — a list of valid reason codes for service contract changes (e.g., suspension, resumption, cancellation reasons). Each element is a `X33VDataTypeStringBean` wrapping a reason code string. Populated by the business logic layer (`KKW01021SFLogic`) before UI render. |

**External state read:**
- `ido_rsn_cd_list` — an instance field initialized to `new X33VDataTypeList()` in the constructor. It is populated by the corresponding logic class during the screen's `actionInit` or data acquisition flow, containing the list of valid reason codes (異動理由コード) that the customer can select from.

## 4. CRUD Operations / Called Services

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

This method contains no service calls, no CBS invocations, and no database access. It performs pure in-memory data transformation only.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | (none) | - | - | No CRUD operations — pure UI data adapter with no external dependencies. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW01021 (KKW01021SF) | `KKW01021SFLogic.actionInit` -> `KKW01021SF01DBean` -> `getJsflist_ido_rsn_cd` | None |
| 2 | Screen:KKW01022 (KKW01021SF) | `KKW01021SFLogic.actionInitKKW01022` -> `KKW01021SF01DBean` -> `getJsflist_ido_rsn_cd` | None |
| 3 | Screen:KKW01030 (KKW01030SF) | `KKW01030SFLogic` -> `KKW01021SF01DBean` -> `getJsflist_ido_rsn_cd` | None |

**Note:** The identical `getJsflist_ido_rsn_cd()` method signature (same body) is defined in 30+ DBeans across multiple screen modules (`KKA15xxx`, `KKA16xxx`, `KKA17xxx`). These are copied by the "Web Client tool V01/L01" (as noted in the file header) and are not inherited. Each module defines its own copy operating on its module-specific `ido_rsn_cd_list` field. This method is primarily consumed by JSP/JSF pages that bind `<h:selectOneMenu>` to the returned `SelectItem` list for rendering a dropdown of change reason codes.

## 6. Per-Branch Detail Blocks

**Block 1** — [LOOP] `for(int i = 0; i < ido_rsn_cd_list.size(); i++)` (L158)

> Iterates over each entry in the change reason code detail list to build a `SelectItem` for the UI dropdown.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ArrayList ary = new ArrayList<SelectItem>();` // Create empty result list [L157] |
| 2 | SET | `i = 0` // Loop counter [L158] |
| 3 | COND | `i < ido_rsn_cd_list.size()` // Continue while not exhausted [L158] |

**Block 1.1** — [IF-BODY] loop body (L159–L163)

> Extracts reason code string from typed list wrapper and constructs a `SelectItem`.

| # | Type | Code |
|---|------|------|
| 1 | CAST | `(X33VDataTypeStringBean) ido_rsn_cd_list.get(i)` // Cast raw Object to typed bean [L159] |
| 2 | EXEC | `.getValue()` // Extract String value from wrapper [L159] |
| 3 | SET | `itemValue = (String) ...` // Store as String [L159] |
| 4 | SET | `new Integer(i).toString()` // Convert index to string as SelectItem value [L160] |
| 5 | EXEC | `new SelectItem(String value, String label)` // Create JSF SelectItem [L160] |
| 6 | CALL | `ary.add(item)` // Add to result list [L161] |
| 7 | SET | `i++` // Increment counter [L158] |

**Block 2** — [RETURN] (L164)

> Returns the populated `ArrayList<SelectItem>` to the caller.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return ary;` // Return the SelectItem list for UI rendering [L164] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `ido_rsn_cd_list` | Field | Change reason code detail list — list of valid reason codes (e.g., suspension, resumption, cancellation) for service contract line items. Each element is a string wrapped in `X33VDataTypeStringBean`. |
| `ido_rsn_cd` | Field | Change reason code — the actual reason code string (e.g., "1" for suspension, "2" for resumption) stored per list entry. |
| `ido_rsn_cd_list_err` | Field | Change reason code detail error field — error message associated with the reason code list (used for validation feedback). |
| `SelectItem` | Type | JSF UI component data type — represents an option in a dropdown list, with a `value` (submitted form value) and a `label` (displayed text). |
| `X33VDataTypeList` | Type | X33 framework generic list type — a framework-managed collection of `X33VDataType` objects used for form data binding. |
| `X33VDataTypeStringBean` | Type | X33 framework string data wrapper — a typed container that wraps a `String` value within the X33 data type system, providing `getValue()` and `setValue()` accessors. |
| `X33VDataTypeBeanInterface` | Interface | X33 framework interface — marks a class as a data bean that can participate in the X33 form binding framework. |
| `X33VListedBeanInterface` | Interface | X33 framework interface — marks a class as a list-capable bean (supports dynamic row addition/removal in table-style forms). |
| `KKW01021SF` | Module | Discount service contract list view screen — the primary screen module for viewing and managing discount service contracts. |
| `KKW01022` | Screen | Discount service contract history view screen — shows the history of changes to discount service contracts. |
| `KKW01030` | Screen | Discount service contract cancellation selection screen — allows users to select and cancel discount service contracts. |
| JSF | Acronym | JavaServer Faces — Sun/Oracle's component-based web framework for building UI. |
| DBean | Abbreviation | DataBean — a Java class that holds form data for a web screen, implementing the X33 framework's data binding interfaces. |
| SF | Abbreviation | Screen (Form) — in K-Opticom naming, a "screen" module identifier (e.g., KKW01021SF). |
| X33 | System | X33 Web Client tool — Fujitsu's internal web application framework (version 2.0.39 at time of this file's initial creation). |
| Web Client tool | Tool | Fujitsu code generation tool (V01/L01) — generates boilerplate DBean, Logic, and Checker classes from design specifications. |
