# Business Logic — KKW03204SFLogic.setDataDsl() [40 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW03204SF.KKW03204SFLogic` |
| Layer | Service (Web Service Logic — part of the web service tier handling screen business logic) |
| Module | `KKW03204SF` (Package: `eo.web.webview.KKW03204SF`) |

## 1. Role

### KKW03204SFLogic.setDataDsl()

This method performs **data preparation for the service contract cancellation screen** (`KKW03204SF`). The Javadoc states "DataBean設定処理（解約処理）" (DataBean setting process — cancellation process) and "画面DataBeanに必要な項目をセットします" (Sets the necessary items on the screen DataBean). It acts as a **screen data transformer**, populating the form-level DataBean with values required for rendering the cancellation screen to the user.

The method executes two primary business operations: first, it retrieves the operational date and transfers the customer's **service end date** (use end date) into the screen DataBean as the **service charge end date**, ensuring the billing termination date displayed to the user is accurate. Second, it builds an **aging information list** — a one-entry list that captures the aging (interest/delay) classification code (`"001"`, representing telephone-related aging) and the **payment request number** (HRADSI 050 number) as the aging target value. These values are required for downstream processing of aging calculations tied to the cancelled service contract.

The method implements a **builder pattern** within the aging list branch: it checks whether the aging information list already contains entries, and if empty (or null), it creates a new list entry, sets the aging subtype code, retrieves the target value from the bean, and assigns it. A large portion of the method body (lines ~800–813) consists of **commented-out code** for a cancelled branching feature that previously classified cancellation types and handled instant cancellation values — these are noted but not executed.

This method is a **shared internal utility** within the `KKW03204SFLogic` class, called by action methods (`actionFix`, `actionUpd_cfm`) that handle the screen's fix (confirm) and update confirmation flows respectively. It is not directly invoked by screens — instead, it supports the screen's business logic by preparing the view data layer.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> STEP1["Get opeDate via JCCWebCommon.getOpeDate()"]
    STEP1 --> STEP2["Get service form bean via super.getServiceFormBean()"]
    STEP2 --> STEP3["Get USE_ENDYMD from bean"]
    STEP3 --> STEP4["Set SVC_CHRG_ENDYMD to bean using usd_endymd"]
    STEP4 --> CHECK{"aging_info_list.getCount() == 0 or
aging_info_list == null?"}
    CHECK -->|true| STEP5["Create new aging_info_bean
via aging_info_list.addDataBean()"]
    STEP5 --> STEP6["Set AGING_SBT_CD to AGING_SBT_CD_TEL"]
    STEP6 --> STEP7["Get HRADSI_050_NO from bean"]
    STEP7 --> STEP8["Set AGING_TG_VALUE to aging_sbt_cd"]
    STEP8 --> END(["End / Return"])
    CHECK -->|false| END
```

| Step | Description |
|------|-------------|
| STEP1 | Retrieves the **operational date** (運用年月日) from `JCCWebCommon.getOpeDate()` using `this` (current logic instance) and a null key. This represents the system's current business date used for date-sensitive operations. |
| STEP2 | Obtains the **service form bean** (`X31SDataBeanAccess`) via `super.getServiceFormBean()`. This is the screen-level DataBean that holds all form data for the KKW03204SF screen. |
| STEP3 | Retrieves the **use end date** (利用終了日) from the bean by sending a message with constant `USE_ENDYMD` and the `DATABEAN_GET_VALUE` flag. This is the date the customer's service terminated. |
| STEP4 | Sets the **service charge end date** (サービス課金終了年月日) to the bean using the retrieved `usd_endymd` value. The comment notes that a common CC was expected to obtain this value, but as a temporary measure the use end date is set directly. |
| CHECK | Evaluates whether the **aging information list** (エンジニアリング情報リスト) is empty (count == 0) or null. If true, the aging list must be initialized; if false, an existing list is assumed and no action is taken. |
| STEP5 | Creates a new entry in the aging information list by calling `addDataBean()` on the `X31SDataBeanAccessArray`. Returns the newly created `X31SDataBeanAccess` as `aging_info_bean`. |
| STEP6 | Sets the **aging subtype code** (エンジニアリング種類コード) to `AGING_SBT_CD_TEL` which resolves to `"001"`, representing telephone-related aging items. |
| STEP7 | Retrieves the **payment request number** (払出０５０番号) from the bean using the `HRADSI_050_NO` key. This number identifies the billing request for the 050-line service. |
| STEP8 | Sets the **aging target value** (エンジニアリング対象値) to the retrieved `aging_sbt_cd` (payment request number), establishing which billing request this aging entry applies to. |
| END | The method returns `void` — all data has been set on the bean, and control returns to the caller. |

**Conditional Branch Details:**

The single conditional branch (`if`) checks the aging information list state:
- **`true` branch**: The aging list is empty or null, so a new entry is created with aging subtype code `"001"` (aging subtype for telephone) and the target value set to the payment request number (HRADSI 050 number).
- **`false` branch**: The aging list already contains data, so no modification is needed — the method proceeds directly to return.

**Commented-out Code (Cancelled Feature):**
Lines 800–813 contain three blocks of commented-out code:
1. A cancellation type determination method call (`getDsl_kind(opeDate)`)
2. Setting the cancellation type to the bean
3. Setting the instant cancellation value (`DSL_SOKU`)

These were removed or commented out and do not execute in the current codebase.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. It operates entirely on instance fields and the service form bean. |

**Instance fields / external state read by this method:**

| Field / Source | Type | Business Description |
|----------------|------|---------------------|
| `this` (KKW03204SFLogic instance) | `KKW03204SFLogic` | Passed to `JCCWebCommon.getOpeDate()` to access operational context for determining the current business date. |
| `super.getServiceFormBean()` | `X31SDataBeanAccess` | The screen-level form DataBean containing all data for the KKW03204SF screen. Used as the primary read/write target for all bean operations. |

## 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 | - | Retrieves the operational date (運用年月日) — the system's current business date — used for date-sensitive processing. |
| R | `X31SDataBeanAccess.sendMessageString` (USE_ENDYMD) | X31SDataBeanAccess | - | Reads the use end date (利用終了日) from the screen form bean. |
| C | `X31SDataBeanAccess.sendMessageString` (SVC_CHRG_ENDYMD) | X31SDataBeanAccess | - | Sets the service charge end date (サービス課金終了年月日) on the screen form bean using the retrieved use end date. |
| R | `X31SDataBeanAccess.getDataBeanArray` (AGING_INFO_LIST) | X31SDataBeanAccess | - | Retrieves the aging information list (エンジニアリング情報リスト) as an array from the screen form bean. |
| R | `X31SDataBeanAccessArray.getCount` | X31SDataBeanAccessArray | - | Checks the count of entries in the aging information list to determine if initialization is needed. |
| C | `X31SDataBeanAccessArray.addDataBean` | X31SDataBeanAccessArray | - | Creates a new entry in the aging information list when it is empty or null. |
| C | `X31SDataBeanAccess.sendMessageString` (AGING_SBT_CD) | X31SDataBeanAccess | - | Sets the aging subtype code (エンジニアリング種類コード) to `"001"` on the new aging info bean. |
| R | `X31SDataBeanAccess.sendMessageString` (HRADSI_050_NO) | X31SDataBeanAccess | - | Reads the payment request number (払出０５０番号) from the screen form bean. |
| C | `X31SDataBeanAccess.sendMessageString` (AGING_TG_VALUE) | X31SDataBeanAccess | - | Sets the aging target value (エンジニアリング対象値) to the payment request number on the aging info bean. |

**Classification:**

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JCCWebCommon.getOpeDate(this, null)` | JCCWebCommon | - | Reads operational date (運用年月日) — system business date used for date-sensitive processing. |
| R | `super.getServiceFormBean()` | X31SDataBeanAccess | - | Gets the screen form bean (画面フォームBean) — the primary data container for the KKW03204SF screen. |
| R | `bean.sendMessageString(KKW03204SFConst.USE_ENDYMD, X31CWebConst.DATABEAN_GET_VALUE)` | X31SDataBeanAccess | - | Reads the service use end date (利用終了日) — the date the customer's service ended. |
| C | `bean.sendMessageString(KKW03204SFConst.SVC_CHRG_ENDYMD, X31CWebConst.DATABEAN_SET_VALUE, usd_endymd)` | X31SDataBeanAccess | - | Sets the service charge end date (サービス課金終了年月日) on the screen bean — controls when billing terminates. |
| R | `bean.getDataBeanArray(KKW03204SFConst.AGING_INFO_LIST)` | X31SDataBeanAccess | - | Retrieves the aging information list (エンジニアリング情報リスト) — an array of aging entries for the screen. |
| R | `aging_info_list.getCount()` | X31SDataBeanAccessArray | - | Counts entries in the aging information list to determine if initialization is needed. |
| C | `aging_info_list.addDataBean()` | X31SDataBeanAccessArray | - | Creates a new aging information entry when the list is empty or null. |
| C | `aging_info_bean.sendMessageString(KKW03204SFConst.AGING_SBT_CD, X31CWebConst.DATABEAN_SET_VALUE, AGING_SBT_CD_TEL)` | X31SDataBeanAccess | - | Sets aging subtype code (エンジニアリング種類コード) to `"001"` (telephone-related aging). |
| R | `bean.sendMessageString(KKW03204SFConst.HRADSI_050_NO, X31CWebConst.DATABEAN_GET_VALUE)` | X31SDataBeanAccess | - | Reads the HRADSI 050 number (払出０５０番号) — payment request number for billing. |
| C | `aging_info_bean.sendMessageString(KKW03204SFConst.AGING_TG_VALUE, X31CWebConst.DATABEAN_SET_VALUE, aging_sbt_cd)` | X31SDataBeanAccess | - | Sets the aging target value (エンジニアリング対象値) to the HRADSI 050 number, linking the aging entry to the specific billing request. |

**Note:** This method performs **no direct database operations** or CBS/SC calls. All data access is via the **screen form DataBean** (`X31SDataBeanAccess`), which is a web-tier data transfer object. The method operates purely at the **view data preparation layer**.

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: `KKW03204SFLogic.actionFix()` | `actionFix()` -> `setDataDsl()` | `sendMessageString [C] SVC_CHRG_ENDYMD, getDataBeanArray [R] AGING_INFO_LIST, getOpeDate [R] opeDate` |
| 2 | Logic: `KKW03204SFLogic.actionUpd_cfm()` | `actionUpd_cfm()` -> `setDataDsl()` | `sendMessageString [C] SVC_CHRG_ENDYMD, getDataBeanArray [R] AGING_INFO_LIST, getOpeDate [R] opeDate` |

**Caller Descriptions:**

1. **`actionFix()`** — The screen's **fix/confirm action** handler. Called when the user clicks the fix button on the contract change screen. This method prepares the DataBean before presenting the confirmation summary to the user, ensuring the cancellation screen displays the correct service charge end date and aging information.

2. **`actionUpd_cfm()`** — The screen's **update confirmation action** handler. Called when the user confirms an update operation. Similar to `actionFix()`, it calls `setDataDsl()` to re-populate the screen DataBean before rendering the confirmation view.

Both callers are **internal logic methods** within the same class (`KKW03204SFLogic`). The actual screen entry point (likely `KKSV03204` or similar) would call these action methods, which in turn invoke `setDataDsl()`. No direct screen/batch entry point was found within 8 hops of this method in the code analysis graph.

**Data flow summary:** The method reads operational context (opeDate) and user data (USE_ENDYMD, HRADSI_050_NO) from the bean, then writes service charge end date (SVC_CHRG_ENDYMD) and aging info (AGING_SBT_CD, AGING_TG_VALUE) back to the bean. No data persists to the database — this is purely a **view data preparation** operation.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(opeDate initialization)` (L791)

> Retrieves the operational date (運用年月日) — the system's current business date. This value is stored but not actively used in the current method body (likely reserved for future use or was used by the commented-out cancellation type determination logic).

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.getOpeDate(this, null)` // Get operational date (運用年月日) [-> JCCWebCommon] |
| 2 | SET | `String opeDate = ...` // Assign the operational date to local variable |

**Block 2** — [SET] `(bean acquisition)` (L796)

> Obtains the screen-level form DataBean that serves as the primary data container for the KKW03204SF screen.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `super.getServiceFormBean()` // Get service form bean [-> X31SDataBeanAccess] |
| 2 | SET | `X31SDataBeanAccess bean = ...` // Screen form bean for KKW03204SF |

**Block 3** — [SET] `(USE_ENDYMD retrieval)` (L798)

> Reads the customer's **service end date** (利用終了日) from the screen form bean. This is the date when the customer's service contract ended or is scheduled to end.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW03204SFConst.USE_ENDYMD, X31CWebConst.DATABEAN_GET_VALUE)` // Read use end date (利用終了日) [-> Constant: USE_ENDYMD = "利用終了日"] |
| 2 | SET | `String usd_endymd = ...` // Store service end date |

**Block 4** — [SET] `(SVC_CHRG_ENDYMD assignment)` (L816)

> Sets the **service charge end date** (サービス課金終了年月日) on the screen bean. The comment indicates that a common CC was planned to obtain this value, but as a temporary measure, the use end date (`usd_endymd`) is used directly.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `bean.sendMessageString(KKW03204SFConst.SVC_CHRG_ENDYMD, X31CWebConst.DATABEAN_SET_VALUE, usd_endymd)` // Set service charge end date using use end date [-> Constant: SVC_CHRG_ENDYMD = "サービス課金終了年月日"] |

**Block 5** — [SET] `(aging_info_bean initialization)` (L820–L821)

> Prepares for building the **aging information list** (エンジニアリング情報リスト). Initializes the aging info bean reference to null and retrieves the aging list from the screen bean.

| # | Type | Code |
|---|------|------|
| 1 | SET | `X31SDataBeanAccess aging_info_bean = null` // Initialize aging info bean reference |
| 2 | EXEC | `bean.getDataBeanArray(KKW03204SFConst.AGING_INFO_LIST)` // Get aging information list [-> Constant: AGING_INFO_LIST = "エンジニアリング情報リスト"] |
| 3 | SET | `X31SDataBeanAccessArray aging_info_list = ...` // Aging info list as array |

**Block 6** — [IF] `(aging_info_list is empty or null)` `[GET_COUNT == 0 || NULL]` (L822)

> Checks whether the aging information list has any existing entries. If the count is 0 or the list is null, the aging list needs to be populated with default aging data.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `aging_info_list.getCount() == 0` // Check list count |
| 2 | CALL | `aging_info_list == null` // Check for null list |
| 3 | COND | Combined: `if(count == 0 || list == null)` // Branch condition |

**Block 6.1** — [ELSE-IF / TRUE BRANCH] `(new entry needed)` (L823–L829)

> Creates a new aging information entry and populates it with the aging subtype code for telephone services (`"001"`) and the payment request number (HRADSI 050 number) as the target value.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `aging_info_list.addDataBean()` // Create new entry in aging list [-> X31SDataBeanAccessArray.addDataBean()] |
| 2 | SET | `aging_info_bean = ...` // Assign new aging info bean |
| 3 | EXEC | `aging_info_bean.sendMessageString(KKW03204SFConst.AGING_SBT_CD, X31CWebConst.DATABEAN_SET_VALUE, AGING_SBT_CD_TEL)` // Set aging subtype code [-> Constant: AGING_SBT_CD = "エンジニアリング種類コード"] [-> AGING_SBT_CD_TEL = "001" (telephone aging)] |
| 4 | EXEC | `bean.sendMessageString(KKW03204SFConst.HRADSI_050_NO, X31CWebConst.DATABEAN_GET_VALUE)` // Get payment request number (払出０５０番号) [-> Constant: HRADSI_050_NO = "払出０５０番号"] |
| 5 | SET | `String aging_sbt_cd = ...` // Store the HRADSI 050 number (used as aging target value) |
| 6 | EXEC | `aging_info_bean.sendMessageString(KKW03204SFConst.AGING_TG_VALUE, X31CWebConst.DATABEAN_SET_VALUE, aging_sbt_cd)` // Set aging target value [-> Constant: AGING_TG_VALUE = "エンジニアリング対象値"] |

**Block 6.2** — [ELSE / FALSE BRANCH] `(list already populated)` (L822 — implicit)

> When the aging information list already contains entries (count > 0 and list is not null), no action is taken. The existing aging data is preserved, and the method proceeds directly to return. This is an implicit branch — the `if` condition is false and execution falls through to the method's end.

| # | Type | Code |
|---|------|------|
| 1 | (no-op) | `// aging_info_bean already has data; skip initialization` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `setDataDsl` | Method | DataBean setting process for cancellation (解約処理) — prepares screen data for the service contract cancellation screen |
| KKW03204SF | Module/Screen | Contract change screen module (契約変更画面) — handles service contract modifications including cancellations |
| `opeDate` | Field | Operational date (運用年月日) — the system's current business date used for date-sensitive operations |
| `X31SDataBeanAccess` | Class | Service form bean — the screen-level DataBean that holds all form data for web screens |
| `X31SDataBeanAccessArray` | Class | DataBean access array — manages collections (arrays) of DataBean entries |
| `USE_ENDYMD` | Constant | Use end date (利用終了日) — the date when the customer's service ended or is scheduled to end |
| `SVC_CHRG_ENDYMD` | Constant | Service charge end date (サービス課金終了年月日) — the date when service-related billing ceases; set from the use end date |
| `AGING_INFO_LIST` | Constant | Engineering information list (エンジニアリング情報リスト) — a list of aging (interest/delay) entries associated with the service contract |
| `AGING_SBT_CD` | Constant | Engineering subtype code (エンジニアリング種類コード) — classifies the type of aging item (e.g., telephone, internet) |
| `AGING_TG_VALUE` | Constant | Engineering target value (エンジニアリング対象値) — the specific value that the aging applies to (e.g., payment request number) |
| `AGING_SBT_CD_TEL` | Constant | Engineering subtype code for telephone = `"001"` — identifies aging entries related to telephone services |
| `HRADSI_050_NO` | Constant | Payment request 050 number (払出０５０番号) — the billing request number for 050-line services; used as the aging target value |
| `JCCWebCommon` | Class | Common web utility class (共通WebCC) — provides shared web-layer methods including operational date retrieval |
| `JCCWebCommon.getOpeDate` | Method | Retrieves the operational date (運用年月日) from the session/context |
| `sendMessageString` | Method | Generic DataBean message method — used to read (DATABEAN_GET_VALUE) or write (DATABEAN_SET_VALUE) string values in the DataBean |
| `addDataBean` | Method | Adds a new DataBean entry to a DataBeanAccessArray collection |
| `getDataBeanArray` | Method | Retrieves an array of DataBean entries from the parent DataBean by key |
| `getCount` | Method | Returns the number of entries in a DataBeanAccessArray |
| DSL | Domain term | Service contract cancellation (解約) — refers to the termination of a customer's service contract |
| エンジニアリング (Engineering) | Domain term | In this system's context, "engineering" refers to **aging** (interest/delay calculations) — specifically delay-related processing for billing adjustments on cancelled contracts |
| 払出 (Haridashi) | Domain term | Payment/Billing issuance — refers to billing statement generation or payment requests |
| 利用終了日 (Riyō Shūryōbi) | Japanese field | Service end date — the date the customer's service terminated |
| サービス課金終了年月日 | Japanese field | Service charge end year-month-date — the date billing for the service ceases |
| エンジニアリング種類コード | Japanese field | Engineering subtype code — classifies the type of aging item |
| エンジニアリング対象値 | Japanese field | Engineering target value — the specific value the aging calculation targets |
| エンジニアリング情報リスト | Japanese field | Engineering information list — array of aging entries for the contract |
| X31CWebConst | Class | Common web constants — contains constants for DataBean access flags like `DATABEAN_GET_VALUE` and `DATABEAN_SET_VALUE` |
| DATABEAN_GET_VALUE | Constant | Flag value — instructs `sendMessageString` to retrieve a value from the DataBean |
| DATABEAN_SET_VALUE | Constant | Flag value — instructs `sendMessageString` to write a value to the DataBean |
