# Business Logic — KKW03204SFLogic.actionFix() [106 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW03204SF.KKW03204SFLogic` |
| Layer | Controller / Web Logic (Package: `eo.web.webview.KKW03204SF`) |
| Module | `KKW03204SF` (050 Number Issuance Change — ０５０番号発番変更) |

## 1. Role

### KKW03204SFLogic.actionFix()

The `actionFix` method implements the confirmation (determination) processing for the **050 Number Issuance Change** screen in K-Opticom's contract management system. The 050 number is a toll-free phone number service; this feature allows customers to change or manage their 050-number-related service contracts from the online service portal.

The method acts as a **router/dispatcher** that branches its processing based on the `trans_div` (transaction division) field, which indicates the type of service operation being confirmed. It handles three distinct service operations: **cancellation** (解約, Kaisetsu), **restoration** (回復, Kaifuku), and **reservation cancellation** (予約取消, Yoyaku Torikeshi). Each branch performs the following pattern: (1) set up DataBean values via a type-specific setup method, (2) map service items to DataBean fields via a type-specific mapping method with function code `FUNC_CD_1` (Check & Register), (3) invoke the corresponding backend service screen, (4) store the results back into the DataBean, and (5) set the appropriate success message.

The method serves as the **entry point for the confirm button** on the 050 Number Issuance Change screen. After all processing, if no error message is found in the bean, it sets the next screen ID (`KKW03206`) for navigation to the change completion screen, displays a system confirmation message to the user, and returns `true`. If an error message exists, it builds an appropriate error display and returns `true` (the calling logic handles the redirect).

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["actionFix()"])
    INIT["Initialize: result=true, get commonInfoBean, get serviceFormBean, msgInfo array"]

    COND{"Check trans_div"}

    DSL["trans_div = OP_TRAN_DIV_DSL (Cancellation)"]
    DSL_SET["setDataDsl()"]
    DSL_MAP["setMappedKKSV0136(FUNC_CD_1)"]
    DSL_SVC["doService(KKSV0136, KKSV0136OP)"]
    DSL_STORE["storeDataBeanDslsrv(paramBean, outputMap)"]
    DSL_MSG["msgInfo[0] = MSGSTRING[0]"]

    KAIHK["trans_div = OP_TRAN_DIV_KAIHK (Restoration)"]
    KAIHK_SET["setDataKaihk()"]
    KAIHK_MAP["setMappedKKSV0162(FUNC_CD_1)"]
    KAIHK_SVC["doService(KKSV0162, KKSV0162OP)"]
    KAIHK_ERRCHK{"setErrorMessageInfo(outputMap, KKW016201SC)"}
    KAIHK_ERR["Return false - error occurred"]
    KAIHK_STORE["storeDataBeanKaihksrv(paramBean, outputMap)"]
    KAIHK_MSG["msgInfo[0] = MSGSTRING[1]"]

    RSVCL["trans_div = OP_TRAN_DIV_RSV_CL (Reservation Cancellation)"]
    RSVCL_SET["setDataDslStp()"]
    RSVCL_MAP["setMappedKKSV0163(FUNC_CD_1)"]
    RSVCL_SVC["doService(KKSV0163, KKSV0163OP)"]
    RSVCL_STORE["storeDataBeanRsvclsrv(paramBean, outputMap)"]
    RSVCL_MSG["msgInfo[0] = MSGSTRING[2]"]

    ERRCHK_MSG["strMsg = bean.sendMessageString(ERR_MSG_ID, DATABEAN_GET_VALUE)"]
    ERRCHK_COND{"strMsg == null or empty?"}
    SUCCESS["Set nextScreenId/nextScreenName to commonInfoBean"]
    SUCCESS_MSG["JCCWebCommon.setMessageInfo(this, EKB4390__I, msgInfo)"]

    ERR_PATH["getMsgRep(trans_div, strMsg)"]
    ERR_NULL_MSG{"str == null?"}
    MSG_ID_ONLY["JCCWebCommon.setMessageInfo(this, strMsg)"]
    MSG_REPLACEMENT["JCCWebCommon.setMessageInfo(this, strMsg, str)"]

    DUMP["JSYwebLog.println(DataBean_Dump)"]
    RETURN["Return result(true)"]

    START --> INIT --> COND
    COND --> DSL
    DSL --> DSL_SET --> DSL_MAP --> DSL_SVC --> DSL_STORE --> DSL_MSG --> ERRCHK_MSG
    COND --> KAIHK
    KAIHK --> KAIHK_SET --> KAIHK_MAP --> KAIHK_SVC --> KAIHK_ERRCHK
    KAIHK_ERRCHK -->|true| KAIHK_ERR
    KAIHK_ERRCHK -->|false| KAIHK_STORE --> KAIHK_MSG --> ERRCHK_MSG
    COND --> RSVCL
    RSVCL --> RSVCL_SET --> RSVCL_MAP --> RSVCL_SVC --> RSVCL_STORE --> RSVCL_MSG --> ERRCHK_MSG

    ERRCHK_MSG --> ERRCHK_COND
    ERRCHK_COND -->|true| SUCCESS --> SUCCESS_MSG --> DUMP --> RETURN
    ERRCHK_COND -->|false| ERR_PATH --> ERR_NULL_MSG
    ERR_NULL_MSG -->|true| MSG_ID_ONLY --> DUMP
    ERR_NULL_MSG -->|false| MSG_REPLACEMENT --> DUMP
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This method takes no parameters. Configuration comes from instance fields set during screen initialization. |
| - | `trans_div` | `String` (inherited) | Transaction division code — determines which of the three service operations to perform. Values include `OP_TRAN_DIV_DSL` (Cancellation), `OP_TRAN_DIV_KAIHK` (Restoration), `OP_TRAN_DIV_RSV_CL` (Reservation Cancellation). Sets the processing branch. |
| - | `outputMap` | `HashMap` (inherited) | Output parameter map populated by `doService()` calls, containing service responses, error flags, and mapped data for each operation branch. |
| - | `MSGSTRING[]` | `String[]` (inherited) | Message string array — indexed by operation type. `MSGSTRING[0]` for cancellation success, `MSGSTRING[1]` for restoration success, `MSGSTRING[2]` for reservation cancellation success. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKAddSupportCC.setMessageInfo` | JKKAddSupportCC | - | Calls `setMessageInfo` in `JKKAddSupportCC` for display message setup |
| - | `JKKCreateNhkDntIktCC.setMessageInfo` | JKKCreateNhkDntIktCC | - | Calls `setMessageInfo` in `JKKCreateNhkDntIktCC` for display message setup |
| - | `JKKFumeiKktkSvcKeiUpdCC.setMessageInfo` | JKKFumeiKktkSvcKeiUpdCC | - | Calls `setMessageInfo` in `JKKFumeiKktkSvcKeiUpdCC` for display message setup |
| - | `JKKGetKikiUpdCodeNameCC.setMessageInfo` | JKKGetKikiUpdCodeNameCC | - | Calls `setMessageInfo` in `JKKGetKikiUpdCodeNameCC` for display message setup |
| - | `JKKGetKojiAkTaknkikiCC.setMessageInfo` | JKKGetKojiAkTaknkikiCC | - | Calls `setMessageInfo` in `JKKGetKojiAkTaknkikiCC` for display message setup |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Calls `sendMessageString` in `OneStopDataBeanAccess` to retrieve error message |
| - | `KKW03204SFLogic.doService` | KKW03204SFLogic | - | Calls `doService` in `KKW03204SFLogic` to invoke backend service screens |
| R | `KKW03204SFLogic.getMsgRep` | KKW03204SFLogic | - | Calls `getMsgRep` in `KKW03204SFLogic` to get replacement message text |
| - | `KKW03204SFLogic.setDataDsl` | KKW03204SFLogic | - | Calls `setDataDsl` in `KKW03204SFLogic` for cancellation DataBean setup |
| - | `KKW03204SFLogic.setDataDslStp` | KKW03204SFLogic | - | Calls `setDataDslStp` in `KKW03204SFLogic` for reservation cancellation DataBean setup |
| - | `KKW03204SFLogic.setDataKaihk` | KKW03204SFLogic | - | Calls `setDataKaihk` in `KKW03204SFLogic` for restoration DataBean setup |
| - | `KKW03204SFLogic.setErrorMessageInfo` | KKW03204SFLogic | - | Calls `setErrorMessageInfo` in `KKW03204SFLogic` for restoration error checking |
| - | `KKW03204SFLogic.setMappedKKSV0136` | KKW03204SFLogic | - | Calls `setMappedKKSV0136` in `KKW03204SFLogic` for cancellation mapping |
| - | `KKW03204SFLogic.setMappedKKSV0162` | KKW03204SFLogic | - | Calls `setMappedKKSV0162` in `KKW03204SFLogic` for restoration mapping |
| - | `KKW03204SFLogic.setMappedKKSV0163` | KKW03204SFLogic | - | Calls `setMappedKKSV0163` in `KKW03204SFLogic` for reservation cancellation mapping |
| - | `KKW03204SFLogic.storeDataBeanDslsrv` | KKW03204SFLogic | - | Calls `storeDataBeanDslsrv` in `KKW03204SFLogic` to store cancellation service result |
| - | `KKW03204SFLogic.storeDataBeanKaihksrv` | KKW03204SFLogic | - | Calls `storeDataBeanKaihksrv` in `KKW03204SFLogic` to store restoration service result |
| - | `KKW03204SFLogic.storeDataBeanRsvclsrv` | KKW03204SFLogic | - | Calls `storeDataBeanRsvclsrv` in `KKW03204SFLogic` to store reservation cancellation service result |

### Backend service invocations (via `doService`):

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `doService(KKSV0136, KKSV0136OP)` | KKSV0136SC / KKSV0136OP | KK_T_SVC_DSL, KK_T_SVC_KEI_UCWK (inferred from mapper) | Service cancellation (解約) — updates service contract to cancelled status |
| U | `doService(KKSV0162, KKSV0162OP)` | KKSV0162SC / KKSV0162OP | KK_T_SVC_KEI_UCWK, KK_T_OP_SVC_KEI (inferred from mapper) | Service restoration (回復) — restores a previously cancelled service contract |
| U | `doService(KKSV0163, KKSV0163OP)` | KKSV0163SC / KKSV0163OP | KK_T_SVC_KEI_UCWK, KK_T_OP_SVC_KEI, KK_T_SVC_DSL (inferred from mapper) | Reservation cancellation (予約取消) — cancels a service reservation |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0136 (Cancellation confirm) | KKSV0136Logic actionExecute -> actionFix -> KKW03204SFLogic.actionFix | doService [U] KK_T_SVC_DSL |
| 2 | Screen:KKSV0162 (Restoration confirm) | KKSV0162Logic actionExecute -> actionFix -> KKW03204SFLogic.actionFix | doService [U] KK_T_SVC_KEI_UCWK |
| 3 | Screen:KKSV0163 (Reservation cancellation confirm) | KKSV0163Logic actionExecute -> actionFix -> KKW03204SFLogic.actionFix | doService [U] KK_T_SVC_DSL |
| 4 | Screen:KKW03205 (050 Number change screen) | KKW03205SFLogic actionFix -> actionFix -> KKW03204SFLogic.actionFix | doService [U] Various (branch-dependent) |

## 6. Per-Branch Detail Blocks

**Block 1** — INIT (L354)

> Initialize local variables and retrieve shared form beans.

| # | Type | Code |
|---|------|------|
| 1 | SET | `result = true;` // Default result is success |
| 2 | EXEC | `X31SDataBeanAccess commoninfoBean = super.getCommonInfoBean();` // Retrieve common form bean for shared session data |
| 3 | EXEC | `X31SDataBeanAccess bean = super.getServiceFormBean();` // Retrieve service-specific form bean |
| 4 | SET | `X31SDataBeanAccess[] paramBean = {bean};` // Wrap bean in array for service call |
| 5 | SET | `String[] msgInfo = new String[1];` // Initialize display message holder |

**Block 2** — IF (condition) `JKKCommonConst.OP_TRAN_DIV_DSL.equals(trans_div)` [trans_div = "01" (Cancellation)] (L361)

> **Processing division "Cancellation" (解約)**. Handles the service cancellation flow: sets up cancellation-specific DataBean values, maps service items, calls the backend cancellation service, stores results, and sets the success message.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setDataDsl();` // Set cancellation-specific DataBean values |
| 2 | EXEC | `setMappedKKSV0136(JPCModelConstant.FUNC_CD_1);` // Map service items to DataBean (function code: Check & Register) |
| 3 | CALL | `doService("KKSV0136", "KKSV0136OP");` // Invoke cancellation service |
| 4 | EXEC | `storeDataBeanDslsrv(paramBean, outputMap);` // Store service result into DataBean |
| 5 | SET | `msgInfo[0] = MSGSTRING[0];` // Set cancellation success message |

**Block 2.1** — IF (nested) `trans_div == OP_TRAN_DIV_DSL` (L361)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setDataDsl()` // Setup cancellation DataBean |
| 2 | EXEC | `setMappedKKSV0136(FUNC_CD_1)` // Map fields for KKSV0136 screen |
| 3 | CALL | `doService("KKSV0136", "KKSV0136OP")` // Call cancellation backend |
| 4 | EXEC | `storeDataBeanDslsrv(paramBean, outputMap)` // Persist results |
| 5 | SET | `msgInfo[0] = MSGSTRING[0]` // Success message for cancellation |

**Block 3** — ELSE-IF (condition) `JKKCommonConst.OP_TRAN_DIV_KAIHK.equals(trans_div)` [trans_div = "02" (Restoration)] (L374)

> **Processing division "Restoration" (回復)**. Handles the service restoration flow: sets up restoration-specific DataBean values, maps service items, calls the backend restoration service, checks for errors via `setErrorMessageInfo`, stores results, and sets the success message. This branch has an additional error-checking step compared to the other branches.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setDataKaihk();` // Set restoration-specific DataBean values |
| 2 | EXEC | `setMappedKKSV0162(JPCModelConstant.FUNC_CD_1);` // Map service items to DataBean (function code: Check & Register) |
| 3 | CALL | `doService("KKSV0162", "KKSV0162OP");` // Invoke restoration service |
| 4 | EXEC | `storeDataBeanKaihksrv(paramBean, outputMap);` // Store service result into DataBean |
| 5 | SET | `msgInfo[0] = MSGSTRING[1];` // Set restoration success message |

**Block 3.1** — IF (nested) `setErrorMessageInfo(outputMap, "KKW016201SC")` (L383)

> **Error check for restoration branch** (OM-2015-0000564, 2015-12-04). If an error occurred during restoration (e.g., unresolved SIP cancellation/ deletion transfer phone OP), return `false` immediately to halt processing. This was added to ensure that transfer phone OPs that were not resolved after a number change are properly cancelled.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `setErrorMessageInfo(outputMap, "KKW016201SC")` // Check for error in restoration output |
| 2 | RETURN | `return false;` // Error detected — abort and propagate failure |

**Block 4** — ELSE-IF (condition) `JKKCommonConst.OP_TRAN_DIV_RSV_CL.equals(trans_div)` [trans_div = "03" (Reservation Cancellation)] (L394)

> **Processing division "Reservation Cancellation" (予約取消)**. Handles the reservation cancellation flow: sets up reservation cancellation-specific DataBean values, maps service items, calls the backend reservation cancellation service, stores results, and sets the success message.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `setDataDslStp();` // Set reservation cancellation-specific DataBean values |
| 2 | EXEC | `setMappedKKSV0163(JPCModelConstant.FUNC_CD_1);` // Map service items to DataBean (function code: Check & Register) |
| 3 | CALL | `doService("KKSV0163", "KKSV0163OP");` // Invoke reservation cancellation service |
| 4 | EXEC | `storeDataBeanRsvclsrv(paramBean, outputMap);` // Store service result into DataBean |
| 5 | SET | `msgInfo[0] = MSGSTRING[2];` // Set reservation cancellation success message |

**Block 5** — POST-PROCESSING (L402)

> After the conditional branch completes, retrieve any error message from the bean and handle success or error navigation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `strMsg = bean.sendMessageString(KKW03204SFConst.ERR_MSG_ID, X31CWebConst.DATABEAN_GET_VALUE);` // Retrieve error message from DataBean |
| 2 | IF | `strMsg == null || "".equals(strMsg)` // No error — proceed to completion screen |

**Block 5.1** — IF (nested) `strMsg == null || "".equals(strMsg)` — Success Path (L404)

> **Success path**: If no error message exists, set the next screen navigation data and display the confirmation message.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_ID, X31CWebConst.DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_ID_KKW03206);` // Set next screen ID (change completion screen) |
| 2 | EXEC | `commoninfoBean.sendMessageString(CommonInfoCFConst.NEXT_SCREEN_NAME, X31CWebConst.DATABEAN_SET_VALUE, JKKScreenConst.SCREEN_NAME_KKW03206);` // Set next screen name |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB4390__I, msgInfo);` // Display completion message to user |

**Block 5.2** — ELSE (nested) Error Path (L412)

> **Error path**: If an error message exists, build the error display with optional text replacement based on `trans_div`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `str = getMsgRep(trans_div, strMsg);` // Get replacement message text |
| 2 | IF | `str == null` // Message ID only (no replacement text) |

**Block 5.2.1** — IF (nested) `str == null` — Message ID Only (L415)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, strMsg);` // Display error message by ID only |

**Block 5.2.2** — ELSE (nested) — With Replacement Text (L418)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, strMsg, str);` // Display error message with replacement text |

**Block 6** — FINAL (L424)

> Log the DataBean state for debugging and return success result.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `JSYwebLog.println(JSYwebLog.DataBean_Dump, getClass(), dumpDatabean(), null, null, null);` // Dump DataBean to log |
| 2 | RETURN | `return result;` // Always returns `true` (result is never modified) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `trans_div` | Field | Transaction division code — determines the type of service operation: cancellation, restoration, or reservation cancellation |
| `OP_TRAN_DIV_DSL` | Constant | Transaction division value for "Cancellation" (解約) — service cancellation processing |
| `OP_TRAN_DIV_KAIHK` | Constant | Transaction division value for "Restoration" (回復) — service restoration processing |
| `OP_TRAN_DIV_RSV_CL` | Constant | Transaction division value for "Reservation Cancellation" (予約取消) — reservation cancellation processing |
| `KKW03204SF` | Screen | 050 Number Issuance Change screen module — allows changing toll-free (050) number service contracts |
| `KKW03206` | Screen | Change completion screen — displayed after successful confirmation processing |
| `KKSV0136` | Screen | Service cancellation (解約) confirm screen — handles cancellation service item mapping |
| `KKSV0162` | Screen | Service restoration (回復) confirm screen — handles restoration service item mapping |
| `KKSV0163` | Screen | Reservation cancellation (予約取消) confirm screen — handles reservation cancellation service item mapping |
| `FUNC_CD_1` | Constant | Function code "1" — Check & Register (チェック＆登録) mode |
| `MSGSTRING[0]` | Constant | Success message for cancellation (解約) |
| `MSGSTRING[1]` | Constant | Success message for restoration (回復) |
| `MSGSTRING[2]` | Constant | Success message for reservation cancellation (予約取消) |
| `ERR_MSG_ID` | Constant | Error message identifier used to check for error conditions in the DataBean |
| `EKB4390__I` | Constant | System message code for completion confirmation display |
| `050番号` | Business term | Toll-free phone number (050 prefix) — a premium telecommunications service in Japan |
| 解約 (Kaisetsu) | Japanese field | Service cancellation — terminates an active service contract |
| 回復 (Kaifuku) | Japanese field | Service restoration — reinstates a previously cancelled service contract |
| 予約取消 (Yoyaku Torikeshi) | Japanese field | Reservation cancellation — cancels a pending service reservation |
| 確定処理 (Kakutei Shori) | Japanese field | Confirmation/determination processing — finalizing user inputs and committing changes |
| 画面遷移 (Gamen Ten'i) | Japanese field | Screen navigation — redirecting to the next screen after processing completes |
| SOD | Acronym | Service Order Data — telecom order fulfillment entity |
| DataBean | Technical term | Form data container (`X31SDataBeanAccess`) — holds screen input/output data |
| `outputMap` | Field | Service output map — holds results from `doService()` calls including error flags and updated data |
| `COMMON_INFO_BEAN` | Technical term | Common information bean (`X31SDataBeanAccess`) — shared session data across screens |
| SIP | Acronym | Session Initiation Protocol — VoIP signaling protocol used for transfer phone services |
| OP | Abbreviation | Operation — refers to specific service operations like transfer phone OP (転送電話OP) |
| KK_T_SVC_DSL | Table | Service cancellation table — stores service cancellation records |
| KK_T_SVC_KEI_UCWK | Table | Service detail work table — stores service contract sub-details |
| KK_T_OP_SVC_KEI | Table | Operation service contract table — stores operation-level service contract data |
