# Business Logic — JKKStbUcwkEoTvKktkSvcKeiCC.sendWctrTekkyoOrder() [59 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKStbUcwkEoTvKktkSvcKeiCC` |
| Layer | Common Component (CC) — shared service component layer |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKStbUcwkEoTvKktkSvcKeiCC.sendWctrTekkyoOrder()

This method issues a removal order (撤去オーダー — "removal/surge order") for viewing control services (視聴制御 — subscription management / pay-per-view control). In the Japanese cable TV / satellite broadcasting domain, "viewing control" refers to the conditional access system that encrypts and controls which channels a subscriber can access via their set-top box (STB). When a subscriber cancels or moves their STB equipment, this method constructs a removal order payload that triggers the downstream service integration framework (SIF) to deregister the viewing control authorization from the device.

The method implements a **routing/dispatch pattern**: it first validates whether STB delivery fees are applicable (`stb_tekkyo_hiyo == "1"`), then iterates over a list of child device records, filtering to include only records that contain an STB identifier. For each valid STB record, it assembles a detailed device information map (including model code, serial number, STB ID, service type code, contract line item, BCAS card ID, and CCAS card ID) and collects them into a list. Finally, it delegates the actual order dispatch to `JKKKojiWctrlOrderSendCC.sendKojiWctrlOrder()`, which executes a multi-step SIF call chain (household device list matching -> viewing control order receipt -> order transmission -> result registration -> STB information update).

The method serves as a **shared utility component** within the service contract removal workflow. It is invoked during the equipment removal process (機器撤去 — "equipment removal/disconnect") when a subscriber's service contract is being terminated or transferred, ensuring that the viewing control authorization is properly revoked from the set-top box. Note: the caller site at line 592 is currently commented out (part of a maintenance comment: "WCサービスIFが複数件に対応していないためコメントアウト" — "WC service IF does not support multiple records, so commented out"), indicating this method is a work-in-progress or conditional integration point.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["sendWctrTekkyoOrder"]) --> INIT["Initialize: create JKKKojiWctrlOrderSendCC, create wctrlOrderCCMap"]
    INIT --> SET_PARAM["Set param: KojiWctrlOrderSendMap -> wctrlOrderCCMap"]
    SET_PARAM --> SET_FUNC["Set func_code from inMap"]
    SET_FUNC --> SET_REQ["Set wctrl_req_trn_cd = 50"]
    SET_REQ --> SET_SYSID["Set sysid from inMap"]
    SET_SYSID --> SET_SVCNO["Set svc_kei_no from inMap"]
    SET_SVCNO --> CHECK_STB{"stb_tekkyo_hiyo == 1?"}
    CHECK_STB -->|Yes| LOOP["Loop: kikiRmvchildList"]
    CHECK_STB -->|No| CLEANUP["param.removeData(KojiWctrlOrderSendMap)"]
    CLEANUP --> END(["Return"])
    LOOP --> CHECK_STB_ID{"Contains stb_id?"}
    CHECK_STB_ID -->|No| NEXT["Next iteration (skip non-STB)"]
    CHECK_STB_ID -->|Yes| BUILD_CHILD["Build childMap: key_tk_mdl_cd, key_kk_seizo_no, key_stbid, key_tk_sbt_cd, svc_kei_ucwk_no, bcas_card_no, ccas_card_no"]
    NEXT --> CHECK_LOOP_END
    BUILD_CHILD --> ADD_LIST["Add childMap to wctrlOrderList"]
    ADD_LIST --> CHECK_LOOP_END{"More items?"}
    CHECK_LOOP_END -->|Yes| LOOP
    CHECK_LOOP_END -->|No| SET_STBLIST["Set stbTekkyoList in wctrlOrderCCMap"]
    SET_STBLIST --> CALL_SEND["Call wctrlOrderCC.sendKojiWctrlOrder(handle, param, KojiWctrlOrderSendMap)"]
    CALL_SEND --> CLEANUP
```

**Constant Resolution:**

| Constant | Resolved Value | Business Meaning |
|----------|---------------|------------------|
| `wctrl_req_trn_cd` | `"50"` | Viewing control request transaction code — identifies this as a removal/deregistration transaction type |
| `stb_tekkyo_hiyo` | `"1"` | STB delivery fee flag — when equal to "1", STB-related removal processing is required |
| `KojiWctrlOrderSendMap` | String key | Request parameter data key for the W-ctrl order send map |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `handle` | `SessionHandle` | Database session handle — provides the transaction context and database connection for all downstream SIF calls executed by `sendKojiWctrlOrder`. Carries the user's authentication and session state. |
| 2 | `param` | `IRequestParameterReadWrite` | Request parameter object — serves as the data carrier for the entire operation. Used to store and retrieve the W-ctrl order send map via `setData()` / `getData()` / `removeData()`. |
| 3 | `inMap` | `HashMap` | Input data map containing order metadata extracted from the screen's request. Provides `func_code` (function code identifying the operation type), `sys_id` (system identifier), `svc_kei_no` (service contract number — the parent service line item), and `stb_tekkyo_hiyo` (flag indicating whether STB delivery fees apply). |
| 4 | `kikiRmvchildList` | `List<HashMap<String,Object>>` | List of child device removal records — each map represents a piece of equipment scheduled for removal from the subscriber's premises. Contains fields like `stb_id`, `taknkiki_model` (home device model code), `kiki_seizo_no` (device serial number), `taknkiki_sbt_cd` (home device subtype code), `svc_kei_ucwk_no` (service contract detail work number), `bcas_id` (BCAS card number for conditional access), and `ccas_id` (CCAS card number). Only records containing `stb_id` are processed (non-STB devices are skipped). |

**External State:**
- `JKKKojiWctrlOrderSendCC` — instantiated within the method; responsible for executing the downstream SIF (Service Integration Framework) call chain that communicates with external viewing control systems.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKKojiWctrlOrderSendCC.sendKojiWctrlOrder` | JKKKojiWctrlOrderSendCC | - | Delegates to W-ctrl order sending component which executes a multi-step SIF call chain |

### Downstream call chain (via `sendKojiWctrlOrder`):

The `sendKojiWctrlOrder` method executes a per-STB loop that performs the following SIF calls for each STB in the list:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `margeSvcIF` | (initial prep) | - | Merges service IF data — initial preparation IF that consolidates service-level information before per-device processing |
| R | `editInMsg_EWCA0010001CBS` | EWCA0010001CBS | - | Household device list matching CBS — constructs the input message for the household device list matching service call |
| R/C | `executeSvcIFCmn` | EWCA0010001CBS | (external SIF) | Executes the household device list matching service IF call (external system query) |
| U | `editResultRP_EWCA0010001CBS` | EWCA0010001CBS | - | Reads results from the household device list matching response and populates the work map |
| - | `jdgErrRslt` | EWCA0010001CBS | - | Judgment result check — validates the processing result and throws if error |
| R | `editInMsg_EWC0011D010CBS` | EWC0011D010CBS | - | Viewing control order receipt CBS — constructs the input message for the viewing control order receipt service call |
| R/C | `executeSvcIFCmn` | EWC0011D010CBS | (external SIF) | Executes the viewing control order receipt service IF call (external system registration) |
| U | `editResultRP_EWC0011D010CBS` | EWC0011D010CBS | - | Reads results from the viewing control order receipt response and populates the work map |
| - | `jdgErrRslt` | EWC0011D010CBS | - | Judgment result check for order receipt |
| R | `editInMsg_EWC0011C010CBS` | EWC0011C010CBS | - | Viewing control order transmission CBS — constructs the input message for order transmission (only when func_code == "1") |
| R/C | `executeSvcIFCmn` | EWC0011C010CBS | (external SIF) | Executes the viewing control order transmission service IF call |
| U | `editResultRP_EWC0011C010CBS` | EWC0011C010CBS | - | Reads results from the order transmission response |
| - | `jdgErrRslt` | EWC0011C010CBS | - | Judgment result check for order transmission |
| R | `editInMsg_EWC0011C020CBS` | EWC0011C020CBS | - | Viewing control order result registration CBS — constructs the input message for registering the order result |
| R/C | `executeSvcIFCmn` | EWC0011C020CBS | (external SIF) | Executes the order result registration service IF call |
| U | `editResultRP_EWC0011C020CBS` | EWC0011C020CBS | - | Reads results from the order result registration response |
| - | `jdgErrRslt` | EWC0011C020CBS | - | Judgment result check for order result registration |
| R | `editInMsg_EWCA0010003CBS` | EWCA0010003CBS | - | STB information update CBS — constructs the input message for updating STB information (only when func_code == "1") |
| R/C | `executeSvcIFCmn` | EWCA0010003CBS | (external SIF) | Executes the STB information update service IF call |
| U | `editResultRP_EWCA0010003CBS` | EWCA0010003CBS | - | Reads results from the STB information update response |
| - | `jdgErrRslt` | EWCA0010003CBS | - | Judgment result check for STB information update |

**Key observation:** All database/entity operations are performed through external SIF (Service Integration Framework) calls to downstream CBS (Component Business Service) modules. The `sendWctrTekkyoOrder` method itself does not perform direct DB operations — it acts as an assembler and dispatcher.

## 5. Dependency Trace

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC:JKKStbUcwkEoTvKktkSvcKeiCC | (line 592, commented out) `...updKojiKiki -> sendWctrTekkyoOrder` | `sendKojiWctrlOrder [C/R/U] external SIF (EWCA0010001CBS, EWC0011D010CBS, EWC0011C010CBS, EWC0011C020CBS, EWCA0010003CBS)` |

**Note:** The only known call site for `sendWctrTekkyoOrder` is at line 592 within the same class `JKKStbUcwkEoTvKktkSvcKeiCC`, and it is currently **commented out** with the rationale: "WCサービスIFが複数件に対応していないためコメントアウト" (WC service IF does not support multiple records, so commented out). This indicates the method is either a planned future integration point or is conditionally enabled. No active callers were found via code search across 59,000+ Java files.

The terminal execution chain through `sendKojiWctrlOrder` reaches the following external CBS modules:

- `EWCA0010001CBS` — Household Device List Matching (Read/Query)
- `EWC0011D010CBS` — Viewing Control Order Receipt (Create/Register)
- `EWC0011C010CBS` — Viewing Control Order Transmission (Create/Transmit, when func_code == "1")
- `EWC0011C020CBS` — Viewing Control Order Result Registration (Create/Register, when func_code == "1")
- `EWCA0010003CBS` — STB Information Update (Update, when func_code == "1")

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Component initialization (L1162)

> Creates the W-ctrl order sending component and the shared data map. Sets the component's data map into the request parameter under the key `KojiWctrlOrderSendMap`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wctrlOrderCC = new JKKKojiWctrlOrderSendCC()` // Instantiate W-ctrl order sending component |
| 2 | SET | `wctrlOrderCCMap = new HashMap<String, Object>()` // Create order data map |
| 3 | EXEC | `param.setData("KojiWctrlOrderSendMap", wctrlOrderCCMap)` // Store map in request params |
| 4 | SET | `childMap = null` // Initialize child map variable |

**Block 2** — [SET] Viewing control order list initialization (L1168)

> Initializes the list that will collect STB removal device records for the viewing control order.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wctrlOrderList = new ArrayList<HashMap<String, Object>>()` // Create STB order list (視聴制御作成) |

**Block 3** — [SET] Order metadata population (L1171-L1179)

> Populates the W-ctrl order data map with operation metadata extracted from the input map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wctrlOrderCCMap.put("func_code", inMap.get("func_code"))` // Function code (機能コード) |
| 2 | SET | `wctrlOrderCCMap.put("wctrl_req_trn_cd", "50")` // Viewing control request transaction code (視聴制御依存処理コード) |
| 3 | SET | `wctrlOrderCCMap.put("sysid", inMap.get("sys_id"))` // System ID (SYSID) |
| 4 | SET | `wctrlOrderCCMap.put("svc_kei_no", inMap.get("svc_kei_no"))` // Service contract number (サービス契約番号) |

**Block 4** — [IF] STB delivery fee check (L1182) `[stb_tekkyo_hiyo == "1"]` (L1182)

> Checks whether STB delivery fees are applicable. When the `stb_tekkyo_hiyo` field in `inMap` equals `"1"`, the method processes STB removal records. This corresponds to the comment "STB撤去費用有の場合" (When STB removal fees exist).

**Block 4.1** — [ELSE/IMPLIED] `stb_tekkyo_hiyo != "1"` (L1182)

> When STB delivery fees are not applicable, the method skips all device processing and proceeds directly to cleanup (removing the data map from params).

**Block 4.2** — [FOR] STB device list iteration (L1186) (L1186)

> Iterates over all child removal records in `kikiRmvchildList`. This is the "STB撤去" (STB removal) processing block.

| # | Type | Code |
|---|------|------|
| 1 | SET | `kikiMap : kikiRmvchildList` // Each record from the device removal list |

**Block 4.2.1** — [IF] Non-STB filter (L1189) `[!containsKey("stb_id")]` (L1189)

> Skips records that do not contain an STB identifier. Corresponds to the comment "STB以外対象外" (Non-STB devices are out of scope).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `continue` // Skip non-STB device records |

**Block 4.2.2** — [ELSE-IMPL] STB record processing (L1191)

> For records containing `stb_id`, assembles a detailed child device information map. Corresponds to "STB" processing block.

| # | Type | Code |
|---|------|------|
| 1 | SET | `childMap = new HashMap<String, Object>()` // New child device map |
| 2 | SET | `childMap.put("key_tk_mdl_cd", kikiMap.get("taknkiki_model"))` // +KR home device model code (+KR家庭機器型式コード) |
| 3 | SET | `childMap.put("key_kk_seizo_no", kikiMap.get("kiki_seizo_no"))` // +KR device serial number (+KR機器製造番号) |
| 4 | SET | `childMap.put("key_stbid", kikiMap.get("stb_id"))` // +KR STB ID (+KRSTBID) |
| 5 | SET | `childMap.put("key_tk_sbt_cd", kikiMap.get("taknkiki_sbt_cd"))` // +KR home device type code (+KR家庭機器種類コード) |
| 6 | SET | `childMap.put("svc_kei_ucwk_no", kikiMap.get("svc_kei_ucwk_no"))` // Service contract detail work number (サービス契約内容番号) |
| 7 | SET | `childMap.put("bcas_card_no", kikiMap.get("bcas_id"))` // BCAS card number (BCAS-ID — conditional access card identifier) |
| 8 | SET | `childMap.put("ccas_card_no", kikiMap.get("ccas_id"))` // CCAS card number (CCAS-ID — conditional access card identifier) |
| 9 | EXEC | `wctrlOrderList.add(childMap)` // Add assembled device record to order list |

**Block 4.2.3** — [AFTER LOOP] Set STB list and dispatch (L1202-L1207)

> After collecting all STB device records, stores the list in the W-ctrl order map and dispatches the removal order via `sendKojiWctrlOrder`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `wctrlOrderCCMap.put("stbTekkyoList", wctrlOrderList)` // Store collected STB removal list (STB配送リスト) |
| 2 | CALL | `wctrlOrderCC.sendKojiWctrlOrder(handle, param, "KojiWctrlOrderSendMap")` // Issue removal order (オーダー発行) |

**Block 5** — [EXEC] Cleanup (L1209)

> Removes the temporary data map from the request parameter to prevent data leakage.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.removeData("KojiWctrlOrderSendMap")` // Remove temp data (一時データ削除) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `svc_kei_no` | Field | Service contract number — the parent-level identifier for a subscriber's service agreement line item |
| `svc_kei_ucwk_no` | Field | Service contract detail work number — internal tracking ID for a specific service contract line item / line detail |
| `stb_tekkyo_hiyo` | Field | STB delivery fee flag — indicates whether STB (set-top box) delivery/removal charges apply ("1" = fees apply / removal processing required) |
| `sys_id` | Field | System identifier — the platform/system ID that owns this service order |
| `func_code` | Field | Function code — identifies the type of function/operation being performed (e.g., "1" for active viewing control order processing) |
| `stb_id` | Field | Set-top box identifier — unique identifier for the subscriber's STB device |
| `taknkiki_model` | Field | Home device model code — model type code for the home equipment (+KR family device model) |
| `kiki_seizo_no` | Field | Device serial number — manufacturing serial number of the equipment |
| `taknkiki_sbt_cd` | Field | Home device type code — categorization code for the type of home equipment |
| `bcas_id` | Field | BCAS card number — BCAS (Broadcaster's Content Access System) card identifier used for conditional access / DRM in Japanese digital broadcasting |
| `ccas_id` | Field | CCAS card number — CCAS (Common Cryptographic Algorithm Suite) card identifier used for conditional access / DRM |
| `wctrl_req_trn_cd` | Field | Viewing control request transaction code — transaction type code ("50" = viewing control removal/deregistration) |
| `KojiWctrlOrderSendMap` | Constant | Request parameter key for the viewing control order sending data map |
| `stbTekkyoList` | Field | STB delivery/removal list — the collected list of STB device records to be processed in the removal order |
| `kikiRmvchildList` | Field | Equipment removal child list — the list of child records for equipment being removed from the subscriber's premises |
| 視聴制御 | Japanese term | Viewing control / subscription management — the conditional access system that controls which channels a subscriber can decrypt and watch |
| 撤去オーダー | Japanese term | Removal order / surge order — an order to deregister or remove a service from a device (in this context, removing viewing control authorization from an STB) |
| 機器撤去 | Japanese term | Equipment removal/disconnect — the business process of removing subscriber equipment from their premises |
| STB | Acronym | Set-Top Box — the subscriber's decoder/terminal device for receiving and decoding broadcast signals |
| BCAS | Acronym | Broadcaster's Content Access System — Japanese conditional access standard for digital broadcasting content protection |
| CCAS | Acronym | Common Cryptographic Algorithm Suite — cryptographic standard used in conjunction with BCAS for content authentication |
| SIF | Acronym | Service Integration Framework — the middleware layer for integrating with external service systems |
| CBS | Acronym | Component Business Service — a granular service component that encapsulates a specific business function and communicates via SIF |
| EWCA0010001CBS | SC Code | Household Device List Matching CBS — external service component for matching/verifying household device information |
| EWC0011D010CBS | SC Code | Viewing Control Order Receipt CBS — external service component for receiving/registering viewing control orders |
| EWC0011C010CBS | SC Code | Viewing Control Order Transmission CBS — external service component for transmitting viewing control orders |
| EWC0011C020CBS | SC Code | Viewing Control Order Result Registration CBS — external service component for registering viewing control order results |
| EWCA0010003CBS | SC Code | STB Information Update CBS — external service component for updating STB device information |
| FTTH | Business term | Fiber To The Home — fiber-optic broadband service (relevant context for the broader billing/contract system this method operates within) |
| JKKKojiWctrlOrderSendCC | Component | KOJI W-CTRL Order Send CC — the common component class responsible for sending viewing control orders to external systems via SIF |
| `executeSvcIFCmn` | Method | Executes a generic SIF (Service Integration Framework) service call — the common IF execution method that routes CBS calls to the appropriate external system |
| `jdgErrRslt` | Method | Judgment Result — validates the result of a CBS/IF call and throws an exception if the result indicates an error |
