# Business Logic — JKKAdchgKakuteiKikiDslCC.executeDslTakinoOp() [118 LOC]

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

## 1. Role

### JKKAdchgKakuteiKikiDslCC.executeDslTakinoOp()

This method performs the **cancellation processing for multi-function router (multifunction router) device options** (多機能ルータの機器オプションの解約処理) in a telecom order fulfillment system. It is a composite business operation that orchestrates the complete decommissioning flow for a customer's bundled internet and voice (VA = Voice/Telephone) services that are tied to a multi-function router product.

The method handles two service types: **Router options** (service code `G01`, representing the multi-function router itself) and **VA (Voice/Telephone) options** (service code `G02`, representing voice services delivered via the router). It applies a conditional dispatch pattern: if the network (net) side is being cancelled (`isNetExist == false`), it processes the router option cancellation; if the telephone (tel) side is being cancelled (`isTelExist == false`), it processes the VA option cancellation.

The method serves as a **shared utility component** called from multiple screen operation classes during account creation and modification workflows. It coordinates with three downstream service layers: (1) fetching current device option status, (2) executing per-option cancellation via `executeDslSvcKeiKikiOp`, and (3) upon confirmation that all options are cancelled, cancelling the parent router service contract itself via `executeDslSvcKeiKiki`. After the full cancellation, it captures the post-cancellation state and populates the cancellation lists (`dslKkopList` and `dslKktkList`) with confirmation records, and sets the `takinoDslFlg` flag on all option entries to `1` to indicate DSL cancellation completion.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeDslTakinoOp(params)"])
    A["Get kktkSvcKeiNo from kikiMap"] --> B["callEKK2811B010 -> kk2811_b010_list"]
    B --> C["param.getData(fixedText) -> paramMap"]
    C --> D["Extract mskmDtlNoNet, mskmDtlNoTel from paramMap"]
    D --> E["svcKeiNoForKiki = null"]
    E --> F["Loop: for each kikiOpListMap in kk2811_b010_list"]
    F --> G["Get kkopStat"]
    G --> H{kkopStat cancelled?
910=cancelled, 920=cancelled}
    H -- Yes, continue --> F2["continue -> next loop"]
    F2 --> F
    H -- No, active --> I["Get kkopSvcKeiNo from kikiOpListMap"]
    I --> J["getEKK2811A010 -> kikiOpMap"]
    J --> K{kikiOpMap null or empty?}
    K -- Yes --> F
    K -- No --> L["Get kkopSvcCd from kikiOpMap"]
    L --> M{kkopSvcCd == G01?
Router option}
    M -- Yes --> N{!isNetExist?}
    N -- No --> P["Next option"]
    P --> F
    N -- Yes --> Q["executeDslSvcKeiKikiOp
with mskmDtlNoNet or MSKM_DTL_NO"]
    Q --> R["getEKK2811A010 -> kikiOpMapResult"]
    R --> S{kikiOpMapResult valid?}
    S -- Yes --> T["Put svcKeiNoNet, add to dslKkopList"]
    S -- No --> U["svcKeiNoForKiki = svcKeiNoNet"]
    T --> U
    U --> P
    M -- No --> V{kkopSvcCd == G02?
VA option}
    V -- Yes --> W{!isTelExist?}
    W -- No --> P2["Next option"]
    P2 --> F
    W -- Yes --> X["executeDslSvcKeiKikiOp
with mskmDtlNoTel or MSKM_DTL_NO"]
    X --> Y["getEKK2811A010 -> kikiOpMapResult"]
    Y --> Z{result valid?}
    Z -- Yes --> AA["Put svcKeiNoTel, add to dslKkopList"]
    Z -- No --> AB{"svcKeiNoForKiki empty?"}
    AA --> AB
    AB -- Yes --> AC["svcKeiNoForKiki = svcKeiNoTel"]
    AB -- No --> P3["Next option"]
    AC --> P3
    P3 --> F
    V -- No --> P4["Next option"]
    P4 --> F
    F --> AA2["Loop ended"]
    AA2 --> AD["checkKkopDsl -> all cancelled?"]
    AD -- Yes --> AE["mskmDtlNoNetTel = mskmDtlNoNet or mskmDtlNoTel"]
    AE --> AF["executeDslSvcKeiKiki -> cancel router"]
    AF --> AG["getEKK0341A010 -> kikiMapResult"]
    AG --> AH{result valid?}
    AH -- Yes --> AI["Put svcKeiNoForKiki, add to dslKktkList"]
    AH -- No --> AJ["Set takinoDslFlg=1 on all dslKkopList"]
    AI --> AJ
    AJ --> END(["Return / Next"])
    END
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle for executing service component calls and data retrieval operations |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object carrying screen input data; used to extract master detail numbers (`mskmDtlNoNet`, `mskmDtlNoTel`) via `getData(fixedText)` |
| 3 | `fixedText` | `String` | Fixed text key used to look up data within the param object and identify specific service sections in downstream calls |
| 4 | `kikiMap` | `HashMap<String, Object>` | Device (equipment) information map containing the master detail number (`MSKM_DTL_NO`) and the multi-function router service contract number (`KKTK_SVC_KEI_NO`) for the primary service |
| 5 | `isNetExist` | `boolean` | Flag indicating whether the network (internet) service still exists. When `false`, the router option cancellation is triggered |
| 6 | `isTelExist` | `boolean` | Flag indicating whether the telephone (voice) service still exists. When `false`, the VA (Voice/Telephone) option cancellation is triggered |
| 7 | `svcKeiNoNet` | `String` | Service contract number for the network (internet) side of the multi-function product; used as the fallback service number for return registration when router is cancelled |
| 8 | `svcKeiNoTel` | `String` | Service contract number for the telephone (voice) side of the multi-function product; used as the fallback service number for return registration when VA is cancelled |
| 9 | `dslKktkList` | `ArrayList<HashMap<String, Object>>` | DSL cancellation list for the primary multi-function router service (kktk). Post-cancellation confirmation records are appended here |
| 10 | `dslKkopList` | `ArrayList<HashMap<String, Object>>` | DSL cancellation list for device options (kkop). Post-cancellation confirmation records for each option (router, VA) are appended here |

**External state / instance fields:** None — this method is self-contained with no instance field reads.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `callEKK2811B010` | EKK2811B010 | Device option service contracts | Fetches list of device option (kkop) service records associated with the multi-function router's service contract number |
| R | `getEKK2811A010` (called twice per loop iteration) | EKK2811A010 | Device option service detail | Fetches detailed info for a specific device option service (kkop) by service contract number — first to get service code, then after cancellation to confirm |
| R | `getEKK0341A010` | EKK0341A010 | Equipment (device) main table | Fetches post-cancellation status of the primary multi-function router service (kktk) for confirmation in the return registration list |
| C | `executeDslSvcKeiKikiOp` (called twice per active option) | DSL SVC KEIKEN | Device option service contract lines | Performs cancellation / cancellation processing for a single device option (router or VA), writing the cancellation record |
| C | `executeDslSvcKeiKiki` | DSL SVC KEIKEN | Equipment service contract | Cancels the parent multi-function router service itself after all device options are confirmed cancelled |
| R | `checkKkopDsl` | DSL CHECK | Device option status | Verifies whether ALL device options tied to the multi-function router have been cancelled (status 910/920) |

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 0 methods.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | (No direct callers found) | — | `getEKK0341A010 [R] Equipment (kktk)`, `executeDslSvcKeiKiki [-] DSL SVC KEIKEN`, `checkKkopDsl [-] Device option status`, `getEKK2811A010 [R] Device option detail (kkop)`, `executeDslSvcKeiKikiOp [-] Device option service line`, `callEKK2811B010 [-] Device option service list` |

**Terminal operations from this method:** `getEKK0341A010` [R], `executeDslSvcKeiKiki` [-], `checkKkopDsl` [-], `getEKK2811A010` [R] (×2 per iteration), `executeDslSvcKeiKikiOp` [-] (×2 per active option), `callEKK2811B010` [-]

## 6. Per-Branch Detail Blocks

### Block 1 — INIT (L727)

> Retrieves the multi-function router's service contract number and fetches the list of all device options tied to it.

| # | Type | Code |
|---|------|------|
| 1 | GET | `kktkSvcKeiNo = (String)kikiMap.get(EKK0341A010CBSMsg1List.KKTK_SVC_KEI_NO)` // Get the multi-function router service contract number from the equipment map |
| 2 | CALL | `kk2811_b010_list = this.callEKK2811B010(handle, param, fixedText, kktkSvcKeiNo)` // Fetch all device option records for the router |
| 3 | SET | `paramMap = (HashMap<String, Object>)param.getData(fixedText)` // Fetch screen input parameter map [-> fixedText used as key] |
| 4 | GET | `mskmDtlNoNet = (String)paramMap.get("mskmDtlNoNet")` // Master detail number for the net side |
| 5 | GET | `mskmDtlNoTel = (String)paramMap.get("mskmDtlNoTel")` // Master detail number for the tel side |
| 6 | SET | `svcKeiNoForKiki = null` // Initialize return registration service number holder |

### Block 2 — FOR LOOP: Process Each Device Option (L743)

> Iterates over all device options (kkop) associated with the multi-function router. For each option that is NOT already cancelled, it dispatches cancellation processing based on the option type (Router vs VA).

| # | Type | Code |
|---|------|------|
| 1 | LOOP | `for (HashMap<String, Object> kikiOpListMap : kk2811_b010_list)` // Iterate through each device option record |

#### Block 2.1 — IF: Skip Already Cancelled Options (L747)

> If the device option's service contract status is already 910 (cancelled) or 920 (canceled), skip this option and continue to the next one.

| # | Type | Code |
|---|------|------|
| 1 | GET | `kkopStat = (String)kikiOpListMap.get(EKK2811B010CBSMsg1List.KKOP_SVC_KEI_STAT)` // Get the service contract status of this device option |
| 2 | IF | `JKKSvcConst.SVC_KEI_STAT_910.equals(kkopStat) || JKKSvcConst.SVC_KEI_STAT_920.equals(kkopStat)` [-> `SVC_KEI_STAT_910="910"` (JKKSvcConst.java:364) — Contract status: 910 (Cancelled); [-> `SVC_KEI_STAT_920="920"` (JKKSvcConst.java:367) — Contract status: 920 (Canceled)] |
| 3 | EXEC | `continue` // Skip this option — already cancelled, proceed to next loop iteration |

#### Block 2.2 — IF: Skip Null/Empty Option Map (L755–758)

> Fetches the detailed device option record. If the fetch returns null or empty, skip this option.

| # | Type | Code |
|---|------|------|
| 1 | GET | `kkopSvcKeiNo = (String)kikiOpListMap.get(EKK2811B010CBSMsg1List.KKOP_SVC_KEI_NO)` // Get the service contract number of this device option |
| 2 | CALL | `kikiOpMap = getEKK2811A010(handle, param, fixedText, kkopSvcKeiNo)` // Fetch detailed device option info from the agreement confirmation system |
| 3 | IF | `kikiOpMap == null || kikiOpMap.isEmpty()` // If no data found, skip |
| 4 | EXEC | `continue` // Skip to next option |

#### Block 2.3 — IF: Router Option (KKOP_RUTER = "G01") (L763–784)

> If the device option is a router option (service code "G01"), and the network side is being cancelled (`!isNetExist`), execute the router option cancellation and record the result.

| # | Type | Code |
|---|------|------|
| 1 | GET | `kkopSvcCd = (String)kikiOpMap.get(EKK2811A010CBSMsg1List.KKOP_SVC_CD)` // Get the service code for this device option |
| 2 | IF | `KKOP_RUTER.equals(kkopSvcCd)` [-> `KKOP_RUTER="G01"` (JKKAdchgKakuteiKikiDslCC.java:102) — Router option service code] |

##### Block 2.3.1 — IF: Network Not Existing (L765)

> When the network side does NOT exist (is being cancelled), perform the router option cancellation processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isNetExist` // Network side is being cancelled |
| 2 | CALL | `this.executeDslSvcKeiKikiOp(handle, param, fixedText, kikiOpMap, StringUtils.isEmpty(mskmDtlNoNet) ? (String)kikiMap.get(EKK0341A010CBSMsg1List.MSKM_DTL_NO) : mskmDtlNoNet)` // Execute option cancellation. Uses mskmDtlNoNet if present; falls back to MSKM_DTL_NO from kikiMap [v19.00.00 modification — added fallback logic] |
| 3 | CALL | `kikiOpMapResult = getEKK2811A010(handle, param, fixedText, kkopSvcKeiNo)` // Re-fetch device option details to get post-cancellation status |
| 4 | IF | `kikiOpMapResult != null && !kikiOpMapResult.isEmpty()` // Post-cancellation record exists |
| 5 | SET | `kikiOpMapResult.put("svcKeiNo", svcKeiNoNet)` // Set the network service contract number for return registration |
| 6 | EXEC | `dslKkopList.add(kikiOpMapResult)` // Add the cancelled option record to the DSL option cancellation list |
| 7 | IF | `!StringUtils.isEmpty(svcKeiNoNet)` // Network service number is available |
| 8 | SET | `svcKeiNoForKiki = svcKeiNoNet` // Set as the primary return registration service number (network priority) |

#### Block 2.4 — IF: VA Option (KKOP_VA = "G02") (L786–810)

> If the device option is a VA (Voice/Telephone) option (service code "G02"), and the telephone side is being cancelled (`!isTelExist`), execute the VA option cancellation and record the result.

| # | Type | Code |
|---|------|------|
| 1 | IF | `KKOP_VA.equals(kkopSvcCd)` [-> `KKOP_VA="G02"` (JKKAdchgKakuteiKikiDslCC.java:105) — VA (Voice/Telephone) option service code] |

##### Block 2.4.1 — IF: Telephone Not Existing (L788)

> When the telephone side does NOT exist (is being cancelled), perform the VA option cancellation processing.

| # | Type | Code |
|---|------|------|
| 1 | IF | `!isTelExist` // Telephone side is being cancelled |
| 2 | CALL | `this.executeDslSvcKeiKikiOp(handle, param, fixedText, kikiOpMap, StringUtils.isEmpty(mskmDtlNoTel) ? (String)kikiMap.get(EKK0341A010CBSMsg1List.MSKM_DTL_NO) : mskmDtlNoTel)` // Execute option cancellation. Uses mskmDtlNoTel if present; falls back to MSKM_DTL_NO from kikiMap [v19.00.00 modification — added fallback logic] |
| 3 | CALL | `kikiOpMapResult = getEKK2811A010(handle, param, fixedText, kkopSvcKeiNo)` // Re-fetch device option details to get post-cancellation status |
| 4 | IF | `kikiOpMapResult != null && !kikiOpMapResult.isEmpty()` // Post-cancellation record exists |
| 5 | SET | `kikiOpMapResult.put("svcKeiNo", svcKeiNoTel)` // Set the telephone service contract number for return registration |
| 6 | EXEC | `dslKkopList.add(kikiOpMapResult)` // Add the cancelled option record to the DSL option cancellation list |
| 7 | IF | `!StringUtils.isEmpty(svcKeiNoTel) && StringUtils.isEmpty(svcKeiNoForKiki)` // Telephone service number available AND no network number set yet |
| 8 | SET | `svcKeiNoForKiki = svcKeiNoTel` // Set as the return registration service number — lower priority than network, only set if network number not already assigned (network priority logic) |

### Block 3 — IF: All Options Cancelled — Cancel Router (L813)

> After processing all device options, check if ALL options are now cancelled. If so, cancel the parent multi-function router service contract, capture the post-cancellation state, and flag all option records as cancelled.

| # | Type | Code |
|---|------|------|
| 1 | IF | `this.checkKkopDsl(handle, param, fixedText, kktkSvcKeiNo)` // Check if all device options for this router are in cancelled state (910 or 920) |

#### Block 3.1 — Determine Detail Number for Router Cancellation (L815–819)

> Selects the master detail number to pass to the router cancellation: prefers the net-side detail number; falls back to the tel-side detail number.

| # | Type | Code |
|---|------|------|
| 1 | SET | `mskmDtlNoNetTel = ""` // Initialize the merged detail number variable |
| 2 | IF | `!StringUtils.isEmpty(mskmDtlNoNet)` // Net-side detail number is available |
| 3 | SET | `mskmDtlNoNetTel = mskmDtlNoNet` // Use net-side detail number |
| 4 | ELSE IF | `!StringUtils.isEmpty(mskmDtlNoTel)` // Net-side empty, check tel-side |
| 5 | SET | `mskmDtlNoNetTel = mskmDtlNoTel` // Use tel-side detail number as fallback |

#### Block 3.2 — Execute Router Cancellation (L822)

> Cancels the entire multi-function router service contract now that all its device options are confirmed cancelled.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `this.executeDslSvcKeiKiki(handle, param, fixedText, kikiMap, mskmDtlNoNetTel)` // Cancel the multi-function router service contract using the merged detail number |
| 2 | CALL | `kikiMapResult = getEKK0341A010(handle, param, fixedText, kktkSvcKeiNo)` // Fetch post-cancellation equipment (kktk) status from agreement confirmation |
| 3 | IF | `kikiMapResult != null && !kikiMapResult.isEmpty()` // Post-cancellation record exists |
| 4 | SET | `kikiMapResult.put("svcKeiNo", svcKeiNoForKiki)` // Set the resolved service contract number for return registration — network preferred, else telephone |
| 5 | EXEC | `dslKktkList.add(kikiMapResult)` // Add the cancelled router record to the DSL primary service cancellation list |

#### Block 3.3 — Set Cancellation Flag on All Option Records (L828–830)

> Marks every device option record in the cancellation list with the `takinoDslFlg` flag set to `"1"`, indicating that DSL cancellation processing has been completed for these options.

| # | Type | Code |
|---|------|------|
| 1 | LOOP | `for (HashMap kkopMap : dslKkopList)` // Iterate over all cancelled device option records |
| 2 | SET | `kkopMap.put("takinoDslFlg", "1")` // Set cancellation completion flag to indicate DSL cancellation is complete |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `kkopSvcKeiNo` | Field | Device option service contract number — unique identifier for a specific device option (router or VA) line item within a multi-function product |
| `kkopStat` / `KKOP_SVC_KEI_STAT` | Field | Device option service contract status — indicates the lifecycle state of the device option (active, cancelled, etc.) |
| `kkopSvcCd` / `KKOP_SVC_CD` | Field | Device option service code — classifies the type of device option: `G01` = Router, `G02` = VA (Voice/Telephone) |
| `kktkSvcKeiNo` / `KKTK_SVC_KEI_NO` | Field | Multi-function router (equipment) service contract number — the parent service contract under which device options are bundled |
| `mskmDtlNoNet` / `mskmDtlNoTel` | Field | Master detail number for the net side / tel side — internal tracking identifier linking screen input to the service contract detail lines |
| `svcKeiNoForKiki` | Field | Return registration service number — the service contract number to be associated with the cancellation confirmation record for re-registration. Network number takes priority over telephone number |
| `dslKktkList` | Field | DSL equipment (kktk) cancellation list — list of cancelled multi-function router parent service records for return |
| `dslKkopList` | Field | DSL device option (kkop) cancellation list — list of cancelled individual device option records for return |
| `takinoDslFlg` | Field | Cancellation DSL flag — set to `"1"` to mark that DSL cancellation processing has been completed for a device option |
| `SVC_KEI_STAT_910` | Constant | Contract status 910 — Cancelled (解約済). The service contract has been formally cancelled |
| `SVC_KEI_STAT_920` | Constant | Contract status 920 — Canceled (キャンセル済). The service contract has been cancelled due to cancellation (e.g., by customer request or system cancellation) |
| `KKOP_RUTER` | Constant | `"G01"` — Router option service code. Identifies a multi-function router device option |
| `KKOP_VA` | Constant | `"G02"` — VA (Voice/Telephone) option service code. Identifies a voice service delivered via the multi-function router |
| `KKTK_SVC_KEI_NO` | Field | Equipment (router) service contract number — the top-level service contract number for the multi-function router equipment |
| `MSKM_DTL_NO` | Field | Master service detail number — the master detail number from the equipment information map, used as a fallback when per-side detail numbers are not available |
| SC (Service Component) | Acronym | Service Component — the modular service layer in the enterprise architecture that encapsulates specific business operations |
| CBS (Common Business Service) | Acronym | Common Business Service — a shared service layer providing cross-cutting business functionality |
| DSL | Business term | Digital Subscriber Line — broadband internet service delivered over telephone lines, in this context referring to FTTH/fiber-to-the-home service using a multi-function router |
| VA | Business term | Voice/Analogue — voice telephone service delivered via the multi-function router (not a separate physical line) |
| kiki | Abbreviation | 機器 (Equipment) — refers to the physical networking equipment, in this context the multi-function router |
| kktk | Abbreviation | 機器提供契約 (Equipment Provision Contract) — the service contract for providing the equipment (multi-function router) |
| kkop | Abbreviation | 機器オプション (Equipment Option) — a device option tied to the equipment provision contract (e.g., router or VA add-on) |
| takino | Abbreviation | 解約 (Cancellation) — cancellation processing for service contracts |
| kikiMap | Field | Equipment map — HashMap containing the equipment (multi-function router) information including service contract numbers and detail numbers |
| EKK0341A010 | SC | Equipment main table inquiry SC — retrieves equipment (kktk) service contract information |
| EKK2811A010 | SC | Device option detail inquiry SC — retrieves device option (kkop) service contract details |
| EKK2811B010 | SC | Device option list inquiry SC — retrieves a list of device option service records for a given parent service |
| Net (Network) | Business term | The internet/broadband connection side of a multi-function router product |
| Tel (Telephone) | Business term | The voice/telephone connection side of a multi-function router product |