# Business Logic — KKW03204SFLogic.setDataKaihk() [28 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW03204SF.KKW03204SFLogic` |
| Layer | Controller (Webview/Screen Logic) |
| Module | `KKW03204SF` (Package: `eo.web.webview.KKW03204SF`) |

## 1. Role

### KKW03204SFLogic.setDataKaihk()

This method performs **data setup for the recovery screen** (回復処理 — kaihi shori), populating the view-layer DataBean with the values required for the KKW03204SF recovery information screen. Specifically, it sets the **recovery year/month/day** (回復年月日) to the current operation date, and ensures the **aging information list** (エイジング情報リスト) exists in the form's DataBean structure, initializing a default aging entry with the telecom service type code and the aging target value (HRADSI_050_NO). The method acts as a **DataBean builder** invoked during the `actionFix()` workflow, which is the screen's primary action handler. It follows the **delegation pattern**, offloading date acquisition to `JCCWebCommon` and DataBean management to the `X31SDataBeanAccess`/`X31SDataBeanAccessArray` infrastructure. In the larger system, this method prepares screen display data — it does **not** perform any CRUD operations against the database; instead, it constructs the view model that the screen renders to the user.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setDataKaihk()"])
    STEP1["Get X31SDataBeanAccess bean = super.getServiceFormBean()"]
    STEP2["Get opeDate = JCCWebCommon.getOpeDate(this, null)"]
    STEP3["Set KAIHK_YMD with opeDate via sendMessageString"]
    STEP4["Get aging_info_list = bean.getDataBeanArray(AGING_INFO_LIST)"]
    COND{Check: count == 0<br>or list == null?}
    STEP5["aging_info_bean = aging_info_list.addDataBean()"]
    STEP6["Set AGING_SBT_CD to AGING_SBT_CD_TEL"]
    STEP7["Get aging_sbt_cd from HRADSI_050_NO"]
    STEP8["Set AGING_TG_VALUE with aging_sbt_cd"]
    END_NODE(["End / Return"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> COND
    COND --> |true| STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> END_NODE
    COND --> |false| END_NODE
```

**Processing Flow Summary:**

1. **Retrieve form bean** — Obtain the `X31SDataBeanAccess` instance representing the current screen's DataBean.
2. **Acquire operation date** — Fetch the current operation date from the shared `JCCWebCommon` utility (this is the system date used for business processing).
3. **Set recovery date** — Store the operation date into the DataBean under key `KAIHK_YMD` (recovery year/month/day).
4. **Initialize aging info list** — Retrieve the aging information list array. If it is empty (`getCount() == 0`) or `null`, create a new entry.
5. **Configure aging entry** — For the new entry, set the aging service type code to `AGING_SBT_CD_TEL` (telecom), retrieve the aging target value from `HRADSI_050_NO`, and store it as `AGING_TG_VALUE`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It operates entirely on the screen's form DataBean obtained via `super.getServiceFormBean()` and internal state. |

**Instance fields / external state read:**

| Source | Type | Business Description |
|--------|------|---------------------|
| `super.getServiceFormBean()` | `X31SDataBeanAccess` | The screen's form DataBean — the shared data structure that holds all form-level data for the KKW03204SF recovery screen |
| `JCCWebCommon` | Utility class | Provides the current operation date (`getOpeDate`) used as the recovery date |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate` | JCCWebCommon | - | Reads the current operation date (system date) for business use |
| R | `X31SDataBeanAccess.getDataBeanArray` | OneStopDataBeanAccess | - | Retrieves the aging info list from the form DataBean |
| C | `OneStopDataBeanAccessArray.addDataBean` | OneStopDataBeanAccessArray | - | Creates a new DataBean entry in the aging info list |
| R | `OneStopDataBeanAccessArray.getCount` | OneStopDataBeanAccessArray | - | Checks if the aging info list has any existing entries |
| - | `X31SDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Sets/gets values in the DataBean (KAIHK_YMD, AGING_SBT_CD, AGING_TG_VALUE, HRADSI_050_NO) |

**Analysis:**
This method performs **zero direct database operations**. All operations are **in-memory DataBean manipulation** — reading from and writing to the screen's form-level DataBean structure. The only external dependency is `JCCWebCommon.getOpeDate()`, which retrieves the current operation date (a common pattern in this codebase for obtaining the business date). No SC (Service Component) calls reach any CBS (Call Back Service) or database layer.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | `KKW03204SFLogic.actionFix()` | `actionFix()` -> `setDataKaihk()` | `sendMessageString` [-] (DataBean), `getOpeDate` [R] (JCCWebCommon) |

**Instructions:**
- The only direct caller is `KKW03204SFLogic.actionFix()`, which is the screen's primary action handler within the same class.
- No external screen or batch entry points call this method directly — it is a private helper invoked internally during the `actionFix` flow.
- Terminal operations from this method are all in-memory DataBean operations (no DB/SC reach).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(data bean retrieval)` (L853)

The method begins by obtaining the screen's form DataBean and the current operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `X31SDataBeanAccess bean = super.getServiceFormBean()` // Services form DataBean access instance |
| 2 | SET | `String opeDate = JCCWebCommon.getOpeDate(this, null)` // 運用手日の取得 — Get operation date (system date) |

**Block 2** — [SET] `(recovery date assignment)` (L861)

Sets the recovery date (回復年月日) in the DataBean to the current operation date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean.sendMessageString(KKW03204SFConst.KAIHK_YMD, X31CWebConst.DATABEAN_SET_VALUE, opeDate)` // 画面DataBeanに回復年月日を設定 — Set recovery year/month/day in screen DataBean |

**Block 3** — [FOR/INIT] `(aging info list preparation)` (L864)

Prepares the aging information list (エイジング情報リスト) — the list that holds aging details displayed on the recovery screen. The comment `//◾️◾️エイジングリスト化◾️◾️` indicates this section converts the data into the aging list format.

| # | Type | Code |
|---|------|------|
| 1 | SET | `X31SDataBeanAccess aging_info_bean = null` // Initialize aging info bean reference |
| 2 | SET | `X31SDataBeanAccessArray aging_info_list = bean.getDataBeanArray(KKW03204SFConst.AGING_INFO_LIST)` // Get the aging info list from the form DataBean |

**Block 4** — [IF] `(empty/null check)` [condition: `aging_info_list.getCount() == 0 || aging_info_list == null`] (L865)

If the aging info list is empty or null, create a new entry and populate it with default values.

| # | Type | Code |
|---|------|------|
| 1 | SET | `aging_info_bean = aging_info_list.addDataBean()` // Create a new DataBean entry in the aging list |
| 2 | SET | `aging_info_bean.sendMessageString(KKW03204SFConst.AGING_SBT_CD, X31CWebConst.DATABEAN_SET_VALUE, AGING_SBT_CD_TEL)` // エイジング種類コードの設定 — Set aging service type code to telecom |
| 3 | SET | `String aging_sbt_cd = bean.sendMessageString(KKW03204SFConst.HRADSI_050_NO, X31CWebConst.DATABEAN_GET_VALUE)` // Get aging target value (HRADSI_050_NO) from form DataBean |
| 4 | SET | `aging_info_bean.sendMessageString(KKW03204SFConst.AGING_TG_VALUE, X31CWebConst.DATABEAN_SET_VALUE, aging_sbt_cd)` // エイジング対象値の設定 — Set the aging target value |

**Block 4 (ELSE)** — `[ELSE]` (implicit)

If the aging info list already has entries (`getCount() > 0` and is not null), this block is skipped. The existing aging data is preserved as-is, and no new entry is created.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KAIHK_YMD` | Constant | Recovery year/month/day — the date field used to display when the recovery process occurred, set to the current operation date |
| `AGING_INFO_LIST` | Constant | Aging information list — a list of DataBean entries representing aging details on the recovery screen |
| `AGING_SBT_CD` | Constant | Aging service type code — classifies the type of aging service (e.g., telecom vs. other) |
| `AGING_SBT_CD_TEL` | Constant | Aging service type code for Telecom — the value used to identify telecom-related aging entries |
| `AGING_TG_VALUE` | Constant | Aging target value — the specific value (HRADSI_050_NO) that the aging applies to |
| `HRADSI_050_NO` | Constant | HRADSI 050 number — a reference identifier used as the aging target value in the recovery context |
| `opeDate` | Field | Operation date — the current business date used across the system for transaction timestamps |
| `getServiceFormBean()` | Method | Retrieves the screen's form-level DataBean that holds all viewable form data |
| `sendMessageString` | Method | DataBean message-passing mechanism for setting and retrieving typed values by key |
| `X31SDataBeanAccess` | Class | Screen-level DataBean access class — provides methods for getting/setting values in the form's data structure |
| `X31SDataBeanAccessArray` | Class | Array wrapper for DataBean lists — supports operations like `addDataBean()`, `getCount()`, `getDataBeanArray()` |
| `JCCWebCommon` | Class | Shared web utility class providing common cross-cutting operations (e.g., `getOpeDate`) |
| 回復処理 (Kaihi shori) | Business term | Recovery processing — the business process of restoring/recovering service status, typically after a disruption or cancellation |
| エイジング (Eijingu) | Business term | Aging — in this context, refers to aged/aging service items that require tracking or recovery action |
| エイジング種類コード (Eijingu shurui code) | Business term | Aging service type code — categorizes aging entries by service type (telecom, mail, etc.) |
| エイジング対象値 (Eijingu taishou value) | Business term | Aging target value — the specific identifier or value that the aging entry applies to |
| 画面DataBean (Gamen DataBean) | Business term | Screen DataBean — the form-level data structure used to pass data between the screen (view) and the logic layer |
