# Business Logic — KKW05602SFLogic.actionShusei() [81 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW05602SF.KKW05602SFLogic` |
| Layer | Service Form Logic (webview/Service Form Logic layer) |
| Module | `KKW05602SF` (Package: `eo.web.webview.KKW05602SF`) |

## 1. Role

### KKW05602SFLogic.actionShusei()

This method implements the **correction button processing** (修正ボタン押下処理) on the tokigi (transfer/ portability) update/cancellation confirmation screen (更新/解除確認画面). In Japan's telephone number portability regime, when a customer wishes to port their phone number to another carrier (MNP: Mobile Number Portability), they may need to cancel their existing service contract at the original carrier (K-Opticom) and/or update their service details. The `actionShusei` method handles the scenario where the user presses the "correction" (修正) button after reviewing their tokigi (transfer/ portability) details on a confirmation screen.

The method implements a **conditional dispatch pattern** based on an update/cancel judgment flag (`UPD_RLS_JUDGE_FL`). When the flag equals `"RLS"` (解除: cancellation), it enters a dedicated cancellation-correction branch that retrieves the current service contract detail (eo optical phone) data, computes suspension preferences and transfer dates from stored reservation data, and derives transfer origin phone numbers, contact phone numbers, and contracted phone numbers for display in the re-editable form. In the non-cancellation branch, it normalizes the transfer preference (tokigi kibou) display value back into a selection code.

After processing, it sets the next screen identity (`KKW05602` — tokigi update/cancellation screen) in the common info bean so that the framework knows where to route the response. This method is **screen logic**: it serves as the action handler for a specific confirmation-screen operation within the `KKW05602` screen flow and does not perform any persistent CRUD operations on its own — it purely prepares and normalizes form data for re-display.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionShusei Entry"])
    GET_BEAN["Get ServiceFormBean"]
    GET_FL["Get update/cancel judgment flag from bean"]
    CHECK_FL{Flag equals RLS?}
    BRANCH_RLS["RLS Branch: Cancellation correction"]
    GET_SVC_LIST["Get service contract eo optical detail list"]
    GET_FIRST_BEAN["Get first data bean from list"]
    GET_KIBO["getKiboUmu: Get suspension preference"]
    SET_ITN_TOKI_KIBO["Set transfer suspension preference"]
    SET_TOKI_KIBO_DSP["Set transfer preference display"]
    GET_TOKI_END_RSV_YMD["Get transfer end reservation date"]
    SET_TOKI_END_YMD["setYmdData: Set transfer end date fields"]
    GET_TOKI_STA_RSV_YMD["Get transfer start reservation date"]
    SET_TOKI_STA_YMD["setYmdData: Set transfer start date fields"]
    GET_TOKI_ADD_CD["Get transfer registration code"]
    GET_TELNO["Get phone number"]
    GET_TENSO_SK_TELNO["Get transfer destination phone number"]
    GET_TENSO_SK_SVKUWNO["Get transfer destination service contract detail number"]
    SET_ITENM_TELNO["getItenMTelNo: Set transfer origin phone number"]
    SET_RRKS_TELNO["getRRSKTelNo: Set contact phone number"]
    SET_RSV_TELNO["getPullDownSelectCd: Set contracted phone number"]
    BRANCH_OTHER["Other Branch: Non-cancellation correction"]
    GET_TOKI_KIBO_DSP2["Get transfer preference display"]
    SET_TOKI_KIBO_CD["getPullDownSelectCd: Normalize transfer preference code"]
    SET_TOKI_KIBO_SET["Set normalized transfer preference code"]
    SET_COMMON["Set common form bean next screen info"]
    RETURN_TRUE["Return true"]

    START --> GET_BEAN
    GET_BEAN --> GET_FL
    GET_FL --> CHECK_FL
    CHECK_FL -->|fl equals RLS| BRANCH_RLS
    CHECK_FL -->|else| BRANCH_OTHER

    BRANCH_RLS --> GET_SVC_LIST
    GET_SVC_LIST --> GET_FIRST_BEAN
    GET_FIRST_BEAN --> GET_KIBO
    GET_KIBO --> SET_ITN_TOKI_KIBO
    SET_ITN_TOKI_KIBO --> SET_TOKI_KIBO_DSP
    SET_TOKI_KIBO_DSP --> GET_TOKI_END_RSV_YMD
    GET_TOKI_END_RSV_YMD --> SET_TOKI_END_YMD
    SET_TOKI_END_YMD --> GET_TOKI_STA_RSV_YMD
    GET_TOKI_STA_RSV_YMD --> SET_TOKI_STA_YMD
    SET_TOKI_STA_YMD --> GET_TOKI_ADD_CD
    GET_TOKI_ADD_CD --> GET_TELNO
    GET_TELNO --> GET_TENSO_SK_TELNO
    GET_TENSO_SK_TELNO --> GET_TENSO_SK_SVKUWNO
    GET_TENSO_SK_SVKUWNO --> SET_ITENM_TELNO
    SET_ITENM_TELNO --> SET_RRKS_TELNO
    SET_RRKS_TELNO --> SET_RSV_TELNO
    SET_RSV_TELNO --> SET_COMMON

    BRANCH_OTHER --> GET_TOKI_KIBO_DSP2
    GET_TOKI_KIBO_DSP2 --> SET_TOKI_KIBO_CD
    SET_TOKI_KIBO_CD --> SET_TOKI_KIBO_SET
    SET_TOKI_KIBO_SET --> SET_COMMON

    SET_COMMON --> RETURN_TRUE
```

**Processing overview:**

1. **Bean acquisition** (line 2024-2026): The method obtains the service form bean (`X31SDataBeanAccess`) from the superclass and reads the update/cancel judgment flag from it. The flag determines whether the user is performing a correction on a cancellation-flow screen or a non-cancellation screen.

2. **Conditional dispatch on `RLS_FL = "RLS"`** (line 2028): This is the central decision point:
   - **RLS Branch (cancellation correction)**: Executes the full block that retrieves service contract detail data from the `EKK0191A010DETAILLIST` data bean array, computes suspension preferences, transfer dates, phone numbers, and contact information, then sets them back into the form bean for re-editing.
   - **Other Branch**: Simply normalizes the transfer preference display value by converting it to its underlying selection code via `getPullDownSelectCd`.

3. **Common form bean setup** (line 2081-2086): Regardless of the branch taken, the method sets the next screen ID and name to `KKW05602` (tokigi update/cancellation screen) in the common info bean.

4. **Return** (line 2088): Always returns `true`, indicating successful processing.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This is a no-argument method. All input data is obtained from the service form bean held in the superclass state. |

**Instance fields and external state read:**

| Source | Type | Business Description |
|--------|------|---------------------|
| `super.getServiceFormBean()` | `X31SDataBeanAccess` | The service form data bean containing the current screen state — includes the update/cancel judgment flag and service contract detail list data beans. |
| `super.getCommonInfoBean()` | `X31SDataBeanAccess` | The common info bean used to set the next screen navigation target. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `OneStopDataBeanAccessArray.getDataBean` | OneStopDataBeanAccessArray | - | Reads the data bean array `EKK0191A010DETAILLIST` (service contract detail <eo optical phone>) from the service form bean. |
| R | `OneStopDataBeanAccess.getDataBean` | OneStopDataBeanAccess | - | Retrieves the first element (index 0) of the service contract detail list. |
| R | `X31SDataBeanAccess.sendMessageString` (multiple) | OneStopDataBeanAccess | - | Reads individual fields from the detail bean — transfer end date, start date, registration code, phone number, transfer destination phone number, and transfer destination service contract detail number. |
| R | `KKW05602SFLogic.getKiboUmu` | KKW05602SFLogic | - | Computes suspension preference (suspension yes/no) from the service contract detail bean. |
| R | `KKW05602SFLogic.getItenMTelNo` | KKW05602SFLogic | - | Derives the transfer origin phone number from the transfer registration code, phone number, and transfer destination phone number. |
| R | `KKW05602SFLogic.getRRSKTelNo` | KKW05602SFLogic | - | Derives the contact phone number from the transfer registration code, phone number, transfer destination phone number, and transfer destination service contract detail number. |
| R | `KKW05602SFLogic.getPullDownSelectCd` | KKW05602SFLogic | - | Converts a display value back to its underlying selection code (used for contracted phone number and transfer preference normalization). |
| R | `X31SDataBeanAccess.sendMessageString` (GET_VALUE) | OneStopDataBeanAccess | - | Reads contracted phone number display value in the non-cancellation correction branch. |
| R | `X31SDataBeanAccess.getDataBeanArray` | OneStopDataBeanAccess | - | Called by `getPullDownSelectCd` to retrieve code list data beans for pull-down conversion. |
| - | `X31SDataBeanAccess.sendMessageString` (SET_VALUE) | OneStopDataBeanAccess | - | Sets corrected values into the service form bean: transfer suspension preference, transfer preference display, transfer end/start date fields, transfer origin phone number, contact phone number, contracted phone number. |
| - | `KKW05602SFLogic.setYmdData` | KKW05602SFLogic | - | Splits a YYYYMMDD date string into separate year, month, and day fields for form display. |
| - | `X31SDataBeanAccess.sendMessageString` (common) | OneStopDataBeanAccess | - | Sets the next screen ID (`KKW05602`) and next screen name (updated/tokigi cancellation) in the common info bean. |

**Classification rationale:**
This method performs **zero persistent writes**. All operations are data access (R) and local value transformations. The `sendMessageString` with `DATABEAN_SET_VALUE` updates in-memory form bean state, not database records. The `getPullDownSelectCd` and `getItenMTelNo`/`getRRSKTelNo`/`getKiboUmu` methods are local helper functions that perform data derivation/lookup from existing bean data.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW05602 | Screen controller/form logic -> `KKW05602SFLogic.actionShusei` | Form bean reads only — no terminal CRUD |

**Note:** The search for callers of `actionShusei` within the `KKW05602SF` module returned no external callers. This method is invoked directly by the `KKW05602` screen's form logic when the user submits the correction button. The method has no downstream CRUD endpoints — it is a pure data preparation/normalization handler.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(service bean acquisition)` (L2024-2026)

> The method acquires the service form bean and reads the update/cancel judgment flag.

| # | Type | Code |
|---|------|------|
| 1 | SET | `bean = super.getServiceFormBean()` // Get service form bean [ServiceFormBean] |
| 2 | SET | `fl = bean.sendMessageString(KKW05602SFConst.UPD_RLS_JUDGE_FL, X31CWebConst.DATABEAN_GET_VALUE)` // Get update/cancel judgment flag [`更新解除処理判定用フラシャッグ`] |

**Block 2** — [IF] `(null != fl && RLS_FL.equals(fl))` `[RLS_FL = "RLS"]` (L2028-2079)

> Cancellation correction branch. When the update/cancel judgment flag equals "RLS", the user is correcting data on the cancellation confirmation screen. This branch retrieves all relevant service contract detail data and derives phone numbers and dates for re-editing.

**Block 2.1** — [SET] `(obtain service contract detail list)` (L2030-2033)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `svcUtwkEoTelBeanList = bean.getDataBeanArray(KKW05602SFConst.EKK0191A010DETAILLIST)` // Get service contract detail <eo optical phone> list [`サービス契約内訳＜eo光電話＞一規照会明細`] |
| 2 | SET | `svcUtwkEoTelBean = svcUtwkEoTelBeanList.getDataBean(0)` // Take first detail record |
| 3 | CALL | `itenKibo = getKiboUmu(svcUtwkEoTelBean)` // Get suspension preference from detail bean |

**Block 2.2** — [SET] `(set transfer preference)` (L2035-2036)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `bean.sendMessageString(KKW05602SFConst.ITNTOKI_KIBO_UM, DATABEAN_SET_VALUE, itenKibo)` // Set transfer suspension preference [`移転トーキ希望有無`] |
| 2 | SET | `bean.sendMessageString(KKW05602SFConst.TOKI_KIBO_DSP, DATABEAN_SET_VALUE, itenKibo)` // Set transfer preference display [`トーキ希望（表示）`] |

**Block 2.3** — [SET] `(set transfer end reservation date)` (L2038-2043)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `itenTokiEndRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_END_RSV_YMD_05, DATABEAN_GET_VALUE)` // Get transfer end reservation date [`移転トーキ終了予定年月日`] |
| 2 | CALL | `setYmdData(bean, itenTokiEndRsvYmd, TOKI_END_RSV_YEAR, TOKI_END_RSV_MON, TOKI_END_RSV_DAY)` // Set transfer end date fields [`トーキ終了予定日（年）`, `（月）`, `（日）`] |

**Block 2.4** — [SET] `(set transfer start reservation date)` (L2045-2050)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `itenTokiStaRsvYmd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_MAN_STA_RSV_YMD_05, DATABEAN_GET_VALUE)` // Get transfer start reservation date [`移転トーキ手動開始予定年月日`] |
| 2 | CALL | `setYmdData(bean, itenTokiStaRsvYmd, TOKI_STA_RSV_YEAR, TOKI_STA_RSV_MON, TOKI_STA_RSV_DAY)` // Set transfer start date fields [`トーキ手動開始予定日（年）`, `（月）`, `（日）`] |

**Block 2.5** — [SET] `(obtain transfer/ phone data)` (L2052-2061)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `tokiAddCd = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.ITNTOKI_ADD_CD_05, DATABEAN_GET_VALUE)` // Get transfer registration code [`移転トーキ登録コード`] |
| 2 | SET | `telNo = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TELNO_05, DATABEAN_GET_VALUE)` // Get phone number [`電話番号`] |
| 3 | SET | `tokiTensoSkTelno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TOKI_TENSO_SK_TELNO_05, DATABEAN_GET_VALUE)` // Get transfer destination phone number [`トーキ転送先電話番号`] |
| 4 | SET | `tokiTensoSkSvkuwno = svcUtwkEoTelBean.sendMessageString(KKW05602SFConst.TOKI_TENSO_SK_SVKUWNO_05, DATABEAN_GET_VALUE)` // Get transfer destination service contract detail number [`トーキ転送先サービス契約内訳番号`] |

**Block 2.6** — [SET] `(set derived phone numbers)` (L2064-2075)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `bean.sendMessageString(KKW05602SFConst.ITENM_TELNO, DATABEAN_SET_VALUE, getItenMTelNo(tokiAddCd, telNo, tokiTensoSkTelno))` // Set transfer origin phone number [`移転元電話番号`] |
| 2 | SET | `rrksTelNo = getRRSKTelNo(bean, tokiAddCd, tokiTensoSkTelno, tokiTensoSkSvkuwno)` // Derive contact phone number [`連絡先電話番号`] |
| 3 | SET | `bean.sendMessageString(KKW05602SFConst.RRKS_TELNO, DATABEAN_SET_VALUE, rrksTelNo)` // Set contact phone number |
| 4 | SET | `rsvTelNoValue = bean.sendMessageString(KKW05602SFConst.RSV_TELNO_DSP, DATABEAN_GET_VALUE)` // Get contracted phone number display [`予約中電話番号（表示）`] |
| 5 | SET | `bean.sendMessageString(KKW05602SFConst.RSV_TELNO_DSP, DATABEAN_SET_VALUE, getPullDownSelectCd(rsvTelNoValue, KKW05602SFConst.RSV_TELNO, bean))` // Set contracted phone number via pull-down code conversion [`予約中電話番号`] |

**Block 3** — [ELSE] `(else branch — non-cancellation correction)` (L2080-2083)

> When the judgment flag is not "RLS", this branch normalizes the transfer preference (tokigi kibou) display value back to its underlying selection code. This is used when the user is correcting data on a non-cancellation confirmation screen.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `tokiKiboDsp = bean.sendMessageString(KKW05602SFConst.TOKI_KIBO_DSP, DATABEAN_GET_VALUE)` // Get transfer preference display [`トーキ希望（表示）`] |
| 2 | SET | `tokiKibo = getPullDownSelectCd(tokiKiboDsp, KKW05602SFConst.TOKI_KIBO, bean)` // Convert display value to selection code [`トーキ希望`] |
| 3 | SET | `bean.sendMessageString(KKW05602SFConst.TOKI_KIBO_DSP, DATABEAN_SET_VALUE, tokiKibo)` // Set normalized transfer preference code |

**Block 4** — [SET] `(set common info next screen)` (L2081-2086)

> After either branch, the common info bean is set with the next screen identity. This is shared across both branches.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `commonBean = super.getCommonInfoBean()` // Get common info bean |
| 2 | SET | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_ID_KKW05602)` // Set next screen ID [`KKW05602`] |
| 3 | SET | `commonBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_NAME_KKW05602)` // Set next screen name [`トーキ更新・解除`] |

**Block 5** — [RETURN] (L2088)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` // Processing complete — forward to next screen |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `actionShusei` | Method | Correction button processing — handles the user pressing the "edit/correct" button on a confirmation screen to return to the data entry form. |
| `RLS_FL` | Constant | Cancel flag value — `"RLS"` indicates the correction is for a cancellation flow (from a cancelled service). |
| `tokigi` (移行トギ) | Business term | Transfer/ portability — refers to telephone number portability (MNP: Mobile Number Portability) in Japan's telecom industry. |
| `UPD_RLS_JUDGE_FL` | Constant Field | Update/cancel judgment flag — the data bean key for the flag that determines whether the screen is in cancellation mode (`"RLS"`) or not. |
| `EKK0191A010DETAILLIST` | Constant Field | Service contract detail <eo optical phone> list — the data bean key for the list of eo optical phone service contract line items. |
| `ITNTOKI` (移行トギ) | Field prefix | Transfer (portability) — prefix for transfer-related fields. `ITN` = 移行 (transfer), `TOKI` = 移行 (portability). |
| `ITNTOKI_KIBO_UM` | Constant Field | Transfer suspension preference yes/no — indicates whether the customer wants to suspend their service during the portability transfer. |
| `TOKI_KIBO_DSP` | Constant Field | Transfer preference display — the display representation of the transfer preference. |
| `ITNTOKI_END_RSV_YMD_05` | Constant Field | Transfer end reservation date — the date when the current service ends due to portability. |
| `ITNTOKI_MAN_STA_RSV_YMD_05` | Constant Field | Transfer start manual reservation date — the date when the portability transfer starts (manually set). |
| `ITNTOKI_ADD_CD_05` | Constant Field | Transfer registration code — classifies the type of portability registration (e.g., transfer origin vs. transfer destination). |
| `TOKI_TENSO_SK_TELNO_05` | Constant Field | Transfer destination phone number — the phone number at the receiving carrier after portability. |
| `TOKI_TENSO_SK_SVKUWNO_05` | Constant Field | Transfer destination service contract detail number — the service contract detail number at the receiving carrier. |
| `ITENM_TELNO` | Constant Field | Transfer origin phone number — the original phone number before portability (MNP: mobile number portability origin). |
| `RRKS_TELNO` | Constant Field | Contact phone number — the phone number to use for contact regarding the portability process. |
| `RSV_TELNO_DSP` | Constant Field | Contracted phone number display — the currently contracted phone number shown on the screen. |
| `RSV_TELNO` | Constant Field | Contracted phone number — the data bean key for contracted phone number lookups. |
| `TOKI_KIBO` | Constant Field | Transfer preference — whether the customer desires the portability transfer. |
| `getItenMTelNo` | Method | Derives the transfer origin phone number based on transfer registration code, current phone number, and transfer destination phone number. |
| `getRRSKTelNo` | Method | Derives the contact phone number based on transfer registration code, phone numbers, and service contract detail number. |
| `getKiboUmu` | Method | Computes suspension preference (yes/no) from the service contract detail bean. |
| `getPullDownSelectCd` | Method | Converts a display value to its underlying selection code using a code list from the data bean. |
| `setYmdData` | Method | Splits a YYYYMMDD date string into separate year, month, and day fields in the bean. |
| `KKW05602` | Constant | Screen ID — the tokigi (transfer/portability) update/cancellation screen. |
| `トーキ更新・解除` | Constant | Screen name — "Transfer Update / Cancellation". |
| `X31SDataBeanAccess` | Class | Service form data bean — the data container for the service form screen state. |
| `X31SDataBeanAccessArray` | Class | Array wrapper for data bean lists — used to hold lists of detail records. |
| `DATABEAN_GET_VALUE` | Constant | Data bean operation — get a value from the bean. |
| `DATABEAN_SET_VALUE` | Constant | Data bean operation — set a value in the bean. |
