# Business Logic — JKKSvkeiShosaClCC.editMapShosaClCmn() [225 LOC]

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

## 1. Role

### JKKSvkeiShosaClCC.editMapShosaClCmn()

This method performs **service contract cancellation mapping** (`照査取消時のサービス共通のマッピング処理` — common service mapping processing at the time of verification cancellation) in the K-Opticom customer base system. It is the central dispatcher for preparing cancellation request payloads across four distinct service categories: Option Service Contract (Support), Equipment Provision Service, Application Details, and Installment Contract. 

The method reads pre-fetched confirmation/list query results from the `rsltShokai` HashMap (populated by the caller with contract approval data) and iterates through each contract type. For each contract item, it invokes mapper components to build cancellation input messages (`editInMsgEKK*`), then calls `editInMsgCmn` to finalize the mapping. The result is a structured HashMap containing all cancellation-ready payload maps keyed by their respective MAP_KEY constants.

The method handles conditional logic specific to Equipment Provision Service (EKK0341): for multi-function router (`C024`) and HGW (`C025`) service codes, it cross-references the service type (`svcSbtCd`) — only processing if the service is eo Light Net (HNET, code 1) or eo Light Phone (HTEL, code 3). For these special services, it also searches the Equipment Operation Service contract via EKK2811B010 to determine whether the device is linked and in what state (active 010, under contract change 020 with change-in-progress flag, or post-cancellation states 910/920). If the device lookup returns no results (no linked device) or the device is in a cancellable state, the cancellation flag is set. After processing, if the Equipment Provision Service was cancelled, the method delegates to `editMapShosaKkop` to concurrently cancel the associated Equipment Operation Service contract.

This is a shared common component (CC) utility — the design pattern is **routing/dispatch with delegation**. It is called from `runSvkeiShosaCl()`, which itself is invoked by the KKSV0004 screen for service contract cancellation operations.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editMapShosaClCmn"])
    INIT["Initialize: rsltShosaMap, arrays"]
    GET1["Get workEKK0021A010Array from rsltShokai"]
    GET2["Get workEKK0391A010Array from rsltShokai"]
    GET3["Get workEKK0341A010Array from rsltShokai"]
    GET4["Get workEKK2541A010Array from rsltShokai"]

    OPT_SECTION["Process: Option Service Contract EKK0391 Cancellation"]
    CHECK_OPT_NULL{"workEKK0391A010Array == null?"}
    OPT_EMPTY["Set wkMapArray empty"]
    OPT_PUT["Put wkMapArray to rsltShosaMap"]

    KKT_SECTION["Process: Equipment Provision Service EKK0341 Cancellation"]
    CHECK_KKT_NULL{"workEKK0341A010Array == null?"}
    KKT_EMPTY["Set wkMapArray empty"]
    KKT_LOOP["Loop each EKK0341 item"]
    GET_KKT_WORK["Get templates via getWorkData"]
    KKT_CHILD_LOOP["Loop each template"]
    GET_SVC_CD["Get kktkSvcCd from childTemplate"]
    GET_SVC_STAT["Get kktkSvcKeiStat from childTemplate"]

    SVC_C024{"kktkSvcCd == C024 or C025?"}
    SVC_ELSE["Non-special service"]
    OPTIN_SKIP{"svcSbtCd != HNET && != HTEL?"}

    KKT_NETWORK{"svcSbtCd == HNET?"}
    SET_G02["Set kkopSvcCd = G02 VA router"]
    SET_G01["Set kkopSvcCd = G01 Router"]

    CALL_EKK2811["Call shokaiMapper.editInMsgEKK2811B010"]
    CALL_EDIT_MN["Call editInMsgCmn"]
    CALL_SC2811["Run SC via ServiceComponentRequestInvoker"]
    GET_OUT2811["Get outMsgEKK2811B010List"]

    EMPTY_OUT{"outMsgEKK2811B010List length == 0?"}
    SET_TRUE["Set shosaClFlg = true"]
    LOOP_2811["Loop each EKK2811B010 output"]

    GET_KKOP_STAT["Get kkopSvcKeiStat from output"]
    GET_CHGECHU["Get kikiRntaiKeiChgechuFlg from output"]

    CHECK_KKOP_STAT{"kkopSvcKeiStat == 010 OR 910 OR 920 OR 020 with chgFlag 1?"}
    SET_TRUE_2["Set shosaClFlg = true"]

    CHECK_FLG{"shosaClFlg == true?"}
    CHECK_KKT_STAT{"kktkSvcKeiStat == 020 OR 030?"}
    CALL_EKK0341["Call shosaClMapper.editInMsgEKK0341C460"]
    CALL_EDIT_MN2["Call editInMsgCmn"]
    ADD_TO_MAP["Add result to wkMapArray"]
    SET_SHOSA["Set isKktkSvcShosaCl = true"]

    PUT_KKT["Put wkMapArray to rsltShosaMap"]

    CALL_KKOP_SECTION["Call editMapShosaKkop"]

    DET_SECTION["Process: Application Details EKK0021 Cancellation"]
    CHECK_DET_NULL{"workEKK0021A010Array == null?"}
    DET_EMPTY["Set wkMapArray empty"]
    DET_LOOP["Loop each EKK0021 item"]
    CALL_EKK0021["Call shosaClMapper.editInMsgEKK0021C110"]
    CALL_EDIT_MN3["Call editInMsgCmn"]
    PUT_DET["Put wkMapArray to rsltShosaMap"]

    INSTALL_SECTION["Process: Installment Contract EKK2541 Cancellation"]
    CHECK_INS_NULL{"workEKK2541A010Array == null?"}
    INS_EMPTY["Set wkMapArray empty"]
    INS_LOOP["Loop each EKK2541 item"]
    CALL_EKK2541["Call shosaClMapper.editInMsgEKK2541C040"]
    CALL_EDIT_MN4["Call editInMsgCmn"]
    PUT_INS["Put wkMapArray to rsltShosaMap"]

    RETURN["Return rsltShosaMap"]

    START --> INIT --> GET1 --> GET2 --> GET3 --> GET4 --> OPT_SECTION
    OPT_SECTION --> CHECK_OPT_NULL
    CHECK_OPT_NULL -- Yes --> OPT_EMPTY --> OPT_PUT
    CHECK_OPT_NULL -- No --> OPT_PUT

    OPT_PUT --> KKT_SECTION
    KKT_SECTION --> CHECK_KKT_NULL
    CHECK_KKT_NULL -- Yes --> KKT_EMPTY
    CHECK_KKT_NULL -- No --> KKT_LOOP
    KKT_EMPTY --> KKT_LOOP
    KKT_LOOP --> GET_KKT_WORK --> KKT_CHILD_LOOP
    KKT_CHILD_LOOP --> GET_SVC_CD --> GET_SVC_STAT --> SVC_C024
    SVC_C024 -- Yes --> SVC_ELSE
    SVC_C024 -- No --> SVC_ELSE
    SVC_ELSE --> OPTIN_SKIP
    OPTIN_SKIP -- Yes --> KKT_CHILD_LOOP
    OPTIN_SKIP -- No --> KKT_NETWORK
    KKT_NETWORK -- Yes --> SET_G02
    KKT_NETWORK -- No --> SET_G01
    SET_G02 --> CALL_EKK2811
    SET_G01 --> CALL_EKK2811
    CALL_EKK2811 --> CALL_EDIT_MN --> CALL_SC2811 --> GET_OUT2811
    GET_OUT2811 --> EMPTY_OUT
    EMPTY_OUT -- Yes --> SET_TRUE --> LOOP_2811
    EMPTY_OUT -- No --> LOOP_2811
    LOOP_2811 --> GET_KKOP_STAT --> GET_CHGECHU --> CHECK_KKOP_STAT
    CHECK_KKOP_STAT -- Yes --> SET_TRUE_2 --> LOOP_2811
    CHECK_KKOP_STAT -- No --> LOOP_2811
    SET_TRUE_2 --> LOOP_2811
    LOOP_2811 --> CHECK_FLG
    CHECK_FLG --> CHECK_KKT_STAT
    CHECK_KKT_STAT -- Yes --> CALL_EKK0341 --> CALL_EDIT_MN2 --> ADD_TO_MAP --> SET_SHOSA
    CHECK_KKT_STAT -- No --> KKT_CHILD_LOOP
    SET_SHOSA --> KKT_CHILD_LOOP
    ADD_TO_MAP --> KKT_CHILD_LOOP
    CALL_EKK0341 --> CALL_EDIT_MN2
    KKT_CHILD_LOOP -- All processed --> PUT_KKT
    PUT_KKT --> CALL_KKOP_SECTION --> DET_SECTION
    DET_SECTION --> CHECK_DET_NULL
    CHECK_DET_NULL -- Yes --> DET_EMPTY
    CHECK_DET_NULL -- No --> DET_LOOP
    DET_EMPTY --> DET_LOOP
    DET_LOOP --> CALL_EKK0021 --> CALL_EDIT_MN3 --> PUT_DET
    PUT_DET --> INSTALL_SECTION
    INSTALL_SECTION --> CHECK_INS_NULL
    CHECK_INS_NULL -- Yes --> INS_EMPTY
    CHECK_INS_NULL -- No --> INS_LOOP
    INS_EMPTY --> INS_LOOP
    INS_LOOP --> CALL_EKK2541 --> CALL_EDIT_MN4 --> PUT_INS
    PUT_INS --> RETURN

    style START fill:#90EE90
    style RETURN fill:#FFB6C1
```

**Constant Resolution:**
- `SVC_SBT_CD_HNET = 1` (eo Light Net service type code)
- `SVC_SBT_CD_HTEL = 3` (eo Light Phone service type code)
- `SVC_KEI_STAT_910 = "910"` (Service contract status: equipment change pending — from `JKKSvcConst`)
- `SVC_KEI_STAT_920 = "920"` (Service contract status: cancellation canceled — from `JKKSvcConst`)
- `MAP_KEY_EKK0021A010 = "EKK0021A010"` (Application detail approval list)
- `MAP_KEY_EKK0391A010 = "EKK0391A010"` (Option service contract <Support> approval list)
- `MAP_KEY_EKK0341A010 = "EKK0341A010"` (Equipment provision service contract approval list)
- `MAP_KEY_EKK2541A010 = "EKK2541A010"` (Installment contract approval list)

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | Request parameter object containing the model group data and control map for the cancellation operation. Carries user input data including contract details to be cancelled. |
| 2 | `fixedText` | `String` | User-arbitrary string, passed through to message builder methods for customizing cancellation request payloads. |
| 3 | `userDataIndex` | `int` | Index within `param` that identifies which business data record to process. Distinguishes between multiple contract lines in a single request. |
| 4 | `rsltShokai` | `HashMap<String, Object>` | Pre-fetched confirmation/query result data. Contains arrays of contract approval records keyed by MAP_KEY constants (EKK0021A010, EKK0391A010, EKK0341A010, EKK2541A010). Populated by the caller before this method runs. |
| 5 | `svcSbtCd` | `int` | Service type code that determines which service category is being cancelled. Value `1` = eo Light Net (HNET), `3` = eo Light Phone (HTEL). Used to filter Equipment Provision Service processing for multi-function routers and HGW devices. |
| 6 | `idoDiv` | `String` | Displacement/division flag — added for smart terminal terminal support (ANK-2054-00-00, 2014/04/16). Passed to `editMapShosaKkop` for Equipment Operation Service cancellation coordination. |
| 7 | `handle` | `SessionHandle` | Session manager handle containing session context. Used for SC (Service Component) invocations via `ServiceComponentRequestInvoker`. |

**External state / instance fields read:**
- None directly read in this method (all state is passed via parameters).

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKSvkeiShosaClCC.getWorkData` | - | - | Retrieves template arrays from contract approval data maps. Called for EKK0391A010, EKK0341A010, EKK0021A010, EKK2541A010 data arrays. |
| R | `JBSbatFUCaseFileRnkData.getString` | - | - | Called within `editInMsgCmn` chain to read string values from parameter data. |
| R | `JBSbatFUMoveNaviData.getString` | - | - | Called within `editInMsgCmn` chain to read string values from navigation data. |
| R | `JBSbatZMAdDataSet.getString` | - | - | Called within `editInMsgCmn` chain to read string values from addition data. |
| R | `JESC0101B010TPMA.getString` | - | - | Called within `editInMsgCmn` chain to read string values from service data. |
| R | `JESC0101B020TPMA.getString` | - | - | Called within `editInMsgCmn` chain to read string values from service data. |
| U | `JKKSvkeiShosaClCC.editInMsgCmn` | - | - | Core message editing method. Finalizes input message mapping for each cancellation request. Called after every mapper method. |
| U | `JKKSvkeiShosaClCC.editMapShosaKkop` | - | - | Called when Equipment Provision Service was cancelled (`isKktkSvcShosaCl == true`). Cancels associated Equipment Operation Service contracts. |
| R | `ACSV0001Flow.run` | ACSV0001 | - | Service component flow invocation within `editInMsgCmn`. |
| U | `JKKSvkeiShosaClShokaiMapperCC.editInMsgEKK2811B010` | EKK2811B010 | - | Searches Equipment Operation Service contracts. Called to find associated device operation service by service detail number and operation service code (G01/G02). |
| U | `JKKSvkeiShosaClShokaiMapperCC.editInMsgEKK0391C080` | EKK0391C080 | - | Builds cancellation input messages for Option Service Contract <Support>. Processes each contract line. |
| U | `JKKSvkeiShosaShosaClMapperCC.editInMsgEKK0341C460` | EKK0341C460 | - | Builds cancellation input messages for Equipment Provision Service. Only called when status is approved (020) or completed (030). |
| U | `JKKSvkeiShosaShosaClMapperCC.editInMsgEKK0021C110` | EKK0021C110 | - | Builds cancellation input messages for Application Details (申込明細). Processes each detail line. |
| U | `JKKSvkeiShosaShosaClMapperCC.editInMsgEKK2541C040` | EKK2541C040 | - | Builds cancellation input messages for Installment Contract (割賦契約). Processes each installment line. |
| U | `CNSV0036OPOperation.run` | CNSV0036 | - | Service component operation within `editInMsgCmn` chain. |
| U | `CNSV0037Flow.run` | CNSV0037 | - | Service component flow within `editInMsgCmn` chain. |
| U | `CNSV0037OPOperation.run` | CNSV0037 | - | Service component operation within `editInMsgCmn` chain. |
| U | `CNSV0038Flow.run` | CNSV0038 | - | Service component flow within `editInMsgCmn` chain. |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS:JKKSvkeiShosaClCC | `runSvkeiShosaCl()` → `editMapShosaClCmn(param, fixedText, i, rsltShokai, svcSbtCd, idoDiv, handle)` | `editInMsgCmn [U]`, `editInMsgEKK2541C040 [U]`, `editInMsgEKK0341C460 [U]`, `editInMsgEKK0391C080 [U]`, `editInMsgEKK0021C110 [U]`, `editMapShosaKkop [U]`, `editInMsgEKK2811B010 [U]`, `getWorkData [R]`, `getString [R]` |

**Instructions:**
- Direct caller: `JKKSvkeiShosaClCC.runSvkeiShosaCl()` (line ~1014), which is a CBS (Business Service component) within the same class.
- The `runSvkeiShosaCl` method is the entry point invoked by the KKSV0004 screen for service contract cancellation processing.
- Terminal operations: `editInMsgCmn` [U] (update — finalizes cancellation messages), `editInMsgEKK0341C460` [U] (update — equipment provision cancellation), `editInMsgEKK0021C110` [U] (update — application details cancellation), `editInMsgEKK0391C080` [U] (update — option service cancellation), `editInMsgEKK2541C040` [U] (update — installment contract cancellation), `editMapShosaKkop` [U] (update — equipment operation service cancellation), `editInMsgEKK2811B010` [U] (update — equipment operation service search), `getWorkData` [R] (read — retrieves template data), `getString` [R] (read — reads string fields from parameter objects).

## 6. Per-Branch Detail Blocks

### Block 1 — INITIALIZATION (L4620)

> Initialize the processing state: create result map, null arrays for all four contract types, and message list.

| # | Type | Code |
|---|------|------|
| 1 | SET | `scCall = new ServiceComponentRequestInvoker()` [L4620] |
| 2 | SET | `rsltShosaMap = new HashMap()` [L4622] |
| 3 | SET | `rslt = null` [L4623] |
| 4 | SET | `workEKK0021A010Array = null` (Application detail approval — 申込明細照会) [L4624] |
| 5 | SET | `workEKK0391A010Array = null` (Option service contract <Support> approval — オプションサービス契約<サポート>照会) [L4625] |
| 6 | SET | `workEKK0341A010Array = null` (Equipment provision service contract approval — 機器提供サービス契約照会) [L4626] |
| 7 | SET | `workEKK2541A010Array = null` (Installment contract approval — 割賦契約照会) [L4627-4628] |
| 8 | SET | `wkCaanMsgList = null` [L4630] |
| 9 | SET | `wkMapArray = null` [L4631] |

### Block 2 — GET CONTRACT ARRAYS FROM rsltShokai (L4633-4638)

> Retrieve pre-fetched contract approval arrays from the rsltShokai HashMap.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `workEKK0021A010Array = (ArrayList)rsltShokai.get(MAP_KEY_EKK0021A010)` [L4633] [MAP_KEY_EKK0021A010 = "EKK0021A010"] |
| 2 | EXEC | `workEKK0391A010Array = (ArrayList)rsltShokai.get(MAP_KEY_EKK0391A010)` [L4634] [MAP_KEY_EKK0391A010 = "EKK0391A010"] |
| 3 | EXEC | `workEKK0341A010Array = (ArrayList)rsltShokai.get(MAP_KEY_EKK0341A010)` [L4635] [MAP_KEY_EKK0341A010 = "EKK0341A010"] |
| 4 | EXEC | `workEKK2541A010Array = (ArrayList)rsltShokai.get(MAP_KEY_EKK2541A010)` [L4636-4638] [MAP_KEY_EKK2541A010 = "EKK2541A010"] |

### Block 3 — PROCESS OPTION SERVICE CONTRACT CANCELLATION (EKK0391) (L4640-4654)

> **Process: Option Service Contract <Support> Cancellation** (オプションサービス契約<サポート>照査取消)
> Iterates through each option service contract and builds cancellation input messages.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wkMapArray = new ArrayList()` [L4641] |
| 2 | IF | `workEKK0391A010Array != null` [L4642] |
| 2.1 | FOR | `i = 0; i < workEKK0391A010Array.size()` — loop each contract item [L4643] |
| 2.2 | CALL | `wkTenplates = getWorkData(EKK0391A010CBSMsg.EKK0391A010CBSMSG1LIST, (Map)workEKK0391A010Array.get(i))` [L4645] |
| 2.3 | FOR | `j = 0; j < wkTenplates.length` — loop each template [L4646] |
| 2.4 | SET | `childTemplate = wkTenplates[j]` [L4647] |
| 2.5 | CALL | `wkCaanMsgList = shosaClMapper.editInMsgEKK0391C080(param, fixedText, userDataIndex, childTemplate)` [L4648] |
| 2.6 | SET | `rslt = editInMsgCmn(param, wkCaanMsgList.get(0))` [L4649] |
| 2.7 | EXEC | `wkMapArray.add(rslt)` [L4650] |
| 3 | SET | `rsltShosaMap.put(MAP_KEY_EKK0391C080, wkMapArray)` [L4653] [MAP_KEY_EKK0391C080 = "EKK0391C080"] |

### Block 4 — PROCESS EQUIPMENT PROVISION SERVICE CANCELLATION (EKK0341) (L4656-4782)

> **Process: Equipment Provision Service Cancellation** (機器提供サービス照査取消)
> This is the most complex block — handles special service codes (C024/C025), cross-references Equipment Operation Service, and may cascade-cancel Equipment Operation Service contracts.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wkMapArray = new ArrayList()` [L4657] |
| 2 | IF | `workEKK0341A010Array != null` [L4658] |
| 2.1 | FOR | `i = 0; i < workEKK0341A010Array.size()` — loop each equipment provision contract item [L4659] |
| 2.2 | CALL | `wkTenplates = getWorkData(EKK0341A010CBSMsg.EKK0341A010CBSMSG1LIST, (Map)workEKK0341A010Array.get(i))` [L4661] |
| 2.3 | FOR | `j = 0; j < wkTenplates.length` — loop each template [L4662] |
| 2.4 | SET | `childTemplate = wkTenplates[j]` [L4663] |
| 2.5 | SET | `isKktkSvcShosaCl = false` (Equipment provision service cancellation flag — 機器提供サービス照査取消を実行する場合true) [L4665-4666] |
| 2.6 | SET | `kktkSvcCd = childTemplate.getString(EKK0341A010CBSMsg1List.KKTK_SVC_CD)` (Equipment provision service code — 機器提供サービスコード) [L4669] |
| 2.7 | SET | `kktkSvcKeiStat = childTemplate.getString(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_STAT)` (Equipment provision service contract status — 機器提供サービス契約ステータス) [L4671] |
| 2.8 | IF | `[C024="C024", C025="C025"] kktkSvcCd == "C024" || "C025"` — Multi-function router or HGW case (多機能ルーター,HGWの場合) [L4673-4675] |

#### Block 4.8.1 — MULTI-FUNCTION ROUTER / HGW PATH (C024/C025) (L4676-4777)

> For multi-function routers (C024) and HGW (C025), check if the service type is eo Light Net (HNET=1) or eo Light Phone (HTEL=3). If not, skip with `continue`.

| # | Type | Code |
|---|------|------|
| 1 | IF | `svcSbtCd != SVC_SBT_CD_HNET (1) && svcSbtCd != SVC_SBT_CD_HTEL (3)` — Net/phone service filter [L4677] [OM-2016-0000423] |
| 1.1 | EXEC | `continue` — skip to next iteration [L4679] |
| 1.2 | ELSE | `else` — process continues [L4680-4681] |
| 2 | SET | `shosaClFlg = false` (Cancellation flag — 照査取消フラグ) [L4686] |
| 3 | SET | `kktkSvcKeiNo = childTemplate.getString(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO)` (Equipment provision service detail number — 機器提供サービス契約番号) [L4687] |
| 4 | SET | `kkopSvcCd = ""` [L4688] |
| 5 | IF | `svcSbtCd == SVC_SBT_CD_HNET (1)` [L4690] |
| 5.1 | SET | `kkopSvcCd = "G02"` — VA router operation (VAの機器オプションを検索) [L4692] |
| 6 | ELSE-IF | `svcSbtCd == SVC_SBT_CD_HTEL (3)` [L4694] |
| 6.1 | SET | `kkopSvcCd = "G01"` — Router operation (ルーターの機器オプションを検索) [L4696] |
| 7 | CALL | `eKK2811B010CaanMsgList = shokaiMapper.editInMsgEKK2811B010(param, kktkSvcKeiNo, kkopSvcCd)` — Equipment operation service search (機器オプションサービス検索) [L5000] |
| 8 | SET | `inMsgEKK2811B010Map = editInMsgCmn(param, eKK2811B010CaanMsgList.get(0))` [L5001] |
| 9 | SET | `rsltEKK2811B010 = scCall.run(inMsgEKK2811B010Map, handle)` — Run SC invocation [L5002] |
| 10 | SET | `outMsgEKK2811B010List = getWorkData(EKK2811B010CBSMsg.EKK2811B010CBSMSG1LIST, rsltEKK2811B010)` [L5003] |

##### Block 4.8.2 — NO LINKED DEVICE CASE (L5005-5006)

> If no linked device found (連帯機器がない場合), set cancellation flag directly.

| # | Type | Code |
|---|------|------|
| 1 | IF | `outMsgEKK2811B010List.length == 0` — No linked device [L5005] |
| 1.1 | SET | `shosaClFlg = true` [L5006] |

##### Block 4.8.3 — LOOP EQUIPMENT OPERATION SERVICE OUTPUTS (L5007-5069)

> Loop through each device operation service output to check cancellation eligibility.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `k = 0; k < outMsgEKK2811B010List.length` — loop each output [L5007] |
| 1.1 | SET | `childTemplateEKK2811B010 = outMsgEKK2811B010List[k]` [L5009] |
| 1.2 | SET | `kkopSvcKeiStat = childTemplateEKK2811B010.getString(EKK2811A010CBSMsg1List.KKOP_SVC_KEI_STAT)` (Equipment operation service contract status — 機器オプションサービス契約ステータス) [L5012] |
| 1.3 | SET | `kikiRntaiKeiChgechuFlg = childTemplateEKK2811B010.getString(EKK2811A010CBSMsg1List.KIKI_RNTAI_KEI_CHGECHU_FLG)` (Device linked contract change-in-progress flag — 機器連帯契約変更中フラグ) [L5014] |
| 1.4 | IF | `[010="010", 910="910", 920="920"] kkopSvcKeiStat == "010" OR SVC_KEI_STAT_910="910" OR SVC_KEI_STAT_920="920" OR (kkopSvcKeiStat == "020" AND kikiRntaiKeiChgechuFlg == "1")` [L5017-5024] — Cancel if status is active (010), change pending (910), cancellation canceled (920), or under contract change (020 with flag 1) |
| 1.4.1 | SET | `shosaClFlg = true` [L5025] |

##### Block 4.8.4 — CHECK CANCELLATION FLAG AND APPLY CANCELLATION (L5028-5059)

> After determining `shosaClFlg`, check if the contract status is approved (020) or completed (030), and if so, execute cancellation.

| # | Type | Code |
|---|------|------|
| 1 | IF | `shosaClFlg == true` (Cancellation flag set — 連帯機器がない or cancellable status) [L5028] |
| 1.1 | IF | `kktkSvcKeiStat == "020" (approved) OR "030" (completed)` — 照査済、締結済の場合、照査取消対象とする [L5030] |
| 1.1.1 | CALL | `wkCaanMsgList = shosaClMapper.editInMsgEKK0341C460(param, fixedText, userDataIndex, childTemplate)` — Build Equipment Provision Service cancellation input (機器提供サービス契約照査取消) [L5031] |
| 1.1.2 | SET | `rslt = editInMsgCmn(param, wkCaanMsgList.get(0))` [L5032] |
| 1.1.3 | EXEC | `wkMapArray.add(rslt)` [L5033] |
| 1.1.4 | SET | `isKktkSvcShosaCl = true` — Mark that Equipment Provision Service was cancelled [L5034-5035] |
| 1.1.5 | ELSE | `else` — status not cancellable, do nothing [L5037] |
| 2 | ELSE | `else` — Non-special service code path (else branch of C024/C025 check) [L5038] |
| 2.1 | IF | `kktkSvcKeiStat == "020" OR "030"` — Same status check for non-special services [L5039] |
| 2.1.1 | CALL | `wkCaanMsgList = shosaClMapper.editInMsgEKK0341C460(param, fixedText, userDataIndex, childTemplate)` [L5040] |
| 2.1.2 | SET | `rslt = editInMsgCmn(param, wkCaanMsgList.get(0))` [L5041] |
| 2.1.3 | EXEC | `wkMapArray.add(rslt)` [L5042] |
| 2.1.4 | SET | `isKktkSvcShosaCl = true` [L5043-5044] |

##### Block 4.8.5 — CASCADE EQUIPMENT OPERATION SERVICE CANCELLATION (L5048-5059)

> If the Equipment Provision Service was cancelled, cascade-cancel the associated Equipment Operation Service contracts.

| # | Type | Code |
|---|------|------|
| 1 | IF | `isKktkSvcShosaCl == true` — 機器提供サービス契約を照査取消した場合、機器オプションサービス契約の照査取消を行う [L5048] |
| 1.1 | CALL | `editMapShosaKkop(handle, param, fixedText, userDataIndex, rsltShosaMap, childTemplate.getString(KKTK_SVC_KEI_NO), idoDiv)` [L5049-5058] — Cascade cancel Equipment Operation Service contracts |

#### Block 4.9 — END EQUIPMENT PROVISION SERVICE PROCESSING (L5061)

| # | Type | Code |
|---|------|------|
| 1 | SET | `rsltShosaMap.put(MAP_KEY_EKK0341C460, wkMapArray)` [L5061] [MAP_KEY_EKK0341C460 = "EKK0341C460"] |

### Block 5 — PROCESS APPLICATION DETAILS CANCELLATION (EKK0021) (L5064-5077)

> **Process: Application Details Cancellation** (申込明細照査取消)
> Straightforward iteration — build cancellation messages for each application detail line.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wkMapArray = new ArrayList()` [L5065] |
| 2 | IF | `workEKK0021A010Array != null` [L5066] |
| 2.1 | FOR | `i = 0; i < workEKK0021A010Array.size()` — loop each application detail item [L5067] |
| 2.2 | CALL | `wkTenplates = getWorkData(EKK0021A010CBSMsg.EKK0021A010CBSMSG1LIST, (Map)workEKK0021A010Array.get(i))` [L5069] |
| 2.3 | FOR | `j = 0; j < wkTenplates.length` — loop each template [L5070] |
| 2.4 | SET | `childTemplate = wkTenplates[j]` [L5071] |
| 2.5 | CALL | `wkCaanMsgList = shosaClMapper.editInMsgEKK0021C110(param, fixedText, userDataIndex, childTemplate)` — Build Application Details cancellation input (申込明細照査取消) [L5072] |
| 2.6 | SET | `rslt = editInMsgCmn(param, wkCaanMsgList.get(0))` [L5073] |
| 2.7 | EXEC | `wkMapArray.add(rslt)` [L5074] |
| 3 | SET | `rsltShosaMap.put(MAP_KEY_EKK0021C110, wkMapArray)` [L5077] [MAP_KEY_EKK0021C110 = "EKK0021C110"] |

### Block 6 — PROCESS INSTALLMENT CONTRACT CANCELLATION (EKK2541) (L5080-5094)

> **Process: Installment Contract Cancellation** (割賦契約照査取消)
> Added in ANK0546-00-00 (2012-09-24). Builds cancellation messages for each installment contract line.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wkMapArray = new ArrayList()` [L5081] |
| 2 | IF | `workEKK2541A010Array != null` [L5082] |
| 2.1 | FOR | `i = 0; i < workEKK2541A010Array.size()` — loop each installment contract item [L5083] |
| 2.2 | CALL | `wkTenplates = getWorkData(EKK2541A010CBSMsg.EKK2541A010CBSMSG1LIST, (Map)workEKK2541A010Array.get(i))` [L5085] |
| 2.3 | FOR | `j = 0; j < wkTenplates.length` — loop each template [L5086] |
| 2.4 | SET | `childTemplate = wkTenplates[j]` [L5087] |
| 2.5 | CALL | `wkCaanMsgList = shosaClMapper.editInMsgEKK2541C040(param, fixedText, userDataIndex, childTemplate)` — Build Installment Contract cancellation input (割賦契約照査取消) [L5088] |
| 2.6 | SET | `rslt = editInMsgCmn(param, wkCaanMsgList.get(0))` [L5089] |
| 2.7 | EXEC | `wkMapArray.add(rslt)` [L5090] |
| 3 | SET | `rsltShosaMap.put(MAP_KEY_EKK2541C040, wkMapArray)` [L5093] [MAP_KEY_EKK2541C040 = "EKK2541C040"] |

### Block 7 — RETURN (L5096)

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return rsltShosaMap` — Returns the complete cancellation payload map [L5096] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `shosaCl` | Abbreviation | Shosa Torikeshi (照査取消) — Verification Cancellation. The core business operation: cancelling previously approved service contracts after verification. |
| `svcSbtCd` | Field | Service type code — categorizes the service being cancelled (HNET=1 Net, HTEL=3 Phone, etc.). |
| `rsltShokai` | Field | Result shokai (結果照会) — Pre-fetched confirmation/query result data containing contract approval arrays. |
| `kktkSvcCd` | Field | Equipment provision service code (機器提供サービスコード) — Identifies the type of equipment service (C024=multi-function router, C025=HGW, C005=modem, etc.). |
| `kktkSvcKeiStat` | Field | Equipment provision service contract status (機器提供サービス契約ステータス) — Contract state code (010=active, 020=approved, 030=completed, 210=suspended, etc.). |
| `kkopSvcCd` | Field | Equipment operation service code (機器オプションサービスコード) — Operation service type (G01=router, G02=VA router). |
| `kkopSvcKeiStat` | Field | Equipment operation service contract status (機器オプションサービス契約ステータス) — Status codes: 010=active, 020=under contract change, 910=change pending, 920=cancellation canceled. |
| `kikiRntaiKeiChgechuFlg` | Field | Device linked contract change-in-progress flag (機器連帯契約変更中フラグ) — "1" means a linked device contract change is currently in progress. |
| `shosaClFlg` | Field | Verification cancellation flag (照査取消フラグ) — Internal flag indicating whether the equipment provision service should be cancelled. |
| `isKktkSvcShosaCl` | Field | Equipment provision service cancellation flag (機器提供サービス照査取消フラグ) — Set to true when Equipment Provision Service is cancelled, triggering cascade cancellation of associated Equipment Operation Service contracts. |
| `idoDiv` | Field | Displacement/division flag (移動区分) — Added for smart terminal terminal support (ANK-2054-00-00). Used to coordinate cascading cancellations. |
| `MAP_KEY_EKK0021A010` | Constant | Application detail approval list key ("EKK0021A010") — Contains pre-fetched application detail contract approval data. |
| `MAP_KEY_EKK0391A010` | Constant | Option service contract <Support> approval list key ("EKK0391A010") — Contains pre-fetched option service contract approval data. |
| `MAP_KEY_EKK0341A010` | Constant | Equipment provision service contract approval list key ("EKK0341A010") — Contains pre-fetched equipment provision service contract approval data. |
| `MAP_KEY_EKK2541A010` | Constant | Installment contract approval list key ("EKK2541A010") — Contains pre-fetched installment contract approval data. |
| `MAP_KEY_EKK0391C080` | Constant | Option service contract <Support> cancellation key ("EKK0391C080") — Output map key for built cancellation payloads. |
| `MAP_KEY_EKK0341C460` | Constant | Equipment provision service contract cancellation key ("EKK0341C460") — Output map key for built cancellation payloads. |
| `MAP_KEY_EKK0021C110` | Constant | Application details cancellation key ("EKK0021C110") — Output map key for built cancellation payloads. |
| `MAP_KEY_EKK2541C040` | Constant | Installment contract cancellation key ("EKK2541C040") — Output map key for built cancellation payloads. |
| `editInMsgCmn` | Method | Core message editing common method — Finalizes input message mapping for cancellation requests. Called after every mapper method. |
| `editMapShosaKkop` | Method | Equipment operation service cancellation mapping — Cascades cancellation to equipment operation service contracts when Equipment Provision Service is cancelled. |
| `ServiceComponentRequestInvoker` | Class | SC invocation engine — Executes Service Component operations (e.g., EKK2811B010 equipment operation service search). |
| `SVC_SBT_CD_HNET` | Constant | eo Light Net service type = 1. Service category for internet services. |
| `SVC_SBT_CD_HTEL` | Constant | eo Light Phone service type = 3. Service category for telephone services. |
| `SVC_KEI_STAT_910` | Constant | Service contract status: 910 (equipment change pending) — from JKKSvcConst. |
| `SVC_KEI_STAT_920` | Constant | Service contract status: 920 (cancellation canceled) — from JKKSvcConst. |
| `SVC_KEI_STAT_SHOSA_ZUMI` | Constant | Service contract status: 020 (verification completed) — Contract has been approved/verified. |
| `SVC_KEI_STAT_CNC_ZUMI` | Constant | Service contract status: 030 (contract completed) — Contract has been finalized. |
| `SVC_KEI_STAT_SVCTK` | Constant | Service contract status: 100 (service in progress) — Active service delivery. |
| `SVC_KEI_STAT_PAUSE` | Constant | Service contract status: 210 (suspended/interrupted) — Service is temporarily halted. |
| `SVC_KEI_STAT_STP` | Constant | Service contract status: 220 (stopped) — Service has been stopped. |
| `EKK0021A010CBSMSG1LIST` | Constant | CBS message list key for application detail data retrieval. |
| `EKK0391A010CBSMSG1LIST` | Constant | CBS message list key for option service contract data retrieval. |
| `EKK0341A010CBSMSG1LIST` | Constant | CBS message list key for equipment provision service data retrieval. |
| `EKK2541A010CBSMSG1LIST` | Constant | CBS message list key for installment contract data retrieval. |
| `EKK2811B010CBSMSG1LIST` | Constant | CBS message list key for equipment operation service output retrieval. |
| `KKTK_SVC_CD` | Constant | Message field: equipment provision service code. |
| `KKTK_SVC_KEI_STAT` | Constant | Message field: equipment provision service contract status. |
| `KKTK_SVC_KEI_NO` | Constant | Message field: equipment provision service contract number/detail number. |
| `KKOP_SVC_KEI_STAT` | Constant | Message field: equipment operation service contract status. |
| `KIKI_RNTAI_KEI_CHGECHU_FLG` | Constant | Message field: device linked contract change-in-progress flag. |
| eo Light Net | Business term | K-Opticom fiber-optic broadband internet service (eoひかりネット). Service type code HNET=1. |
| eo Light Phone | Business term | K-Opticom fiber-optic telephone service (eoひかり電話). Service type code HTEL=3. |
| Multi-function router | Business term | Multi-functional router device (多機能ルーター) — Service code C024. Provides routing, WiFi, and other functions. |
| HGW | Business term | Home Gateway — Service code C025. Fujitsu's integrated residential gateway device. |
| VA router | Business term | Virtual Access router — Equipment operation service code G02. Associated with eo Light Net (HNET) service. |
| Option Service Contract <Support> | Business term | Additional service contract for support services (オプションサービス契約<サポート>). Service code EKK0391. |
| Equipment Provision Service | Business term | Service for providing hardware equipment to customers (機器提供サービス). Service code EKK0341. |
| Equipment Operation Service | Business term | Service for operating equipment features (機器オプションサービス). Service code EKK2811. |
| Application Details | Business term | Order application detail lines (申込明細). Service code EKK0021. Each line represents a detail of the order. |
| Installment Contract | Business term | Installment payment contract (割賦契約). Service code EKK2541. For deferred payment of equipment or services. |
| KKSV0004 | Screen | Service contract cancellation screen. The entry point that triggers `runSvkeiShosaCl()` which calls this method. |
| CAANMsg | Type | Message model class — carries business data fields as key-value pairs. Used throughout for parameter exchange. |

---
