# Business Logic — JKKTVSvcKeiKaihukuCC.cancelRecovery() [234 LOC]

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

## 1. Role

### JKKTVSvcKeiKaihukuCC.cancelRecovery()

This method performs **recovery from cancellation** processing for the e0 Hikari TV service contract system (eo光TVサービス契約回復処理). When a customer requests to restore a service that was previously placed in cancellation (休止・中断中 — "suspended / in interruption"), this method systematically **reverses every layer of the cancellation** that was applied, unwinding the cancellation state from the highest level (the application/maskumi layer) down through service contracts, service detail lines, machine-provisioned services, optional services, and service contract return lines.

The method implements a **delegation and iteration pattern**: it calls a series of Service Component (SC) CBS (Common Business Service) methods, each responsible for undoing a specific cancellation operation. For nested service hierarchies (service contract details, machine provisioned items, optional services, return lines), it first queries the list of affected records, then iterates over each one calling the corresponding cancellation-reversal CBS.

Its role in the larger system is as a **shared utility** called by the primary `kaihuku()` recovery entry point within `JKKTVSvcKeiKaihukuCC`. It is the core business logic engine that coordinates the multi-layer unwinding of cancellation states across telecom service contract data, ensuring data consistency by tracking and updating `lastUpdDtm` (last update datetime) at each step.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["cancelRecovery start"])
    
    START --> GET_DATA["Extract fields from ccMsg map"]
    
    GET_DATA --> CALL_CAAN["Call EKK0021C080<br/>Pre-cancellation inquiry cancellation"]
    
    CALL_CAAN --> CALL_C220["Call EKK0081C220<br/>Pre-cancellation service contract cancellation"]
    
    CALL_C220 --> GET_LAST_UPD["Retrieve lastUpdDtm from response"]
    
    GET_LAST_UPD --> CALL_B004["Call EKK0161B004<br/>Service contract details list"]
    
    CALL_B004 --> LOOP_SVC["For each service detail line item"]
    
    LOOP_SVC --> CALL_C230["Call EKK0161C230<br/>Pre-cancellation service contract detail cancellation"]
    
    CALL_C230 --> GET_LAST_UPD2["Retrieve lastUpdDtm from response"]
    
    GET_LAST_UPD2 --> CALL_B501["Call EKK0341B501<br/>Machine provisioned service list"]
    
    CALL_B501 --> LOOP_KIKI["For each machine provisioned item"]
    
    LOOP_KIKI --> CALL_C410["Call EKK0341C410<br/>Pre-cancellation machine cancellation"]
    
    CALL_C410 --> GET_LAST_UPD3["Retrieve lastUpdDtm from response"]
    
    GET_LAST_UPD3 --> NEXT_SVC["Next service detail"]
    NEXT_SVC --> LOOP_KIKI
    
    LOOP_KIKI --> CALL_B002["Call EKK0351B002<br/>Optional services list"]
    
    CALL_B002 --> LOOP_OPT["For each optional service"]
    
    LOOP_OPT --> CALL_C290["Call EKK0351C290<br/>Pre-cancellation optional service cancellation"]
    
    CALL_C290 --> GET_LAST_UPD4["Retrieve lastUpdDtm from response"]
    
    GET_LAST_UPD4 --> NEXT_OPT["Next optional service"]
    NEXT_OPT --> LOOP_OPT
    
    LOOP_OPT --> CALL_B001["Call EKK0241B001<br/>Service contract return line list"]
    
    CALL_B001 --> LOOP_KAI["For each return line"]
    
    LOOP_KAI --> CALL_A010["Call EKK0251A010<br/>Service contract return line agreement"]
    
    CALL_A010 --> CALL_B504["Call EKK0341B504<br/>Machine list by return line"]
    
    CALL_B504 --> LOOP_KAIKEN["For each machine"]
    
    LOOP_KAIKEN --> FILTER_CHECK{Skip filter:<br/>status != 920 ||<br/>svcCode != C013?}
    
    FILTER_CHECK -->|Yes| SKIP_MACH["Continue (skip)"]
    
    FILTER_CHECK -->|No| CALL_C410_2["Call EKK0341C410<br/>Pre-cancellation machine cancellation"]
    
    CALL_C410_2 --> GET_LAST_UPD5["Retrieve lastUpdDtm from response"]
    
    GET_LAST_UPD5 --> NEXT_KAIKEN["Next machine"]
    NEXT_KAIKEN --> LOOP_KAIKEN
    
    SKIP_MACH --> NEXT_KAIKEN
    LOOP_KAIKEN --> STATUS_CHECK{Return line status = 920?}
    
    STATUS_CHECK -->|Yes| CALL_C080["Call EKK0251C080<br/>Service contract return line cancellation"]
    
    CALL_C080 --> GET_LAST_UPD6["Retrieve lastUpdDtm from response"]
    
    GET_LAST_UPD6 --> NEXT_KAI["Next return line"]
    
    STATUS_CHECK -->|No| SKIP_C080["Skip cancellation"]
    SKIP_C080 --> NEXT_KAI
    
    NEXT_KAI --> CALL_A010_APP["Call EKK0011A010<br/>Application agreement"]
    
    CALL_A010_APP --> GET_APP_STATUS["Get current mskm status and lastUpdDtm"]
    
    GET_APP_STATUS --> APP_CHECK{mskm status = 920<br/>Cancelled?}
    
    APP_CHECK -->|Yes| STAT_130_CHECK{mskm_staus = 130<br/>Approved?}
    
    STAT_130_CHECK -->|Yes| CALL_C120["Call EKK0011C120<br/>Post-approval application cancellation"]
    
    STAT_130_CHECK -->|No| CALL_C070["Call EKK0011C070<br/>Pre-approval application cancellation"]
    
    APP_CHECK -->|No| END_END(["Return / Next"])
    
    CALL_C120 --> END_END
    CALL_C070 --> END_END
    NEXT_KAI --> END_END
    NEXT_SVC --> END_END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for maintaining the transaction context and connection to the application server. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service Component invocation orchestrator — routes CBS requests to the appropriate backend service components. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter container used to read/write data maps (e.g., `ccMsg`) and pass data between CBS calls. |
| 4 | `dataMapKey` | `String` | Key used to look up the business data map (`ccMsg`) within `param` containing service contract identifiers, functional codes, and timestamps. |
| 5 | `mskmNo` | `String` | Application number (申込番号) — the unique identifier for the customer's service application/order. Used in the final application-level cancellation reversal. |
| 6 | `mskmDtlNo` | `String` | Application detail number (申込詳細番号) — identifies a specific line item within an application. Used as input to all pre-cancellation CBS calls. |
| 7 | `mskm_staus` | `String` | Application status code (申込ステータス) — the current status code of the application being recovered. Used to determine whether to call post-approval cancellation (130) or pre-approval cancellation (other). Note: field name preserved from source. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKTVSvcKeiKaihukuCC.callSC` | - | - | Calls `callSC` in `JKKTVSvcKeiKaihukuCC` — central dispatcher for CBS invocations |
| R | `EKK0021C080CBS` | EKK0021C080CBS | - | Pre-cancellation inquiry cancellation (照枠前申込明細キャンセル取消) |
| R | `EKK0081C220CBS` | EKK0081C220CBS | - | Pre-cancellation service contract cancellation (照枠前サービス契約キャンセル取消) |
| R | `EKK0161B004CBS` | EKK0161B004CBS | - | Service contract details list retrieval (サービス契約内容一覧照会) |
| R | `EKK0161C230CBS` | EKK0161C230CBS | - | Pre-cancellation service contract detail cancellation (照枠前サービス契約内容キャンセル取消) |
| R | `EKK0341B501CBS` | EKK0341B501CBS | - | Machine provisioned service list by service detail number (機器提供サービス契約一覧照会(サービス契約内容番号)) |
| R | `EKK0341C410CBS` | EKK0341C410CBS | - | Pre-cancellation machine provisioned service cancellation (照枠前機器提供サービス契約キャンセル取消) |
| R | `EKK0351B002CBS` | EKK0351B002CBS | - | Optional services list by service contract number (オプションサービス契約一覧照会(サービス契約番号)) |
| R | `EKK0351C290CBS` | EKK0351C290CBS | - | Pre-cancellation optional service cancellation (照枠前オプションサービス契約キャンセル取消) |
| R | `EKK0241B001CBS` | EKK0241B001CBS | - | Service contract return line list (サービス契約回線内容一覧照会) |
| R | `EKK0251A010CBS` | EKK0251A010CBS | - | Service contract return line agreement (サービス契約回線内容同意照会) |
| R | `EKK0341B504CBS` | EKK0341B504CBS | - | Machine provisioned service list by return line (機器提供サービス契約一覧照会(サービス契約回線内容)) |
| R | `EKK0251C080CBS` | EKK0251C080CBS | - | Service contract return line cancellation (サービス契約回線キャンセル取消) |
| R | `EKK0011A010CBS` | EKK0011A010CBS | - | Application agreement (申込同意照会) |
| R | `EKK0011C120CBS` | EKK0011C120CBS | - | Post-approval application cancellation (承認後申込キャンセル取消) |
| R | `EKK0011C070CBS` | EKK0011C070CBS | - | Pre-approval application cancellation (承認前申込キャンセル取消) |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `callSC` [R], `getName` [R], `callSC` [R], `getName` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R], `callSC` [R], `getName` [R], `getString` [R], `getString` [R], `getString` [R], `getString` [R]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Method: `JKKTVSvcKeiKaihukuCC.kaihuku()` | `kaihuku()` -> `cancelRecovery(handle, scCall, param, dataMapKey, mskmNo, mskmDtlNo, mskm_staus)` | EKK0021C080CBS [R], EKK0081C220CBS [R], EKK0161B004CBS [R], EKK0161C230CBS [R], EKK0341B501CBS [R], EKK0341C410CBS [R], EKK0351B002CBS [R], EKK0351C290CBS [R], EKK0241B001CBS [R], EKK0251A010CBS [R], EKK0341B504CBS [R], EKK0251C080CBS [R], EKK0011A010CBS [R], EKK0011C120CBS [R], EKK0011C070CBS [R] |

## 6. Per-Branch Detail Blocks

**Block 1** — INIT (data extraction) (L1489)

> Extracts fields from the ccMsg data map and prepares data for the first CBS call.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.getData(dataMapKey)` -> `ccMsg` — retrieves the HashMap containing business data |
| 2 | SET | `funcCode = ccMsg.get("func_code")` — functional code from the data map |
| 3 | SET | `ido_div = ccMsg.get("ido_div")` — movement classification code (異動区分) |
| 4 | SET | `lastUpdDtm = ccMsg.get("lastUpdDtm")` — last update datetime (更新年月日時分秒) |
| 5 | SET | `mskm_lastUpdDtm = ccMsg.get("mskm_lastUpdDtm")` — application last update datetime (申込更新年月日時分秒) |

**Block 2** — CALL (EKK0021C080) (L1499)

> Cancels the pre-cancellation inquiry detail. This is the top-level cancellation reversal.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0021C080IN` = new `CAANMsg(EKK0021C080CBSMsg.class.getName())` |
| 2 | SET | `eKK0021C080IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0021C080IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 4 | SET | `eKK0021C080IN.set(UPD_DTM_BF, mskm_lastUpdDtm)` |
| 5 | CALL | `callSC(handle, scCall, param, dataMapKey, eKK0021C080IN)` |

**Block 3** — CALL (EKK0081C220) (L1510)

> Cancels the pre-cancellation service contract. This undoes the main service contract cancellation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0081C220IN` = new `CAANMsg(EKK0081C220CBSMsg.class.getName())` |
| 2 | SET | `eKK0081C220IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0081C220IN.set(SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 4 | SET | `eKK0081C220IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5 | SET | `eKK0081C220IN.set(IDO_DIV, ido_div)` |
| 6 | SET | `eKK0081C220IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 7 | CALL | `callSC(handle, scCall, param, dataMapKey, eKK0081C220IN)` -> `eKK0081C220OUT` |
| 8 | SET | `lastUpdDtm = eKK0081C220OUT.getString(UPD_DTM)` — retrieves updated timestamp |

**Block 4** — LOOP (service contract details) (L1527)

> Iterates over all service contract detail lines (サービス契約内容) for the given service contract number and cancels pre-cancellation at the detail level.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0161b004IN` = new `CAANMsg(EKK0161B004CBSMsg.class.getName())` |
| 2 | SET | `ekk0161b004IN.set(FUNC_CODE, "1")` — hardcoded query mode |
| 3 | SET | `ekk0161b004IN.set(KEY_SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 4 | CALL | `callSC(...).getCAANMsgList(...)` -> `ekk0161b004OUT[]` |
| 5 | LOOP | `for (CAANMsg curSvcKeiUcwkInfo : ekk0161b004OUT)` |

**Block 4.1** — CALL (EKK0161C230) inside detail loop (L1534)

> Cancels pre-cancellation at the service contract detail line level.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0161C230IN` = new `CAANMsg(EKK0161C230CBSMsg.class.getName())` |
| 2 | SET | `eKK0161C230IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0161C230IN.set(SVC_KEI_UCWK_NO, curSvcKeiUcwkInfo.getString(SVC_KEI_UCWK_NO))` |
| 4 | SET | `eKK0161C230IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5 | SET | `eKK0161C230IN.set(IDO_DIV, ido_div)` |
| 6 | SET | `eKK0161C230IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 7 | CALL | `callSC(...)` -> `eKK0161C230OUT` |
| 8 | SET | `lastUpdDtm = eKK0161C230OUT.getString(UPD_DTM)` |

**Block 4.2** — LOOP (machine provisioned services within each detail) (L1553)

> For each service detail line, retrieves associated machine provisioned services and cancels pre-cancellation for each.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0341b501IN` = new `CAANMsg(EKK0341B501CBSMsg.class.getName())` |
| 2 | SET | `ekk0341b501IN.set(FUNC_CODE, "1")` |
| 3 | SET | `ekk0341b501IN.set(KEY_SVC_KEI_UCWK_NO, curSvcKeiUcwkInfo.getString(SVC_KEI_UCWK_NO))` |
| 4 | CALL | `callSC(...).getCAANMsgList(...)` -> `ekk0341b501OUT[]` |
| 5 | LOOP | `for (CAANMsg curKktkSvcKeiInfo : ekk0341b501OUT)` |

**Block 4.2.1** — CALL (EKK0341C410) inside machine loop (L1561)

> Cancels pre-cancellation at the machine provisioned service level.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341C410IN` = new `CAANMsg(EKK0341C410CBSMsg.class.getName())` |
| 2 | SET | `eKK0341C410IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0341C410IN.set(KKTK_SVC_KEI_NO, curKktkSvcKeiInfo.getString(KKTK_SVC_KEI_NO))` |
| 4 | SET | `eKK0341C410IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5 | SET | `eKK0341C410IN.set(IDO_DIV, ido_div)` |
| 6 | SET | `eKK0341C410IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 7 | CALL | `callSC(...)` -> `eKK0341C410OUT` |
| 8 | SET | `lastUpdDtm = eKK0341C410OUT.getString(UPD_DTM)` |

**Block 5** — LOOP (optional services) (L1578)

> Retrieves optional services (オプションサービス) for the service contract and cancels pre-cancellation at the optional service level for each.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0351b002IN` = new `CAANMsg(EKK0351B002CBSMsg.class.getName())` |
| 2 | SET | `ekk0351b002IN.set(FUNC_CODE, "1")` |
| 3 | SET | `ekk0351b002IN.set(KEY_SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 4 | CALL | `callSC(...).getCAANMsgList(...)` -> `ekk0351b002OUT[]` |
| 5 | LOOP | `for (CAANMsg curOpSvcKeiInfo : ekk0351b002OUT)` |

**Block 5.1** — CALL (EKK0351C290) inside optional service loop (L1585)

> Cancels pre-cancellation at the optional service level.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0351C290IN` = new `CAANMsg(EKK0351C290CBSMsg.class.getName())` |
| 2 | SET | `eKK0351C290IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0351C290IN.set(OP_SVC_KEI_NO, curOpSvcKeiInfo.getString(OP_SVC_KEI_NO))` |
| 4 | SET | `eKK0351C290IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5 | SET | `eKK0351C290IN.set(IDO_DIV, ido_div)` |
| 6 | SET | `eKK0351C290IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 7 | CALL | `callSC(...)` -> `eKK0351C290OUT` |
| 8 | SET | `lastUpdDtm = eKK0351C290OUT.getString(UPD_DTM)` |

**Block 6** — LOOP (service contract return lines) (L1604)

> Retrieves service contract return lines (サービス契約回線内容) and cancels pre-cancellation at the return line level. This block also processes machine provisioned services associated with return lines.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241b001IN` = new `CAANMsg(EKK0241B001CBSMsg.class.getName())` |
| 2 | SET | `ekk0241b001IN.set(FUNC_CODE, "1")` |
| 3 | SET | `ekk0241b001IN.set(KEY_SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 4 | CALL | `callSC(...).getCAANMsgList(...)` -> `ekk0241b001OUT[]` |
| 5 | LOOP | `for (CAANMsg curKaiUcwkInfo : ekk0241b001OUT)` |

**Block 6.1** — CALL (EKK0251A010 + EKK0341B504) inside return line loop (L1611)

> For each return line, retrieves the return line agreement and associated machine provisioned services.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0251a010IN` = new `CAANMsg(EKK0251A010CBSMsg.class.getName())` |
| 2 | SET | `ekk0251a010IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `ekk0251a010IN.set(KEY_SVC_KEI_KAISEN_UCWK_NO, ...getString(SVC_KEI_KAISEN_UCWK_NO))` |
| 4 | SET | `ekk0251a010IN.set(KEY_GENE_ADD_DTM, ...getString(GENE_ADD_DTM))` |
| 5 | CALL | `callSC(...).getCAANMsgList(...)[0]` -> `ekk0251a010OUT` |
| 6 | SET | `ekk0341b504IN` = new `CAANMsg(EKK0341B504CBSMsg.class.getName())` |
| 7 | SET | `ekk0341b504IN.set(FUNC_CODE, funcCode)` |
| 8 | SET | `ekk0341b504IN.set(KEY_SVC_KEI_KAISEN_UCWK_NO, ...getString(SVC_KEI_KAISEN_UCWK_NO))` |
| 9 | CALL | `callSC(...).getCAANMsgList(...)` -> `ekk0341b504OUTList[]` |
| 10 | LOOP | `for (CAANMsg curKaisenKiki : ekk0341b504OUTList)` |

**Block 6.1.1** — FILTER (machine status check) (L1628)

> Filters machine provisioned items: skips processing if `KKTK_SVC_KEI_STAT` equals "920" OR `KKTK_SVC_CD` equals "C013". This condition uses `||` (OR) — the `continue` only executes when BOTH conditions are true (status != 920 AND code != C013), meaning it processes records where status IS "920" OR code IS "C013".

| # | Type | Code |
|---|------|------|
| 1 | SET | `kktkSvcKeiStat = curKaisenKiki.getString(KKTK_SVC_KEI_STAT)` |
| 2 | SET | `kktkSvcCd = curKaisenKiki.getString(KKTK_SVC_CD)` |
| 3 | IF (nested) | `"920".equals(kktkSvcKeiStat) || "C013".equals(kktkSvcCd)` |

**Block 6.1.2** — CALL (EKK0341C410) inside filtered machine loop (L1632)

> Cancels pre-cancellation for filtered machine provisioned services within a return line.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0341C410IN` = new `CAANMsg(EKK0341C410CBSMsg.class.Name())` |
| 2 | SET | `eKK0341C410IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0341C410IN.set(KKTK_SVC_KEI_NO, curKaisenKiki.getString(KKTK_SVC_KEI_NO))` |
| 4 | SET | `eKK0341C410IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5 | SET | `eKK0341C410IN.set(IDO_DIV, ido_div)` |
| 6 | SET | `eKK0341C410IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 7 | CALL | `callSC(...)` -> `eKK0341C410OUT` |
| 8 | SET | `lastUpdDtm = eKK0341C410OUT.getString(UPD_DTM)` |

**Block 6.2** — IF (return line status check) (L1645)

> If the return line status (`SVC_KEI_KAISEN_UCWK_STAT`) is NOT "920" (Cancelled), skips further processing of this return line. This corresponds to the comment: "If service return line is in use, do not update." (サービス回線内容が使用中の場合は更新しない。)

| # | Type | Code |
|---|------|------|
| 1 | SET | `returnLineStatus = ekk0251a010OUT.getString(SVC_KEI_KAISEN_UCWK_STAT)` |
| 2 | IF (nested) | `!"920".equals(returnLineStatus)` |

**Block 6.2.1** — CALL (EKK0251C080) inside status-920 branch (L1654)

> Cancels the service contract return line cancellation. Only executed when the return line status is "920" (Cancelled).

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0251c080IN` = new `CAANMsg(EKK0251C080CBSMsg.class.getName())` |
| 2 | SET | `ekk0251c080IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `ekk0251c080IN.set(SVC_KEI_KAISEN_UCWK_NO, curKaiUcwkInfo.getString(SVC_KEI_KAISEN_UCWK_NO))` |
| 4 | SET | `ekk0251c080IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5 | SET | `ekk0251c080IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 6 | CALL | `callSC(...)` -> `ekk0251c080OUT` |
| 7 | SET | `lastUpdDtm = ekk0251c080OUT.getString(UPD_DTM)` |

**Block 7** — INIT (application cancellation reversal) (L1665)

> Begins the application-level cancellation reversal. Calls EKK0011A010 with `funcCode = "2"` to query the current application status and details.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0011A010IN` = new `CAANMsg(EKK0011A010CBSMsg.class.getName())` |
| 2 | SET | `eKK0011A010IN.set(FUNC_CODE, "2")` — application inquiry mode |
| 3 | SET | `eKK0011A010IN.set(KEY_MSKM_NO, mskmNo)` |
| 4 | CALL | `callSC(...).getCAANMsgList(...)[0]` -> `curMskmInfo` |
| 5 | SET | `cur_mskm_staus = curMskmInfo.getString(MSKM_STAT)` — current application status |
| 6 | SET | `mskm_lastUpdDtm = curMskmInfo.getString(LAST_UPD_DTM)` — refreshes last update time |

**Block 8** — IF (application status check) (L1675)

> Checks whether the current application status (`cur_mskm_staus`) is "920" (Cancelled — 承認済). If cancelled, proceeds to reverse the cancellation. Otherwise, exits without further processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"920".equals(cur_mskm_staus)` — status is "Cancelled" |

**Block 8.1** — IF (approved status check) (L1677)

> Within the cancelled branch: checks if the input `mskm_staus` parameter equals `MSKM_STAT_130` ("130" — Approved). If approved, calls post-approval cancellation reversal (EKK0011C120).

| # | Type | Code |
|---|------|------|
| 1 | IF | `mskm_staus.equals(MSKM_STAT_130)` where `MSKM_STAT_130 = "130"` (Approved — 承認済) |

**Block 8.1.1** — CALL (EKK0011C120) — Post-approval application cancellation reversal (L1678)

> Cancels the post-approval application cancellation. This is used when the original application was already approved before being cancelled.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0011C120IN` = new `CAANMsg(EKK0011C120CBSMsg.class.getName())` |
| 2 | SET | `eKK0011C120IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0011C120IN.set(MSKM_NO, mskmNo)` |
| 4 | SET | `eKK0011C120IN.set(UPD_DTM_BF, mskm_lastUpdDtm)` |
| 5 | CALL | `callSC(handle, scCall, param, dataMapKey, eKK0011C120IN)` |

**Block 8.2** — ELSE (pre-approval cancellation reversal) (L1689)

> When the current status is "920" (Cancelled) but the input `mskm_staus` is NOT "130" (Approved), this means the application was cancelled before approval. Calls pre-approval application cancellation reversal (EKK0011C070).

| # | Type | Code |
|---|------|------|
| 1 | ELSE | `mskm_staus != "130"` (pre-approval cancellation path) |

**Block 8.2.1** — CALL (EKK0011C070) — Pre-approval application cancellation reversal (L1693)

> Cancels the pre-approval application cancellation. This is used when the application was cancelled before being approved.

| # | Type | Code |
|---|------|------|
| 1 | SET | `eKK0011C070IN` = new `CAANMsg(EKK0011C070CBSMsg.class.getName())` |
| 2 | SET | `eKK0011C070IN.set(FUNC_CODE, funcCode)` |
| 3 | SET | `eKK0011C070IN.set(MSKM_NO, mskmNo)` |
| 4 | SET | `eKK0011C070IN.set(UPD_DTM_BF, mskm_lastUpdDtm)` |
| 5 | CALL | `callSC(handle, scCall, param, dataMapKey, eKK0011C070IN)` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — unique identifier for a service contract in the telecom system |
| `svc_kei_ucwk_no` | Field | Service detail work number — internal tracking ID for a service contract line item |
| `svc_kei_kaisen_ucwk_no` | Field | Service contract return line work number — identifier for a return line within a service contract (回線 = line/loop) |
| `kktk_svc_kei_no` | Field | Machine provisioned service contract number — identifies a service contract line item associated with a provisioned equipment (機器提供) |
| `kktk_svc_kei_stat` | Field | Machine provisioned service status — status code of the machine provisioned service (e.g., "920" = Cancelled) |
| `kktk_svc_cd` | Field | Machine provisioned service code — classification code for the type of machine provisioned service (e.g., "C013") |
| `op_svc_kei_no` | Field | Optional service contract number — identifies an optional service (オプションサービス) such as insurance, extended warranty, or value-added service |
| `mskm_no` | Field | Application number — the customer's unique service application identifier (申込 = application/submission) |
| `mskm_dtl_no` | Field | Application detail number — identifies a specific detail/line item within an application (詳細) |
| `mskm_stat` | Field | Application status — the current status of the application (e.g., "130" = Approved, "920" = Cancelled) |
| `mskm_lastUpdDtm` | Field | Application last update datetime — the timestamp when the application was last modified |
| `ido_div` | Field | Movement classification — indicates the type of movement/change (異動区分), used in cancellation processing |
| `func_code` | Field | Functional code — distinguishes between operation modes (e.g., "1" = query, "2" = application approval) |
| `lastUpdDtm` | Field | Last update datetime — tracks the most recent update timestamp for optimistic concurrency control |
| `upd_dtm_bf` | Field | Update datetime before — used as a pre-update timestamp for optimistic locking checks |
| MSKM_STAT_130 | Constant | Application status: "130" = Approved (承認済) — the application has been approved |
| MSKM_STAT_920 | Constant | Application status: "920" = Cancelled (キャンセル済) — the application has been cancelled |
| CAANMsg | Type | Common Application ANalysis message — the base message class used for CBS request/response data exchange |
| EKK###CBS | Pattern | Enterprise K-Opticom CBS — a Common Business Service class where ### is the service number |
| EKK###CBSMsg | Pattern | CBS message class — defines the input/output field schema for a CBS call |
| CBS | Acronym | Common Business Service — the service component layer that handles business logic and data access |
| SC | Acronym | Service Component — a modular business service unit invoked by Common Components (CC) |
| CC | Acronym | Common Component — shared business logic components (this class's category) |
| e0 Hikari TV | Business term | eo Hikari TV — a fiber-optic internet and TV service offered by K-Opticom |
| 照枠 (terawara) | Term | Pre-cancellation reservation frame — indicates the system state before the final cancellation is confirmed; "照枠前" means "within the reservation frame before cancellation" |
| キャンセル取消 (kyanseru torikeshi) | Term | Cancellation cancellation — the act of reversing/undoing a previously made cancellation (i.e., recovery) |
| 回復 (kaihuku) | Term | Recovery — restoring a service from a cancelled/suspended state |
| 回線 (kaisen) | Term | Line — refers to the telecommunications line/loop associated with a service contract; "回線内容" = line details |
| オプションサービス | Term | Optional service — additional value-added services beyond the base service (e.g., insurance, equipment rental) |
| 機器提供 (kiki teikyou) | Term | Machine provisioned — services that include physical equipment provision (set-top boxes, routers, STBs) |
| 承認済 (shounin-zumi) | Term | Approved — the application has been approved and is in an approved state |
| 承認前 | Term | Pre-approval — the application has not yet been approved |
| 承認後 | Term | Post-approval — the application has been approved |
| 休止 (kyuushi) | Term | Suspension — temporarily pausing a service |
| 中断 (chuudan) | Term | Interruption — temporarily suspending service activity |
