# Business Logic — KKW02701SFLogic.forwardFix() [53 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02701SF.KKW02701SFLogic` |
| Layer | Controller Logic (webview package, extends `JCCWebBusinessLogic`) |
| Module | `KKW02701SF` (Package: `eo.web.webview.KKW02701SF`) |

## 1. Role

### KKW02701SFLogic.forwardFix()

`forwardFix()` is the **Update button press processing** method for the KKW02701 screen — the course history verification screen in the K-Opticom eo customer base system. Its primary business purpose is to process the user's update action after verifying and executing a service change operation via a backend service call.

The method performs four sequential responsibilities. First, it **invokes a backend service** (`invokeService`) to execute the core service change logic, passing in the prepared parameter map and receiving an output map with service results. Second, it **validates the equipment operation reservation flag** (`kikiOpRsvFlg`) returned by the `KKSV039552SC` integration — if equipment is already reserved, processing is aborted with an error message (message code `EKBF750_KW`), preventing conflicting equipment operations. Third, it **checks for service invocation errors** via `X31CMessageResult`; any non-null result triggers an error message display and abort. Fourth, it **special-cases the eo Mobile 3G service category** (`PRC_GRP_CD_08`): when the customer is in this mobile course, it runs a mobile course change cancel check (`isMobileCourseChgCheckResult`), displaying a warning message (`EKB9480_KW`) if the cancel check fails. Finally, regardless of which branch was taken, it displays a generic cancellation confirmation message (`EKB9360__I`) and forwards the user to the KKW02703 screen (`setForwardInfo`).

The method implements a **gate-and-forward pattern** — it gates processing through multiple validation checkpoints (equipment reservation, service result, mobile course check), and on successful completion, dispatches the user to a downstream screen. This is the "Fix" (更新/fixed action) counterpart in the screen's button processing flow, distinct from the "Return button processing" (`forwardReturn`) that follows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["forwardFix"])
    START --> INIT["Initialize: inputMap, outputMap, paramMap, svcFormBean"]
    INIT --> SET_IN_MSG["setInMsg - Set upper item data"]
    SET_IN_MSG --> INVOKE["invokeService - Call service"]
    INVOKE --> CHECK_KKSV0395{"KKSV039552SC key exists and kikiOpRsvFlg == 1"}
    CHECK_KKSV0395 -->|true| SET_ERR_KKSV0395["setMessageInfo EKBF750_KW"]
    SET_ERR_KKSV0395 --> RETURN_FALSE_1["Return false"]
    CHECK_KKSV0395 -->|false| CHECK_MSG_RESULT{"msgResult != null?"}
    CHECK_MSG_RESULT -->|true| SET_ERR_MSG["setMessageInfo msgResult"]
    SET_ERR_MSG --> RETURN_FALSE_2["Return false"]
    CHECK_MSG_RESULT -->|false| GET_PRC_GRP["Get price group code from svcFormBean"]
    GET_PRC_GRP --> CHECK_MOBILE{"prcGrpCd == PRC_GRP_CD_08?"}
    CHECK_MOBILE -->|true| CHECK_MOBILE_RESULT{"isMobileCourseChgCheckResult"}
    CHECK_MOBILE_RESULT -->|false| SET_WARN_MOBILE["setMessageInfo EKB9480_KW"]
    SET_WARN_MOBILE --> MERGE
    CHECK_MOBILE_RESULT -->|true| MERGE
    CHECK_MOBILE -->|false| MERGE
    MERGE["Proceed to message setup"] --> SET_CANCEL_MSG["setMessageInfo EKB9360__I with Cancel label"]
    SET_CANCEL_MSG --> SET_FORWARD["setForwardInfo KKW02703"]
    SET_FORWARD --> RETURN_TRUE["Return true"]
```

**CRITICAL — Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|-----------------|
| `PRC_GRP_CD_08` | `"08"` | eo Mobile 3G price group code — identifies mobile course customers |
| `KKSV039552SC` | `"KKSV039552SC"` | Output map key for equipment operation reservation check service |
| `EKB9480_KW` | Message Code | Warning message for mobile course change cancel check failure |
| `EKB9360__I` | Message Code | Cancellation confirmation info message |
| `EKBF750_KW` | Message Code | Error message for equipment operation reservation conflict |
| `KKW02703` | Screen ID | Forward destination screen ID |

## 3. Parameter Analysis

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

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

| Field / Source | Type | Business Description |
|---------------|------|---------------------|
| `svcFormBean` (from `getServiceFormBean()`) | `X31SDataBeanAccess` | The current screen's data bean, providing access to form values including the price group code (`prcGrpCd`) |
| `this` (implicit) | `KKW02701SFLogic` | The business logic instance itself, used by `JCCWebCommon.setMessageInfo()` and `setForwardInfo()` |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCCBatCommon.invokeService` | JCCBatCommon | - | Invokes the backend service to perform core business processing. The SC code and target entity are determined dynamically by the invoked service (likely the course change/service registration SC). |
| - | `KKW02701SFLogic.isMobileCourseChgCheckResult` | KKW02701SFLogic | - | Checks mobile course change cancel eligibility for eo Mobile 3G customers. Returns boolean indicating whether the cancel check passes. |
| - | `KKW02701SFLogic.setInMsg` | KKW02701SFLogic | - | Sets upper item data (parent/context data) into the input parameter map for service invocation. |
| - | `KKW02701SFLogic.setForwardInfo` | KKW02701SFLogic | - | Sets forwarding screen information (KKW02703 screen ID and name) in the data bean for screen transition. |
| - | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets error/warning/info messages in the session context for display to the end user. |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Retrieves the price group code (`prcGrpCd`) from the service form bean. Read operation on form data. |

**Analysis Notes:**

- The central operation is `invokeService(paramMap, inputMap, outputMap)` which delegates to `JCCBatCommon.invokeService()`. The actual SC code and database tables are determined at runtime based on the screen context and the data contained in `paramMap` — the specific service being called is not hardcoded in this method. The `outputMap` may contain a key `"KKSV039552SC"` with equipment operation reservation information.
- The `KKSV039552SC` output map key references the equipment operation reservation check service, introduced in ANK-4287-00-00 (version 60.00.00) for the eo fixed-term equipment option reservation feature.
- No direct database CRUD operations exist in this method — all persistence is delegated to the backend service invoked via `invokeService()`.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKW02701SF | `KKW02701SFLogic.forwardFix()` [entry point — Update button handler] | `invokeService [R/U] KKSV039552SC (equipment operation reservation check)` |
| 2 | Screen:KKW02701SF | `KKW02701SFLogic.forwardFix()` -> `isMobileCourseChgCheckResult()` | `isMobileCourseChgCheckResult [R] Mobile course change cancel check` |

**Caller analysis notes:**
- The only direct callers found for `forwardFix()` are within the same `KKW02701SFLogic` class itself. This method is the entry point for the Update button processing in the KKW02701 screen (Course History Verification).
- The method is invoked by the screen framework (X31) when the user presses the "Update" (更新) button on the KKW02701 screen.

## 6. Per-Branch Detail Blocks

**Block 1** — [SETUP] — Data initialization (L426–L430)

| # | Type | Code |
|---|------|------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` |
| 2 | SET | `outputMap = new HashMap<String, Object>()` |
| 3 | SET | `paramMap = null` |
| 4 | SET | `svcFormBean = super.getServiceFormBean()` |

> Initializes data structures for the service invocation. `inputMap` carries data to the service, `outputMap` receives results, and `paramMap` will hold the filtered parameters for the service call.

**Block 2** — [CALL] — Set upper item data (L432)

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = setInMsg(svcFormBean, inputMap, JKKCommonConst.FUNC_CODE_1)` |
| 2 | EXEC | `// 上部項目の設定 (Set upper item data)` |

> Prepares the input parameter map by setting upper/context-level data from the form bean. `FUNC_CODE_1` identifies this as a screen function call.

**Block 3** — [CALL] — Service invocation (L435)

| # | Type | Code |
|---|------|------|
| 1 | SET | `msgResult = invokeService(paramMap, inputMap, outputMap)` |
| 2 | EXEC | `// サービス呼び出し (Service call)` |

> Executes the core backend service. The service performs the actual business processing (course change/registration) and populates `outputMap` with results. `msgResult` captures any error message from the service.

**Block 4** — [IF] — Equipment operation reservation conflict check (L437–L450)

> ANK-4287-00-00 ADD START — eo fixed-term equipment option reservation feature. If the equipment operation reservation flag is set, the system blocks the update to prevent conflicting equipment operations.

**Block 4.1** — [IF] — `kikiOpRsvFlg == "1"` (Equipment reserved) (L439–L447)

| # | Type | Code |
|---|------|------|
| 1 | SET | `kksv039552ccMap = (HashMap<String, Object>) outputMap.get("KKSV039552SC")` |
| 2 | IF | `kksv039552ccMap != null && kksv039552ccMap.containsKey("kikiOpRsvFlg")` |
| 3 | SET | `kikiOpRsvFlg = (String) kksv039552ccMap.get("kikiOpRsvFlg")` |
| 4 | IF | `"1".equals(kikiOpRsvFlg)` |
| 5 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKBF750_KW)` |
| 6 | RETURN | `return false` |

> When `kikiOpRsvFlg` is `"1"`, it means equipment is already reserved for this service change. The update is blocked, and error message `EKBF750_KW` is displayed to inform the user of the equipment reservation conflict.

**Block 5** — [IF] — Service error handling (L453–L458)

| # | Type | Code |
|---|------|------|
| 1 | IF | `null != msgResult` |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, msgResult)` |
| 3 | RETURN | `return false` |

> If the service invocation returned an error message (non-null `msgResult`), display the error and abort. This is the general error handling path for service failures.

**Block 6** — [SET] — Get price group code (L460)

| # | Type | Code |
|---|------|------|
| 1 | SET | `prcGrpCd = svcFormBean.sendMessageString("料金グループコード", X31CWebConst.DATABEAN_GET_VALUE)` |

> Reads the price group code from the service form bean. The string `"料金グループコード"` (Price group code) is used as the data key.

**Block 7** — [IF] — eo Mobile 3G special handling (L462–L473)

> `// eoモバイル3Gの場合 (For eo Mobile 3G)` — When the customer's price group code equals `PRC_GRP_CD_08`, special mobile course change cancel check is performed.

**Block 7.1** — [IF] — Mobile course change cancel check (L464–L469)

| # | Type | Code |
|---|------|------|
| 1 | IF | `JKKCommonConst.PRC_GRP_CD_08.equals(prcGrpCd)` |
| 2 | IF | `!isMobileCourseChgCheckResult(outputMap)` |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB9480_KW)` |
| 4 | // | `// 関連チェック（モバイルコース変更取消チェック）(Related check — Mobile course change cancel check)` |

> For eo Mobile 3G customers, if the mobile course change cancel check fails, display warning message `EKB9480_KW`. This prevents customers from making incompatible changes to their mobile course. The process continues (does not abort) — only a warning is shown.

**Block 8** — [CALL] — Display cancellation confirmation (L472)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB9360__I, new String[]{"予約取消"})` |

> Sets the cancellation confirmation info message. `"予約取消"` translates to "Cancel" — this informs the user that the update was processed as a cancellation action.

**Block 9** — [CALL] — Set forward destination (L474–L475)

| # | Type | Code |
|---|------|------|
| 1 | CALL | `setForwardInfo(JKKScreenConst.SCREEN_ID_KKW02703, JKKScreenConst.SCREEN_NAME_KKW02703)` |
| 2 | // | `// 遷移先画面情報を設定します (Set forward destination screen information)` |

> Configures the screen transition to KKW02703. The customer contract change screen details screen will be displayed next.

**Block 10** — [RETURN] — Success (L477)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return true` |

> Processing completed successfully. The screen framework will transition to KKW02703 as set in Block 9.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| KKW02701SF | Screen | Course History Verification screen — allows users to review and update course history records for customer service contracts |
| KKW02703 | Screen ID | Customer Contract Change Details screen — the next screen in the workflow after the update is processed |
| forwardFix | Method | Update button press processing — processes service change updates submitted by the user |
| `kikiOpRsvFlg` | Field | Equipment operation reservation flag — when set to "1", indicates equipment is already reserved for an operation, blocking conflicting updates |
| KKSV039552SC | SC Code | Equipment operation reservation check service component — verifies if equipment is reserved for operations |
| `prcGrpCd` | Field | Price group code — classifies the customer's service category (e.g., "08" for eo Mobile 3G) |
| `PRC_GRP_CD_08` | Constant | Price group code "08" — identifies eo Mobile 3G customers who are subject to mobile course change cancel checks |
| isMobileCourseChgCheckResult | Method | Mobile course change cancel check — verifies whether mobile course changes can be cancelled for the current customer |
| `setInMsg` | Method | Upper item data setter — prepares input parameter map with context/parent data for service invocation |
| `invokeService` | Method | Service dispatcher — invokes the backend service with the prepared parameter map, handling service routing and error capture |
| `setForwardInfo` | Method | Forward destination setter — configures the screen transition target (screen ID and name) for post-processing navigation |
| `setMessageInfo` | Method | Message setter — sets system messages (error, warning, info) in the session context for display to the user |
| `sendMessageString` | Method | Data bean string accessor — retrieves or sets string values in the screen's data bean |
| `X31CMessageResult` | Type | Service call result wrapper — carries error/success messages from service invocations |
| `JCCBatCommon.invokeService` | CBS | Common batch/web service invocation — the base service dispatcher used for all backend service calls |
| EKBF750_KW | Message Code | Equipment operation reservation conflict error — displayed when trying to update while equipment is reserved |
| EKB9480_KW | Message Code | Mobile course change cancel check warning — displayed when the mobile course cancel check detects an issue |
| EKB9360__I | Message Code | Cancellation confirmation info — displayed to confirm the update was processed as a cancellation |
| FUNC_CODE_1 | Constant | Function code "1" — identifies the call as a standard screen function |
| ANK-4287-00-00 | Change Request | eo fixed-term equipment option reservation feature — introduced the equipment reservation conflict check in v60.00.00 |
| 更新ボタン押下処理 | Japanese comment | Update button press processing — the business operation triggered when the user clicks the Update button |
| 上部項目の設定 | Japanese comment | Set upper item data — configuring parent/context-level data in the input map |
| サービス呼び出し | Japanese comment | Service call — invoking the backend service for business processing |
| eoモバイル3Gの場合 | Japanese comment | For eo Mobile 3G — the mobile service category branch |
| 関連チェック | Japanese comment | Related check — refers to the mobile course change cancel check |
| 予約取消 | Japanese text | Cancellation — the action being confirmed |
| 遷移先画面情報を設定します | Japanese comment | Set forward destination screen information — preparing the screen transition |
