# Business Logic — KKW02404SFLogic.executeKaihkSvc() [34 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.web.webview.KKW02404SF.KKW02404SFLogic` |
| Layer | Service (Logic layer within the web presentation tier) |
| Module | `KKW02404SF` (Package: `eo.web.webview.KKW02404SF`) |

## 1. Role

### KKW02404SFLogic.executeKaihkSvc()

This method performs the **Fixed Global IP Recovery Service** (固定グローバルIP回復サービス) — a business operation that restores (recovers) a previously suspended or cancelled Fixed Global IP (IP Address) service for a customer. The method follows a **mapping-then-invoke-then-fetch** pattern typical of the platform's service execution architecture: it first maps data from the UI DataBean into an input structure, invokes a backend service component via `invokeService`, and then retrieves the updated service information back into the DataBean for presentation.

The method is a **delegating orchestration step** within the broader Fixed Global IP Address Information Update Access workflow (KKW02404SF). It is called from `KKW02404SFLogic.actionFix()`, which is the form-action handler for the fixed IP recovery screen (KKSV0266). The method does not contain conditional branching logic — it always executes the same linear recovery flow regardless of input parameters.

The method handles a single **service type**: Fixed Global IP recovery. It uses a **template/service delegation pattern** by constructing a parameter map, a mapper instance, input/output maps, and then delegates the actual business logic execution to the centralized `invokeService()` method, which routes the call to the appropriate backend CBS/SC.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKaihkSvc paramBean func_code"])
    DEFINE["Define paramMap inputMap outputMap as HashMap"]
    INIT["Initialize paramMap inputMap outputMap as new HashMap"]
    SET_PARAM["SET paramMap.put TELEGRAM_INFO_USECASE_ID with KKSV0266"]
    CREATE_MAPPER["CREATE mapper = new KKSV0266_KKSV0266OPDBMapper"]
    MAP_SVC["CALL setOpSvcKeiKaihkCC paramBean inputMap func_code"]
    MAP_SOD["CALL setJKKHakkoSODCC paramBean inputMap func_code"]
    MAP_WORK["CALL setKKSV0266WORK paramBean inputMap func_code"]
    CLEAR_RTN["EXEC paramBean 0 sendMessageString RTN_MSG_ID DATABEAN_SET_VALUE empty string"]
    INVOKE["CALL invokeService paramMap inputMap outputMap"]
    GET_RESULT["CALL getOpSvcKeiKaihkCC paramBean outputMap"]
    END_NODE(["Return"])

    START --> DEFINE --> INIT --> SET_PARAM --> CREATE_MAPPER --> MAP_SVC --> MAP_SOD --> MAP_WORK --> CLEAR_RTN --> INVOKE --> GET_RESULT --> END_NODE
```

**Step-by-step explanation:**

1. **Variable Declaration** (lines ~705–707): Three `HashMap<String, Object>` references are declared (`paramMap`, `inputMap`, `outputMap`) but initialized to `null`.

2. **HashMap Initialization** (lines ~711–713): All three maps are instantiated as new `HashMap` objects. `paramMap` carries the telegram/context parameters (use case ID), `inputMap` is populated by the mapper with service-item-to-DataBean field mappings, and `outputMap` collects the results returned from the invoked service.

3. **Parameter Setup** (lines ~716–717): The method sets the `TELEGRAM_INFO_USECASE_ID` in `paramMap` to `"KKSV0266"`, identifying this execution as belonging to the Fixed Global IP Recovery screen (KKSV0266) within the Telegram routing framework.

4. **Mapper Instantiation** (lines ~720): A `KKSV0266_KKSV0266OPDBMapper` is created to handle DataBean-to-input-map and output-map-to-DataBean conversions.

5. **Recovery CC Mapping** (lines ~723): `setOpSvcKeiKaihkCC` maps the **Operation Service Contract Detail** (操作サービス契約詳細) data from the `paramBean` into `inputMap` by `func_code`. This is the primary service detail recovery mapping.

6. **SODCC Mapping** (lines ~725): `setJKKHakkoSODCC` maps **Service Order Data Creation Center** (SOD作成センター) data from the `paramBean` into `inputMap`.

7. **WORK Mapping** (lines ~727): `setKKSV0266WORK` maps the screen-specific **WORK** entity data into `inputMap`.

8. **Return Message Clear** (lines ~729): The return message ID field (`RTN_MSG_ID`) is cleared by setting it to an empty string via `sendMessageString`. This ensures no residual error messages persist after a successful mapping phase.

9. **Service Execution** (lines ~732): The method calls `invokeService(paramMap, inputMap, outputMap)`, which delegates to the backend service infrastructure to execute the Fixed Global IP recovery CBS/SC. The `inputMap` is consumed and the `outputMap` is populated with results.

10. **Result Fetch** (lines ~735): `getOpSvcKeiKaihkCC` fetches the recovery results from `outputMap` back into the `paramBean`, making the updated data available for screen rendering.

11. **Return**: The method returns `void` — the `paramBean` is mutated in-place with the updated recovery data.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramBean` | `X31SDataBeanAccess[]` | Array of DataBeans carrying the screen's business data — includes service contract numbers (`svc_kei_no`), optional service contract numbers (`op_svc_kei_no`), service detail work numbers (`svc_kei_ucwk_no`), IP address information (FIXIPAD), sub-netmask values, usage start/end dates, and other Fixed Global IP service fields. The method reads from and writes to this object. |
| 2 | `func_code` | `String` | Function code that identifies which recovery operation or screen action is being performed. Passed through to the mapper's `set*` methods to determine which fields to map. |

**Instance fields / external state read:**
- No instance fields or external state are directly read by this method. All state flows through the parameters and the `KKSV0266_KKSV0266OPDBMapper` local instance.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `KKSV0266_KKSV0266OPDBMapper.setOpSvcKeiKaihkCC` | KKSV0266_KKSV0266OPDBMapper | - | Maps operation service contract detail data from paramBean into inputMap |
| - | `KKSV0266_KKSV0266OPDBMapper.setJKKHakkoSODCC` | KKSV0266_KKSV0266OPDBMapper | - | Maps Service Order Data (SOD) creation data from paramBean into inputMap |
| - | `KKSV0266_KKSV0266OPDBMapper.setKKSV0266WORK` | KKSV0266_KKSV0266OPDBMapper | - | Maps WORK entity data from paramBean into inputMap |
| - | `OneStopDataBeanAccess.sendMessageString` | OneStopDataBeanAccess | - | Sets the return message ID field to an empty string to clear any prior messages |
| - | `KKW02404SFLogic.invokeService` | JCCBatCommon | - | Invokes the backend CBS service for Fixed Global IP recovery execution |
| R | `KKSV0266_KKSV0266OPDBMapper.getOpSvcKeiKaihkCC` | KKSV0266_KKSV0266OPDBMapper | - | Fetches operation service contract detail results from outputMap back into paramBean |

**Analysis:**

This method performs **zero direct Create/Read/Update/Delete operations on database tables**. Instead, it acts as a **coordination layer** that:
- Populates `inputMap` via mapper `set` operations (R — reading from DataBean)
- Delegates actual database work to `invokeService`, which routes to the CBS layer
- Retrieves results via `getOpSvcKeiKaihkCC` (R — reading from outputMap into DataBean)

The `invokeService` call routes to the Fixed Global IP recovery CBS (typically an `EKK`-prefixed SC/CBS in the platform), which performs the actual persistence operations on the service contract and order data tables. The mapper layer handles DataBean-to-map conversions without direct DB access.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0266 | actionFix -> executeKaihkSvc | getOpSvcKeiKaihkCC [R], invokeService [-] |

**Detailed caller analysis:**

The method is called exclusively from `KKW02404SFLogic.actionFix()`, which is the form-action handler invoked when the user submits the Fixed Global IP Recovery screen. The call chain is:

```
KKSV0266 (Recovery Screen) -> KKW02404SFLogic.actionFix() -> KKW02404SFLogic.executeKaihkSvc()
```

The `actionFix()` method prepares the context and then delegates to `executeKaihkSvc()` to perform the actual recovery service execution. After `executeKaihkSvc()` completes, control returns to `actionFix()`, which typically proceeds to return a success/failure result code for screen navigation.

## 6. Per-Branch Detail Blocks

**Block 1** — [VARIABLE DECLARATION] `(No condition — top-level sequential flow)` (L{705})

> Declare three HashMap references as null before initialization.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> paramMap = null;` // Parameter map for invokeService |
| 2 | SET | `HashMap<String, Object> inputMap = null;` // Input map for mapper operations |
| 3 | SET | `HashMap<String, Object> outputMap = null;` // Output map for invokeService results |

**Block 2** — [VARIABLE INITIALIZATION] `(No condition — top-level sequential flow)` (L{711})

> Initialize HashMap instances. Comments indicate purpose: paramMap for parameter setup, inputMap for input, outputMap for result storage.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>();` // Parameter setup map [`-> "パラメータ設定用マップ"`] |
| 2 | SET | `inputMap = new HashMap<String, Object>();` // Input map [`-> "入力用マップ"`] |
| 3 | SET | `outputMap = new HashMap<String, Object>();` // Result storage map [`-> "結果格納用マップ"`] |

**Block 3** — [PARAMETER SET] `(No condition — top-level sequential flow)` (L{716})

> Set the use case ID to KKSV0266 in the parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(X31CWebConst.TELEGRAM_INFO_USECASE_ID, "KKSV0266");` // Set use case ID for Telegram routing [`-> X31CWebConst.TELEGRAM_INFO_USECASE_ID`] |

**Block 4** — [MAPPER CREATION] `(No condition — top-level sequential flow)` (L{720})

> Create a new instance of the KKSV0266 data mapper.

| # | Type | Code |
|---|------|------|
| 1 | SET | `KKSV0266_KKSV0266OPDBMapper mapper = new KKSV0266_KKSV0266OPDBMapper();` // Service item–DataBean mapping mapper [`-> "上りマッピング処理（サービス項目-DataBean項目マッピング）"`] |

**Block 5** — [RECOVERY CC MAPPING] `(No condition — top-level sequential flow)` (L{723})

> Map operation service contract detail (操作サービス契約詳細) data from paramBean into inputMap.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setOpSvcKeiKaihkCC(paramBean, inputMap, func_code);` // Recovery CC mapping [`-> "回復CC"`] |

**Block 6** — [SODCC MAPPING] `(No condition — top-level sequential flow)` (L{725})

> Map Service Order Data Creation Center (SOD作成センター) data from paramBean into inputMap.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setJKKHakkoSODCC(paramBean, inputMap, func_code);` // SODCC mapping [`-> "SODCCマッピング"`] |

**Block 7** — [WORK MAPPING] `(No condition — top-level sequential flow)` (L{727})

> Map WORK entity data from paramBean into inputMap.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.setKKSV0266WORK(paramBean, inputMap, func_code);` // WORK mapping [`-> "WORKマッピング"`] |

**Block 8** — [RETURN MESSAGE CLEAR] `(No condition — top-level sequential flow)` (L{729})

> Clear the return message ID field by setting it to an empty string. This prevents residual error messages from persisting on the screen.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramBean[0].sendMessageString(KKW02404SFConst.RTN_MSG_ID, X31CWebConst.DATABEAN_SET_VALUE, "");` // Clear return ID [`-> "戻返IDをクリア"`] [`-> KKW02404SFConst.RTN_MSG_ID = "返戻メッセージID"`] [`-> X31CWebConst.DATABEAN_SET_VALUE`] |

**Block 9** — [SERVICE EXECUTION] `(No condition — top-level sequential flow)` (L{732})

> Invoke the backend service for Fixed Global IP recovery. This is the core business operation — the paramMap carries context (use case ID), inputMap carries the mapped service data, and outputMap receives the results.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `invokeService(paramMap, inputMap, outputMap);` // Service execution [`-> "サービス実行"`] |

**Block 10** — [RESULT FETCH] `(No condition — top-level sequential flow)` (L{735})

> Fetch the recovery results from outputMap back into the paramBean for screen display.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `mapper.getOpSvcKeiKaihkCC(paramBean, outputMap);` // Result acquisition [`-> "結果取得"`] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| Fixed Global IP | Business term | A globally routable public IP address assigned to a customer's dedicated line service — can be recovered (restored) after cancellation/suspension |
| kaihkSvc | Field | Japanese abbreviation for "kaifuku service" (回復サービス) — recovery service; restores a previously cancelled service |
| kaifuku (回復) | Field | Recovery / restoration — the business act of reinstating a suspended or cancelled service |
| paramBean | Field | DataBean array carrying all screen field values between the UI and the logic layer |
| func_code | Field | Function code — identifies the specific screen action or operation type being executed |
| invokeService | Method | Centralized service invocation method that routes calls to the appropriate backend CBS (Common Business Service) |
| setOpSvcKeiKaihkCC | Method | Maps operation service contract detail data (操作サービス契約詳細) — the primary service detail entity for the recovery |
| setJKKHakkoSODCC | Method | Maps Service Order Data (SOD) creation data — SOD = Service Order Data, the central order fulfillment entity in the platform |
| setKKSV0266WORK | Method | Maps WORK entity data — screen-specific work data for the KKSV0266 recovery screen |
| getOpSvcKeiKaihkCC | Method | Fetches operation service contract detail results from the output map back into the DataBean |
| KKSV0266 | Screen | Fixed Global IP Recovery screen — the UI screen where users initiate the Fixed Global IP service recovery operation |
| TELEGRAM_INFO_USECASE_ID | Constant | Telegram routing identifier — identifies which use case/screen is invoking the service |
| RTN_MSG_ID | Constant | Return message ID field — the screen field where success/error messages are displayed to the user |
| DATABEAN_SET_VALUE | Constant | Constant indicating a value should be set directly on the DataBean |
| FIXIPAD | Constant | IP Address — the global IP address field (IPアドレス) |
| SVC_KEI_NO | Constant | Service contract number (サービス契約番号) — the unique identifier for a service contract |
| OP_SVC_KEI_NO | Constant | Optional service contract number (オプションサービス契約番号) — identifier for optional/service add-on contracts |
| SOD | Acronym | Service Order Data — the central telecom order fulfillment entity that tracks service orders through their lifecycle |
| CC | Abbreviation | Contract Center / Calculation Center — a service component layer handling contract and billing calculations |
| CBS | Acronym | Common Business Service — backend service component for business logic execution |
| SC | Abbreviation | Service Component — a modular business logic component in the platform architecture |
