---

# (DD39) Business Logic — JDKCommon08CC.editOrderResultRegistMsg() [110 LOC]

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

## 1. Role

### JDKCommon08CC.editOrderResultRegistMsg()

This method prepares and assembles the inbound message payload (CAANMsg template) for the **Watching Control Order Result Registration Service (視聴制御オーダ結果登録サービス)** — an internal Enterprise CBS (EWC0011C020CBS) that records the final registration outcome of a watching control (content access restriction) order into the system's order management tables. In the broader workflow, it serves as the **final registration step** in a multi-service chaining sequence: after watching control order reception (EWC0011C010) and order transmission (EWC0011C020) have completed, this method packages the result back into the CAANMsg format so the calling SC (Service Component) can persist the outcome to the database.

The method implements a **builder/collector pattern** — it gathers operational metadata (operate date/time, operator ID) from `tmpParamMap`, pulls the current watching control order status, order send datetime, control command issuance flag, and run result code from a previously built message list (`EWC0011C010CBSMSG1LIST`), and conditionally sets each field on the template (using `setNull` when values are absent, or `set` when they have concrete values). The assembled message template is then stored in `paramMap` under `JCMConstants.TEMPLATE_LIST_KEY` so the caller's `scCall.run()` invocation can use it as the input to the CBS.

The method acts as a **shared utility called by many screens and batches** — specifically invoked from the `unlink` method's watching control order result registration processing block. It does not branch by service type; it always prepares the same EWC0011C020CBS result registration message.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editOrderResultRegistMsg(paramMap, inMap, tmpParamMap)"])

    START --> BUILD_TEMPLATE["Build CAANMsg template<br/>new CAANMsg(EWC0011C020CBSMsg)"]
    BUILD_TEMPLATE --> SET_TEMPLATE_ID["Set template ID = EWC0011C020"]
    SET_TEMPLATE_ID --> CHECK_INMAP["Check inMap"]

    CHECK_INMAP -- "null" --> CHECK_WCTRL_ORDER_NO["Check wctrl_order_no in tmpParamMap"]
    CHECK_INMAP -- "not null" --> SET_FUNC_CODE["Set FUNC_CODE = 1<br/>(機能コード)"]
    SET_FUNC_CODE --> SET_OPERATEDATE["Set OPERATEDATE from tmpParamMap.operate_date_key"]
    SET_OPERATEDATE --> SET_OPERATEDATETIME["Set OPERATEDATETIME from tmpParamMap.operate_datetime_key"]
    SET_OPERATEDATETIME --> SET_OPERATORID["Set OPERATORID from tmpParamMap.operator_id"]
    SET_OPERATORID --> CHECK_WCTRL_ORDER_NO

    CHECK_WCTRL_ORDER_NO -- "null or empty" --> SET_NULL_WCTRL_ORDER_NO["SetNull WCTRL_ORDER_NO"]
    CHECK_WCTRL_ORDER_NO -- "has value" --> SET_WCTRL_ORDER_NO["Set WCTRL_ORDER_NO<br/>from tmpParamMap.wctrl_order_no"]

    SET_NULL_WCTRL_ORDER_NO --> GET_MSG_LIST["Get msgList from<br/>tmpParamMap.EWC0011C010CBSMSG1LIST"]
    SET_WCTRL_ORDER_NO --> GET_MSG_LIST

    GET_MSG_LIST --> CHECK_WCTRL_ORDER_STAT["Check WCTRL_ORDER_STAT in msgList"]

    CHECK_WCTRL_ORDER_STAT -- "null or empty" --> SET_NULL_WCTRL_ORDER_STAT["SetNull WCTRL_ORDER_STAT"]
    CHECK_WCTRL_ORDER_STAT -- "has value" --> SET_WCTRL_ORDER_STAT["Set WCTRL_ORDER_STAT<br/>from msgList.getString"]

    SET_NULL_WCTRL_ORDER_STAT --> CHECK_ORDER_SEND_DTM["Check ORDER_SEND_DTM in msgList"]
    SET_WCTRL_ORDER_STAT --> CHECK_ORDER_SEND_DTM

    CHECK_ORDER_SEND_DTM -- "null or empty" --> SET_NULL_ORDER_SEND_DTM["SetNull ORDER_SEND_DTM"]
    CHECK_ORDER_SEND_DTM -- "has value" --> SET_ORDER_SEND_DTM["Set ORDER_SEND_DTM<br/>from msgList.getString"]

    SET_NULL_ORDER_SEND_DTM --> CHECK_CTRL_CMD_HAKKO_ZUMI_FLG["Check CTRL_CMD_HAKKO_ZUMI_FLG in msgList"]
    SET_ORDER_SEND_DTM --> CHECK_CTRL_CMD_HAKKO_ZUMI_FLG

    CHECK_CTRL_CMD_HAKKO_ZUMI_FLG -- "null or empty" --> SET_NULL_CTRL_CMD["SetNull CTRL_CMD_HAKKO_ZUMI_FLG"]
    CHECK_CTRL_CMD_HAKKO_ZUMI_FLG -- "has value" --> SET_CTRL_CMD["Set CTRL_CMD_HAKKO_ZUMI_FLG<br/>from msgList.getString"]

    SET_NULL_CTRL_CMD --> CHECK_RUN_RSLT_CD["Check RUN_RSLT_CD in msgList"]
    SET_CTRL_CMD --> CHECK_RUN_RSLT_CD

    CHECK_RUN_RSLT_CD -- "null or empty" --> SET_NULL_RUN_RSLT_CD["SetNull RUN_RSLT_CD"]
    CHECK_RUN_RSLT_CD -- "has value" --> SET_RUN_RSLT_CD["Set RUN_RSLT_CD<br/>from msgList.getString"]

    SET_NULL_RUN_RSLT_CD --> CHECK_LAST_UPD_DTM_BF["Check last_upd_dtm_bf in tmpParamMap"]
    SET_RUN_RSLT_CD --> CHECK_LAST_UPD_DTM_BF

    CHECK_LAST_UPD_DTM_BF -- "null or empty" --> SET_NULL_LAST_UPD["SetNull LAST_UPD_DTM_BF"]
    CHECK_LAST_UPD_DTM_BF -- "has value" --> SET_LAST_UPD["Set LAST_UPD_DTM_BF<br/>from tmpParamMap.last_upd_dtm_bf"]

    SET_NULL_LAST_UPD --> PACK_TEMPLATES["Pack template array<br/>templates[0] = template<br/>paramMap.put(TEMPLATE_LIST_KEY, templates)"]
    SET_LAST_UPD --> PACK_TEMPLATES

    PACK_TEMPLATES --> RETURN["Return paramMap"]
    RETURN --> END([""])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramMap` | `HashMap<String, Object>` | The outbound parameter container that will hold the assembled message template array. After this method returns, `paramMap` contains a `CAANMsg[]` array at key `JCMConstants.TEMPLATE_LIST_KEY` (templateリストキー), which the caller passes to the SC invocation. |
| 2 | `inMap` | `HashMap` | The inbound data map from the screen/batch entry point. When not null, its data is **not** directly used in this method's result registration flow (the operational fields like FUNC_CODE, OPERATEDATE, OPERATEDATETIME, OPERATORID are always hardcoded to `"1"` or fetched from `tmpParamMap`, not from `inMap`). |
| 3 | `tmpParamMap` | `HashMap<String, Object>` | The intermediate working map shared across service chaining steps. It carries: (a) `operate_date_key` — operation date, (b) `operate_datetime_key` — operation date/time, (c) `operator_id` — operator ID, (d) `wctrl_order_no` — watching control order number, (e) `EWC0011C010CBSMSG1LIST` — the message list from the prior watching control order reception step (used to pull WCTRL_ORDER_STAT, ORDER_SEND_DTM, CTRL_CMD_HAKKO_ZUMI_FLG, RUN_RSLT_CD), (f) `last_upd_dtm_bf` — last update datetime before the current operation. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| W | `CAANMsg.set` | EWC0011C020CBS | Watching control order result registration message | Sets template fields with non-null values |
| W | `CAANMsg.setNull` | EWC0011C020CBS | Watching control order result registration message | Sets template fields to null when values are absent |
| R | `CAANMsg.get` (via tmpParamMap) | - | tmpParamMap | Reads operational metadata keys (operate_date_key, operate_datetime_key, operator_id, wctrl_order_no, last_upd_dtm_bf) |
| R | `CAANMsg.getString` | EWC0011C010CBSMsg | EWC0011C010CBSMSG1LIST | Reads WCTRL_ORDER_STAT, ORDER_SEND_DTM, CTRL_CMD_HAKKO_ZUMI_FLG, RUN_RSLT_CD from the prior step's message list |
| W | `HashMap.put` | - | paramMap | Stores the assembled CAANMsg[] template array under JCMConstants.TEMPLATE_LIST_KEY |

This method does **not** directly invoke any SC (Service Component) or CBS (Central Business Service) — it is purely a **message preparation (build) method**. The actual database write (C operation) is performed by the caller (`unlink`) via `scCall.run(paramMap, handle)` after this method returns. The CBS `EWC0011C020CBS` performs the watching control order result registration (視聴制御オーダ結果登録).

## 5. Dependency Trace

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

Direct callers found: 1 method.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CC: JDKCommon08CC.unlink | `unlink` → (after order reception & transmission) → `editOrderResultRegistMsg` → returns to `unlink` → `scCall.run` → EWC0011C020CBS | `CAANMsg.set [W] watching_control_order_result`<br>`CAANMsg.setNull [W] watching_control_order_result` |

**Call chain detail:** The `unlink` method in `JDKCommon08CC` (line ~1869) is part of a watching control device unlink process (アンリンク処理). After successfully completing (a-6) watching control order reception and (a-7) watching control order transmission, step (a-8) calls `editOrderResultRegistMsg` to prepare the result registration message, then immediately invokes `scCall.run(paramMap, handle)` to execute the CBS and persist the result. The SC call result is then processed by `editResultRrr` and error-checked via `JDKBPCommon.hasError`.

## 6. Per-Branch Detail Blocks

### Block 1 — [TEMPLATE BUILD] (L3033)

> Initializes a new CAANMsg template for the EWC0011C020CBS service. Sets the template ID to "EWC0011C020".

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | EXEC | `CAANMsg template = new CAANMsg(EWC0011C020CBSMsg.class.getName())` | Create new CAANMsg template for watching control order result registration |
| 2 | SET | `template.set(EWC0011C020CBSMsg.TEMPLATEID, "EWC0011C020")` | Set template ID = "EWC0011C020" — identifies this as a result registration message |

### Block 2 — [IF: inMap is not null] (L3039)

> When inMap (the inbound data map from the entry point) is present, populate operational metadata on the template. Note: FUNC_CODE is hardcoded to "1" (機能コード), and operational fields are read from tmpParamMap rather than inMap.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `template.set(EWC0011C010CBSMsg.FUNC_CODE, "1")` | Set FUNC_CODE = "1" (機能コード — function code, default: 1) [-> FUNC_CODE="1"] |
| 2 | SET | `template.set(EWC0011C020CBSMsg.OPERATEDATE, tmpParamMap.get("operate_date_key"))` | Set operation date from tmpParamMap.operate_date_key [-> operate_date_key] |
| 3 | SET | `template.set(EWC0011C020CBSMsg.OPERATEDATETIME, tmpParamMap.get("operate_datetime_key"))` | Set operation date/time from tmpParamMap.operate_datetime_key [-> operate_datetime_key] |
| 4 | SET | `template.set(EWC0011C020CBSMsg.OPERATORID, tmpParamMap.get("operator_id"))` | Set operator ID from tmpParamMap.operator_id [-> operator_id] |

### Block 3 — [IF: wctrl_order_no is null or empty] (L3060)

> The watching control order number (視聴制御オーダ番号) is required for result registration. When absent from tmpParamMap, set the field to null; otherwise set its value.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET (null branch) | `template.setNull(EWC0011C020CBSMsg.WCTRL_ORDER_NO)` | Set WCTRL_ORDER_NO to null — no watching control order number available [-> WCTRL_ORDER_NO] |
| 2 | SET (has-value branch) | `template.set(EWC0011C020CBSMsg.WCTRL_ORDER_NO, tmpParamMap.get("wctrl_order_no"))` | Set WCTRL_ORDER_NO from tmpParamMap [-> wctrl_order_no] |

### Block 4 — [IF: WCTRL_ORDER_STAT is null or empty] (L3068)

> Reads WCTRL_ORDER_STAT (視聴制御オーダステータス — watching control order status) from the prior step's message list `msgList` (EWC0011C010CBSMSG1LIST). This was populated during the order reception step (a-6) by `editResultUktk`. When the status is absent, set to null.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET (null branch) | `template.setNull(EWC0011C020CBSMsg.WCTRL_ORDER_STAT)` | Set WCTRL_ORDER_STAT to null — status not available from prior step [-> WCTRL_ORDER_STAT] |
| 2 | SET (has-value branch) | `template.set(EWC0011C020CBSMsg.WCTRL_ORDER_STAT, msgList.getString(EWC0011C010CBSMsg.WCTRL_ORDER_STAT))` | Set WCTRL_ORDER_STAT from msgList of prior reception step [-> WCTRL_ORDER_STAT] |

### Block 5 — [IF: ORDER_SEND_DTM is null or empty] (L3080)

> Reads ORDER_SEND_DTM (オーダ送信年月日時分秒 — order send datetime) from the prior step's message list. This field records when the watching control order was transmitted.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET (null branch) | `template.setNull(EWC0011C020CBSMsg.ORDER_SEND_DTM)` | Set ORDER_SEND_DTM to null — send datetime not available [-> ORDER_SEND_DTM] |
| 2 | SET (has-value branch) | `template.set(EWC0011C020CBSMsg.ORDER_SEND_DTM, msgList.getString(EWC0011C010CBSMsg.ORDER_SEND_DTM))` | Set ORDER_SEND_DTM from msgList of prior reception step [-> ORDER_SEND_DTM] |

### Block 6 — [IF: CTRL_CMD_HAKKO_ZUMI_FLG is null or empty] (L3092)

> Reads CTRL_CMD_HAKKO_ZUMI_FLG (制御コマンド発行済フラグ — control command issuance completion flag) from the prior step's message list. This flag indicates whether control commands have already been issued for the watching control order.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET (null branch) | `template.setNull(EWC0011C020CBSMsg.CTRL_CMD_HAKKO_ZUMI_FLG)` | Set CTRL_CMD_HAKKO_ZUMI_FLG to null — issuance flag not available [-> CTRL_CMD_HAKKO_ZUMI_FLG] |
| 2 | SET (has-value branch) | `template.set(EWC0011C020CBSMsg.CTRL_CMD_HAKKO_ZUMI_FLG, msgList.getString(EWC0011C010CBSMsg.CTRL_CMD_HAKKO_ZUMI_FLG))` | Set CTRL_CMD_HAKKO_ZUMI_FLG from msgList [-> CTRL_CMD_HAKKO_ZUMI_FLG] |

### Block 7 — [IF: RUN_RSLT_CD is null or empty] (L3104)

> Reads RUN_RSLT_CD (実行結果コード — execution result code) from the prior step's message list. This code indicates the outcome of the watching control order processing (success, failure, etc.).

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET (null branch) | `template.setNull(EWC0011C020CBSMsg.RUN_RSLT_CD)` | Set RUN_RSLT_CD to null — result code not available [-> RUN_RSLT_CD] |
| 2 | SET (has-value branch) | `template.set(EWC0011C020CBSMsg.RUN_RSLT_CD, msgList.getString(EWC0011C010CBSMsg.RUN_RSLT_CD))` | Set RUN_RSLT_CD from msgList [-> RUN_RSLT_CD] |

### Block 8 — [IF: last_upd_dtm_bf is null or empty] (L3115)

> The last update datetime before the current operation (更新前最終年月日時分秒). This is a concurrency control field — the CBS uses it to detect if the record was modified since the data was read.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET (null branch) | `template.setNull(EWC0011C020CBSMsg.LAST_UPD_DTM_BF)` | Set LAST_UPD_DTM_BF to null — no pre-update timestamp [-> LAST_UPD_DTM_BF] |
| 2 | SET (has-value branch) | `template.set(EWC0011C020CBSMsg.LAST_UPD_DTM_BF, tmpParamMap.get("last_upd_dtm_bf"))` | Set LAST_UPD_DTM_BF from tmpParamMap [-> last_upd_dtm_bf] |

### Block 9 — [TEMPLATE PACKAGING] (L3124)

> Packs the assembled template into a CAANMsg array and stores it in paramMap so the caller's SC invocation can use it.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `CAANMsg[] templates = new CAANMsg[1]` | Create template array with one element |
| 2 | SET | `templates[0] = template` | Place assembled template in array slot 0 |
| 3 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` | Store template array in paramMap under TEMPLATE_LIST_KEY [-> TEMPLATE_LIST_KEY] |
| 4 | RETURN | `return paramMap` | Return the populated paramMap to the caller (unlink) |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `wctrl_order_no` | Field | Watching control order number — the unique identifier for a watching control (content access restriction) order in the system |
| `wctrl_order_stat` | Field | Watching control order status — indicates the current state of a watching control order (e.g., registered, transmitted, completed, failed) |
| `order_send_dtm` | Field | Order send datetime — the timestamp when the watching control order was transmitted to downstream systems |
| `ctrl_cmd_hakko_zumi_flg` | Field | Control command issuance completion flag — whether control commands have already been issued for the watching control order |
| `run_rslt_cd` | Field | Execution result code — the outcome code of the watching control order processing (success/failure/other) |
| `last_upd_dtm_bf` | Field | Last update datetime before — the timestamp of the last modification to the record before the current operation (used for optimistic concurrency control) |
| `operate_date_key` | Field | Operation date — the business date on which the operation is being performed |
| `operate_datetime_key` | Field | Operation date/time — the full timestamp of the operation |
| `operator_id` | Field | Operator ID — the identifier of the user or system performing the operation |
| `FUNC_CODE` | Field | Function code — identifies the operation type; "1" typically means registration/insertion (機能コード — default: 1) |
| `EWC0011C020CBS` | CBS | Watching control order result registration CBS — the enterprise service that records watching control order registration outcomes |
| `EWC0011C010CBS` | CBS | Watching control order reception CBS — the service that registers a watching control order into the system |
| `EWC0011C020CBSMsg` | Class | Message class for EWC0011C020 CBS — defines the fields of the watching control order result registration message |
| `EWC0011C010CBSMsg` | Class | Message class for EWC0011C010 CBS — defines the fields of the watching control order reception message |
| `CAANMsg` | Class | Fujitsu's CAAN (Customized Application Activity Network) message class — a structured message container used throughout the platform for CBS inter-service communication |
| `unlink` | Business term | Device unlink process — the business process of unlinking STB (Set-Top Box) and C-CAS (Conditional Access Client) devices from a watching control order |
| アンリンク処理 | Business term | Unlink processing — the process of releasing the association between set-top box and C-CAS card on a watching control order |
| 視聴制御オーダ結果登録 | Business term | Watching control order result registration — the business operation of recording the final outcome of a watching control order (registration, transmission, result) into the system |
| 視聴制御 | Business term | Watching control / Content access restriction — the system that controls which users can access which content (e.g., pay-TV channels) based on their subscription |
| STB | Acronym | Set-Top Box — the subscriber's device that decodes and displays television signals |
| C-CAS | Acronym | Conditional Access Client — the client-side component managing content encryption/decryption access rights |
| SC | Acronym | Service Component — the service layer component that invokes CBS to perform database operations |
| CBS | Acronym | Central Business Service — the enterprise-level service that encapsulates business logic and database operations |
| TEMPLATE_LIST_KEY | Field | The key under which CAANMsg template arrays are stored in paramMap [-> "TEMPLATE_LIST_KEY"] |
| EWC0011C020 | Constant | Template ID for the watching control order result registration message |

---
