# Business Logic — KKW02541SFLogic.setHktgiBean() [20 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02541SF.KKW02541SFLogic` |
| Layer | Service / Logic (Package: `eo.web.webview.KKW02541SF`, within web presentation layer logic tier) |
| Module | `KKW02541SF` (Package: `eo.web.webview.KKW02541SF`) |

## 1. Role

### KKW02541SFLogic.setHktgiBean()

This method performs initial DataBean setup for the HTGI (Hikidashi — payout/withdrawal) screen, as indicated by the Javadoc comment "DataBean設定処理（初回データ保持用）" (DataBean setup processing for initial data retention). It serves as a data bridge that reads the **Service Contract Number** (サービス契約番号, `svc_kei_no`) from the input DataBean array and writes it back to the same position within the same DataBean, effectively normalizing or projecting the value onto the screen's expected DataBean key (`KKW02541SFConst.SVC_KEI_NO`). The method follows a simple delegate pattern: it takes an array of `X31SDataBeanAccess` objects (representing screen DataBeans), extracts a single field, and places it back into the same DataBean under a standardized key. Originally, this method also handled the customer contract succession list and SYSID fields (lines now commented out from version 4.01, IT1-2012-0001210), but the current implementation is limited to the service contract number only. It is a private utility method called internally by `KKW02541SFLogic.actionInit()`, making it a supporting method within the initialization flow of the HTGI screen.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["setHktgiBean(paramBean)"])
    STEP1["GET svc_kei_no from paramBean[0]<br>sendMessageString(SVC_KEI_NO=\"サービス契約番号\", GET_VALUE)"]
    STEP2["SET svc_kei_no back to paramBean[0]<br>sendMessageString(SVC_KEI_NO=\"サービス契約番号\", SET_VALUE, svc_kei_no)"]
    END_NODE(["Return / Next"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> END_NODE
```

**Processing Summary:**

1. **GET** — Reads the service contract number from the first DataBean (`paramBean[0]`) using the key `SVC_KEI_NO = "サービス契約番号"` (Service Contract Number) with the `DATABEAN_GET_VALUE` operation mode.
2. **SET** — Writes the retrieved value back into the same DataBean (`paramBean[0]`) using the same key and `DATABEAN_SET_VALUE` operation mode.

The method is a linear, sequential processing flow with no conditional branches, loops, or exception handling. It performs a single field read-then-write operation within the same DataBean.

> **Historical Note (v4.01, IT1-2012-0001210):** The original implementation also processed the customer contract succession list (`CUST_KEI_HKTGI_LIST`), SYSID fields, and an alternate service contract number key (`SVC_KEI_NO_02`). These were removed in the v4.01 modification, simplifying the method to only handle the service contract number.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | Array of screen DataBeans carrying UI-level data for the HTGI screen. The first element (`paramBean[0]`) is used as both the source and target for the service contract number field. This array is populated by the framework before the initialization action and is used to transfer data between the view layer and the logic tier. |

**Instance fields read:** None — this method does not reference any instance fields.

**External state accessed:** None — the method operates purely on its parameter and returns via side effect (modifying the DataBean in place).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `X31SDataBeanAccess.sendMessageString` | X31SDataBeanAccess | - | Calls `sendMessageString` to read the service contract number from the DataBean (GET operation) |
| - | `X31SDataBeanAccess.sendMessageString` | X31SDataBeanAccess | - | Calls `sendMessageString` to write the service contract number back into the DataBean (SET operation) |

**Analysis:**

This method does **not** perform any database CRUD operations. It operates entirely in-memory within the DataBean framework:

- **GET** — `paramBean[0].sendMessageString(KKW02541SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_GET_VALUE)` reads the service contract number from the DataBean. This is a framework-level getter operation, not a database query.
- **SET** — `paramBean[0].sendMessageString(KKW02541SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, svc_kei_no)` writes the value back. This is a framework-level setter operation.

No SC (Service Component), CBS (Business Service), Entity, or DB table operations are performed by this method.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-], `sendMessageString` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic:KKW02541SFLogic | `KKW02541SFLogic.actionInit()` -> `KKW02541SFLogic.setHktgiBean` | `sendMessageString` (DataBean GET/SET — no DB) |

**Caller Details:**

- **`KKW02541SFLogic.actionInit()`** — The action initialization method of the same logic class. This is the sole direct caller. `actionInit()` is the entry point for the HTGI screen's initialization flow, and `setHktgiBean()` is invoked as part of setting up initial DataBean values at screen load time.

**Trace Direction:**

- **Upstream (who calls this method):** `KKW02541SFLogic.actionInit()` → `setHktgiBean()`
- **Downstream (what this method calls):** `X31SDataBeanAccess.sendMessageString()` (2 calls — GET and SET)
- **Downstream (SC/CBS/DB):** None — this method is a pure DataBean utility with no service component or database dependencies.

## 6. Per-Branch Detail Blocks

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

> Reads the service contract number from the first DataBean element. This is the GET operation for the `svc_kei_no` field. The Javadoc comment above the commented-out section reads "v4.01 2012/10/03 MOD START" / "サービス契約番号" (Service Contract Number).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svc_kei_no = paramBean[0].sendMessageString(KKW02541SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_GET_VALUE)` // Read service contract number from DataBean [-> SVC_KEI_NO="サービス契約番号"] |

**Block 2** — [ASSIGNMENT] (L129)

> Writes the retrieved service contract number back to the same DataBean element. This is the SET operation for the `svc_kei_no` field. The method then returns (void).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW02541SFConst.SVC_KEI_NO, X31CWebConst.DATABEAN_SET_VALUE, svc_kei_no)` // Write service contract number back to DataBean [-> SVC_KEI_NO="サービス契約番号"] |
| 2 | RETURN | `// void method, implicit return` |

---

**Commented-out historical blocks (not executed):**

The following blocks represent code that was removed in version 4.01 (IT1-2012-0001210) and are no longer part of the active method. They are documented here for historical reference.

**Block 3 (DEPRECATED)** — [DECLARATION] (L119–L120)

> Previously read the customer contract succession list from DataBean. Removed in v4.01.

| # | Type | Code |
|---|------|------|
| 1 | SET | `hktgilist = paramBean[0].getDataBeanArray(KKW02541SFConst.CUST_KEI_HKTGI_LIST)` // [-> CUST_KEI_HKTGI_LIST="顧客契約引継リスト" (Customer Contract Succession List)] |
| 2 | SET | `hktgiBean = hktgilist.getDataBean(0)` // Get first element of succession list |

**Block 4 (DEPRECATED)** — [DECLARATION] (L124–L126)

> Previously read SYSID from the HTGI bean and set it into paramBean[0]. Removed in v4.01.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `sysid = hktgiBean.sendMessageString(KKW02541SFConst.SYSID_02, X31CWebConst.DATABEAN_GET_VALUE)` // [-> SYSID_02="SYSID_02"] |
| 2 | EXEC | `paramBean[0].sendMessageString(KKW02541SFConst.SYSID, X31CWebConst.DATABEAN_SET_VALUE, sysid)` // [-> SYSID="SYSID"] |

**Block 5 (DEPRECATED)** — [DECLARATION] (L131)

> Previously read service contract number from the derived `hktgiBean` using key `SVC_KEI_NO_02`. Removed in v4.01.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `svc_kei_no = hktgiBean.sendMessageString(KKW02541SFConst.SVC_KEI_NO_02, X31CWebConst.DATABEAN_GET_VALUE)` // [-> SVC_KEI_NO_02="サービス契約番号"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract line item in the system |
| `svc_kei` | Acronym | Service Kei — "Kei" (計) means "plan" or "contract" in Japanese telecom context; refers to a service subscription |
| HTGI | Acronym | Hikidashi (引き出し) — Payout/Withdrawal; refers to the HTGI screen handling service withdrawal operations |
| DataBean | Pattern | A framework object (`X31SDataBeanAccess`) that encapsulates screen-level data for transfer between view and logic tiers |
| `sendMessageString` | Method | Framework method on DataBean used to get or set string values by key; modes: `DATABEAN_GET_VALUE` (read) and `DATABEAN_SET_VALUE` (write) |
| `SVC_KEI_NO` | Constant | Key `"サービス契約番号"` (Service Contract Number) used to identify the service contract number field in DataBean operations |
| `CUST_KEI_HKTGI_LIST` | Constant (Deprecated) | Key for the customer contract succession list array, previously used to retrieve multiple customer contracts for succession processing |
| `SYSID` | Field | System identifier — an internal system-level ID used for tracking and identification |
| v4.01 | Version | Software version 4.01, which included modification IT1-2012-0001210 that simplified this method |
| X31SDataBeanAccess | Class | Framework class representing a single screen DataBean that holds string-keyed data for a web screen |
| X31SDataBeanAccessArray | Class (Deprecated) | Framework class for arrays of DataBeans, previously used to hold multiple customer contract succession entries |
