# Business Logic — JKKTVSvcKeiKaihukuCC.recoveryToPauseStatus() [267 LOC]

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

## 1. Role

### JKKTVSvcKeiKaihukuCC.recoveryToPauseStatus()

This method performs the business operation of **recovering all service line items from a "paused/suspended" (休止・中断中) state back to normal active status**. It is invoked during the overall service recovery flow (`kaihuku()`) when a customer's TV service — which was previously placed on hold — needs to be restored to full operation. The method handles three categories of service lines: (1) core service contract details, (2) device-provided service contracts (equipment such as set-top boxes), and (3) option service contracts (optional add-on services like insurance or extended warranty). Each category follows a query-then-recover pattern: it first reads the current state from the relevant service component (SC), filters records that match the original cancellation detail number (`mskmDtlNoBf`), and then invokes the corresponding recovery CBS to reverse the pause. For option services that have been formally terminated (status 910), it performs an additional pause check — if the pause date is set but the pause release date is absent, it triggers a dedicated pause recovery CBS. For service contract withdrawal records, it re-enables device contracts matching the FTTH service code (C013) with terminated status, and reopens the withdrawal record itself unless it is already in use (status 100). Finally, it dispatches viewing control (視聴制御) orders to the equipment for every service work line that was recovered, ensuring the STB/IPTV hardware state is synchronized with the restored service status. The method acts as a **delegation router**: it iterates through the hierarchical service data model (service line item → device contract → withdrawal record) and delegates to the appropriate SC/CBS for each sub-domain, then aggregates equipment information to batch-submit viewing control orders.

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> EXTRACT["Extract funcCode, ido_div, mskmDtlNoBf, lastUpdDtm, opeDate from ccMsg"]

    EXTRACT --> C1["CALL EKK0081C210CBS<br/>Pause Service Contract Recovery"]
    C1 --> UPDATE_DTMs["Update lastUpdDtm from response"]

    UPDATE_DTMs --> C2["CALL EKK0161B004CBS<br/>Service Contract Detail List"]
    C2 --> LOOP1["For each svcKeiUcwkInfo<br/>filter by mskmDtlNoBf match"]

    LOOP1 --> C3["CALL EKK0161C220CBS<br/>Pause Service Contract Detail Recovery"]
    C3 --> UPDATE_DTMs2["Update lastUpdDtm"]

    UPDATE_DTMs2 --> C4["CALL EKK0341B501CBS<br/>Device Service Contract List"]
    C4 --> LOOP2["For each kktkSvcKeiInfo<br/>filter by mskmDtlNoBf match"]

    LOOP2 --> C5["CALL EKK0341C400CBS<br/>Pause Device Service Contract Recovery"]
    C5 --> UPDATE_DTMs3["Update lastUpdDtm"]

    UPDATE_DTMs3 --> BUILD_MAP["Build svcUcwkMap<br/>svc_kei_ucwk_no -> <SVC_CD, MODEL>"]

    BUILD_MAP --> END1["End inner loops"]
    END1 --> END2["End outer loop"]

    END2 --> C6["CALL EKK0351B002CBS<br/>Option Service Contract List"]
    C6 --> LOOP3["For each opSvcKeiInfo<br/>filter by mskmDtlNoBf match"]

    LOOP3 --> CHECK_STAT["Check opSvcKeiStat == 910<br/>(Terminated)"]

    CHECK_STAT -->|Yes| C7["CALL EKK0351A010CBS<br/>Option Service Contract Single"]
    CHECK_STAT -->|No| SKIP_OPT["Skip"]

    C7 --> CHECK_PAUSE["opSvcPauseYmd set AND<br/>opSvcPauseRlsYmd NOT set"]
    CHECK_PAUSE -->|Yes| C8["CALL EKK0351C280CBS<br/>Pause Option Service Recovery"]
    CHECK_PAUSE -->|No| SKIP_PAUSE["Skip recovery"]
    C8 --> UPDATE_DTMs4["Update lastUpdDtm"]

    UPDATE_DTMs4 --> END3["End option loop"]
    SKIP_OPT --> END3
    SKIP_PAUSE --> END3

    END3 --> C9["CALL EKK0241B001CBS<br/>Service Contract Withdrawal List"]
    C9 --> LOOP4["For each kaiUcwkInfo"]

    LOOP4 --> C10["CALL EKK0251A010CBS<br/>Withdrawal Detail Single"]
    C10 --> C11["CALL EKK0341B504CBS<br/>Device Service Contract Withdrawal List"]

    C11 --> LOOP5["For each kaisenKiki<br/>filter stat=910 AND svcCd=C013<br/>filter by mskmDtlNoBf match"]

    LOOP5 --> C12["CALL EKK0341C400CBS<br/>Pause Device Service Contract Recovery"]
    C12 --> UPDATE_DTMs5["Update lastUpdDtm"]

    UPDATE_DTMs5 --> END4["End device withdrawal loop"]
    END4 --> CHECK_WITHDRAWAL["Check kaiSakenUCWKStat != 100<br/>(Not in use)"]

    CHECK_WITHDRAWAL -->|Yes| C13["CALL EKK0251C060CBS<br/>Service Contract Withdrawal Reopening"]
    CHECK_WITHDRAWAL -->|No| SKIP_REOPEN["Skip reopening"]

    C13 --> END5["End withdrawal loop"]
    SKIP_REOPEN --> END5

    END5 --> LOOP_MAP["For each entry in svcUcwkMap"]

    LOOP_MAP --> C14["CALL execWctrlOrderToPause<br/>Viewing Control Order Dispatch"]
    C14 --> END6(["Return / Next"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle providing the transactional context for all CBS (Common Business Service) calls. Used to maintain connection state across the multi-step recovery process. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component invocation handler that routes CBS requests to the correct backend. Used by `callSC` to dispatch each SC/CBS call with proper request/response message mapping. |
| 3 | `param` | `IRequestParameterReadWrite` | Request/response parameter container holding business data maps (including `dataMapKey`-scoped data). Provides `getData` and `setData` methods to access shared state between CC components and service components. |
| 4 | `dataMapKey` | `String` | Key to identify the specific data map within `param` where business context (function code, service contract number, system ID, etc.) is stored. Used by `callSC` and `execWctrlOrderToPause` to locate the working data context. |
| 5 | `mskmDtlNo` | `String` | Detail number of the cancellation request (解約時申込ま明細番号) — the unique identifier for the specific line item that was being cancelled. Used throughout the method as a filter criterion to identify which paused service records correspond to this particular recovery operation. |

**Instance/External State:**
- No instance fields are read by this method; it is fully stateless, deriving all context from the `param` data map.
- Reads external constant `TEMPLATE_ID_EKK0081C210`, `TEMPLATE_ID_EKK0161B004`, `TEMPLATE_ID_EKK0161C220`, `TEMPLATE_ID_EKK0341B501`, `TEMPLATE_ID_EKK0341C400`, `TEMPLATE_ID_EKK0351B002`, `TEMPLATE_ID_EKK0351A010`, `TEMPLATE_ID_EKK0351C280`, `TEMPLATE_ID_EKK0241B001`, `TEMPLATE_ID_EKK0251A010`, `TEMPLATE_ID_EKK0341B504`, `TEMPLATE_ID_EKK0251C060` — all resolved from class-level private static final constants.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `EKK0081C210CBS` | EKK0081C210 | KK_T_SVC_KEI (service contract) | Calls "Pause Service Contract Recovery" (休止中サービス契約回復) — recovers a paused service contract. Sets funcCode, svcKeiNo, mskmDtlNo, kaihkYmd, idoDiv, updDtmBf. |
| R | `EKK0161B004CBS` | EKK0161B004 | KK_T_SVC_KEI_UCWK (service contract work detail) | Calls "Service Contract Detail List" (サービス契約内訳一覧照会) — retrieves all work detail records for a service contract. Filters records by mskmDtlNoBf later in code. |
| R | `EKK0161C220CBS` | EKK0161C220 | KK_T_SVC_KEI_UCWK (service contract work detail) | Calls "Pause Service Contract Detail Recovery" (休止中サービス契約内訳回復) — recovers a paused service contract work detail line item. Sets funcCode, svcKeiUcwkNo, mskmDtlNo, kaihkYmd, idoDiv, updDtmBf. |
| R | `EKK0341B501CBS` | EKK0341B501 | KK_T_KKTK_SVC_KEI (device service contract) | Calls "Device Service Contract List (Service Contract Number)" (機器提供サービス契約一覧照会(サービス契約番号)) — retrieves device/service contract records for a service work detail. |
| R | `EKK0341C400CBS` | EKK0341C400 | KK_T_KKTK_SVC_KEI (device service contract) | Calls "Pause Device Service Contract Recovery" (休止中機器提供サービス契約回復) — recovers a paused device-provided service contract. Sets funcCode, kktkSvcKeiNo, mskmDtlNo, kaihkYmd, idoDiv, updDtmBf. Called twice in this method. |
| R | `EKK0351B002CBS` | EKK0351B002 | KK_T_OP_SVC_KEI (option service contract) | Calls "Option Service Contract List (Service Contract Number)" (オプションサービス契約一覧照会(サービス契約番号)) — retrieves option service contract records. |
| R | `EKK0351A010CBS` | EKK0351A010 | KK_T_OP_SVC_KEI (option service contract) | Calls "Option Service Contract Single" (オプションサービス契約一意照会) — retrieves a single option service contract record with pause date/relief date fields. Used to check if pause is active. |
| R | `EKK0351C280CBS` | EKK0351C280 | KK_T_OP_SVC_KEI (option service contract) | Calls "Pause Option Service Contract Recovery" (休止中オプションサービス契約回復) — recovers a paused option service contract. Set when pause date exists but release date does not. |
| R | `EKK0241B001CBS` | EKK0241B001 | KK_T_SVC_KEI_KAISEN_UCWK (service contract withdrawal work) | Calls "Service Contract Withdrawal Detail List" (サービス契約回線内訳一覧照会) — retrieves service contract withdrawal records. |
| R | `EKK0251A010CBS` | EKK0251A010 | KK_T_SVC_KEI_KAISEN_UCWK (service contract withdrawal work) | Calls "Service Contract Withdrawal Detail Single" (サービス契約回線内訳一意照会) — retrieves a single withdrawal detail record including status. Used to check if withdrawal is in use. |
| R | `EKK0341B504CBS` | EKK0341B504 | KK_T_KKTK_SVC_KEI (device service contract) | Calls "Device Service Contract List (Service Contract Withdrawal Detail)" (機器提供サービス契約一覧照会(サービス契約回線内訳)) — retrieves device contract records for a withdrawal. Filters for stat=910 and svcCd=C013 (FTTH). |
| R | `EKK0251C060CBS` | EKK0251C060 | KK_T_SVC_KEI_KAISEN_UCWK (service contract withdrawal work) | Calls "Service Contract Withdrawal Reopening" (サービス契約回線内訳使用再開) — re-enables a withdrawal record that was not in active use. |
| - | `JKKTVSvcKeiKaihukuCC.callSC` | - | - | Internal helper method that dispatches CBS calls with template-based message construction. Wraps all SC/CBS invocations with error handling and response message mapping. |
| - | `JKKTVSvcKeiKaihukuCC.execWctrlOrderToPause` | - | Viewing Control System (視聴制御) | Internal helper method that dispatches viewing control (equipment lock/unlock) orders to set-top boxes via `JKKWctrlOrderSendCC.sendWctrlOrder`. Aggregates device info (STB ID, model) for C010/C011 device types. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | N/A (Called by internal CBS) | `JKKTVSvcKeiKaihukuCC.kaihuku()` → `recoveryToPauseStatus(handle, scCall, param, dataMapKey, mskmDtlNo)` | `EKK0081C210 [R] KK_T_SVC_KEI`, `EKK0161B004 [R] KK_T_SVC_KEI_UCWK`, `EKK0161C220 [R] KK_T_SVC_KEI_UCWK`, `EKK0341B501 [R] KK_T_KKTK_SVC_KEI`, `EKK0341C400 [R] KK_T_KKTK_SVC_KEI` (×2), `EKK0351B002 [R] KK_T_OP_SVC_KEI`, `EKK0351A010 [R] KK_T_OP_SVC_KEI`, `EKK0351C280 [R] KK_T_OP_SVC_KEI`, `EKK0241B001 [R] KK_T_SVC_KEI_KAISEN_UCWK`, `EKK0251A010 [R] KK_T_SVC_KEI_KAISEN_UCWK`, `EKK0341B504 [R] KK_T_KKTK_SVC_KEI`, `EKK0251C060 [R] KK_T_SVC_KEI_KAISEN_UCWK`, `execWctrlOrderToPause [-] Viewing Control System (視聴制御)` |

**Notes:**
- No direct screen entry points (KKSV*) were found calling this method within 8 hops. It is exclusively called internally by the `kaihuku()` method of the same class, which serves as the main recovery entry point.
- The method is a **leaf recovery orchestrator** — it does not call further CC entry points beyond its own internal helpers (`callSC`, `execWctrlOrderToPause`).

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Extract business context from ccMsg (L1729–L1743)

Extracts function code, movement division, pre-cancellation detail number, last update timestamp, and operational date from the shared data map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ccMsg = (HashMap) param.getData(dataMapKey)` // Shared data map containing business context [dataMapKey] |
| 2 | SET | `funcCode = (String) ccMsg.get("func_code")` // Function code identifying the originating function/screen |
| 3 | SET | `ido_div = (String) ccMsg.get("ido_div")` // Movement division (異動区分) — identifies the type of movement (recovery, change, etc.) |
| 4 | SET | `mskmDtlNoBf = (String) ccMsg.get("mskm_dtl_no")` // Pre-cancellation detail number — original line item being cancelled |
| 5 | SET | `lastUpdDtm = (String) ccMsg.get("lastUpdDtm")` // Last update datetime before the pause |
| 6 | SET | `opeDate = JPCBPCommon.getOpeDate(null)` // Operational date (運用日) — current business date from system clock |

**Block 2** — [CALL] EKK0081C210 — Pause Service Contract Recovery (L1747–L1763)

Recovers the top-level service contract from paused status. Sets up a CAANMsg with the EKK0081C210CBS template and dispatches via `callSC`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0081c210IN = new CAANMsg(EKK0081C210CBSMsg.class.getName())` // Input message for pause recovery |
| 2 | EXEC | `ekk0081c210IN.set(TEMPLATEID, TEMPLATE_ID_EKK0081C210)` // "EKK0081C210" |
| 3 | EXEC | `ekk0081c210IN.set(FUNC_CODE, funcCode)` // Function code from ccMsg |
| 4 | EXEC | `ekk0081c210IN.set(SVC_KEI_NO, ccMsg.get("svc_kei_no"))` // Service contract number |
| 5 | EXEC | `ekk0081c210IN.set(MSKM_DTL_NO, mskmDtlNo)` // Cancellation detail number |
| 6 | EXEC | `ekk0081c210IN.set(KAIHK_YMD, opeDate)` // Recovery date |
| 7 | EXEC | `ekk0081c210IN.set(IDO_DIV, ido_div)` // Movement division |
| 8 | EXEC | `ekk0081c210IN.set(UPD_DTM_BF, lastUpdDtm)` // Previous last update datetime |
| 9 | CALL | `ekk0081c210OUT = callSC(handle, scCall, param, dataMapKey, ekk0081c210IN)` |
| 10 | SET | `lastUpdDtm = ekk0081c210OUT.getString(UPD_DTM)` // Updated last update datetime from response |

**Block 3** — [CALL] EKK0161B004 — Service Contract Detail List (L1766–L1770)

Retrieves all service contract work detail records for the service contract. Filters later by matching `mskmDtlNoBf`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0161b004IN = new CAANMsg(EKK0161B004CBSMsg.class.getName())` |
| 2 | EXEC | `ekk0161b004IN.set(TEMPLATEID, TEMPLATE_ID_EKK0161B004)` // "EKK0161B004" |
| 3 | EXEC | `ekk0161b004IN.set(FUNC_CODE, "1")` // Fixed value "1" |
| 4 | EXEC | `ekk0161b004IN.set(KEY_SVC_KEI_NO, ccMsg.get("svc_kei_no"))` // Service contract number as key |
| 5 | CALL | `ekk0161b004OUT = callSC(...).getCAANMsgList(EKK0161B004CBSMsg.EKK0161B004CBSMSG1LIST)` // Returns CAANMsg[] |

**Block 4** — [FOR] Iterate service contract work detail records (L1772–L1822)

For each service contract work detail record matching the original cancellation detail number:
- Recovers the work detail via EKK0161C220
- Recovers associated device service contracts via EKK0341C400
- Builds a map of recovered equipment info for later viewing control dispatch

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | FOR | `for (CAANMsg curSvcKeiUcwkInfo : ekk0161b004OUT)` | Iterate over service contract work detail records |
| 2 | IF | `if (!mskmDtlNoBf.equals(curSvcKeiUcwkInfo.getString(MSKM_DTL_NO)))` | [Filter] Skip records that do not match the original cancellation detail number |
| 2.1 | EXEC | `continue;` | Skip this record |
| 3 | CALL | `EKK0161C220CBS` — Pause Service Contract Detail Recovery | Recovers the paused service contract work detail line item |
| 3.1 | SET | `ekk0161c220IN.set(TEMPLATEID, TEMPLATE_ID_EKK0161C220)` // "EKK0161C220" |
| 3.2 | EXEC | `ekk0161c220IN.set(FUNC_CODE, funcCode)` |
| 3.3 | EXEC | `ekk0161c220IN.set(SVC_KEI_UCWK_NO, curSvcKeiUcwkInfo.getString(SVC_KEI_UCWK_NO))` // Service work detail number |
| 3.4 | EXEC | `ekk0161c220IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 3.5 | EXEC | `ekk0161c220IN.set(KAIHK_YMD, opeDate)` |
| 3.6 | EXEC | `ekk0161c220IN.set(IDO_DIV, ido_div)` |
| 3.7 | EXEC | `ekk0161c220IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 3.8 | CALL | `ekk0161c220OUT = callSC(...)` |
| 3.9 | SET | `lastUpdDtm = ekk0161c220OUT.getString(UPD_DTM)` |
| 4 | CALL | `EKK0341B501CBS` — Device Service Contract List | Retrieves device contracts associated with this service work detail |
| 4.1 | SET | `ekk0341b501IN.set(TEMPLATEID, TEMPLATE_ID_EKK0341B501)` // "EKK0341B501" |
| 4.2 | EXEC | `ekk0341b501IN.set(FUNC_CODE, "1")` // Fixed "1" |
| 4.3 | EXEC | `ekk0341b501IN.set(KEY_SVC_KEI_UCWK_NO, curSvcKeiUcwkInfo.getString(SVC_KEI_UCWK_NO))` // Service work detail number as key |
| 4.4 | CALL | `ekk0341b501OUT = callSC(...).getCAANMsgList(...)` |
| 5 | FOR | `for (CAANMsg curKktkSvcKeiInfo : ekk0341b501OUT)` | Iterate over device service contract records |
| 5.1 | IF | `if (!mskmDtlNoBf.equals(curKktkSvcKeiInfo.getString(MSKM_DTL_NO)))` | [Filter] Skip records not matching original cancellation detail |
| 5.2 | EXEC | `continue;` | Skip |
| 6 | CALL | `EKK0341C400CBS` — Pause Device Service Contract Recovery | Recovers the paused device contract |
| 6.1 | SET | `ekk0341c400IN.set(TEMPLATEID, TEMPLATE_ID_EKK0341C400)` // "EKK0341C400" |
| 6.2 | EXEC | `ekk0341c400IN.set(FUNC_CODE, funcCode)` |
| 6.3 | EXEC | `ekk0341c400IN.set(KKTK_SVC_KEI_NO, curKktkSvcKeiInfo.getString(KKTK_SVC_KEI_NO))` // Device service contract number |
| 6.4 | EXEC | `ekk0341c400IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 6.5 | EXEC | `ekk0341c400IN.set(KAIHK_YMD, opeDate)` |
| 6.6 | EXEC | `ekk0341c400IN.set(IDO_DIV, ido_div)` |
| 6.7 | EXEC | `ekk0341c400IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 6.8 | CALL | `ekk0341c400OUT = callSC(...)` |
| 6.9 | SET | `lastUpdDtm = ekk0341c400OUT.getString(UPD_DTM)` |
| 7 | IF | `if (!svcUcwkMap.containsKey(svc_kei_ucwk_no))` | [Map Init] Check if service work line map entry exists |
| 7.1 | SET | `svcUcwkMap.put(svc_kei_ucwk_no, new HashMap<String, String>())` | Initialize the map entry |
| 7.2 | SET | `ucwkInfo = svcUcwkMap.get(svc_kei_ucwk_no)` | Retrieve the map entry |
| 7.3 | SET | `ucwkInfo.put(KKTK_SVC_CD, curKktkSvcKeiInfo.getString(KKTK_SVC_CD))` // Map service code to device serial number |
| 7.4 | SET | `ucwkInfo.put(KKTK_SVC_CD + "_MODEL", curKktkSvcKeiInfo.getString(TAKNKIKI_MODEL_CD))` // Map service code with "_MODEL" suffix to model code |

**Block 5** — [CALL] EKK0351B002 — Option Service Contract List (L1828–L1836)

Retrieves option service contract records for the service contract. Option services are processed in a separate flow because they require an additional pause-state validation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0351b002IN = new CAANMsg(EKK0351B002CBSMsg.class.getName())` |
| 2 | EXEC | `ekk0351b002IN.set(TEMPLATEID, TEMPLATE_ID_EKK0351B002)` // "EKK0351B002" |
| 3 | EXEC | `ekk0351b002IN.set(FUNC_CODE, "1")` // Fixed "1" |
| 4 | EXEC | `ekk0351b002IN.set(KEY_SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 5 | CALL | `ekk0351b002OUT = callSC(...).getCAANMsgList(...)` |

**Block 6** — [FOR] Iterate option service contract records (L1838–L1903)

For each option service contract matching the original cancellation detail:
- Checks if status is "910" (terminated)
- If terminated, retrieves pause date and release date
- If pause date is set but release date is absent, triggers pause recovery

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | FOR | `for (CAANMsg curOpSvcKeiInfo : ekk0351b002OUT)` | Iterate over option service contract records |
| 2 | IF | `if (!mskmDtlNoBf.equals(curOpSvcKeiInfo.getString(MSKM_DTL_NO)))` | [Filter] Skip records not matching original cancellation detail |
| 2.1 | EXEC | `continue;` | Skip |
| 3 | SET | `opSvcKeiStat = curOpSvcKeiInfo.getString(OP_SVC_KEI_STAT)` // Option service contract status |
| 4 | IF | `if ("910".equals(opSvcKeiStat))` | [Condition] Option service contract is "Terminated" (解約済) — only terminated contracts require pause recovery |
| 4.1 | CALL | `EKK0351A010CBS` — Option Service Contract Single | Retrieves a single option service contract record with pause date fields |
| 4.1.1 | SET | `ekk0351a010IN.set(TEMPLATEID, TEMPLATE_ID_EKK0351A010)` // "EKK0351A010" |
| 4.1.2 | EXEC | `ekk0351a010IN.set(FUNC_CODE, "2")` // Fixed "2" |
| 4.1.3 | EXEC | `ekk0351a010IN.set(KEY_OP_SVC_KEI_NO, curOpSvcKeiInfo.getString(OP_SVC_KEI_NO))` |
| 4.1.4 | EXEC | `ekk0351a010IN.set(KEY_RSV_APLY_YMD, opeDate)` // Request application date = operational date |
| 4.1.5 | CALL | `ekk0351a010INOUT = callSC(...).getCAANMsgList(...)` |
| 4.2 | SET | `opSvcPauseYmd = ekk0351a010INOUT[0].getString(SVC_PAUSE_YMD)` // Service pause date (サービス休止年月日) |
| 4.3 | SET | `opSvcPauseRlsYmd = ekk0351a010INOUT[0].getString(SVC_PAUSE_RLS_YMD)` // Service pause release date (サービス休止解除年月日) |
| 5 | IF | `if ((opSvcPauseYmd != null && !"".equals(opSvcPauseYmd)) && (opSvcPauseRlsYmd == null || "".equals(opSvcPauseRlsYmd)))` | [Condition] Pause date is set AND pause release date is NOT set — meaning the service is still in a paused state. "休止年月日が設定され、休止解除年月日が設定されていない場合、「休止中回復処理」を行う" |
| 5.1 | CALL | `EKK0351C280CBS` — Pause Option Service Contract Recovery | Recovers the paused option service contract |
| 5.1.1 | SET | `ekk0351c280IN.set(TEMPLATEID, TEMPLATE_ID_EKK0351C280)` // "EKK0351C280" |
| 5.1.2 | EXEC | `ekk0351c280IN.set(FUNC_CODE, funcCode)` |
| 5.1.3 | EXEC | `ekk0351c280IN.set(OP_SVC_KEI_NO, curOpSvcKeiInfo.getString(OP_SVC_KEI_NO))` |
| 5.1.4 | EXEC | `ekk0351c280IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5.1.5 | EXEC | `ekk0351c280IN.set(KAIHK_YMD, opeDate)` |
| 5.1.6 | EXEC | `ekk0351c280IN.set(IDO_DIV, ido_div)` |
| 5.1.7 | EXEC | `ekk0351c280IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 5.1.8 | CALL | `ekk0351c280OUT = callSC(...)` |
| 5.1.9 | SET | `lastUpdDtm = ekk0351c280OUT.getString(UPD_DTM)` |

**Block 7** — [CALL] EKK0241B001 — Service Contract Withdrawal List (L1909–L1917)

Retrieves service contract withdrawal records. These are records where the service contract line item has been fully withdrawn/cancelled. The recovery process needs to handle these differently — device contracts are recovered individually, and the withdrawal itself is reopened only if not in active use.

| # | Type | Code |
|---|------|------|
| 1 | SET | `ekk0241b001IN = new CAANMsg(EKK0241B001CBSMsg.class.getName())` |
| 2 | EXEC | `ekk0241b001IN.set(TEMPLATEID, TEMPLATE_ID_EKK0241B001)` // "EKK0241B001" |
| 3 | EXEC | `ekk0241b001IN.set(FUNC_CODE, "1")` // Fixed "1" |
| 4 | EXEC | `ekk0241b001IN.set(KEY_SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 5 | CALL | `ekk0241b001OUT = callSC(...).getCAANMsgList(...)` |

**Block 8** — [FOR] Iterate withdrawal records (L1919–L1975)

For each withdrawal record:
- Retrieves withdrawal detail (EKK0251A010)
- Retrieves associated device contracts (EKK0341B504), filtering for stat=910 (Terminated) and svcCd=C013 (FTTH service code)
- Recovers matching device contracts via EKK0341C400
- Reopens the withdrawal (EKK0251C060) if the withdrawal status is NOT "100" (in use)

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | FOR | `for (CAANMsg curKaiUcwkInfo : ekk0241b001OUT)` | Iterate over service contract withdrawal records |
| 2 | CALL | `EKK0251A010CBS` — Withdrawal Detail Single | Retrieves withdrawal detail including status (SVC_KEI_KAISEN_UCWK_STAT) |
| 2.1 | SET | `ekk0251a010IN.set(TEMPLATEID, TEMPLATE_ID_EKK0251A010)` // "EKK0251A010" |
| 2.2 | EXEC | `ekk0251a010IN.set(FUNC_CODE, funcCode)` |
| 2.3 | EXEC | `ekk0251a010IN.set(KEY_SVC_KEI_KAISEN_UCWK_NO, curKaiUcwkInfo.getString(SVC_KEI_KAISEN_UCWK_NO))` |
| 2.4 | EXEC | `ekk0251a010IN.set(KEY_GENE_ADD_DTM, curKaiUcwkInfo.getString(GENE_ADD_DTM))` // Generation add datetime |
| 2.5 | CALL | `ekk0251a010OUT = callSC(...).getCAANMsgList(...)[0]` |
| 3 | CALL | `EKK0341B504CBS` — Device Service Contract Withdrawal List | Retrieves device contracts for this withdrawal |
| 3.1 | SET | `ekk0341b504IN.set(TEMPLATEID, TEMPLATE_ID_EKK0341B504)` // "EKK0341B504" |
| 3.2 | EXEC | `ekk0341b504IN.set(FUNC_CODE, funcCode)` |
| 3.3 | EXEC | `ekk0341b504IN.set(KEY_SVC_KEI_KAISEN_UCWK_NO, curKaiUcwkInfo.getString(SVC_KEI_KAISEN_UCWK_NO))` |
| 3.4 | CALL | `ekk0341b504OUTList = callSC(...).getCAANMsgList(...)` |
| 4 | FOR | `for (CAANMsg curKaisenKiki : ekk0341b504OUTList)` | Iterate over device records for this withdrawal |
| 4.1 | IF | `if (!"910".equals(KKTK_SVC_KEI_STAT) || !"C013".equals(KKTK_SVC_CD))` | [Filter] Skip unless status=910 (Terminated) AND service code=C013 (FTTH) |
| 4.2 | EXEC | `continue;` | Skip non-matching device records |
| 4.3 | IF | `if (!mskmDtlNoBf.equals(curKaisenKiki.getString(MSKM_DTL_NO)))` | [Filter, v5.00.01 addition] Skip records not matching original cancellation detail |
| 4.4 | EXEC | `continue;` | Skip |
| 5 | CALL | `EKK0341C400CBS` — Pause Device Service Contract Recovery | Recovers the paused device contract for this withdrawal |
| 5.1 | SET | `ekk0341c400IN.set(TEMPLATEID, TEMPLATE_ID_EKK0341C400)` |
| 5.2 | EXEC | `ekk0341c400IN.set(FUNC_CODE, funcCode)` |
| 5.3 | EXEC | `ekk0341c400IN.set(KKTK_SVC_KEI_NO, curKaisenKiki.getString(KKTK_SVC_KEI_NO))` |
| 5.4 | EXEC | `ekk0341c400IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 5.5 | EXEC | `ekk0341c400IN.set(KAIHK_YMD, opeDate)` |
| 5.6 | EXEC | `ekk0341c400IN.set(IDO_DIV, ido_div)` |
| 5.7 | EXEC | `ekk0341c400IN.set(UPD_DTM_BF, lastUpdDtm)` |
| 5.8 | CALL | `ekk0341c400OUT = callSC(...)` |
| 5.9 | SET | `lastUpdDtm = ekk0341c400OUT.getString(UPD_DTM)` |
| 6 | IF | `if ("100".equals(ekk0251a010OUT.getString(SVC_KEI_KAISEN_UCWK_STAT)))` | [Condition] Withdrawal detail status = "100" (In Use / 使用中) — skip reopening |
| 6.1 | EXEC | `continue;` | Skip — do not reopen withdrawal if in use |
| 7 | CALL | `EKK0251C060CBS` — Service Contract Withdrawal Reopening | Re-enables the withdrawal record for active use |
| 7.1 | SET | `ekk0251c060IN.set(TEMPLATEID, TEMPLATE_ID_EKK0251C060)` // "EKK0251C060" |
| 7.2 | EXEC | `ekk0251c060IN.set(FUNC_CODE, funcCode)` |
| 7.3 | EXEC | `ekk0251c060IN.set(SVC_KEI_KAISEN_UCWK_NO, curKaiUcwkInfo.getString(SVC_KEI_KAISEN_UCWK_NO))` |
| 7.4 | EXEC | `ekk0251c060IN.set(MSKM_DTL_NO, mskmDtlNo)` |
| 7.5 | EXEC | `ekk0251c060IN.set(USE_STAYMD, opeDate)` // Use start date (使用開始日) |
| 7.6 | EXEC | `ekk0251c060IN.set(IDO_DIV, ido_div)` |
| 7.7 | EXEC | `ekk0251c060IN.set(KK0251_UPD_DTM_BF, ekk0251a010OUT.getString(LAST_UPD_DTM))` |
| 7.8 | SET | `msgList = new CAANMsg[]{new CAANMsg(EKK0251C060CBSMsg1List.class.getName())}` |
| 7.9 | EXEC | `msgList[0].set(SVC_KEI_NO, ccMsg.get("svc_kei_no"))` |
| 7.10 | EXEC | `msgList[0].set(KK0241_UPD_DTM_BF, lastUpdDtm)` |
| 7.11 | EXEC | `ekk0251c060IN.set(EKK0251C060CBSMSG1LIST, msgList)` |
| 7.12 | CALL | `callSC(handle, scCall, param, dataMapKey, ekk0251c060IN)` |

**Block 9** — [WHILE/ITERATOR] Viewing control order dispatch (L1977–L1985)

Iterates over the aggregated equipment map (`svcUcwkMap`) and dispatches viewing control orders for each recovered service work line. The viewing control order tells the set-top box/IPTV equipment to unblock/restore the service.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `it = svcUcwkMap.keySet().iterator()` // Iterator over recovered service work line numbers |
| 2 | WHILE | `while (it.hasNext())` | [視聴制御オーダ発行] Iterate all recovered service work lines |
| 2.1 | SET | `svcUcwkNo = it.next()` | Get next service work line number |
| 2.2 | SET | `ucwkInfo = svcUcwkMap.get(svcUcwkNo)` | Get equipment info map: `{ C009: deviceSerial, C009_MODEL: modelCode, C010: stbId, C011: ccasStbId }` |
| 2.3 | CALL | `execWctrlOrderToPause(handle, param, scCall, svcUcwkNo, ucwkInfo, dataMapKey)` | Dispatch viewing control order (視聴制御依存処理コード) to equipment via `JKKWctrlOrderSendCC.sendWctrlOrder` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `recoveryToPauseStatus` | Method | Recovery from paused/suspended status — restores a service that was placed on hold (休止・中断) back to normal active status |
| `func_code` | Field | Function code (機能コード) — identifies the originating business function/screen that initiated the operation |
| `ido_div` | Field | Movement division (異動区分) — classifies the type of change (e.g., recovery, cancellation, transfer) |
| `mskmDtlNo` | Field | Cancellation detail number (解約時申込ま明細番号) — unique identifier for a specific line item within a cancellation request |
| `mskmDtlNoBf` | Field | Pre-cancellation detail number — the cancellation detail number captured before the pause, used as a filter to find the correct records |
| `svc_kei_no` | Field | Service contract number (サービス契約番号) — unique identifier for a service contract line |
| `svc_kei_ucwk_no` | Field | Service contract work detail number (サービス契約内訳番号) — sub-identifier within a service contract for a specific work/detail line item |
| `kktk_svc_kei_no` | Field | Device service contract number (機器提供サービス契約番号) — identifier for a device-provided service contract (set-top box, modem, etc.) |
| `kktk_svc_cd` | Field | Device service code (機器提供サービスコード) — code identifying the type of device service (e.g., C013 = FTTH) |
| `svc_kei_kaisen_ucwk_no` | Field | Service contract withdrawal work number (サービス契約回線内訳番号) — identifier for a service contract withdrawal/detail line |
| `op_svc_kei_stat` | Field | Option service contract status (オプションサービス契約ステータス) — status code for option services; 910 = Terminated (解約済) |
| `op_svc_pause_ymd` | Field | Service pause date (サービス休止年月日) — date when the service was paused |
| `op_svc_pause_rls_ymd` | Field | Service pause release date (サービス休止解除年月日) — date when the pause was lifted; null/empty means still paused |
| `svc_kei_kaisen_ucwk_stat` | Field | Service contract withdrawal work status (サービス契約回線内訳ステータス) — status of withdrawal; 100 = In Use (使用中) |
| `kaihk_ymd` | Field | Recovery date (回復年月日) — the date on which recovery is being processed |
| `upd_dtm_bf` | Field | Previous update datetime (更新年月日時分秒) — the last update timestamp before the operation, used for optimistic concurrency |
| `take_n_kiki` | Field | Equipment/product (製品機器) — the physical device associated with a service contract |
| `takin_kiki_model_cd` | Field | Product model code (製品モデルコード) — model identifier for the equipment |
| `C010` | Key | STB ID — set-top box identifier, stored as key "C010" in the ucwkInfo map |
| `C011` | Key | CCAS STB ID — CCAS-capable set-top box identifier, stored as key "C011" in the ucwkInfo map |
| `C009` | Key | Device serial number — stored as key "C009" in the ucwkInfo map |
| `C009_MODEL` | Key | Device model code — stored as key "C009_MODEL" (service code + "_MODEL") in the ucwkInfo map |
| `WC_TOK_DGTIA_GRP_CD6` | Constant | Business parameter — digital TIA group code for viewing control, retrieved via `getBuisinessParameter` |
| `WCTRL_REQ_TRN_CD_SVC_KAIHK` | Constant | Viewing control transaction code for service recovery (視聴制御取引コード_サービス回復) |
| 910 | Status Code | Terminated (解約済) — option service contract status indicating the service has been fully cancelled |
| 100 | Status Code | In Use (使用中) — withdrawal detail status indicating the line is still actively used |
| C013 | Service Code | FTTH (Fiber To The Home) — broadband internet service delivered via fiber optics |
| Viewing Control (視聴制御) | Business term | Equipment-level access control mechanism that locks/unlocks set-top boxes and IPTV devices based on service subscription status |
| `kk0241_upd_dtm_bf` | Field | Previous update datetime for KK_T0241 (service contract withdrawal table) |
| `kk0251_upd_dtm_bf` | Field | Previous update datetime for KK_T0251 (service contract withdrawal detail table) |
| EKK0081C210 | SC Code | Pause Service Contract Recovery (休止中サービス契約回復) — recovers top-level service contract from pause |
| EKK0161B004 | SC Code | Service Contract Detail List (サービス契約内訳一覧照会) — queries work detail records for a service contract |
| EKK0161C220 | SC Code | Pause Service Contract Detail Recovery (休止中サービス契約内訳回復) — recovers a paused work detail line |
| EKK0341B501 | SC Code | Device Service Contract List (機器提供サービス契約一覧照会) — queries device contracts for a service work detail |
| EKK0341C400 | SC Code | Pause Device Service Contract Recovery (休止中機器提供サービス契約回復) — recovers a paused device contract |
| EKK0341B504 | SC Code | Device Service Contract Withdrawal List (機器提供サービス契約一覧照会(サービス契約回線内訳)) — queries device contracts for a withdrawal |
| EKK0351B002 | SC Code | Option Service Contract List (オプションサービス契約一覧照会) — queries option service contracts |
| EKK0351A010 | SC Code | Option Service Contract Single (オプションサービス契約一意照会) — queries a single option service record |
| EKK0351C280 | SC Code | Pause Option Service Contract Recovery (休止中オプションサービス契約回復) — recovers a paused option service |
| EKK0241B001 | SC Code | Service Contract Withdrawal Detail List (サービス契約回線内訳一覧照会) — queries withdrawal records |
| EKK0251A010 | SC Code | Service Contract Withdrawal Detail Single (サービス契約回線内訳一意照会) — queries a single withdrawal detail |
| EKK0251C060 | SC Code | Service Contract Withdrawal Reopening (サービス契約回線内訳使用再開) — re-enables a withdrawal record |
| JPCBPCommon.getOpeDate | Utility | Retrieves the current operational date (運用日) from the system/business clock |
| `callSC` | Internal Method | Common service call wrapper — constructs CBS request/response, manages templates, handles exceptions |
| `execWctrlOrderToPause` | Internal Method | Dispatches viewing control orders to equipment (STB/IPTV) to unblock restored services |
| `JKKWctrlOrderSendCC.sendWctrlOrder` | External CC | Sends viewing control orders (視聴制御依存処理コード) to the viewing control system |
| CAANMsg | Class | Common asynchronous message class used for CBS request/response communication |
