# Business Logic — JKKKikiIchiranCancelCC.executeOrderSet() [95 LOC]

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

## 1. Role

### JKKKikiIchiranCancelCC.executeOrderSet()

This method is the business-order orchestration hub for the equipment provision service contract cancellation flow. Its primary responsibility is to determine whether SOD (Service Order Data) must be generated for a cancellation or deletion operation, and if so, create the necessary order work records to trigger downstream SOD transmission.

The method operates on equipment provision services (機材提供サービス) — telecommunications services where physical networking equipment (broadband routers, home gateways, multi-function routers, or optical phone devices) is leased to the subscriber. It examines the service type (`workKktkSvcCd`) and the presence of OLS (Overlay Layer Services) functionality on the leased equipment. Only when the service matches one of four supported equipment types (BBR, VA/optical phone, multi-function router/Takinorutar, or eo Home Gateway) AND the equipment has OLS enabled does this method proceed with order creation.

The method implements a **conditional dispatch pattern**: after determining that SOD generation is required (i.e., no prior SOD has been sent, indicated by a blank `stp_sod_send_ymd`), it sequentially executes four business operations: (1) assigns a unique processing number via `execEKK1081C011`, (2) registers the order cancellation condition via `execEKK1081D010`, (3) creates the order work registration for cancellation (skipped during check/confirmation processing), and (4) registers the order deletion condition followed by the order work registration for deletion. The "not check" guard (`!FUNC_CODE_2.equals(...)`) ensures these order work registrations are skipped when the method is called in a preview/confirmation mode rather than an execution mode.

This method is a shared component called by `executeDsl()` and `updKktkSvcCancel()` within the same class, meaning it serves multiple entry points in the equipment cancellation screen flows. It acts as the bridge between the equipment agreement consultation (executed via `execEZM0411A010`) and the SOD order generation pipeline (EKK1081/EKK1551 CBSs).

## 2. Processing Pattern (Detailed Business Logic)

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

    START --> GET_MSG["Get EKK0341A010 CBS msg"]
    GET_MSG --> GET_CC["Get ccMsg from param"]
    GET_CC --> GET_SVC_CD["Get workKktkSvcCd from CBS"]
    GET_SVC_CD --> GET_MODEL["Get keyTaknkikiModelCd"]
    GET_MODEL --> CHECK_MODEL{keyTaknkikiModelCd<br/>is not blank?}

    CHECK_MODEL -->|No| END_RETURN(["Return Done"])
    CHECK_MODEL -->|Yes| CHECK_SEIZO{KIKI_SEIZO_NO<br/>is not blank?}

    CHECK_SEIZO -->|No| END_RETURN
    CHECK_SEIZO -->|Yes| EXEC_EZM["execEZM0411A010 Home terminal<br/>agreement consultation"]
    EXEC_EZM --> GET_OLS["Get olsKinoUm from EZM result"]
    GET_OLS --> GET_SOD_YMD["Get stp_sod_send_ymd from ccMsg"]
    GET_SOD_YMD --> CHECK_SVC{svcCd is BBR C014<br/>or OVA C004<br/>or TAKINO_RUTAR C024<br/>or HGW C025?}

    CHECK_SVC -->|No| END_RETURN
    CHECK_SVC -->|Yes| CHECK_OLS{olsKinoUm is 1?}

    CHECK_OLS -->|No| END_RETURN
    CHECK_OLS -->|Yes| CHECK_SOD_YMD2{stp_sod_send_ymd<br/>is blank?}

    CHECK_SOD_YMD2 -->|No| END_RETURN
    CHECK_SOD_YMD2 -->|Yes| STEP1["Get unique number execEKK1081C011"]
    STEP1 --> STEP2["Register release condition<br/>execEKK1081D010"]
    STEP2 --> CHECK_FUNC{func_code is 2?}

    CHECK_FUNC -->|No| STEP3["Create order work Release<br/>execEKK1551D010"]
    CHECK_FUNC -->|Yes| STEP4["Register delete condition<br/>execEKK1081D010"]
    STEP3 --> CHECK_FUNC2{func_code is 2?}

    CHECK_FUNC2 -->|No| STEP5["Create order work Delete<br/>execEKK1551D010"]
    CHECK_FUNC2 -->|Yes| STEP6["Set stp_sod_send_ymd_ret"]
    STEP4 --> STEP6
    STEP5 --> STEP6
    STEP6 --> END_RETURN
```

**Processing Flow Summary:**

1. **Data retrieval** — The method extracts the equipment provision service agreement consultation result (`CAANMsg`) from `temporaryData` using key `EKK0341A010_ODR`, and retrieves the parameter linkage map (`ccMsg`) from the request parameter.

2. **Pre-condition gates** — Two sequential null/blank checks act as early-exit guards: first on `keyTaknkikiModelCd` (key equipment model code), then on `KIKI_SEIZO_NO` (equipment serial number). If either is blank, the method returns immediately — no order processing is needed for equipment without a model or serial number.

3. **Home terminal agreement consultation** — `execEZM0411A010` is called to perform the home terminal equipment agreement consultation, which determines whether the leased equipment supports OLS (Overlay Layer Services) functionality.

4. **Service type & OLS eligibility** — The method checks if the service code matches one of four supported equipment types (BBR=C014, VA/optical phone=C004, multi-function router=C024, eo Home Gateway=C025) AND the equipment has OLS enabled (OLS_KINO_UM_ARI="1").

5. **SOD generation trigger** — If `stp_sod_send_ymd` (stop SOD send date) is blank, it means no SOD has been transmitted yet, so order creation is triggered:
   - Assign unique processing number (`execEKK1081C011`)
   - Register cancellation condition (`execEKK1081D010` with ODR_KAIYAKU_SOD_1="1")
   - Create order work for cancellation (if not in check mode)
   - Register deletion condition (`execEKK1081D010` with ODR_SHOKYO_SOD_2="2")
   - Create order work for deletion (if not in check mode)
   - Store the operation date as `stp_sod_send_ymd_ret`

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database/transaction session handle providing the connection context for all CBS (Common Business Service) calls executed within this method. Represents the active database session for the current request. |
| 2 | `scCall` | `ServiceComponentRequestInvoker` | Service component invocation proxy used to route requests to downstream CBS and SC (Service Component) endpoints. Acts as the transport mechanism for calling `execEKK1081C011`, `execEKK1081D010`, `execEKK1551D010`, and `execEZM0411A010`. |
| 3 | `param` | `IRequestParameterReadWrite` | Request parameter container that holds both incoming screen data and inter-layer linkage information. Used to retrieve the `ccMsg` HashMap via `getData(dataMapKey)` and serves as the communication channel between the calling screen and this business component. |
| 4 | `dataMapKey` | `String` | Key used to identify and retrieve the parameter linkage data map from `param`. This key identifies which section of the parameter container holds the order cancellation context (including `stp_sod_send_ymd` and `func_code`). |
| 5 | `temporaryData` | `HashMap<String, Object>` | Session-scoped temporary data store that carries intermediate results between processing steps. Contains the `EKK0341A010_ODR` CBS message (equipment provision service agreement result) at entry, and receives results from `execEKK1081C011` and `execEKK1081D010` at exit. |

**Instance fields / external state referenced:**

| Field / Constant | Type | Business Description |
|-----------------|------|---------------------|
| `TEMPLATE_ID_EKK0341A010_ODR` | `String` (const) | Value `"EKK0341A010_ODR"` — key for retrieving the equipment provision service agreement consultation CBS result from `temporaryData`. |
| `getNullToStr(...)` | Method | Utility method that converts null values to empty strings, preventing NullPointerException on String operations. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `execEZM0411A010` | EZM0411A010CBS | EKK0341 (Equipment Provision Service Agreement) | Home terminal equipment agreement consultation — queries subscriber's home terminal equipment details and OLS (Overlay Layer Services) capability. Returns `CAANMsg` containing `ols_kino_um` (OLS function presence flag). |
| C | `execEKK1081C011` | EKK1081C011CBS | KKT_SVC (Equipment Service Contract) | Assigns a unique processing number for the order cancellation workflow. The result is stored in `temporaryData` under key `EKK1081C011` for downstream use by other order processing steps. |
| C | `execEKK1081D010` (1st) | EKK1081D010CBS | KKT_ODR_HAKKO_JOKEN (Order Release Condition) | Registers the order cancellation (release) condition record with SOD type code `"1"` (ODR_KAIYAKU_SOD_1). This marks the service contract for cancellation in the order release table. |
| C | `execEKK1551D010` (1st) | EKK1551D010CBS | KKT_ODR_SVC (Order Service Contract), KK_T_ODR_HAKKO_JOKEN | Creates the order information work registration for cancellation. Generates order work records that will be used to produce SOD (Service Order Data) for cancellation transmission. Skipped during check/confirmation mode. |
| C | `execEKK1081D010` (2nd) | EKK1081D010CBS | KKT_ODR_HAKKO_JOKEN (Order Deletion Condition) | Registers the order deletion condition record with SOD type code `"2"` (ODR_SHOKYO_SOD_2). This marks the service contract for deletion in the order release table, following the cancellation registration. |
| C | `execEKK1551D010` (2nd) | EKK1551D010CBS | KKT_ODR_SVC (Order Service Contract), KK_T_ODR_HAKKO_JOKEN | Creates the order information work registration for deletion. Generates order work records for deletion SOD transmission. Skipped during check/confirmation mode. |

**CRUD Classification Rationale:**
- **C (Create)**: All CBS methods in this flow create new records. `EKK1081C011` creates processing number assignments, `EKK1081D010` creates order condition entries (release and deletion), and `EKK1551D010` creates order work registration records. The naming pattern (`callEKKxxxxSC`, `execEKKxxxxCBS`) and the business context (order cancellation workflow) confirm these are all create operations.
- The SC Codes are derived from the CBS method names themselves: `EKK1081C011CBS`, `EKK1081D010CBS`, `EKK1551D010CBS`, `EZM0411A010CBS`.
- Entity/table names are inferred from the business domain: KKT (equipment equipment/sv kei) tables for service contracts, EKK0341 for equipment provision agreements, and OD HAKKO JOKEN (order release conditions) for order condition records.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | JKKKikiIchiranCancelCC (internal) | `JKKKikiIchiranCancelCC.executeDsl` -> `JKKKikiIchiranCancelCC.executeOrderSet` | `execEKK1551D010 [C] KKT_ODR_SVC`, `execEKK1081D010 [C] KKT_ODR_HAKKO_JOKEN`, `execEKK1081C011 [C] KKT_SVC`, `execEZM0411A010 [C] EKK0341` |
| 2 | JKKKikiIchiranCancelCC (internal) | `JKKKikiIchiranCancelCC.updKktkSvcCancel` -> `JKKKikiIchiranCancelCC.executeOrderSet` | `execEKK1551D010 [C] KKT_ODR_SVC`, `execEKK1081D010 [C] KKT_ODR_HAKKO_JOKEN`, `execEKK1081C011 [C] KKT_SVC`, `execEZM0411A010 [C] EKK0341` |

**Notes:**
- Both direct callers are internal methods within `JKKKikiIchiranCancelCC`, meaning this method serves as a shared processing step within the broader equipment provision service cancellation screen flow.
- No external screen (KKSV*) or batch entry points were found within 8 hops, suggesting the entry points are higher-level DSL/SC methods that invoke the caller methods first.
- All terminal operations are Create (C) operations — this method does not perform any reads, updates, or deletes directly; it delegates all data operations to downstream CBSs.

## 6. Per-Branch Detail Blocks

**Block 1** — [IF] `keyTaknkikiModelCd` is not blank (L1491)

> If the key equipment model code is present, proceed with home terminal agreement processing. Otherwise, skip the entire order set block.

| # | Type | Code |
|---|------|------|
| 1 | GET | `CAANMsg ekk0341a010cbsMsg = (CAANMsg)temporaryData.get(TEMPLATE_ID_EKK0341A010_ODR)` // Get equipment provision service agreement result [-> `EKK0341A010_ODR`] |
| 2 | EXEC | `HashMap<String, Object> ccMsg = (HashMap<String, Object>)param.getData(dataMapKey)` // Get parameter linkage data map |
| 3 | GET | `String workKktkSvcCd = ekk0341a010cbsMsg.getString(EKK0341A010CBSMsg1List.KKTK_SVC_CD)` // Get equipment provision service code |
| 4 | GET | `String keyTaknkikiModelCd = ekk0341a010cbsMsg.getString("taknkiki_model_cd")` // Get key equipment model code |
| 5 | IF | `!JCKBPCommon.isNullOrBlank(keyTaknkikiModelCd)` // Entry guard: equipment must have a model code |

**Block 1.1** — [IF] `KIKI_SEIZO_NO` is not blank (L1495)

> Nested version-gated block (v6.00.02 addition). If the equipment serial number (機器製造番号) is not blank, proceed with agreement processing. This check was added in v6.00.02 and ensures that equipment without a serial number is excluded from order processing.

| # | Type | Code |
|---|------|------|
| 1 | GET | `getNullToStr(ekk0341a010cbsMsg.getString(EKK0341A010CBSMsg1List.KIKI_SEIZO_NO))` // Get equipment serial number [-> `"kiki_seizo_no"`, Japanese: 機器製造番号] |
| 2 | IF | `!"".equals(getNullToStr(...KIKI_SEIZO_NO))` // Nested guard: equipment must have a serial number |
| 3 | CALL | `execEZM0411A010(handle, scCall, param, dataMapKey, temporaryData, keyTaknkikiModelCd)` // Home terminal agreement consultation (executed if serial number present) |

**Block 1.1.1** — [POST-EZM processing] Order set execution for eligible equipment (L1502)

> After the home terminal agreement consultation, this block determines whether SOD generation is needed based on service type, OLS capability, and prior SOD transmission status.

| # | Type | Code |
|---|------|------|
| 1 | GET | `String olsKinoUm = getNullToStr(ezm0411a010Msg_out.getString(EZM0411A010CBSMsg1List.OLS_KINO_UM))` // Get OLS function presence flag [-> `"ols_kino_um"`, Japanese: OLS機能有無]. Value `"1"` = OLS enabled (OLS_KINO_UM_ARI) |
| 2 | GET | `String stp_sod_send_ymd = getNullToStr((String)ccMsg.get("stp_sod_send_ymd"))` // Get stop SOD send date. Blank = no SOD sent yet |
| 3 | IF | `(KKTK_SVC_CD_BBR="C014" || KKTK_SVC_CD_OVA="C004" || KKTK_SVC_CD_TAKINO_RUTAR="C024" || JKKStrConst.KKTK_SVC_CD_HGW="C025")` && `OLS_KINO_UM_ARI="1"` (L1514-1519) <br/> **Condition**: Service type is one of the four eligible equipment types AND OLS is enabled. <br/> **Branches**: BBR (Broadband router), OVA (Optical phone device), TAKINO_RUTAR (Multi-function router), HGW (eo Home Gateway) — all require SOD if OLS is active. <br/> **Note**: Commented-out v7.00.01 code previously included multi-function router-specific advance registration (`execEKK1091D010KkOptSvc`), which was removed in v7.00.03. |

**Block 1.1.1.1** — [IF] `stp_sod_send_ymd` is blank (L1523)

> If the stop SOD send date is blank, no SOD has been transmitted yet. This triggers the full order creation pipeline: unique number assignment, condition registration, and order work creation.

| # | Type | Code |
|---|------|------|
| 1 | PUT | `temporaryData.put(TEMPLATE_ID_EKK1081C011, execEKK1081C011(...))` // Assign unique processing number [-> `"EKK1081C011"`]. The result is stored for downstream use by the CBS pipeline. |
| 2 | PUT | `temporaryData.put(TEMPLATE_ID_EKK1081D010, execEKK1081D010(..., ODR_KAIYAKU_SOD_1="1"))` // Register release (cancellation) condition [-> `"EKK1081D010"`, SOD type `"1"` = Order cancellation (解約)]. This creates a record in the order release condition table. |
| 3 | IF | `!FUNC_CODE_2.equals(ccMsg.get("func_code"))` // func_code is not "2" (not check mode) (L1534) <br/> **Branch No (execution mode)**: Create order work for cancellation. <br/> **Branch Yes (check mode)**: Skip order work creation; only register conditions for preview. |
| 3a | CALL (Branch No) | `execEKK1551D010(handle, scCall, param, dataMapKey, temporaryData, ODR_KAIYAKU_SOD_1)` // Create order work registration for cancellation. Generates order service records for SOD cancellation transmission. |
| 4 | PUT | `temporaryData.put(TEMPLATE_ID_EKK1081D010, execEKK1081D010(..., ODR_SHOKYO_SOD_2="2"))` // Register delete condition [-> `"EKK1081D010"`, SOD type `"2"` = Order deletion (消去)]. Overwrites the previous EKK1081D010 result. |
| 5 | IF | `!FUNC_CODE_2.equals(ccMsg.get("func_code"))` // func_code is not "2" (not check mode) (L1543) <br/> **Branch No (execution mode)**: Create order work for deletion. <br/> **Branch Yes (check mode)**: Skip order work creation. |
| 5a | CALL (Branch No) | `execEKK1551D010(handle, scCall, param, dataMapKey, temporaryData, ODR_SHOKYO_SOD_2)` // Create order work registration for deletion. Generates order service records for SOD deletion transmission. |
| 6 | PUT | `ccMsg.put("stp_sod_send_ymd_ret", (String)ccMsg.get("unyo_ymd"))` // Store operation date as return value. `unyo_ymd` (運用年月日, Operation Date) is saved as the stop SOD send return date, recording when the SOD transmission was processed. |
| 7 | COMMENT | Version comments: v7.00.03 removal of multi-function router advance registration. Previously, if `KKTK_SVC_CD_TAKINO_RUTAR="C024"`, `execEKK1091D010KkOptSvc` was called for advance registration of equipment options (v7.00.01), but this was removed in v7.00.03. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `executeOrderSet` | Method | Order set execution — orchestrates SOD (Service Order Data) generation for equipment provision service cancellation |
| EKK0341A010 | CBS | Equipment Provision Service Agreement Consultation CBS — retrieves the subscriber's equipment provision service contract details |
| EZM0411A010 | CBS | Home Terminal Equipment Agreement Consultation CBS — performs agreement consultation for leased home terminal equipment and returns OLS capability |
| EKK1081C011 | CBS | Unique Processing Number Assignment CBS — generates a unique processing number for the order cancellation workflow |
| EKK1081D010 | CBS | Order Release/Delete Condition Registration CBS — registers order conditions in the release condition table (type 1 = cancellation, type 2 = deletion) |
| EKK1551D010 | CBS | Order Information Work Registration CBS — creates order work records for SOD transmission |
| `workKktkSvcCd` | Field | Equipment provision service code — identifies the type of leased equipment service (BBR, VA, Multi-func router, Home Gateway) |
| `keyTaknkikiModelCd` | Field | Key equipment model code — the model identifier of the primary leased equipment |
| `kiki_seizo_no` | Field | Equipment serial number (機器製造番号) — unique manufacturing serial number of the leased equipment. Added as a check gate in v6.00.02. |
| `ols_kino_um` | Field | OLS function presence (OLS機能有無) — flag indicating whether the leased equipment supports Overlay Layer Services. `"1"` = enabled, other values = disabled. |
| `stp_sod_send_ymd` | Field | Stop SOD send date (停止SOD送信年月日) — tracks whether SOD has been transmitted for this cancellation. Blank means no SOD has been sent, triggering order creation. |
| `stp_sod_send_ymd_ret` | Field | Stop SOD send return date — stores the operation date (`unyo_ymd`) as the recorded SOD transmission date |
| `unyo_ymd` | Field | Operation date (運用年月日) — the system date when the operation was performed |
| `func_code` | Field | Function code — indicates the processing mode. `"2"` = check/confirmation mode (processing skipped), other values = execution mode |
| `OLS_KINO_UM_ARI` | Constant | OLS function present flag = `"1"` — indicates the equipment supports Overlay Layer Services |
| `ODR_KAIYAKU_SOD_1` | Constant | Order cancellation SOD type = `"1"` — SOD type code for service contract cancellation (解約) |
| `ODR_SHOKYO_SOD_2` | Constant | Order deletion SOD type = `"2"` — SOD type code for order record deletion (消去) |
| `FUNC_CODE_2` | Constant | Check mode function code = `"2"` — when set, skips order work creation (preview/confirmation only) |
| `KKTK_SVC_CD_BBR` | Constant | Equipment provision service code for BBR (Broadband Router) = `"C014"` |
| `KKTK_SVC_CD_OVA` | Constant | Equipment provision service code for VA/Optical Phone device = `"C004"` (宅内機器形式: home terminal equipment type) |
| `KKTK_SVC_CD_TAKINO_RUTAR` | Constant | Equipment provision service code for Multi-function Router = `"C024"` |
| `KKTK_SVC_CD_HGW` | Constant | Equipment provision service code for eo Home Gateway = `"C025"` (added in ANK-4315, v7.00.01) |
| SOD | Acronym | Service Order Data — data record transmitted to downstream systems for service provisioning, modification, or cancellation |
| OLS | Acronym | Overlay Layer Services — IP-layer service functionality (typically IPv6/v4 overlay) available on leased equipment |
| CBS | Acronym | Common Business Service — shared service component for business logic execution |
| SC | Acronym | Service Component — lower-level service unit called via SC invocation framework |
| CC | Acronym | Common Controller — custom business component class in the Fujitsu Futurity BP platform |
| CAANMsg | Type | Common AN message container — generic message object used to pass CBS input/output data |
| BBR | Business term | Broadband Router — leased broadband networking equipment |
| VA | Business term | Virtual Adapter / Voice Analog — optical phone service device (電話用VA) |
| Home Gateway | Business term | eo Home Gateway (eoホームゲートウェイ) — integrated residential networking equipment provided by NTT East, model code C025 |
| 解約 (Kaiyaku) | Japanese term | Service contract cancellation — terminates an active service contract |
| 消去 (Shousho) | Japanese term | Order record deletion — removes/clears order records from the system |
| 機器提供サービス (Kiki Teikyou Service) | Japanese term | Equipment provision service — telecommunications services where physical equipment is leased to the subscriber |
| 宅内機器一意向照会 (Takunai Kiki Ichiiko Shoukai) | Japanese term | Home terminal equipment agreement consultation — inquiry about the status of leased home terminal equipment |
