# Business Logic — JKKKikiIchiranKkUpdCC.execKikiKaifukuShori() [93 LOC]

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

## 1. Role

### JKKKikiIchiranKkUpdCC.execKikiKaifukuShori()

This method performs **equipment-provided service contract recovery** (機器提供サービス契約の回復). It is invoked when a customer returns hardware equipment (e.g., an optical network terminal or router) associated with a telecom service contract, and the system must restore the service contract data to its pre-delivery state. The method acts as a **delegation dispatcher**: it gathers all the necessary context — the service contract agreement data (from template `EKK0081A010`), the equipment-provided service contract data (from template `EKK0341A010`), operational metadata (date, transfer flags, return equipment ID), and the caller's destination address details — packages them into a temporary data container keyed by `JKK_KIKIICHIRAN_KKKAIFUKU_CC`, and then delegates the actual recovery logic to `JKKKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku()`. After the downstream recovery completes, it cleans up its temporary data and returns. The method is a **pass-through coordinator**, not a doer: it prepares and hands off, following the composite common component (CC) delegation pattern. It has no conditional branching of its own; all business logic is pushed down to the called recovery component.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["execKikiKaifukuShori()"])

    START --> Init["param.setData() - Create HashMap for temp container"]

    Init --> GetMsgs["Extract ccMsg and outMap from param"]

    GetMsgs --> GetCBS1["Retrieve EKK0081A010 CBS (service contract agreement) from temporaryData"]

    GetCBS1 --> GetCBS2["Retrieve EKK0341A010 CBS (equipment-provided service contract) from temporaryData"]

    GetCBS2 --> CopyFields["Copy fields from ccMsg to outMap:
func_code, check_scrn_id, svc_kei_no, svc_kei_data,
kktk_svc_kei_no, kktk_svc_kei_data, unyo_ymd, ido_div,
hmpin_kiki_no, upd_dtm_hmpin_kiki, ido_rsn_cd,
ichiranIndex, address info"]

    CopyFields --> RtrField["Copy rtr_khk_um (Router recovery target) field"]

    RtrField --> CallCC["new JKKKikiIchiranKkKaifukuCC()
.execKikiIchiranKikiKaifuku(handle, param, fixedText)"]

    CallCC --> Cleanup["param.removeData() - Remove temp container"]

    Cleanup --> END(["Return void"])
```

**Processing notes:**

- This method contains **no conditional branches** of its own. Every invocation follows the same linear path: initialize temp storage, extract context messages, copy fields into the output map, delegate to the recovery CC, and clean up.
- The `/* v7.00.01 変更開始 */` comment block shows that `setKikiIchiranIkkatsuList()` was **removed** from this method in version 7.00.01 — that list-building logic was migrated into `JKKKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku()` to consolidate recovery logic in one place.
- The router recovery field `rtr_khk_um` was added under the `ANK-2979-00-00` ticket, indicating a feature addition for router device recovery tracking.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle used to maintain the connection context for CBS (Component Business Service) calls. Carries the transaction/session identity for all downstream database operations. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service Component invocation router. Used by downstream called methods to make SC (Service Component) calls. |
| 3 | `param` | `IRequestParameterReadWrite` | The shared request parameter map that acts as the data pipeline between CCs. Read/write operations on this map pass data between the caller and called components. The method uses it to store and retrieve the temporary data container and the caller's message map. |
| 4 | `dataMapKey` | `String` | The key used to access the caller's primary message map (`ccMsg`) within the `param` data pipeline. Contains the caller's original request context including `func_code`, `svc_kei_no`, `kktk_svc_kei_no`, `ido_div`, `hmpin_kiki_no`, and address information. |
| 5 | `temporaryData` | `HashMap<String, Object>` | A transient data map used as a shared scratchpad across the CC call chain. Contains CBS messages retrieved from templates — notably `EKK0081A010` (service contract agreement) and `EKK0341A010` (equipment-provided service contract). |

**External state / constants referenced:**

| Name | Type | Business Description |
|------|------|---------------------|
| `JKK_KIKIICHIRAN_KKKAIFUKU_CC` | `static final String = "JKKKikiIchiranKkKaifukuCC"` | Temporary data container key. Used to store/retrieve the HashMap passed to the recovery CC. |
| `TEMPLATE_ID_EKK0081A010` | `static final String = "EKK0081A010"` | CBS template ID for the service contract agreement (サービス契約一覧照会). Provides the master service contract data. |
| `TEMPLATE_ID_EKK0341A010` | `static final String = "EKK0341A010"` | CBS template ID for the equipment-provided service contract (機器提供サービス契約). Provides the equipment delivery contract data needed for recovery. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `JKKKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku` | - | - | Creates/Recovers equipment-provided service contract via the recovery component. Delegates full recovery logic including CBS calls for EKK0081A010 and EKK0341A010. |
| R | `JBSbatDKNyukaFinAdd.getData` | JBSbatDKNyukaFinAdd | - | Reads data in the data preparation batch support SC. |
| R | `JBSbatKKGetCTITelno.setData` | JBSbatKKGetCTITelno | - | Sets data in the CIT telephone number retrieval batch support SC. |
| R | `JFUeoTelOpTransferCC.getData` | JFUeoTelOpTransferCC | - | Reads data in the NTT East telephone number operation transfer CC. |
| R | `JFUTransferCC.getData` | JFUTransferCC | - | Reads data in the telephone number transfer CC. |
| R | `JFUTransferListToListCC.getData` | JFUTransferListToListCC | - | Reads data in the telephone number list-to-list transfer CC. |
| R | `KKW12701SFLogic.getData` | KKW12701SFLogic | - | Reads data in the service recovery function logic SC. |
| - | `JBSbatAKKshkmRsltInfoTukiawsday.setData` | JBSbatAKKshkmRsltInfoTukiawsday | - | Sets data in the result information tracking by day batch support SC. |
| - | `JBSbatAKKshkmRsltInfoTukiaws.setData` | JBSbatAKKshkmRsltInfoTukiaws | - | Sets data in the result information tracking batch support SC. |
| - | `JBSbatAKKshkmRsltInfoTukiawsRealSkh.setData` | JBSbatAKKshkmRsltInfoTukiawsRealSkh | - | Sets data in the result information tracking real schedule batch support SC. |
| - | `JBSbatAKKshkmRsltInfTkCvsNCnsl.setData` | JBSbatAKKshkmRsltInfTkCvsNCnsl | - | Sets data in the result information tracking CVS consultation batch support SC. |

### Detailed view of the direct called method

**JKKKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku()** — the only direct method call. This called method internally:

1. Calls `callSC(handle, scCall, param, dataMapKey, ekk0081a010IN)` with SC code `EKK0081A010` (service contract agreement query) if the service contract data is not already present.
2. Calls `execEKK0341A010(handle, scCall, param, dataMapKey, temporaryData, kktk_svc_kei_no)` — the equipment-provided service contract CBS query.
3. Calls `execKikiKaifuku(handle, scCall, param, dataMapKey, temporaryData)` — the actual recovery CBS handler.
4. Conditionally calls `execEDK0301C040()` if a return equipment number (`hmpin_kiki_no`) exists.
5. Calls `execEKK0341A010()` again post-recovery to fetch updated data.
6. Calls `setKikiIchiranIkkatsuList()` if `func_code = "1"`.

**Called method sequence:**

```mermaid
sequenceDiagram
    participant caller as JKKKikiIchiranKkUpdCC
    participant temp as temporaryData
    participant cc as JKKKikiIchiranKkKaifukuCC
    participant param as param (data pipeline)
    participant sc as ServiceComponent

    caller->>temp: get EKK0081A010 CBS
    caller->>temp: get EKK0341A010 CBS
    caller->>param: copy fields to outMap
    caller->>param: copy rtr_khk_um
    caller->>cc: new JKKKikiIchiranKkKaifukuCC()
    caller->>cc: execKikiIchiranKikiKaifuku()
    cc->>param: getData(dataMapKey) -> ccMsg
    alt svc_kei_data == null
        cc->>sc: callSC EKK0081A010 (FUNC_CODE="2")
        cc->>temp: put EKK0081A010 result
    end
    alt kktk_svc_kei_data == null
        cc->>sc: execEKK0341A010 (kktk_svc_kei_no)
        cc->>temp: put EKK0341A010 result
    end
    cc->>sc: execKikiKaifuku()
    alt hmpin_kiki_no not empty
        cc->>sc: execEDK0301C040()
    end
    cc->>sc: execEKK0341A010 (post-recovery fetch)
    cc->>ccMsg: put kktk_svc_kei_data_kaihuku
    cc->>temp: put EKK0341A010_AF
    alt func_code == "1"
        cc->>sc: setKikiIchiranIkkatsuList()
    end
    cc-->>caller: return
    caller->>param: removeData(JKK_KIKIICHIRAN_KKKAIFUKU_CC)
```

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JKKKikiIchiranKkUpdCC.execKikiIchiranKikiUpd() | `execKikiIchiranKikiUpd()` -> `execKikiKaifukuShori()` | `execKikiIchiranKikiKaifuku [C] -`, `callSC [R] EKK0081A010`, `execEKK0341A010 [R] EKK0341A010`, `execKikiKaifuku [C] -`, `execEDK0301C040 [C] -`, `setKikiIchiranIkkatsuList [C] -` |

**Notes:** The caller `execKikiIchiranKikiUpd()` is the screen-side update handler for the equipment-provided service contract list screen. It is invoked when the user performs a recovery (return) operation on equipment-provided service contracts from the list display, triggering this recovery coordination method.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(Initialize temp data container)` (L4033)

> Prepare the temporary data container that will be passed to the recovery component.

| # | Type | Code |
|---|------|------|
| 1 | SET | `param.setData(JKK_KIKIICHIRAN_KKKAIFUKU_CC, new HashMap<String, Object>())` // Create temp container at key JKK_KIKIICHIRAN_KKKAIFUKU_CC = "JKKKikiIchiranKkKaifukuCC" |

**Block 2** — [SET] `(Extract caller message and output map)` (L4035-4036)

> Retrieve the caller's message map and the temp container output map for field copying.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = (HashMap<String, Object>)param.getData(dataMapKey)` // Caller's original request context |
| 2 | SET | `outMap = (HashMap<String, Object>)param.getData(JKK_KIKIICHIRAN_KKKAIFUKU_CC)` // Temp output container |

**Block 3** — [SET] `(Retrieve CBS messages from temporaryData)` (L4039-4041)

> Pull the pre-fetched CBS messages from the shared temporary data map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081a010cbsMsg = (CAANMsg)temporaryData.get(TEMPLATE_ID_EKK0081A010)` // SERVICE CONTRACT AGREEMENT [-> "EKK0081A010"] |
| 2 | SET | `ekk0341a010cbsMsg_bf = (CAANMsg)temporaryData.get(TEMPLATE_ID_EKK0341A010)` // EQUIPMENT SERVICE CONTRACT BEFORE [-> "EKK0341A010"] |

**Block 4** — [SET] `(Copy fields from ccMsg to outMap — core service contract data)` (L4044-4058)

> Copy the essential service contract context fields. These fields provide the downstream recovery component with all the data it needs to identify and recover the contract.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.put("func_code", ccMsg.get("func_code"))` // Function code |
| 2 | SET | `outMap.put("check_scrn_id", ccMsg.get("check_scrn_id"))` // Screen ID |
| 3 | SET | `outMap.put("svc_kei_no", ccMsg.get("svc_kei_no"))` // Service contract number |
| 4 | SET | `outMap.put("svc_kei_data", ekk0081a010cbsMsg)` // Service contract agreement CBS data |
| 5 | SET | `outMap.put("kktk_svc_kei_no", ccMsg.get("kktk_svc_kei_no"))` // Equipment-provided service contract number |
| 6 | SET | `outMap.put("kktk_svc_kei_data", ekk0341a010cbsMsg_bf)` // Equipment-provided service contract CBS data (before) |
| 7 | SET | `outMap.put("unyo_ymd", ccMsg.get("unyo_ymd"))` // Operational date (YYYYMMDD) |
| 8 | SET | `outMap.put("ido_div", ccMsg.get("ido_div"))` // Transfer classification |
| 9 | SET | `outMap.put("hmpin_kiki_no", ccMsg.get("hmpin_kiki_no"))` // Return equipment number |
| 10 | SET | `outMap.put("upd_dtm_hmpin_kiki", ccMsg.get("upd_dtm_hmpin_kiki"))` // Update datetime (return equipment) |
| 11 | SET | `outMap.put("ido_rsn_cd", ccMsg.get("ido_rsn_cd"))` // Transfer reason code |
| 12 | SET | `outMap.put("ichiranIndex", ccMsg.get("ichiranIndex"))` // List index |

**Block 5** — [SET] `(Copy address info fields from ccMsg to outMap — equipment delivery destination)` (L4061-4077)

> Copy the full address of the equipment delivery destination. This is the delivery address recorded at the time the equipment was originally delivered, which may need to be restored during recovery.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.put("kiki_shs_ad_man_input_flg", ccMsg.get("kiki_shs_ad_man_input_flg"))` // Manual input flag (equipment delivery destination) |
| 2 | SET | `outMap.put("kiki_sohus_nm", ccMsg.get("kiki_sofu_shs_nm"))` // Delivery recipient name (equipment delivery destination) |
| 3 | SET | `outMap.put("kiki_sohus_kana", ccMsg.get("kiki_sofu_shs_kana"))` // Delivery recipient name kana (equipment delivery destination) |
| 4 | SET | `outMap.put("kiki_sohus_ad_cd", ccMsg.get("kiki_sofu_ad_cd"))` // Address code (equipment delivery destination) |
| 5 | SET | `outMap.put("kiki_sohus_pcd", ccMsg.get("kiki_sofu_pcd"))` // Postal code (equipment delivery destination) |
| 6 | SET | `outMap.put("kiki_sohus_state_nm", ccMsg.get("kiki_sofu_state"))` // Prefecture (equipment delivery destination) |
| 7 | SET | `outMap.put("kiki_sohus_city_nm", ccMsg.get("kiki_sofu_city"))` // City/town/village (equipment delivery destination) |
| 8 | SET | `outMap.put("kiki_sohus_oaztsu_nm", ccMsg.get("kiki_sofu_oaztsu"))` // Oaza/street name (equipment delivery destination) |
| 9 | SET | `outMap.put("kiki_sohus_azcho_nm", ccMsg.get("kiki_sofu_azcho"))` // Chome/block (equipment delivery destination) |
| 10 | SET | `outMap.put("kiki_sohus_bnchigo", ccMsg.get("kiki_sofu_bnchigo"))` // Lot/number (equipment delivery destination) |
| 11 | SET | `outMap.put("kiki_sohus_adrttm", ccMsg.get("kiki_sofu_adrttm"))` // Building name (equipment delivery destination) |
| 12 | SET | `outMap.put("kiki_sohus_adrrm", ccMsg.get("kiki_sofu_adrrm"))` // Room number (equipment delivery destination) |
| 13 | SET | `outMap.put("kiki_sohus_telno", ccMsg.get("kiki_sofu_telno"))` // Phone number (equipment delivery destination) |
| 14 | SET | `outMap.put("haiso_req_shitei_ymd", ccMsg.get("haiso_req_shitei_ymd"))` // Delivery request designated date |

**Block 6** — [SET] `(Copy router recovery target field)` (L4079-4081)

> ANK-2979-00-00 ADD: Copy the router recovery target user map field for router device recovery tracking.

| # | Type | Code |
|---|------|------|
| 1 | SET | `outMap.put("rtr_khk_um", ccMsg.get("rtr_khk_um"))` // Router recovery target (ANK-2979-00-00) |

**Block 7** — [CALL] `(Delegate to recovery component)` (L4083-4084)

> Instantiate the dedicated recovery CC and execute the full recovery logic. The recovery component internally handles CBS calls for service contract queries, contract updates, equipment cancellation, and post-recovery data fetch.

| # | Type | Code |
|---|------|------|
| 1 | SET | `jkkKikiIchiranKkKaifukuCC = new JKKKikiIchiranKkKaifukuCC()` // Create recovery CC instance |
| 2 | CALL | `jkkKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku(handle, param, JKK_KIKIICHIRAN_KKKAIFUKU_CC)` // Execute full recovery |

**Block 8** — [SET] `(Cleanup)` (L4115)

> Remove the temporary data container from the param pipeline to prevent stale data leakage.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.removeData(JKK_KIKIICHIRAN_KKKAIFUKU_CC)` // Remove temp container |

**Block 9** — [COMMENT] `(v7.00.01 change note)` (L4087-4098)

> In version 7.00.01, the `setKikiIchiranIkkatsuList()` call was commented out here because that list-building logic was migrated into `JKKKikiIchiranKkKaifukuCC.execKikiIchiranKikiKaifuku()`. The downstream component now handles record storage directly.

| # | Type | Code |
|---|------|------|
| 1 | COMMENT | `/* v7.00.01 変更開始 */ // setKikiIchiranIkkatsuList() moved to recovery CC` |
| 2 | COMMENT | `// JKKKikiIchiranKkKaifukuCCで検索処理を行っているため２レコード格納されてしまう。` |
| 3 | COMMENT | `// if(FUNC_CODE_1.equals(ccMsg.get("func_code"))) { setKikiIchiranIkkatsuList(...); }` |
| 4 | COMMENT | `/* v7.00.01 変更完了 */` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the unique identifier for a service contract line item |
| `svc_kei_data` | Field | Service contract data — the full service contract agreement object from CBS EKK0081A010 |
| `kktk_svc_kei_no` | Field | Equipment-provided service contract number — the contract number specific to equipment leased/provided by the carrier |
| `kktk_svc_kei_data` | Field | Equipment-provided service contract data — the full contract object from CBS EKK0341A010 |
| `hmpin_kiki_no` | Field | Return equipment number — the ID of the equipment being returned to the carrier |
| `ido_div` | Field | Transfer classification — indicates the type of contract transfer (new, change, cancel, etc.) |
| `ido_rsn_cd` | Field | Transfer reason code — the reason for the contract transfer |
| `unyo_ymd` | Field | Operational date — the effective date of the operation (YYYYMMDD format) |
| `upd_dtm_hmpin_kiki` | Field | Update datetime for return equipment — timestamp when the return equipment was last updated |
| `ichiranIndex` | Field | List index — the position of the selected record in the screen's list display |
| `func_code` | Field | Function code — identifies the operation type. `"1"` typically indicates a forward/addition operation |
| `check_scrn_id` | Field | Screen ID — identifies which screen initiated the request |
| `kiki_shs_ad_man_input_flg` | Field | Manual input flag for equipment delivery destination — indicates whether the address was manually entered |
| `kiki_sohus_nm` / `kiki_sofu_shs_nm` | Field | Delivery recipient name (equipment delivery destination) |
| `kiki_sohus_kana` / `kiki_sofu_shs_kana` | Field | Delivery recipient name in kana (equipment delivery destination) |
| `kiki_sohus_ad_cd` / `kiki_sofu_ad_cd` | Field | Address code (equipment delivery destination) |
| `kiki_sohus_pcd` / `kiki_sofu_pcd` | Field | Postal code (equipment delivery destination) |
| `kiki_sohus_state_nm` / `kiki_sofu_state` | Field | Prefecture name (equipment delivery destination) |
| `kiki_sohus_city_nm` / `kiki_sofu_city` | Field | City/town/village name (equipment delivery destination) |
| `kiki_sohus_oaztsu_nm` / `kiki_sofu_oaztsu` | Field | Oaza/street name (equipment delivery destination) |
| `kiki_sohus_azcho_nm` / `kiki_sofu_azcho` | Field | Chome/block number (equipment delivery destination) |
| `kiki_sohus_bnchigo` / `kiki_sofu_bnchigo` | Field | Lot/plot number (equipment delivery destination) |
| `kiki_sohus_adrttm` / `kiki_sofu_adrttm` | Field | Building name (equipment delivery destination) |
| `kiki_sohus_adrrm` / `kiki_sofu_adrrm` | Field | Room number (equipment delivery destination) |
| `kiki_sohus_telno` / `kiki_sofu_telno` | Field | Phone number (equipment delivery destination) |
| `haiso_req_shitei_ymd` | Field | Delivery request designated date — the date requested for equipment delivery |
| `rtr_khk_um` | Field | Router recovery target user map — identifies which router user record is subject to recovery (ANK-2979-00-00) |
| EKK0081A010 | CBS | Service Contract Agreement Inquiry — CBS that retrieves service contract agreement data |
| EKK0341A010 | CBS | Equipment-provided Service Contract — CBS that handles equipment-provided service contract data |
| EDK0301C040 | CBS | Equipment Cancellation — CBS that processes equipment cancellation (called when `hmpin_kiki_no` is present) |
| KIKI | Japanese abbreviation | 機器 — Equipment (telecom equipment such as ONT, routers) |
| KIKIICHIRAN | Japanese abbreviation | 機器一覧 — Equipment list |
| KAIHUKU | Japanese abbreviation | 回復 — Recovery (restoring a contract to a previous state) |
| SOD | Acronym | Service Order Data — telecom order fulfillment domain entity |
| CBS | Acronym | Component Business Service — backend service component for database operations |
| SC | Acronym | Service Component — the invocation layer for CBS services |
| CC | Acronym | Composite Common — the shared component layer in this architecture (CC classes coordinate across CBS calls) |
| CAANMsg | Type | Common Application Agent Notification Message — the CBS message wrapper type carrying CBS request/response data |
