# Business Logic — KKA16701SFLogic.forwardFix() [54 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKA16701SF.KKA16701SFLogic` |
| Layer | Controller (Web Logic) |
| Module | `KKA16701SF` (Package: `eo.web.webview.KKA16701SF`) |

## 1. Role

### KKA16701SFLogic.forwardFix()

This method implements the **Update Button Press Processing** (更新ボタン押下処理) for a service contract cancellation flow within the eo (NTT East one-stop web ordering) system. When a user clicks the "Update" button on a service modification screen, this method coordinates the end-to-end processing: it retrieves the current form data via `setInMsg`, invokes a backend service through `invokeService` to perform the core business operation, and then performs a series of post-processing checks.

The method implements a **delegation + guard pattern**. It delegates the primary business operation to the backend service (via `JCCBatCommon.invokeService`), and then applies layered guard checks before navigating to the completion screen. One guard (added under ANK-4287-00-00) checks a key operation reservation flag (`kikiOpRsvFlg`) returned from a KKSV039552SC sub-component — if set to "1", it blocks the flow and displays an error. Another guard checks for a generic service invocation error (`msgResult`).

A critical conditional branch is driven by the **price group code** (料金グループコード). When the price group code equals "08" (PRC_GRP_CD_08 — eo Mobile EM service), the method performs an additional **mobile course change cancellation check** via `isMobileCourseChgCheckResult`. This method verifies whether the customer is performing a specific plan transition (from plan code A26 to A59, or vice versa — i.e., from standard 3G 7.2M type to 3G 7.2M optical hybrid type, or the reverse). If this sensitive plan change is detected and a work order case exists, an additional warning message is displayed.

Regardless of the branch taken, the method always displays an information message confirming "Contract Cancellation" (予約取消) and then sets the forward navigation target to screen KKW02703 (Contract Cancellation Completion — 予約取消完了). It is called by five distinct screen logic classes (KKA15401SFLogic, KKA15501SFLogic, KKA16501SFLogic, KKA16701SFLogic, KKA17901SFLogic), making it a shared button handler across multiple service modification workflows.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["forwardFix"])
    START --> INIT["Initialize inputMap, outputMap, paramMap"]
    INIT --> GET_BEAN["Get svcFormBean from super"]
    GET_BEAN --> SET_IN["setInMsg with FUNC_CODE_1"]
    SET_IN --> INVOKE["invokeService with paramMap, inputMap, outputMap"]
    INVOKE --> CHECK_KKSV{kksv039552ccMap != null and has kikiOpRsvFlg}
    CHECK_KKSV -->|true| CHECK_FLG{kikiOpRsvFlg equals 1}
    CHECK_KKSV -->|false| CHECK_MSG{msgResult != null}
    CHECK_FLG -->|true| ERR_KIKI["setMessageInfo EKBF750_KW"]
    ERR_KIKI --> RET_KIKI["Return false"]
    CHECK_FLG -->|false| CHECK_MSG
    CHECK_MSG -->|true| ERR_RESULT["setMessageInfo msgResult"]
    ERR_RESULT --> RET_RESULT["Return false"]
    CHECK_MSG -->|false| GET_PRC["sendMessageString priceGroupCode"]
    GET_PRC --> CHECK_PRG{prcGrpCd equals 08}
    CHECK_PRG -->|true| MOB_CHECK["isMobileCourseChgCheckResult outputMap"]
    MOB_CHECK --> MOBILE_RESULT{Result is false}
    MOBILE_RESULT -->|true| WARN_MOB["setMessageInfo EKB9480_KW"]
    WARN_MOB --> SET_INFO["setMessageInfo EKB9360__I with 予約取消"]
    MOBILE_RESULT -->|false| SET_INFO
    CHECK_PRG -->|false| SET_INFO
    SET_INFO --> FORWARD["setForwardInfo KKW02703 予約取消完了"]
    FORWARD --> RET_TRUE["Return true"]
```

**Block descriptions:**

1. **Initialization & Service Invocation (Lines 1158–1170):** Creates input/output parameter maps, retrieves the service form bean, sets input data via `setInMsg` (using FUNC_CODE_1 = "1" for check+register mode), and invokes the backend service via `invokeService`.

2. **Key Operation Reservation Guard (Lines 1172–1183):** [ANK-4287-00-00 ADD] Checks if `KKSV039552CC` contains `kikiOpRsvFlg` set to "1". If so, sets error message `EKBF750_KW` (equipment operation reservation error) and returns `false`, blocking the cancellation flow.

3. **Service Error Guard (Lines 1186–1190):** If `msgResult` is not null (indicating a service error occurred), sets the error message via `JCCWebCommon.setMessageInfo` and returns `false`.

4. **Price Group Code Branch (Lines 1192–1202):** Retrieves the price group code (料金グループコード) from the service form bean. If equal to "08" (eo Mobile EM), performs mobile course change cancellation check. If the check fails (returns false), displays warning `EKB9480_KW`.

5. **Completion & Forwarding (Lines 1204–1207):** Sets the informational message `EKB9360__I` with argument "Contract Cancellation" (予約取消), navigates to screen `KKW02703` (Contract Cancellation Completion — 予約取消完了), and returns `true`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | This is an instance method with no external parameters. It operates on the instance's service form bean (retrieved via `super.getServiceFormBean()`) and internally-managed maps. |

**Instance fields / external state read:**

| Source | Field / Accessor | Business Description |
|--------|-----------------|---------------------|
| `super.getServiceFormBean()` | `X31SDataBeanAccess svcFormBean` | The current screen's form bean containing user-entered data and pricing context (including the price group code). |
| `this` (implicit) | Instance state of `KKA16701SFLogic` | The logic class instance, used in `setMessageInfo(this, ...)` calls for error message routing. |

## 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 with paramMap, inputMap, outputMap — delegates core business processing (service type registration/cancellation logic). |
| - | `KKA16701SFLogic.isMobileCourseChgCheckResult` | KKA16701SFLogic | - | Checks if a mobile course change cancellation warning is needed by comparing old and new course plan codes (PCRS_CD_A26, PCRS_CD_A59). |
| - | `KKA16701SFLogic.setForwardInfo` | KKA16701SFLogic | - | Sets navigation target screen info (KKW02703 / 予約取消完了) for post-processing forwarding. |
| - | `KKA16701SFLogic.setInMsg` | KKA16701SFLogic | - | Sets input message parameters from the service form bean into the input map using FUNC_CODE_1. |
| C | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets error message EKBF750_KW (equipment operation reservation conflict) — creates session error info. |
| C | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets error message from msgResult — creates session error info on service failure. |
| C | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets informational message EKB9360__I with "予約取消" (Contract Cancellation) — creates session info. |
| C | `JCCWebCommon.setMessageInfo` | JCCWebCommon | - | Sets warning message EKB9480_KW (mobile course change cancellation warning) — creates session warning info. |
| C | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Retrieves the price group code from the service form bean. |

**Notes:**
- The `invokeService` call delegates to the backend service component (likely `JCCBatCommon`) which handles the actual database CRUD operations for the service modification/cancellation. The specific SC Code and entity tables are not directly referenced in this method's source — they are encapsulated within the called service.
- The `isMobileCourseChgCheckResult` helper checks course plan codes against PCRS_CD_A26 ("A26" — 3G 7.2M Standard Type) and PCRS_CD_A59 ("A59" — 3G 7.2M Optical Hybrid Type) to detect sensitive plan transitions.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Logic: KKA15401SFLogic | `apiControl()` → `forwardFix()` | `invokeService [U] Service cancellation/registration` |
| 2 | Logic: KKA15501SFLogic | `apiControl()` → `forwardFix()` | `invokeService [U] Service cancellation/registration` |
| 3 | Logic: KKA16501SFLogic | `apiControl()` → `forwardFix()` | `invokeService [U] Service cancellation/registration` |
| 4 | Logic: KKA16701SFLogic | `apiControl()` → `forwardFix()` | `invokeService [U] Service cancellation/registration` |
| 5 | Logic: KKA17901SFLogic | `apiControl()` → `forwardFix()` | `invokeService [U] Service cancellation/registration` |

**Notes:**
- All five callers are logic classes (not direct screen entry points) that invoke `forwardFix()` from within their `apiControl()` method. These correspond to different service modification screens within the eo web ordering system.
- The method is a shared button handler — the Update button press is processed uniformly across multiple service change screens, each calling this same method with their respective form data.
- Terminal operations from this method: `setInMsg` (parameter setup), `invokeService` (backend service call), `setMessageInfo` (error/info message creation), `setForwardInfo` (navigation target setup), `isMobileCourseChgCheckResult` (plan change detection).

## 6. Per-Branch Detail Blocks

**Block 1** — [PROCESS] Initialize maps and get form bean (L1158)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `inputMap = new HashMap<String, Object>()` | Creates the input parameter map for the service invocation. |
| 2 | SET | `outputMap = new HashMap<String, Object>()` | Creates the output parameter map to receive service results. |
| 3 | SET | `paramMap = null` | Initializes the parameter map (populated later by setInMsg). |
| 4 | SET | `svcFormBean = super.getServiceFormBean()` | Retrieves the current screen's form bean containing user-entered data. |

**Block 2** — [PROCESS] Set input data and invoke service (L1165–L1170)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `paramMap = setInMsg(svcFormBean, inputMap, JKKCommonConst.FUNC_CODE_1)` | Sets input message parameters from the form bean. FUNC_CODE_1 = "1" indicates check and register mode (チェック＆登録). |
| 2 | CALL | `msgResult = invokeService(paramMap, inputMap, outputMap)` | Invokes the backend service to perform the core business operation (service cancellation/registration processing). |

**Block 3** — [IF] Equipment operation reservation flag check (L1173–L1184)
*ANK-4287-00-00 ADD: Guard against equipment operation reservation conflicts*

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `kksv039552ccMap = (HashMap)outputMap.get("KKSV039552SC")` | Retrieves the KKSV039552SC sub-component result from the output map. |
| 2 | IF | `kksv039552ccMap != null && kksv039552ccMap.containsKey("kikiOpRsvFlg")` | Checks if the equipment operation reservation flag exists in the output. |
| 3 | SET | `kikiOpRsvFlg = (String)kksv039552ccMap.get("kikiOpRsvFlg")` | Extracts the equipment operation reservation flag value. |
| 4 | IF | `"1".equals(kikiOpRsvFlg)` — [KIKI_OP_RSV_FLG = "1"] | If the flag is "1", an equipment operation conflict exists. |
| 5 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKBF750_KW)` | Sets error message for equipment operation reservation conflict. |
| 6 | RETURN | `return false` | Aborts processing — returns `false` to signal failure. |
| 7 | ELSE | Fall-through to Block 4 (msgResult check). | No action — processing continues. |

**Block 4** — [IF] Service error result check (L1186–L1190)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `null != msgResult` — [msgResult is not null] | If the service invocation returned an error result. |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, msgResult)` | Sets the error message from the service result. |
| 3 | RETURN | `return false` | Aborts processing — returns `false` to signal service error. |
| 4 | ELSE | Fall-through to Block 5 (price group code retrieval). | Service succeeded — continue with post-processing. |

**Block 5** — [PROCESS] Retrieve price group code (L1192)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `prcGrpCd = svcFormBean.sendMessageString("料金グループコード" (price group code), X31CWebConst.DATABEAN_GET_VALUE)` | Retrieves the price group code from the service form bean. The string "料金グループコード" is a key for the form bean's message string retrieval. |

**Block 6** — [IF] eo Mobile 3G price group code branch (L1194–L1202)
*PRC_GRP_CD_08 = "08" (eo Mobile EM — 料金グループコード（eoモバイル(EM)）)*

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | IF | `JKKCommonConst.PRC_GRP_CD_08.equals(prcGrpCd)` — [PRC_GRP_CD_08 = "08"] | If the price group code is "08" (eo Mobile EM service). |
| 2 | IF | `!isMobileCourseChgCheckResult(outputMap)` — [Mobile course change cancellation check] | Calls the helper method to check if a sensitive plan transition (A26 ↔ A59) is occurring. Returns `false` when a warning is needed. |
| 3 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB9480_KW)` | Sets the mobile course change cancellation warning message when the check detects a sensitive plan change. |
| 4 | ELSE | Fall-through (check passed or not applicable). | No warning message set — continue to Block 7. |

**Block 7** — [PROCESS] Set informational message and forward (L1204–L1207)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `JCCWebCommon.setMessageInfo(this, JPCOnlineMessageConstant.EKB9360__I, new String[]{"予約取消"} (Contract Cancellation))` | Sets the completion information message indicating contract cancellation has been processed. |
| 2 | CALL | `setForwardInfo(JKKScreenConst.SCREEN_ID_KKW02703, JKKScreenConst.SCREEN_NAME_KKW02703)` | Sets forward navigation to screen KKW02703 (予約取消完了 — Contract Cancellation Completion). |
| 3 | RETURN | `return true` | Returns `true` indicating successful completion of the update button processing. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `forwardFix` | Method | Update button press processing — handles the core flow when a user clicks the "Update" button on a service modification/cancellation screen. |
| `setInMsg` | Method | Input message setter — populates the input parameter map from the service form bean for service invocation. |
| `invokeService` | Method | Backend service invoker — delegates to the business logic tier (JCCBatCommon) to perform actual data operations. |
| `setForwardInfo` | Method | Forward navigation setter — configures the target screen for post-processing redirect. |
| `isMobileCourseChgCheckResult` | Method | Mobile course change cancellation checker — detects if a customer is transitioning between 3G standard type (A26) and 3G optical hybrid type (A59), or vice versa. |
| `kikiOpRsvFlg` | Field | Equipment operation reservation flag — when set to "1", indicates an equipment operation conflict that blocks the cancellation flow. |
| `prcGrpCd` | Field | Price group code (料金グループコード) — classifies the service type/plan category (e.g., "08" for eo Mobile EM). |
| FUNC_CODE_1 | Constant | "1" — Function code for check and register mode (チェック＆登録). Used by setInMsg to configure input processing behavior. |
| PRC_GRP_CD_08 | Constant | "08" — Price group code for eo Mobile EM (eoモバイル(EM)). Triggers mobile-specific post-processing logic. |
| SCREEN_ID_KKW02703 | Constant | "KKW02703" — Screen ID for Contract Cancellation Completion screen (予約取消完了画面). |
| SCREEN_NAME_KKW02703 | Constant | "予約取消完了" — Screen name for Contract Cancellation Completion. |
| EKBF750_KW | Constant | Error message key — Equipment operation reservation conflict error message. |
| EKB9480_KW | Constant | Warning message key — Mobile course change cancellation warning message. |
| EKB9360__I | Constant | Information message key — Contract cancellation completion information message. |
| PCRS_CD_A26 | Constant | "A26" — Pricing course code: 3G 7.2M Standard Type (3G 7.2M 標準タイプ). |
| PCRS_CD_A59 | Constant | "A59" — Pricing course code: 3G 7.2M Optical Hybrid Type (3G 7.2M 光ハイブリッドタイプ). |
| KKSV039552SC | Field key | Sub-component key in outputMap — Contains equipment operation reservation related results. |
| KKSV039504CC | Field key | Sub-component key in outputMap (used by isMobileCourseChgCheckResult) — Contains old and new course plan codes (old_pcrs_cd, new_pcrs_cd). |
| ANK-4287-00-00 | Change ticket | Change ticket identifier for the equipment operation reservation flag check feature. |
| eo Mobile EM | Business term | eo Mobile EM service — NTT East's mobile service using EM (Evolved Mobile) technology. One of several price group code categories. |
| 予約取消 | Japanese field | Contract Cancellation — the business operation being performed; displayed in the completion message. |
| 予約取消完了 | Japanese term | Contract Cancellation Completion — the name of the completion screen (KKW02703) that users are forwarded to after successful processing. |
| 料金グループコード | Japanese term | Price Group Code — classifies the service type/billing category (e.g., IP telemeter, eo Mobile, eo Light Telephone, etc.). |
| JCCBatCommon | Component | Common batch service invoker — the CBS (Component-Based Service) layer entry point for backend business service execution. |
| JCCWebCommon | Component | Common web utility — provides message-setting methods for the web layer (setMessageInfo). |
| JPCOnlineMessageConstant | Component | Online message constant definitions — central message key repository for the eo online ordering system. |
| X31SDataBeanAccess | Component | Service form bean accessor — base class providing access to the current screen's form data. |
| X31CWebConst | Component | Web constant definitions — contains web-layer constant values (e.g., DATABEAN_GET_VALUE). |
| 更新ボタン押下処理 | Japanese comment | Update button press processing — the Javadoc description of this method's purpose. |
