# Business Logic — JKKIdoRsvHaneiCC.executeIdoRsvHanei() [15 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKIdoRsvHaneiCC` |
| Layer | CC / Common Component (Package: `com.fujitsu.futurity.bp.custom.common`) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKIdoRsvHaneiCC.executeIdoRsvHanei()

This method is the **cancellation execution entry point** for the k-opticom customer billing system (eo顧客基盤システム). The class name `JKKIdoRsvHaneiCC` stands for "JKK Ido Reservation Handling Common Component" — where "Ido" (異動) refers to contract modifications and "Hanei" (反映) means reflecting changes. Specifically, this method executes the cancellation (解約) process for a service contract line item.

The method follows a **delegation pattern**: it initializes the processing context, extracts the target data from the request parameter map, and delegates the actual cancellation logic to `JKKBpCommon.runIdoRsvHanei()`, which in turn creates a `JKKIdoRsvHanei` entity instance and invokes its `runIdoRsvHanei` method to carry out the core business operation.

This is a **shared common component** called by the contract change flow (`JKKAdchgIdoRsvHaneiCC.callIdoRsvHaneiCC()`). It serves as the orchestrator for the cancellation branch of the contract modification processing, handling the case where a customer cancels their service. The method has no internal conditional branches — it always executes the cancellation path regardless of the modification classification code (異動区分), with the specific service type routing handled inside the delegated `runIdoRsvHanei()` call.

The Javadoc (解約実行処理です。パラメータの異動区分に従って解約処理を実行します。 — "Cancellation execution processing. Executes cancellation processing according to the parameter's modification classification.") indicates that this is the top-level handler that kicks off the cancellation workflow. The processing type is determined by the modification classification (異動区分) contained within the `param` object.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeIdoRsvHanei(handle, param, fixedText)"])
    INIT["init(param, fixedText)"]
    GET_DATA["param.getData(fixedText) -> trgtData"]
    CALL_RUN["JKKBpCommon.runIdoRsvHanei(handle, param, trgtData, fixedText)"]
    RETURN["return param"]
    END(["End"])

    START --> INIT
    INIT --> GET_DATA
    GET_DATA --> CALL_RUN
    CALL_RUN --> RETURN
    RETURN --> END
```

**Processing summary:**

1. **Initialization (init):** Clears error information from the control map and lazily initializes the `JKKIdoRsvHaneiMapperCC` mapper instance. This prepares the request context for the cancellation operation.
2. **Target data extraction:** Retrieves the cancellation target data HashMap from the parameter object using the `fixedText` key. This HashMap contains the business data needed for the cancellation (e.g., service contract number, modification classification code).
3. **Delegated execution:** Calls `JKKBpCommon.runIdoRsvHanei()` with the session handle, parameter object, target data, and fixed text. This method delegates to a `JKKIdoRsvHanei` entity's `runIdoRsvHanei()` method, which performs the actual cancellation logic including service component calls.
4. **Return:** Returns the (mutated) parameter object containing the updated business data.

There are no conditional branches (if/else, switch/case) within this method. All processing is sequential and unconditional.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session manager handle carrying database connection context and transaction management information. Used throughout the cancellation process to maintain the database session and transaction boundary. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object containing the model group (business data map) and control map (error/routing information). The parameter carries the contract cancellation request data including service contract number (`svc_kei_no`), modification classification code (`ido_kubun_cd`), and other cancellation-related fields. The object is mutated in-place during processing (errors appended to control map, results written back). |
| 3 | `fixedText` | `String` | User-defined arbitrary string used as a map key to identify and retrieve the target data within the `IRequestParameterReadWrite` object. Typically set to a constant like "target" or a specific business key that distinguishes this data block from other data blocks in the same request. |

**Internal state accessed:**

| No | Field | Type | Business Description |
|----|-------|------|---------------------|
| 1 | `mapper` | `JKKIdoRsvHaneiMapperCC` | Mapper object group used for input/output message transformation between the request format and the service component call format. Lazily initialized in `init()`. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKBpCommon.runIdoRsvHanei` | (delegated) | - | Core cancellation execution — delegates to `JKKIdoRsvHanei.runIdoRsvHanei()`, which performs data read, service contract cancellation, and service component calls |
| - | `JKKIdoRsvHanei.runIdoRsvHanei` | (delegated) | - | The entity-level cancellation method called by `JKKBpCommon.runIdoRsvHanei()` |
| - | `JKKIdoRsvHaneiCC.init` | - | - | Initializes the mapper instance and clears error information from the control map |

The pre-computed evidence from the code analysis graph also shows deeper terminal operations reached through `JKKBpCommon.runIdoRsvHanei`:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JBSbatDKNyukaFinAdd.getData` | (SC inferred) | (BSbatDKNyukaFin — billing insertion finalization entity) | Reads billing-related data during cancellation |
| R | `JFUeoTelOpTransferCC.getData` | (SC inferred) | (Eo telecom operation transfer entity) | Reads telecom operation transfer data |
| R | `JFUTransferCC.getData` | (SC inferred) | (Transfer entity) | Reads general transfer data |
| R | `JFUTransferListToListCC.getData` | (SC inferred) | (Transfer list entity) | Reads transfer list data |
| R | `KKW12701SFLogic.getData` | (SC inferred) | (Service function data entity) | Reads service function data for cancellation |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `runIdoRsvHanei` [-], `runIdoRsvHanei` [-], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `getData` [R], `init` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS:JKKAdchgIdoRsvHaneiCC | `callIdoRsvHaneiCC()` -> `JKKIdoRsvHaneiCC.executeIdoRsvHanei(handle, param, fixedText)` | `runIdoRsvHanei` [-], `getData` [R] x5, `init` [-] |

**Notes on call chain:**
- The primary caller is `JKKAdchgIdoRsvHaneiCC.callIdoRsvHaneiCC()`, a CBS (Contract Change Service) that orchestrates contract modification processing. When the modification classification indicates a cancellation, it routes to this method.
- This method delegates to `JKKBpCommon.runIdoRsvHanei()`, which creates a `JKKIdoRsvHanei` entity and calls its `runIdoRsvHanei()` method to perform the actual cancellation business logic.

## 6. Per-Branch Detail Blocks

### Block 1 — INIT (L122)

> Initialization processing (初期処理). Sets up the mapper instance and clears error information in the control map.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `init(param, fixedText)` | Initialize mapper and clear control map error info. Internally: (a) lazily instantiate `JKKIdoRsvHaneiMapperCC` if null; (b) call `param.setControlMapData(SCControlMapKeys.ERROR_INFO, new ArrayList<Object>())` to clear any previous error messages. |

### Block 2 — EXEC (L125)

> Request parameter data extraction (リクエストパラメータの取得処理). Retrieves the cancellation target data from the parameter object.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `HashMap trgtData = (HashMap)param.getData(fixedText)` | Extract the target HashMap from the parameter using the `fixedText` key. This HashMap contains all cancellation-related business data including service contract number (`svc_kei_no`), modification classification code (`ido_kubun_cd`), and other contract details. |

### Block 3 — CALL (L128)

> Delegation to core cancellation processing (異動予約反映処理を呼び出す). Executes the actual cancellation logic via the common processing utility.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `JKKBpCommon.runIdoRsvHanei(handle, param, trgtData, fixedText)` | Core cancellation execution. Delegates to `JKKIdoRsvHanei.runIdoRsvHanei()`, which performs: (a) reads cancellation target data; (b) maps input data to service component format; (c) calls relevant service components to execute cancellation; (d) maps results back to the parameter object. Terminal operations include multiple `getData` calls (R) for billing, transfer, and service function data reads. |

### Block 4 — RETURN (L130)

> Return the processed parameter object (業務データ取得・書込用I/F).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | RETURN | `return param` | Return the parameter object which now contains updated business data and any error information generated during the cancellation processing. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `JKKIdoRsvHaneiCC` | Class | JKK Ido Reservation Handling Common Component — contract modification/cancellation processing component. "JKK" = k-opticom, "Ido" (異動) = modification, "Rsv" (予約) = reservation, "Hanei" (反映) = reflection. |
| `executeIdoRsvHanei` | Method | Cancellation execution method — the entry point for executing contract cancellation processing. |
| 解約 (Kaishaku) | Business term | Contract cancellation — the business operation of terminating an existing service contract. |
| 異動区分 (Ido Kubun) | Field | Modification classification code — categorizes the type of contract change (e.g., new registration, modification, cancellation). Determines which processing branch is executed. |
| 反映 (Hanei) | Business term | Reflection — the process of applying/reflecting contract changes (modifications, cancellations) to the downstream systems and databases. |
| `SessionHandle` | Type | Database session handle — carries connection context, transaction boundary, and database session state for the duration of the business operation. |
| `IRequestParameterReadWrite` | Type | Request parameter interface — bidirectional data carrier containing model group (business data) and control map (routing and error information). |
| `fixedText` | Parameter | User-defined arbitrary string — serves as a map key to identify target data blocks within the parameter object. |
| `JKKIdoRsvHaneiMapperCC` | Class | Mapper component — transforms input request data into service component call format and maps service component responses back to the application parameter format. |
| `JKKBpCommon` | Class | Business process common utility — shared static methods for common contract operation workflows including cancellation, modification, and registration. |
| `JKKIdoRsvHanei` | Class | Cancellation entity class — contains the core cancellation business logic, invoked by `JKKBpCommon.runIdoRsvHanei()`. |
| `SCControlMapKeys.ERROR_INFO` | Constant | Error information key — used to store error messages in the control map. Value: `"ERROR_INFO"`. |
| `param.getData()` | Method | Retrieves a data map from the parameter object by key. Returns a `HashMap` containing the business data for the specified key. |
| `SC` | Acronym | Service Component — a service-layer class that interfaces with downstream systems (e.g., billing, telecom operations). Naming pattern: `JFU*`, `JBSbat*`. |
| `CBS` | Acronym | Contract Billing System — the overall business system for contract and billing operations. |
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract line item. |
| `init` | Method | Initialization processing (初期処理) — sets up the mapper and clears error information before the main operation. |
