# Business Logic — JKKAdchgKakuteiKikiDslCC.executeKikiDsl() [197 LOC]

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

## 1. Role

### JKKAdchgKakuteiKikiDslCC.executeKikiDsl()

This method orchestrates the **equipment cancellation processing triggered by a move (residence change / 住所変更)**. It is a central entry-point Common Component (CC) in the K-Opticom customer base system for handling service contract cancellations when a customer relocates. Specifically, it performs the following business operations:

1. **Service existence analysis** -- It reads the residence change details from the system (via `callEKK2101B001`), then fetches the service contract data for each line item (via `callEKK0081A010`). It determines whether Network (FTTH / ネット), Phone (電話), or TV (テレビ) services exist at the destination, and whether they have already been terminated (status 910) or cancelled (status 920).

2. **Line-attached equipment cancellation** -- It identifies all equipment (ONU, HGW, modem, splitter, inline filter, V-ONU, takino multi-router) attached to the service lines at the source location and initiates their cancellation processing (`dslKaisenKiki`), followed by delivery cancellation processing (`haisoCancel`).

3. **Exchange cancellation processing (v19.01.00 ADD)** -- For equipment that was reserved for exchange (but not yet executed), it creates a cancellation list (`createKokanCancelKikiList`), processes delivery cancellation, and then executes the equipment exchange cancellation (`executeKokanCancelKiki`).

4. **SOD issuance** -- It issues a Service Order Data (SOD) document summarizing all cancellations (`hakkoSODKktkDsl`), which is used for downstream billing and operational workflows.

5. **HGW transfer reservation processing (ANK-4315-00-00)** -- If the destination has an HGW (Home Gateway) as the equipment provision service, it invokes the equipment transfer reservation handler (`callkikiIdoYoyakuHanei`), which manages the logistics of transferring multi-function routers and ONU equipment.

The method uses a **routing/dispatch pattern**: it reads service contract codes (CD00130_01/02/03), then branches to the appropriate processing path based on service type (Network, Phone, TV). It acts as the **coordinator** in the larger move-completion workflow, called from screen `KKSV0325` after the user confirms the move details.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKikiDsl params"])
    START --> INIT["init param fixedText"]
    INIT --> GET_MAP["Get paramMap from param.getData fixedText"]
    GET_MAP --> MAP_CHECK{paramMap null or empty?}
    MAP_CHECK -->|Yes| RET1["Return param"]
    MAP_CHECK -->|No| GET_ADCG_NO["Get adchg_no from paramMap"]
    GET_ADCG_NO --> ADCG_CHECK{adchgNo empty?}
    ADCG_CHECK -->|Yes| RET2["Return param"]
    ADCG_CHECK -->|No| CALL_B001["callEKK2101B001 get residence change details"]
    CALL_B001 --> B001_CHECK{kk2101_b001_list null or empty?}
    B001_CHECK -->|Yes| RET3["Return param"]
    B001_CHECK -->|No| INIT_FLAGS["Initialize service flags isNetExist isTelExist isTvExist"]
    INIT_FLAGS --> GET_DSL_KIBO["Get dslKiboYmdAft cancellation desired date"]
    GET_DSL_KIBO --> LOOP_START["Loop each adchgDtlMap in kk2101_b001_list"]
    LOOP_START --> GET_SKBT["Get chafSkbtNo chbfSkbtNo from adchgDtlMap"]
    GET_SKBT --> SKBT_CHECK{chafSkbtNo empty?}
    SKBT_CHECK -->|Yes| SET_BEFORE["svcKeiNo equals chbfSkbtNo"]
    SKBT_CHECK -->|No| SET_AFTER["svcKeiNo equals chafSkbtNo"]
    SET_BEFORE --> SVCNO_CHECK{svcKeiNo empty?}
    SET_AFTER --> SVCNO_CHECK
    SVCNO_CHECK -->|Yes| SKIP["Continue loop"]
    SVCNO_CHECK -->|No| CALL_A010["callEKK0081A010 get service contract"]
    CALL_A010 --> SVC_NULL{svcKeiMap null?}
    SVC_NULL -->|Yes| SKIP
    SVC_NULL -->|No| GET_STAT["Get svcKeiStat"]
    GET_STAT --> STAT_CHECK{svcKeiStat 910 or 920 or chafSkbtNo empty?}
    STAT_CHECK -->|Yes Terminated or Cancelled| GET_SVC_CD_A["Get svcCd"]
    STAT_CHECK -->|No Active| GET_SVC_CD_B["Get svcCd"]
    GET_SVC_CD_A --> SVD_NET_A{svcCd CD00130_01 Network?}
    GET_SVC_CD_B --> SVD_NET_B{svcCd CD00130_01 Network?}
    SVD_NET_A -->|Yes| SET_NET_A["svcKeiNoNet equals svcKeiNo"]
    SVD_NET_A -->|No| SVD_TEL_A{svcCd CD00130_02 Phone?}
    SVD_TEL_A -->|Yes| SET_TEL_A["svcKeiNoTel equals svcKeiNo"]
    SVD_TEL_A -->|No| SVD_TV_A{svcCd CD00130_03 TV?}
    SVD_TV_A -->|Yes| SET_TV_A["svcKeiNoTv equals svcKeiNo"]
    SVD_TV_A -->|No| SKIP
    SET_NET_A --> SKIP
    SET_TEL_A --> SKIP
    SET_TV_A --> SKIP
    SVD_NET_B -->|Yes| SET_NET_B["svcKeiNoNet equals svcKeiNo set isNetExist"]
    SVD_NET_B -->|No| SVD_TEL_B{svcCd CD00130_02 Phone?}
    SVD_TEL_B -->|Yes| SET_TEL_B["svcKeiNoTel equals svcKeiNo set isTelExist"]
    SVD_TEL_B -->|No| SVD_TV_B{svcCd CD00130_03 TV?}
    SVD_TV_B -->|Yes| SET_TV_B["svcKeiNoTv equals svcKeiNo set isTvExist"]
    SVD_TV_B -->|No| SKIP
    SET_NET_B --> SKIP
    SET_TEL_B --> SKIP
    SET_TV_B --> SKIP
    SKIP --> LOOP_END{More items?}
    LOOP_END -->|Yes| LOOP_START
    LOOP_END -->|No| CALL_2091["callEKK2091A010 get residence change data"]
    CALL_2091 --> ADCG_NULL{adchgMap null?}
    ADCG_NULL -->|Yes| RET4["Return param"]
    ADCG_NULL -->|No| CREATE_LISTS["Create dslKktkList dslKkopList"]
    CREATE_LISTS --> GET_KISEI["Get svcKeiKaisenUcwkNo"]
    GET_KISEI --> DSL_KAISAN["dslKaisenKiki line attached equipment cancellation"]
    DSL_KAISAN --> HAISO1["haisoCancel delivery cancellation dslKktkList"]
    HAISO1 --> CREATE_KOKAN["createKokanCancelKikiList v19.01.00 add"]
    CREATE_KOKAN --> HAISO2["haisoCancel kokanCancelKktkList"]
    HAISO2 --> KOKAN_LOOP["Loop each kk0341_a010_map in kokanCancelKktkList"]
    KOKAN_LOOP --> EXEC_KOKAN["executeKokanCancelKiki"]
    EXEC_KOKAN --> KOKAN_END{More items?}
    KOKAN_END -->|Yes| KOKAN_LOOP
    KOKAN_END -->|No| SOD_ISSUE["hakkoSODKktkDsl SOD issuance"]
    SOD_ISSUE --> GET_ITNM["Get itnmSvcKeiKaisenUcwkNo"]
    GET_ITNM --> KIKI_LOOP["Loop each adchgDtlMap in kk2101_b001_list"]
    KIKI_LOOP --> KIKI_CHECK{adchgDtlSbtCd 03 and chgTgKeiNo not empty?}
    KIKI_CHECK -->|No| KIKI_MORE{More items?}
    KIKI_CHECK -->|Yes| KIKI_GET["getEKK0341A010 equipment provision service"]
    KIKI_GET --> KIKI_NULL{result null or empty?}
    KIKI_NULL -->|Yes| KIKI_MORE
    KIKI_NULL -->|No| KIKI_STAT{stat 910 or 920?}
    KIKI_STAT -->|Yes| KIKI_MORE
    KIKI_STAT -->|No| KIKI_SVC_CD{kktkSvcCd KKTK_SVC_CD_HGW?}
    KIKI_SVC_CD -->|Yes| CALL_HANEI["callkikiIdoYoyakuHanei equipment transfer"]
    KIKI_SVC_CD -->|No| KIKI_MORE
    CALL_HANEI --> KIKI_MORE
    KIKI_MORE -->|Yes| KIKI_LOOP
    KIKI_MORE -->|No| FINAL["Return param"]
    RET1 --> END_NODE(["End"])
    RET2 --> END_NODE
    RET3 --> END_NODE
    RET4 --> END_NODE
    FINAL --> END_NODE
```

**Block processing flow description:**

- **Initialization (L166)**: `init(param, fixedText)` initializes the mapper (`JKKAdchgMapperCC`) and the service component request invoker (`ServiceComponentRequestInvoker`).

- **Early returns for missing data**: If `paramMap`, `adchgNo`, or the `kk2101_b001_list` are empty/null, the method returns `param` immediately without further processing. These guard clauses ensure downstream calls only proceed when valid residence change data exists.

- **Service classification loop (L201-L280)**: Iterates over all residence change detail records. For each record, it determines the correct service contract number (using the "before change" ID if the "after change" ID is empty -- indicating service cancellation/retention). It then queries the service contract and classifies by status:
  - If status is 910 (terminated) or 920 (cancelled), the service contract is marked but no existence flag is set.
  - If status is active, the service contract number is recorded AND the appropriate existence flag is set to `true`.

- **Residence change data acquisition (L284)**: `callEKK2091A010` retrieves the residence change header data including the service contract line number (`svcKeiKaisenUcwkNo`).

- **Equipment cancellation cascade (L291)**: `dslKaisenKiki` processes equipment attached to the service line, branching by equipment type (Network/Phone equipment vs. TV equipment) and service existence at the destination.

- **Delivery cancellation (L294)**: `haisoCancel` processes delivery cancellation for the cancelled equipment list.

- **Exchange cancellation (L298-L323, v19.01.00 ADD)**: `createKokanCancelKikiList` builds a list of equipment that was reserved for exchange but needs to be cancelled instead. Then `haisoCancel` processes delivery cancellation again, and finally `executeKokanCancelKiki` is called for each entry.

- **SOD issuance (L329)**: `hakkoSODKktkDsl` generates the Service Order Data document for all cancellations.

- **HGW transfer reservation (ANK-4315-00-00, L331-L365)**: If the residence change detail's sub-code is "03" (equipment provision service) and there's a target service contract number, it checks the equipment type. If the equipment is HGW, it invokes `callkikiIdoYoyakuHanei` to handle the equipment transfer reservation.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Session context handle carrying the database session, authentication, and transaction context. Required for all SC (Service Component) calls and DB operations within this method. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object wrapping the model group and control map. Contains the residence change data (`adchgNo`, `kk2101_b001_list`) under the key `fixedText`, and is populated with cancellation results, SOD data, and error messages before return. |
| 3 | `fixedText` | `String` | User-defined arbitrary string used as a key to retrieve/store data within the `param` map. Acts as a namespace separator for this method's data within the broader request context. |

**Read-only external state:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `this.mapper` | `JKKAdchgMapperCC` | Mapper component for data transformation between SC results and business objects. Used in `createKokanCancelKikiList` for SC call coordination. Initialized in `init()`. |
| `this.scCall` | `ServiceComponentRequestInvoker` | Service component invocation utility for executing remote SC methods. Initialized in `init()` with an optional log class name. |

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK2101B001` | EKK2101B001SC | KK_T_ADCG_DTL (Residence change details) | Calls `callEKK2101B001` to retrieve residence change detail records for the given `adchgNo` with detail sub-code "01" |
| R | `callEKK0081A010` | EKK0081A010SC | KK_T_SVC_KEI (Service contracts) | Calls `callEKK0081A010` to retrieve full service contract data for a given `svcKeiNo` (service contract number) |
| R | `callEKK2091A010` | EKK2091A010SC | KK_T_ADCG (Residence change header) | Calls `callEKK2091A010` to retrieve residence change header data including the service contract line number |
| C | `dslKaisenKiki` (internal) | - | - | Internal method: processes line-attached equipment cancellation -- iterates equipment via `callEKK0341B504` and dispatches cancellation handlers |
| - | `callEKK0341B504` (called from dslKaisenKiki) | EKK0341B504SC | KK_T_KKTK_SVC_KEI (Equipment provision service contracts) | Calls `callEKK0341B504` to retrieve equipment attached to a service line |
| R | `getEKK0341A010` | EKK0341A010SC | KK_T_KKTK_SVC_KEI (Equipment provision service contracts) | Calls `getEKK0341A010` to retrieve equipment provision service contract details (called from `dslKaisenKiki` and the ANK-4315-00-00 block) |
| - | `executeDslTakinoOp` (called from dslKaisenKiki) | - | - | Internal method: handles multi-router (takino) and device cancellation processing |
| - | `executeDslSvcKeiKiki` (called from dslKaisenKiki) | - | - | Internal method: processes service-type-specific equipment cancellation (network/phone/TV) |
| D | `haisoCancel` | - | - | Processes delivery cancellation for the given equipment list -- sets delivery status to cancelled |
| C | `createKokanCancelKikiList` | - | - | (v19.01.00 ADD) Creates a list of equipment that was reserved for exchange but now needs exchange cancellation processing |
| - | `scCall.run` (called from createKokanCancelKikiList) | EKK0341B032SC | KK_T_KKTK_SVC_KEI (Equipment provision service contracts) | Executes SC call `EKK0341B032` with conditions to get equipment provision service contract data |
| D | `executeKokanCancelKiki` | - | - | (v19.01.00 ADD) Executes the exchange cancellation for a single piece of equipment |
| C | `hakkoSODKktkDsl` | - | - | Issues SOD (Service Order Data) for all cancellation equipment records -- generates SOD document for billing/ops |
| - | `callkikiIdoYoyakuHanei` (ANK-4315-00-00) | - | - | (ANK-4315-00-00) Invokes the equipment transfer reservation handler for HGW (Home Gateway) equipment -- manages multi-function router and ONU transfer |
| - | `getAdchgDtlList` (called from createKokanCancelKikiList) | - | - | Helper: retrieves residence change detail list from param using mapper |
| - | `mapper.setEKK0341B032` | - | - | Mapper: prepares EKK0341B032 SC call parameters |
| - | `mapper.getEKK0341B032` | - | - | Mapper: extracts EKK0341B032 SC results |
| - | `mapper.scResultCheck` | - | - | Mapper: validates SC call results and checks for errors |

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0325 | `KKSV0325OPOperation.target15.invoke` -> `JKKAdchgKakuteiKikiDslCC.executeKikiDsl` | `callEKK2101B001 [R] KK_T_ADCG_DTL, callEKK0081A010 [R] KK_T_SVC_KEI, callEKK2091A010 [R] KK_T_ADCG, dslKaisenKiki [C] KK_T_KKTK_SVC_KEI, hakkoSODKktkDsl [C] SOD, callkikiIdoYoyakuHanei [C] HGW transfer` |

**Notes:**
- `KKSV0325` is the residence change determination screen. The CCRequestBroker `target15` is configured to invoke `executeKikiDsl` with delegate `KKSV032513CC`.
- `KKSV0325OPOperation` is the BPM operation class that orchestrates the overall residence change processing workflow. `executeKikiDsl` is called after prior processing steps (e.g., address validation, service contract determination) complete successfully.

## 6. Per-Branch Detail Blocks

**Block 1** — [INIT] (L166)

> Initialization of mapper and SC call invoker.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `init(param, fixedText)` |

**Block 1.1** — [nested init] (L73-L93)

> The `init` method lazily initializes the mapper and service component request invoker.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (null == this.mapper)` [L76] |
| 2 | SET | `this.mapper = new JKKAdchgMapperCC()` [L78] |
| 3 | IF | `if (null == this.scCall)` [L84] |
| 4 | SET | `this.scCall = new ServiceComponentRequestInvoker()` [L86] |

**Block 2** — [EARLY RETURN: paramMap] (L169-L172)

> Retrieves the parameter map for the given `fixedText`. If the map is null or empty, the method returns immediately.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = (HashMap) param.getData(fixedText)` [L169] |
| 2 | IF | `if (paramMap == null || paramMap.isEmpty())` [L170] [-> EARLY RETURN] |
| 3 | RETURN | `return param` [L171] |

**Block 3** — [EARLY RETURN: adchgNo] (L175-L179)

> Extracts the residence change number (`adchg_no`). If missing, the method returns early -- no residence change to process.

| # | Type | Code |
|---|------|------|
| 1 | SET | `adchgNo = (String) paramMap.get("adchg_no")` [L175] |
| 2 | IF | `if (StringUtils.isEmpty(adchgNo))` [L176] [-> EARLY RETURN] |
| 3 | RETURN | `return param` [L177] |

**Block 4** — [EARLY RETURN: kk2101_b001_list] (L180-L185)

> Calls `callEKK2101B001` to retrieve residence change detail list. If no detail records exist, returns early.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk2101_b001_list = callEKK2101B001(handle, param, fixedText, adchgNo, "01")` [L180] |
| 2 | IF | `if (kk2101_b001_list == null || kk2101_b001_list.size() == 0)` [L181] [-> EARLY RETURN] |
| 3 | RETURN | `return param` [L182] |

**Block 5** — [FLAG INITIALIZATION] (L186-L200)

> Initializes service existence flags and the cancellation desired date.

| # | Type | Code |
|---|------|------|
| 1 | SET | `isNetExist = false` [L186] |
| 2 | SET | `svcKeiNoNet = null` [L187] |
| 3 | SET | `isTelExist = false` [L188] |
| 4 | SET | `svcKeiNoTel = null` [L189] |
| 5 | SET | `isTvExist = false` [L190] |
| 6 | SET | `svcKeiNoTv = null` [L191] |
| 7 | SET | `dslKiboYmdAft = (String) paramMap.get(JKKAdchgConstCC.PARAM_KEY_TPPV_TKKJ_DSL_KIBO_YMD)` [L196] [-> ANK-4315-00-00 ADD] |

**Block 6** — [SERVICE CLASSIFICATION LOOP] (L201-L280)

> Iterates over all residence change detail records. For each record, determines the correct service contract number, fetches the service contract, and classifies by service code (Network/Phone/TV) and status (active/terminated/cancelled).

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (HashMap adchgDtlMap : kk2101_b001_list)` [L201] |
| 2 | SET | `chafSkbtNo = (String) adchgDtlMap.get(EKK2101B001CBSMsg1List.CHAF_SKBT_NO)` [L207] |
| 3 | SET | `chbfSkbtNo = (String) adchgDtlMap.get(EKK2101B001CBSMsg1List.CHBF_SKBT_NO)` [L208] |
| 4 | IF | `if (StringUtils.isEmpty(chafSkbtNo))` [L213] [-> Use "before change" ID] |
| 5 | SET | `svcKeiNo = chbfSkbtNo` [L214] |
| 6 | ELSE | `svcKeiNo = chafSkbtNo` [L218] |
| 7 | IF | `if (StringUtils.isEmpty(svcKeiNo))` [L220] [-> continue] |
| 8 | CALL | `svcKeiMap = callEKK0081A010(handle, param, fixedText, svcKeiNo)` [L225] |
| 9 | IF | `if (svcKeiMap == null)` [L228] [-> continue] |
| 10 | SET | `svcKeiStat = (String) svcKeiMap.get(EKK0081A010CBSMsg1List.SVC_KEI_STAT)` [L233] |

**Block 6.1** — [TERMINATED/CANCELLED PATH] `(svcKeiStat == 910 or 920 or chafSkbtNo empty)` [L233-L239]

> When the service contract is already terminated, cancelled, or this is a cancellation/retention case (after-change ID is empty), record the service number without setting existence flags.

| # | Type | Code |
|---|------|------|
| 1 | IF | `if (JKKSvcConst.SVC_KEI_STAT_910.equals(svcKeiStat) \|\| JKKSvcConst.SVC_KEI_STAT_920.equals(svcKeiStat) \|\| StringUtils.isEmpty(chafSkbtNo))` [L233-L238] [-> SVC_KEI_STAT_910 = "terminated", SVC_KEI_STAT_920 = "cancelled"] |
| 2 | SET | `svcCd = (String) svcKeiMap.get(EKK0081A010CBSMsg1List.SVC_CD)` [L241] |
| 3 | IF | `if (JKKStrConst.CD00130_01.equals(svcCd))` [L243] [-> CD00130_01 = Network service] |
| 4 | SET | `svcKeiNoNet = svcKeiNo` [L244] |
| 5 | ELSE IF | `if (JKKStrConst.CD00130_02.equals(svcCd))` [L248] [-> CD00130_02 = Phone service] |
| 6 | SET | `svcKeiNoTel = svcKeiNo` [L249] |
| 7 | ELSE IF | `if (JKKStrConst.CD00130_03.equals(svcCd))` [L253] [-> CD00130_03 = TV service] |
| 8 | SET | `svcKeiNoTv = svcKeiNo` [L254] |

**Block 6.2** — [ACTIVE SERVICE PATH] `(svcKeiStat != 910, 920, and chafSkbtNo not empty)` [L258-L277]

> When the service contract is active, record the service number AND set the existence flag for the corresponding service type.

| # | Type | Code |
|---|------|------|
| 1 | ELSE | [L257] |
| 2 | SET | `svcCd = (String) svcKeiMap.get(EKK0081A010CBSMsg1List.SVC_CD)` [L259] |
| 3 | IF | `if (JKKStrConst.CD00130_01.equals(svcCd))` [L261] [-> CD00130_01 = Network] |
| 4 | SET | `svcKeiNoNet = svcKeiNo` [L262] |
| 5 | SET | `isNetExist = true` [L263] |
| 6 | ELSE IF | `if (JKKStrConst.CD00130_02.equals(svcCd))` [L266] [-> CD00130_02 = Phone] |
| 7 | SET | `svcKeiNoTel = svcKeiNo` [L267] |
| 8 | SET | `isTelExist = true` [L268] |
| 9 | ELSE IF | `if (JKKStrConst.CD00130_03.equals(svcCd))` [L271] [-> CD00130_03 = TV] |
| 10 | SET | `svcKeiNoTv = svcKeiNo` [L272] |
| 11 | SET | `isTvExist = true` [L273] |

**Block 7** — [RESIDENCE CHANGE DATA ACQUISITION] (L284-L289)

> Calls `callEKK2091A010` to retrieve the residence change header data. If retrieval fails, returns early.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `adchgMap = callEKK2091A010(handle, param, fixedText, adchgNo)` [L284] |
| 2 | IF | `if (adchgMap == null)` [L287] [-> EARLY RETURN] |
| 3 | RETURN | `return param` [L288] |

**Block 8** — [EQUIPMENT CANCELLATION PREPARATION] (L291-L293)

> Creates empty lists for cancellation equipment and calls `dslKaisenKiki` to process line-attached equipment cancellation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `dslKktkList = new ArrayList<HashMap<String, Object>>()` [L291] |
| 2 | SET | `dslKkopList = new ArrayList<HashMap<String, Object>>()` [L292] |
| 3 | SET | `svcKeiKaisenUcwkNo = (String) adchgMap.get(EKK2091A010CBSMsg1List.ITENS_SVKEI_KISUW_NO)` [L293] |
| 4 | CALL | `dslKaisenKiki(handle, param, fixedText, svcKeiKaisenUcwkNo, isNetExist, isTelExist, isTvExist, svcKeiNoNet, svcKeiNoTel, svcKeiNoTv, dslKktkList, dslKkopList)` [L294] |

**Block 8.1** — [DSL KAI SAN KIKI details]

> Internal method `dslKaisenKiki` (L366-L470) processes equipment attached to service lines. For each piece of equipment:
> - Gets the equipment provision service contract via `callEKK0341B504`
> - Checks if the equipment is already terminated/cancelled (status 910/920) -- if so, skips
> - If the equipment is Network/Phone type (`isNetTelKktkSvcCd`):
>   - If it's a multi-router (takino, C024) or HGW (`KKTK_SVC_CD_HGW`): calls `executeDslTakinoOp`
>   - Otherwise, if neither Network nor Phone exist at destination: calls `executeDslSvcKeiKiki`, then re-fetches the equipment status and adds to `dslKktkList`
> - If the equipment is TV type (`isTvKktkSvcCd`):
>   - If TV doesn't exist at destination: calls `executeDslSvcKeiKiki`, then re-fetches and adds to `dslKktkList`

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk0341_b504_list = callEKK0341B504(handle, param, fixedText, svcKeiKaisenUcwkNo)` |
| 2 | FOR | `for kk0341B504Map in kk0341_b504_list` |
| 3 | CALL | `kikiMap = getEKK0341A010(handle, param, fixedText, kktkSvcKeiNo)` |
| 4 | IF | `if (JKKSvcConst.SVC_KEI_STAT_910.equals(kktkSvcKeiStat) || JKKSvcConst.SVC_KEI_STAT_920.equals(kktkSvcKeiStat))` [-> skip] |
| 5 | IF | `if (isNetTelKktkSvcCd(kktkSvcCd))` |
| 6 | IF | `if (KKTK_SVC_CD_TAKINO.equals(kktkSvcCd) || JKKStrConst.KKTK_SVC_CD_HGW.equals(kktkSvcCd))` [-> v72.00.00 MODIFY] |
| 7 | CALL | `executeDslTakinoOp(...)` |
| 8 | ELSE IF | `if (!isNetExist && !isTelExist)` |
| 9 | CALL | `executeDslSvcKeiKiki(handle, param, fixedText, kikiMap, mskmDtlNoNetTel)` |
| 10 | IF | `isTvKktkSvcCd(kktkSvcCd)` |
| 11 | IF | `if (!isTvExist)` |
| 12 | CALL | `executeDslSvcKeiKiki(handle, param, fixedText, kikiMap, mskmDtlNoTv)` |

**Block 9** — [DELIVERY CANCELLATION] (L297)

> Processes delivery cancellation for the equipment cancellation list.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `haisoCancel(handle, param, dslKktkList)` [L297] |

**Block 10** — [EXCHANGE CANCELLATION -- v19.01.00 ADD] (L298-L326)

> This block was added in v19.01.00 (OM-2015-0000962). It handles equipment that was reserved for exchange but now needs exchange cancellation processing.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kokanCancelKktkList = new ArrayList<HashMap<String, Object>>()` [L300] |
| 2 | CALL | `createKokanCancelKikiList(handle, param, fixedText, adchgNo, isNetExist, isTelExist, isTvExist, svcKeiNoNet, svcKeiNoTel, svcKeiNoTv, kokanCancelKktkList)` [L303] |
| 3 | CALL | `haisoCancel(handle, param, kokanCancelKktkList)` [L306] |
| 4 | FOR | `for (HashMap kk0341_a010_map : kokanCancelKktkList)` [L308] |
| 5 | CALL | `executeKokanCancelKiki(handle, param, fixedText, kk0341_a010_map)` [L311] |

**Block 10.1** — [createKokanCancelKikiList internals]

> Retrieves residence change detail list, checks for exchange records (where before-change and after-change IDs differ and are both non-empty). For each exchange-recorded equipment, queries the equipment provision service contract via SC call `EKK0341B032`, checks if the equipment status is "110" (in exchange), and if the corresponding service doesn't exist at the destination, adds it to the cancellation list.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `kk2101_b001_list = getAdchgDtlList(param, fixedText, handle, adchgNo, JKKAdchgConstCC.CD01241_KKTK_SVC_KEI_NO)` |
| 2 | FOR | `for kk2101_b001_map in kk2101_b001_list` |
| 3 | SET | `kktkSvcKeiNo = (String) kk2101_b001_map.get(EKK2101B001CBSMsg1List.CHG_TG_KEI_NO)` |
| 4 | IF | `if (chbfSkbtNo not empty && chafSkbtNo not empty && chbfSkbtNo != chafSkbtNo)` [exchange record detected] |
| 5 | SET | `condMap.put(JKKAdchgMapperCC.COND_KEY_KKTK_SVC_KEI_NO, kktkSvcKeiNo)` |
| 6 | SET | `condMap.put(JKKAdchgMapperCC.COND_KEY_OPEDATE, JKKAdchgConstCC.DEFAULT_RSV_APLY_YMD)` |
| 7 | CALL | `reqMap = mapper.setEKK0341B032(param, fixedText, condMap)` |
| 8 | CALL | `resMap = scCall.run(reqMap, handle)` |
| 9 | CALL | `kk0341_b032_map_af = mapper.getEKK0341B032(param, fixedText, resMap)` |
| 10 | CALL | `mapper.scResultCheck(param)` |
| 11 | IF | `if ("110".equals(kktkSvcKeiStat))` [exchange in progress] |
| 12 | IF | `if (isNetTelKktkSvcCd(kktkSvcCd) && !isNetExist && !isTelExist)` or `if (isTvKktkSvcCd(kktkSvcCd) && !isTvExist)` [-> add to kokanCancelKktkList] |

**Block 11** — [SOD ISSUANCE] (L329)

> Issues the Service Order Data (SOD) document summarizing all cancellation equipment records.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `hakkoSODKktkDsl(handle, param, fixedText, dslKktkList, dslKkopList)` [L329] |

**Block 12** — [HGW TRANSFER RESERVATION -- ANK-4315-00-00 ADD] (L331-L365)

> This block was added in v61.00.00 (ANK-4315-00-00) for the eo home gateway introduction project. It handles the case where the destination location has an HGW (Home Gateway) as the equipment provision service.

| # | Type | Code |
|---|------|------|
| 1 | SET | `itnmSvcKeiKaisenUcwkNo = (String) adchgMap.get(EKK2091A010CBSMsg1List.ITNM_SVKEI_KISUW_NO)` [L331] |
| 2 | FOR | `for (HashMap adchgDtlMap : kk2101_b001_list)` [L333] |
| 3 | SET | `chafSkbtNo = (String) adchgDtlMap.get(EKK2101B001CBSMsg1List.CHAF_SKBT_NO)` [L337] |
| 4 | SET | `chbfSkbtNo = (String) adchgDtlMap.get(EKK2101B001CBSMsg1List.CHBF_SKBT_NO)` [L338] |
| 5 | SET | `adchgDtlSbtCd = (String) adchgDtlMap.get(EKK2101B001CBSMsg1List.ADCHG_DTL_SBT_CD)` [L339] |
| 6 | SET | `chgTgKeiNo = (String) adchgDtlMap.get(EKK2101B001CBSMsg1List.CHG_TG_KEI_NO)` [L340] |
| 7 | IF | `if ("03".equals(adchgDtlSbtCd) && !JKKStringUtil.isNullBlank(chgTgKeiNo))` [L342] [-> Equipment provision service sub-code 03] |
| 8 | CALL | `kikiMap = getEKK0341A010(handle, param, fixedText, chgTgKeiNo)` [L346] |
| 9 | IF | `if (kikiMap == null || kikiMap.isEmpty())` [L347] [-> continue] |
| 10 | SET | `kktkSvcKeiStat = (String) kikiMap.get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_STAT)` [L353] |
| 11 | IF | `if (JKKSvcConst.SVC_KEI_STAT_910.equals(kktkSvcKeiStat) || JKKSvcConst.SVC_KEI_STAT_920.equals(kktkSvcKeiStat))` [L354] [-> skip: already terminated/cancelled] |
| 12 | SET | `kktkSvcCd = (String) kikiMap.get(EKK0341A010CBSMsg1List.KKTK_SVC_CD)` [L359] |
| 13 | IF | `if (JKKStrConst.KKTK_SVC_CD_HGW.equals(kktkSvcCd))` [L361] [-> HGW equipment detected] |
| 14 | CALL | `callkikiIdoYoyakuHanei(handle, param, fixedText, itnmSvcKeiKaisenUcwkNo, kaisenKikiList, kk2101_b001_list, dslKiboYmdAft)` [L363] [-> Transfer multi-router and ONU equipment] |

**Block 13** — [RETURN] (L368)

> Returns the populated request parameter object.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return param` [L368] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `adchg_no` | Field | Residence change number -- the unique identifier for a residence change (move) record in the system |
| `adchgDtlSbtCd` | Field | Residence change detail sub-code -- classifies the type of residence change detail. Value "03" means equipment provision service |
| `chafSkbtNo` | Field | After-change service contract number -- the new service contract number after a move/transfer. Used when the service contract is being changed rather than cancelled |
| `chbfSkbtNo` | Field | Before-change service contract number -- the original service contract number before the move. Used as the primary identifier when the after-change ID is not yet set (service cancellation/retention case) |
| `chgTgKeiNo` | Field | Change target service number -- the service contract number that is the target of a change (e.g., equipment transfer) |
| `dslKiboYmdAft` | Field | Cancellation desired date (after) -- user-specified date for equipment cancellation. Added in ANK-4315-00-00 for home gateway integration |
| `svcKeiNo` | Field | Service contract number -- unique identifier for a service contract line |
| `svcKeiNoNet` | Field | Network service contract number at destination -- stores the service contract number for Network (FTTH) service at the destination |
| `svcKeiNoTel` | Field | Phone service contract number at destination -- stores the service contract number for Phone service at the destination |
| `svcKeiNoTv` | Field | TV service contract number at destination -- stores the service contract number for TV service at the destination |
| `svcKeiStat` | Field | Service contract status -- numeric code representing the state of a service contract. 910 = terminated, 920 = cancelled |
| `svcKeiKaisenUcwkNo` | Field | Service contract line internal number -- internal tracking number for the service contract line used to look up attached equipment |
| `itnmSvcKeiKaisenUcwkNo` | Field | Item service contract line internal number -- internal number for the equipment item service contract line |
| `dslKktkList` | List | Cancellation equipment list -- contains maps of equipment records that need to be cancelled |
| `dslKkopList` | List | Cancellation equipment option list -- contains maps of equipment option/service records for cancellation |
| `kokanCancelKktkList` | List | Exchange cancellation equipment list (v19.01.00) -- contains maps of equipment records reserved for exchange but now needing cancellation |
| `kk2101_b001_list` | List | Residence change detail list -- list of residence change detail records returned by `callEKK2101B001` |
| CD00130_01 | Constant | Network service code -- identifies the service as Network (FTTH / フレッツ) |
| CD00130_02 | Constant | Phone service code -- identifies the service as Phone (電話) |
| CD00130_03 | Constant | TV service code -- identifies the service as TV (テレビ) |
| SVC_KEI_STAT_910 | Constant | Service contract status 910 -- terminated (解約済). Used to skip already-terminated services |
| SVC_KEI_STAT_920 | Constant | Service contract status 920 -- cancelled (キャンセル済). Used to skip already-cancelled services |
| KKTK_SVC_CD_HGW | Constant | Equipment provision service code for HGW (Home Gateway) -- identifies Home Gateway equipment type |
| KKTK_SVC_CD_TAKINO | Constant | Equipment provision service code for multi-router (takino) -- identifies the "takino" multi-router equipment (C024) |
| KKTK_SVC_CD_MODEM | Constant | Equipment provision service code for modem (C005) |
| KKTK_SVC_CD_ONU | Constant | Equipment provision service code for ONU (C012) |
| KKTK_SVC_CD_V_ONU | Constant | Equipment provision service code for V-ONU (C013) |
| CD00132_ONU | Constant | ONU service code -- identifies ONU as line-attached equipment |
| SOD | Acronym | Service Order Data -- a document generated for operational and billing workflows, summarizing service changes |
| HGW | Acronym | Home Gateway -- residential gateway equipment combining router, modem, and Wi-Fi access point functions |
| ONU | Acronym | Optical Network Unit -- fiber-optic termination equipment used in FTTH networks |
| FTTH | Business term | Fiber To The Home -- fiber-optic broadband internet service provided by K-Opticom (フレッツ) |
| 住所変更 (juusho henkou) | Japanese term | Residence change / move -- the business process of moving a customer's service from one address to another |
| 機器解約 (kiki kaisai) | Japanese term | Equipment cancellation -- the process of cancelling equipment (ONU, modem, router, etc.) attached to service lines |
| 配送取消 (haiso torikeshi) | Japanese term | Delivery cancellation -- cancelling scheduled equipment delivery, typically when equipment is no longer needed at the original address |
| 交換取消 (koukan torikeshi) | Japanese term | Exchange cancellation -- cancelling equipment that was reserved for exchange (replacement) at the destination |
| 機器提供サービス (kiki teikyou saabisu) | Japanese term | Equipment provision service -- the service of providing rental equipment (ONU, modem, router, etc.) to customers |
| 回線 (kaisen) | Japanese term | Line -- the telecom connection line to which equipment is attached |
| サービス契約 (saabisu keiyaku) | Japanese term | Service contract -- the contractual agreement for a telecom service (Network, Phone, or TV) |
| eoホームゲートウェイ | Japanese term | eo Home Gateway -- NTT West's residential gateway service, integrated in ANK-4315-00-00 |
| `mskmDtlNoNet` | Field | Mask detail number for Network -- used in `dslKaisenKiki` to determine which delivery cancellation to invoke |
| `mskmDtlNoTel` | Field | Mask detail number for Phone -- used in `dslKaisenKiki` |
| `mskmDtlNoTv` | Field | Mask detail number for TV -- used in `dslKaisenKiki` |
| `mskmDtlNoNetTel` | Field | Combined mask detail number (Network or Phone) -- fallback for `dslKaisenKiki` when both Network and Phone may be involved |
| EKK2101B001 | SC Code | Residence change detail inquiry SC -- retrieves residence change detail records |
| EKK0081A010 | SC Code | Service contract inquiry SC -- retrieves full service contract data |
| EKK2091A010 | SC Code | Residence change header inquiry SC -- retrieves residence change header data |
| EKK0341B504 | SC Code | Equipment inquiry by service line SC -- retrieves equipment attached to a service line |
| EKK0341A010 | SC Code | Equipment provision service contract inquiry SC -- retrieves equipment provision service contract details |
| EKK0341B032 | SC Code | Equipment provision service reservation inquiry SC -- queries equipment reservation/exchange status |
| K-Opticom | Business term | Japanese broadband ISP operated by NTT West, providing FTTH, phone, and TV services |