# Business Logic — KKW02510SFLogic.displayGyomuErrorMsg() [68 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02510SF.KKW02510SFLogic` |
| Layer | Logic (Web/Controller layer — part of the KKW02510SF multi-selection update module) |
| Module | `KKW02510SF` (Package: `eo.web.webview.KKW02510SF`) |

## 1. Role

### KKW02510SFLogic.displayGyomuErrorMsg()

This method is the **error message display processor** for the Multi-Selection Update screen (KKW02510SF). It prepares and renders operation-specific error messages to the user by resolving contextual placeholder strings based on the incoming message ID (`rtn_msgId`) and the transaction division (`trans_div`). It implements a **conditional routing/dispatch pattern**, where the transaction division determines which service lifecycle scenario is active — cancellation (`OP_TRAN_DIV_DSL` = "04"), recovery (`OP_TRAN_DIV_KAIHK` = "05"), or reservation cancellation (`OP_TRAN_DIV_RSV_CL` = "06") — and each scenario maps one or more specific message codes to localized parameter arrays. When no scenario-specific parameters are resolved, the method falls back to displaying the message template directly without substitution. It plays the role of a **screen-side error presentation utility** called after validation failures in the fix and update-confirm action handlers, acting as the bridge between backend error detection and user-facing message display.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["displayGyomuErrorMsg parameters"])
    INIT["Initialize params equals null"]
    CHECK_MSG["rtn_msgId is not null and not empty"]
    DSL_BRANCH["trans_div equals OP_TRAN_DIV_DSL equals 04"]
    EKB0690_CHECK["rtn_msgId equals EKB0690_NW equals EKB0690-NW"]
    EKB0690_PARAMS["Set params with termination date and past strings"]
    KAIHK_BRANCH["trans_div equals OP_TRAN_DIV_KAIHK equals 05"]
    EKB5440_CHECK_K["rtn_msgId equals EKB5440_JW equals EKB5440-JW"]
    EKB5440_PARAMS_K["Set params with recovery period expiry strings"]
    RSV_CL_BRANCH["trans_div equals OP_TRAN_DIV_RSV_CL equals 06"]
    EKB5420_CHECK["rtn_msgId equals EKB5420_JW equals EKB5420-JW"]
    EKB5420_PARAMS["Set params with option and reservation cancel strings"]
    NULL_CHECK["params is not null"]
    SET_MSG_PARAMS["Call setMessageInfo with params"]
    SET_MSG_DEFAULT["Call setMessageInfo without params"]
    END_RETURN(["Return void"])

    START --> INIT
    INIT --> CHECK_MSG
    CHECK_MSG -->|true| DSL_BRANCH
    DSL_BRANCH -->|true| EKB0690_CHECK
    EKB0690_CHECK -->|true| EKB0690_PARAMS
    DSL_BRANCH -->|false| KAIHK_BRANCH
    KAIHK_BRANCH -->|true| EKB5440_CHECK_K
    EKB5440_CHECK_K -->|true| EKB5440_PARAMS_K
    KAIHK_BRANCH -->|false| RSV_CL_BRANCH
    RSV_CL_BRANCH -->|true| EKB5420_CHECK
    EKB5420_CHECK -->|true| EKB5420_PARAMS
    EKB0690_CHECK -->|false| KAIHK_BRANCH
    EKB5440_CHECK_K -->|false| RSV_CL_BRANCH
    EKB5420_CHECK -->|false| NULL_CHECK
    EKB0690_PARAMS --> NULL_CHECK
    EKB5440_PARAMS_K --> NULL_CHECK
    EKB5420_PARAMS --> NULL_CHECK
    NULL_CHECK -->|true| SET_MSG_PARAMS
    NULL_CHECK -->|false| SET_MSG_DEFAULT
    SET_MSG_PARAMS --> END_RETURN
    SET_MSG_DEFAULT --> END_RETURN
    CHECK_MSG -->|false| END_RETURN
```

**Business description of flow:**

1. **Initialization** — The method begins by setting the local `params` variable to `null`. This variable will hold a string array of placeholder values for template substitution.
2. **Message ID validation** — The method checks whether `rtn_msgId` is non-null and non-empty. If the message ID is absent, the method returns immediately with no action (the error was already handled upstream).
3. **Transaction division routing** — If a valid message ID is present, the method dispatches based on `trans_div`:
   - **DSL (Cancellation, "04")** — Only one message code is handled: `EKB0690-NW` (past date error), which substitutes `"termination date"` and `"past"` as the two placeholder strings.
   - **KAIHK (Recovery, "05")** — One message code is handled: `EKB5440-JW` (recovery period expired), which substitutes `"outside recovery period"` and `"recovery is"` as the two placeholder strings.
   - **RSV_CL (Reservation Cancellation, "06")** — One message code is handled: `EKB5420-JW` (reservation cancellation unavailable), which substitutes `"option"` and `"reservation cancellation"` as the two placeholder strings.
4. **Fallback parameter check** — After all branch conditions, if `params` is still `null` (meaning the message ID was not recognized or the transaction division did not match a specific scenario), the method falls back to calling `setMessageInfo` with only the message ID, allowing the message template to display without substitution.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `rtn_msgId` | `String` | The error message template ID returned from upstream processing. It identifies which specific error message to display (e.g., `EKB0690-NW` for past date errors, `EKB5440-JW` for recovery period expiry, `EKB5420-JW` for reservation cancellation unavailable). Each value maps to a predefined Japanese error message template in the message resource bundle. |
| 2 | `trans_div` | `String` | The transaction division code indicating the current operation mode of the multi-selection update screen. It determines which service lifecycle scenario the error relates to. Possible values: `"04"` (DSL/Cancellation), `"05"` (Recovery/Kaihk), `"06"` (Reservation Cancellation/RSV_CL). This value controls the conditional branch that selects the appropriate parameter substitutions. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCCWebCommon.setMessageInfo` | - | - | Calls `setMessageInfo` on the web common utility to render the error message on the display screen. When `params` is not null, it performs parameter substitution in the message template. When `params` is null, it displays the raw message template by message ID. |

**Notes:** This method is purely a **presentation-layer** utility — it does not perform any Create, Read, Update, or Delete operations against the database. Its sole purpose is to prepare and dispatch error message metadata to the view layer via `JCCWebCommon.setMessageInfo`.

## 5. Dependency Trace

### Dependency Flow

```mermaid
sequenceDiagram
    participant ACT as ActionMethod
    participant LOGIC as KKW02510SFLogic
    participant WEB as JCCWebCommon

    ACT->>LOGIC: actionFix() calls displayGyomuErrorMsg
    ACT->>LOGIC: actionUpdCfm() calls displayGyomuErrorMsg
    LOGIC->>WEB: setMessageInfo(this, rtn_msgId, params)
    LOGIC->>WEB: setMessageInfo(this, rtn_msgId)
```

### Callers

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen method: `actionFix()` | `KKW02510SFLogic.actionFix()` -> `displayGyomuErrorMsg(rtn_msgId, trans_div)` | `setMessageInfo [-] Screen message display` |
| 2 | Screen method: `actionUpdCfm()` | `KKW02510SFLogic.actionUpdCfm()` -> `displayGyomuErrorMsg(rtn_msgId, trans_div)` | `setMessageInfo [-] Screen message display` |

**Notes:** Both callers are private action handler methods within `KKW02510SFLogic` itself (same class). They are invoked when error conditions are detected during the "fix" (update preparation) and "update-confirm" operations on the Multi-Selection Update screen. The screen entry point is `KKSV0251` (Multi-Selection Update).

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L1070)

> Initialize the local parameter array to null. This ensures that if no message-specific parameters are resolved through the conditional branches, the fallback path can detect the null state and call `setMessageInfo` without substitution.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String[] params = null;` // Local variable initialized to null for parameter substitution fallback |

**Block 2** — [IF] `(rtn_msgId != null && !"".equals(rtn_msgId))` (L1072)

> Validate that the message ID is present and non-empty. If the message ID is null or blank, the method returns immediately — there is no error message to display. The TODO comment (L1067) notes that the return content may be extended in the future, with logic possibly added depending on the content.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `rtn_msgId != null && !"".equals(rtn_msgId)` // Message ID must be present to proceed |
| 2 | EXEC | *(enters inner blocks if condition true)* |

**Block 2.1** — [IF] `[JKKCommonConst.OP_TRAN_DIV_DSL = "04"]` `(JKKCommonConst.OP_TRAN_DIV_DSL.equals(trans_div))` (L1076)

> Transaction division is **DSL (Cancellation)**. In cancellation mode, only the past date error message (`EKB0690-NW`) is handled. The commented-out blocks reference older error codes (`EKB5440-JW` for suspended future date, `EKB0270-NW` for future date) that were removed per IT1-2013-0000140 (2013/01/09). These were previously used to substitute date-related placeholder strings in cancellation context.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `JKKCommonConst.OP_TRAN_DIV_DSL.equals(trans_div)` // trans_div equals "04" (Cancellation/解約) |
| 2 | [COMMENT] | // IT1-2013-0000140 2013/01/09 DEL START — older error codes EKB5440-JW and EKB0270-NW were removed |
| 3 | [COMMENT] | // Suspended future date (EKB5440-JW) — previously set params to ["休止", "未来日指定の解約は"] |
| 4 | [COMMENT] | // Future date (EKB0270-NW) — previously set params to ["利用終了日", "運用日+60日", "日付"] |
| 5 | [COMMENT] | // IT1-2013-0000140 2013/01/09 DEL END |

**Block 2.1.1** — [IF] `(JPCOnlineMessageConstant.EKB0690_NW.equals(rtn_msgId))` (L1087)

> The message ID is **EKB0690-NW** (past date error). In cancellation context, this error occurs when the termination date (`利用終了日`) is set to a past date. The params array provides two substitution placeholders: `"termination date"` (利用終了日) and `"past"` (過去).

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `JPCOnlineMessageConstant.EKB0690_NW.equals(rtn_msgId)` // rtn_msgId equals "EKB0690-NW" |
| 2 | SET | `params = new String[]{"利用終了日", "過去"};` // params = ["termination date", "past"] — message template substitution values |

**Block 2.2** — [ELSE-IF] `[JKKCommonConst.OP_TRAN_DIV_KAIHK = "05"]` `(JKKCommonConst.OP_TRAN_DIV_KAIHK.equals(trans_div))` (L1094)

> Transaction division is **KAIHK (Recovery)**. In recovery mode, the recovery period expiry error (`EKB5440-JW`) is handled. This error triggers when the user attempts a recovery operation outside the allowed recovery window.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `JKKCommonConst.OP_TRAN_DIV_KAIHK.equals(trans_div)` // trans_div equals "05" (Recovery/回復) |

**Block 2.2.1** — [IF] `(JPCOnlineMessageConstant.EKB5440_JW.equals(rtn_msgId))` (L1097)

> The message ID is **EKB5440-JW** (recovery period expiry). The params array provides two substitution placeholders: `"outside recovery period"` (回復可能期間外) and `"recovery is"` (回復は).

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `JPCOnlineMessageConstant.EKB5440_JW.equals(rtn_msgId)` // rtn_msgId equals "EKB5440-JW" |
| 2 | SET | `params = new String[]{"回復可能期間外", "回復は"};` // params = ["outside recovery period", "recovery is"] |

**Block 2.3** — [ELSE-IF] `[IT2-2012-0001034 ADD START]` `[JKKCommonConst.OP_TRAN_DIV_RSV_CL = "06"]` `(JKKCommonConst.OP_TRAN_DIV_RSV_CL.equals(trans_div))` (L1103)

> Transaction division is **RSV_CL (Reservation Cancellation)**. This branch was added per IT2-2012-0001034 to handle reservation cancellation errors.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `JKKCommonConst.OP_TRAN_DIV_RSV_CL.equals(trans_div)` // trans_div equals "06" (Reservation Cancellation/予約取消) |

**Block 2.3.1** — [IF] `(JPCOnlineMessageConstant.EKB5420_JW.equals(rtn_msgId))` (L1107)

> The message ID is **EKB5420-JW** (reservation cancellation unavailable). This error triggers when the user attempts to cancel a reservation that cannot be cancelled (e.g., an option that is ineligible for cancellation). The params array provides two substitution placeholders: `"option"` (オプション) and `"reservation cancellation"` (予約取消).

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `JPCOnlineMessageConstant.EKB5420_JW.equals(rtn_msgId)` // rtn_msgId equals "EKB5420-JW" |
| 2 | SET | `params = new String[]{"オプション", "予約取消"};` // params = ["option", "reservation cancellation"] |

**Block 3** — [IF/ELSE] `(OM-2016-0002076 MOD END) params != null` (L1112)

> After all conditional branches complete, check whether `params` was resolved to a non-null value. If parameters were set (meaning a recognized message ID matched a specific scenario), call `setMessageInfo` with the parameter array for template substitution. Otherwise, call `setMessageInfo` with only the message ID for fallback display. This modification (OM-2016-0002076, 2017/03/13) was added to handle cases where substitution text is not set, allowing message display to proceed without parameters.

| # | Type | Code |
|---|------|------|
| 1 | CHECK | `null != params` // Was any scenario-specific parameter set? |
| 2 | CALL | `JCCWebCommon.setMessageInfo(this, rtn_msgId, params);` // Display message with parameter substitution |
| 3 | ELSE | |
| 4 | CALL | `JCCWebCommon.setMessageInfo(this, rtn_msgId);` // Fallback: display message by ID only |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `rtn_msgId` | Parameter | Return message ID — the error message template identifier returned from upstream processing, used to look up and display the appropriate error message |
| `trans_div` | Parameter | Transaction division — a code indicating the current operation mode on the screen, determining which service lifecycle scenario the error relates to |
| `params` | Local Variable | Parameter substitution array — a string array of placeholder values injected into error message templates at runtime |
| OP_TRAN_DIV_DSL | Constant | Transaction division "04" — DSL (Disconnect/Cancellation) mode, where the user is cancelling a service contract |
| OP_TRAN_DIV_KAIHK | Constant | Transaction division "05" — Kaihk (Recovery) mode, where the user is recovering a previously cancelled service |
| OP_TRAN_DIV_RSV_CL | Constant | Transaction division "06" — Reservation Cancellation mode, where the user is cancelling a service reservation |
| EKB0690-NW | Message ID | Past date error — triggered when the service termination date is set to a date in the past |
| EKB5440-JW | Message ID | Recovery period expiry error — triggered when attempting recovery outside the allowed recovery window period |
| EKB5420-JW | Message ID | Reservation cancellation unavailable — triggered when attempting to cancel a reservation that is ineligible |
| JCCWebCommon | Class | Web common utility class providing shared screen-level operations including message display via `setMessageInfo` |
| setMessageInfo | Method | Display method on `JCCWebCommon` that pushes an error message (optionally with parameter substitutions) to the screen for user display |
| 解約 (Kaisha) | Japanese term | Cancellation — the act of terminating a service contract; maps to transaction division "04" |
| 回復 (Kaifuku) | Japanese term | Recovery — the act of restoring a previously cancelled service; maps to transaction division "05" |
| 予約取消 (Yoyaku Torikeshi) | Japanese term | Reservation cancellation — the act of cancelling a service reservation before it takes effect; maps to transaction division "06" |
| 利用終了日 (Riyō Shūryō-bi) | Japanese field | Service termination date — the date when a service contract ends; used as a placeholder in EKB0690-NW error message |
| 回復可能期間外 (Kaifuku Kanō Kikan-gai) | Japanese term | Outside recovery period — the state of being past the allowed window for recovering a cancelled service |
| オプション (Opusyon) | Japanese term | Option — an optional service attached to a contract; used as a placeholder in EKB5420-JW error message |
| 過去 (Kako) | Japanese term | Past — the state of a date being in the past; used as a placeholder in EKB0690-NW error message |
| Multi-Selection Update | Screen module | KKW02510SF — the screen module for batch updating multiple service selections (changes, cancellations, recoveries, reservation cancellations) |
| KKW02510SFLogic | Class | The logic handler class for the Multi-Selection Update screen, extending `JCCWebBusinessLogic` |
| actionFix | Method | The fix (update preparation) action handler in KKW02510SFLogic that may call displayGyomuErrorMsg |
| actionUpdCfm | Method | The update-confirm action handler in KKW02510SFLogic that may call displayGyomuErrorMsg |