# Business Logic — KKW02541SFLogic.setNinshoID() [53 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02541SF.KKW02541SFLogic` |
| Layer | Controller (Web View Logic) |
| Module | `KKW02541SF` (Package: `eo.web.webview.KKW02541SF`) |

## 1. Role

### KKW02541SFLogic.setNinshoID()

This method performs the **display authentication ID creation processing** (表示用認証ID作成処理) — it generates a composite authentication identifier for screen display by iterating over the **bandwidth information list** (帯域情報リスト) contained in the parameter data beans. For each row in the list, it retrieves the **ISP authentication ID** (ISP認証ID) and, if present, the **multi-session authentication ID** (マルチセッショニング用認証ID), then combines them into a single comma-separated **display authentication ID** (表示用認証ID) that is written back to the data bean for rendering. This method acts as a **data transformer / presentation preparer** — it does not perform any CRUD operations on databases, but rather reshapes domain-specific authentication data into a display-friendly format for the web view. It also handles alternating row-style assignment ("odd" / "even") for table row visual styling on the client side, implementing a simple **iterative data enrichment** pattern across all rows of the bandwidth information list.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setNinshoID(paramBean)"])
    START --> GET_TIK["Get TIK_LIST (Bandwidth Information List)"]
    GET_TIK --> LOOP_INIT["Initialize i = 0"]
    LOOP_INIT --> LOOP_CHECK{"i < tik_list.getCount()?"}
    LOOP_CHECK -- "Yes" --> LOOP_BODY["Enter loop body"]
    LOOP_BODY --> INIT_TIK_BEAN["Set tik_bean = null"]
    INIT_TIK_BEAN --> RANGE_CHECK{"tik_list.getCount() - 1 >= i?"}
    RANGE_CHECK -- "Yes" --> GET_BEAN["Get existing bean: tik_list.getDataBean(i)"]
    RANGE_CHECK -- "No" --> ADD_BEAN["Add new bean: tik_list.addDataBean()"]
    GET_BEAN --> NULL_CHECK{"tik_bean == null?"}
    ADD_BEAN --> NULL_CHECK
    NULL_CHECK -- "Yes" --> CONTINUE["Continue to next iteration"]
    NULL_CHECK -- "No" --> INIT_VARS["Initialize ninsho_id = null"]
    INIT_VARS --> GET_ISP["Get ISP authentication ID from data bean"]
    GET_ISP --> GET_MLTISE["Get Multi-session auth ID from data bean"]
    GET_MLTISE --> MLTISE_CHECK{"mltise_ninsho_id == null or empty?"}
    MLTISE_CHECK -- "Yes" --> USE_ISP_ONLY["ninsho_id = isp_ninsho_id"]
    MLTISE_CHECK -- "No" --> COMBINE_IDS["ninsho_id = isp_ninsho_id + ',' + mltise_ninsho_id"]
    USE_ISP_ONLY --> SET_DISPLAY_ID["Set display auth ID: sendMessageString(NINSHO_ID_01, ninsho_id)"]
    COMBINE_IDS --> SET_DISPLAY_ID
    SET_DISPLAY_ID --> ODD_CHECK{"i % 2 == 1?"}
    ODD_CHECK -- "Yes (odd)" --> SET_EVEN["Set ROW_STYLE = 'even'"]
    ODD_CHECK -- "No (even)" --> SET_ODD["Set ROW_STYLE = 'odd'"]
    SET_EVEN --> NEXT_ITER["i++"]
    SET_ODD --> NEXT_ITER
    NEXT_ITER --> LOOP_CHECK
    LOOP_CHECK -- "No" --> END_NODE(["Return / Next"])
    CONTINUE --> NEXT_ITER
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | An array of data bean access objects representing screen-level business data. `paramBean[0]` contains the **bandwidth information list** (帯域情報リスト) which holds per-row domain information including ISP authentication IDs, multi-session authentication IDs, service contract numbers, and other display fields. This array serves as the primary data conduit between the controller and the view layer. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `OneStopDataBeanAccessArray.getDataBeanArray` | OneStopDataBeanAccessArray | - | Retrieves the bandwidth information list (帯域情報リスト) from `paramBean[0]` — a read of the in-memory data bean collection |
| R | `OneStopDataBeanAccessArray.getCount` | OneStopDataBeanAccessArray | - | Gets the count of rows in the bandwidth information list to drive the loop iteration |
| R | `OneStopDataBeanAccessArray.getDataBean` | OneStopDataBeanAccessArray | - | Retrieves an existing data bean at index `i` from the bandwidth information list |
| C | `OneStopDataBeanAccessArray.addDataBean` | OneStopDataBeanAccessArray | - | Adds a new (empty) data bean to the bandwidth information list when the list does not yet have a row for the current index — effectively growing the list |
| R | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Reads the **ISP authentication ID** (ISP認証ID) field value from a data bean row |
| R | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Reads the **multi-session authentication ID** (マルチセッショニング用認証ID) field value from a data bean row |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Writes the computed **display authentication ID** (表示用認証ID) back to the data bean row |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Writes the alternating **row style** ("odd" / "even") for CSS class assignment on the client side |

**CRUD Summary:** This method performs **0 database operations**. It is a pure **data transformation** layer that reads from and writes to in-memory data beans (`OneStopDataBeanAccess` / `OneStopDataBeanAccessArray`). The only side effect is modifying the data bean content for screen rendering.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `KKW02541SFLogic.actionInit()` | `actionInit()` -> `setNinshoID(paramBean)` | `sendMessageString` [-] (display auth ID), `sendMessageString` [-] (row style), `addDataBean` [C] (row growth), `getDataBean` [R] (bandwidth list row), `getDataBeanArray` [R] (bandwidth list) |

**Context:** The method is called from `KKW02541SFLogic.actionInit()`, which is the initialization handler for the KKW02541SF screen. This indicates the method is part of the **screen entry initialization flow** — it prepares the bandwidth information list data beans with computed display authentication IDs before the view is rendered.

## 6. Per-Branch Detail Blocks

**Block 1** — [GET ARRAY] `(paramBean[0].getDataBeanArray)` (L146)

> Retrieves the bandwidth information list from the first data bean in the parameter array.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `X31SDataBeanAccessArray tik_list = paramBean[0].getDataBeanArray(KKW02541SFConst.TIK_LIST)` |

**Block 2** — [FOR LOOP] `(int i = 0; i < tik_list.getCount(); i++)` (L148)

> Iterates over all rows in the bandwidth information list, processing each row's authentication IDs.

| # | Type | Code |
|---|------|------|
| 1 | SET | `tik_bean = null` // Initialize local reference [-> `null`] |

**Block 2.1** — [IF] `(tik_list.getCount() - 1 >= i)` (L150)

> Checks whether an existing data bean is available at the current index.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tik_bean = tik_list.getDataBean(i)` // Get existing bean at index i |

**Block 2.2** — [ELSE] `(tik_list.getCount() - 1 < i)` (L153)

> When the list does not yet have a bean at the current index, a new bean is created. This handles the case where new rows may need to be added to the display list.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tik_bean = tik_list.addDataBean()` // Add new bean to the list |

**Block 2.3** — [IF] `(tik_bean == null)` (L156)

> Null-guard: if the data bean could not be obtained or created, skip this row and continue to the next iteration.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip to next iteration |

**Block 3** — [INITIALIZATION] (L161-L162)

> Initializes local variables for the authentication ID computation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ninsho_id = null` // Display authentication ID (表示用認証ID) |

**Block 4** — [DATA EXTRACTION] (L164-L170)

> Retrieves both authentication IDs from the data bean row.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `isp_ninsho_id = tik_bean.sendMessageString(KKW02541SFConst.ISP_NINSHO_ID_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get ISP Authentication ID (ISP認証ID) |
| 2 | EXEC | `mltise_ninsho_id = tik_bean.sendMessageString(KKW02541SFConst.MLTISE_NINSHO_ID_01, X31CWebConst.DATABEAN_GET_VALUE)` // Get Multi-session Authentication ID (マルチセッショニング用認証ID) |

**Block 5** — [IF] `(mltise_ninsho_id == null || "".equals(mltise_ninsho_id))` (L172)

> Determines the composite display authentication ID. If no multi-session authentication ID is present, the display ID is simply the ISP authentication ID. Otherwise, the two IDs are concatenated with a comma separator.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ninsho_id = isp_ninsho_id` // Use ISP auth ID alone [When no multi-session auth ID] |

**Block 5.1** — [ELSE] `(mltise_ninsho_id != null && !"".equals(mltise_ninsho_id))` (L175)

> When a multi-session authentication ID exists, combine both IDs into a comma-separated string for display purposes.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ninsho_id = isp_ninsho_id + "," + mltise_ninsho_id` // Concatenate both auth IDs with comma separator |

**Block 6** — [SET DISPLAY ID] (L179-L180)

> Writes the computed display authentication ID back to the data bean for screen rendering.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tik_bean.sendMessageString(KKW02541SFConst.NINSHO_ID_01, X31CWebConst.DATABEAN_SET_VALUE, ninsho_id)` // Set display auth ID (表示用認証ID) |

**Block 7** — [IF] `(i % 2 == 1)` (L187)

> Alternating row-style assignment for visual table styling. When the index is odd (i % 2 == 1), assigns the CSS class "even". This is the first half of a standard alternating-row stripe pattern (odd-indexed rows receive "even" style, even-indexed rows receive "odd" style).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tik_bean.sendMessageString(KKW02541SFConst.ROW_STYLE_01, X31CWebConst.DATABEAN_SET_VALUE, "even")` // Set row style for odd-indexed rows |

**Block 7.1** — [ELSE] `(i % 2 != 1)` (L190)

> When the index is even (i % 2 == 0), assigns the CSS class "odd" for the alternating stripe pattern.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `tik_bean.sendMessageString(KKW02541SFConst.ROW_STYLE_01, X31CWebConst.DATABEAN_SET_VALUE, "odd")` // Set row style for even-indexed rows |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `tik_list` (帯域情報リスト) | Field | Bandwidth information list — a collection of data bean rows representing bandwidth domain entries, each containing authentication IDs and other domain-specific display fields |
| `ISP_NINSHO_ID_01` (ISP認証ID) | Field | ISP Authentication ID — the primary authentication identifier assigned by the Internet Service Provider for a service contract |
| `MLTISE_NINSHO_ID_01` (マルチセッショニング用認証ID) | Field | Multi-session Authentication ID — an additional authentication identifier used when multiple sessions are configured on a single service line |
| `NINSHO_ID_01` (表示用認証ID) | Field | Display Authentication ID — the combined/computed authentication ID written to the data bean for display on the web screen (ISP ID, optionally concatenated with multi-session ID) |
| `ROW_STYLE_01` (行スタイル) | Field | Row Style — a CSS class indicator ("odd" or "even") used to create alternating row stripes in HTML table rendering for visual readability |
| `paramBean[0]` | Field | First data bean in the parameter array — serves as the root container holding the bandwidth information list and other screen-level data |
| `X31SDataBeanAccess` | Technical | Data bean access interface — the object used to get/set field values on screen data beans via the `sendMessageString` pattern |
| `X31SDataBeanAccessArray` | Technical | Data bean array access — a specialized data bean container that supports indexed access (`getDataBean(i)`, `addDataBean()`, `getCount()`) for tabular row data |
| `X31CWebConst.DATABEAN_GET_VALUE` | Constant | Data bean constant — used as the "command" parameter of `sendMessageString` to indicate a field-read operation |
| `X31CWebConst.DATABEAN_SET_VALUE` | Constant | Data bean constant — used as the "command" parameter of `sendMessageString` to indicate a field-write operation |
| `KKW02541SF` | Module | Web screen module — a K-Opticom web application module for bandwidth information display functionality |
| K-Opticom | Business term | A Japanese telecommunications service provider offering broadband, cable, and other network services to residential and business customers |
