# (DD42) Business Logic — JDKCommon08CC.editTkniKiki3Msg() [61 LOC]

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

## 1. Role

### JDKCommon08CC.editTkniKiki3Msg()

This method constructs the input message for the **Indoor Device List Inquiry (3)** service (宅内機器一覧照会(3)), which is a CBS (Central Business System) call responsible for returning detailed information about customer indoor equipment — specifically the set-top box (STB) and related terminal device identifiers returned from the equipment management system. The method follows a **builder pattern**: it creates a `CAANMsg` template, populates it with operational metadata and device attributes, and wraps the template in an array stored in the caller's parameter map for subsequent Service Component (SC) invocation.

The method handles **one service type** — the indoor device list inquiry (3) — but branches its behavior based on device subtype. When the device subtype is "C0" (C-CAS, a Cable-CAS integrated set-top box), the method intentionally omits the model code field from the message, as C-CAS devices do not require a model code for this inquiry context. For all other device types, the model code is included.

In the larger system, this method is a **shared utility** called by multiple screens and operations that need to query indoor device details after an initial device type lookup. It is specifically invoked during the returned equipment approval workflow (DKSV0081) after the system has already determined the device subtype from a prior search, and it serves as the message preparation step before the actual SC call is dispatched via `scCall.run()`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editTkniKiki3Msg"]) --> CREATE_TEMPLATE["Create CAANMsg template<br/>with EWCA0010001CBSMsg"]
    CREATE_TEMPLATE --> SET_TEMPLATEID["Set templateID = EWCA0010001"]
    SET_TEMPLATEID --> CHECK_INMAP["inMap != null?"]
    CHECK_INMAP -->|Yes| SET_PARAMS["Set funcCode=1,<br/>operateDate, operateDatetime,<br/>operatorID from tmpParamMap"]
    CHECK_INMAP -->|No| CHECK_MDL_CD["taknkiki_mdl_cd<br/>null/empty or<br/>C-CAS?"]
    SET_PARAMS --> CHECK_MDL_CD
    CHECK_MDL_CD -->|True| SET_NULL_MDL_CD["template.setNull(KEY_TK_MDL_CD)"]
    CHECK_MDL_CD -->|False| SET_MDL_CD["template.set(KEY_TK_MDL_CD,<br/>taknkiki_mdl_cd)"]
    SET_NULL_MDL_CD --> CHECK_SEIZO_NO["kiki_seizo_no<br/>null/empty?"]
    SET_MDL_CD --> CHECK_SEIZO_NO
    CHECK_SEIZO_NO -->|True| SET_NULL_SEIZO["template.setNull(KEY_KK_SEIZO_NO)"]
    CHECK_SEIZO_NO -->|False| SET_SEIZO["template.set(KEY_KK_SEIZO_NO,<br/>kiki_seizo_no)"]
    SET_NULL_SEIZO --> CHECK_SBT_CD["taknkiki_sbt_cd<br/>null/empty?"]
    SET_SEIZO --> CHECK_SBT_CD
    CHECK_SBT_CD -->|True| SET_NULL_SBT["template.setNull(KEY_TK_SBT_CD)"]
    CHECK_SBT_CD -->|False| SET_SBT["template.set(KEY_TK_SBT_CD,<br/>taknkiki_sbt_cd)"]
    SET_NULL_SBT --> SET_NULL_STBID["template.setNull(KEY_STBID)"]
    SET_SBT --> SET_NULL_STBID
    SET_NULL_STBID --> CREATE_ARRAY["Create CAANMsg[1]<br/>array with template"]
    CREATE_ARRAY --> PUT_TEMPLATE_LIST["paramMap.put(TEMPLATE_LIST_KEY,<br/>array)"]
    PUT_TEMPLATE_LIST --> RETURN_RESULT["Return paramMap"]
    RETURN_RESULT --> END_NODE(["End"])
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `paramMap` | `HashMap<String, Object>` | The caller's request parameter map used to carry the constructed message template list. After processing, `paramMap` will contain the `TEMPLATE_LIST_KEY` entry with the populated `CAANMsg[]` array, which will be consumed by the Service Component invocation framework to dispatch the CBS call. |
| 2 | `inMap` | `HashMap` | Raw user data from the calling screen/operation. Used solely to determine whether operational metadata (operate date, time, operator ID) should be included in the message template. Non-null indicates the caller has screen-level context to propagate. |
| 3 | `tmpParamMap` | `HashMap<String, Object>` | Intermediate parameter map carrying device and operational data. It provides the device type code (`taknkiki_sbt_cd`), device model code (`taknkiki_mdl_cd`), equipment manufacturing number (`kiki_seizo_no`), operate date, operate datetime, and operator ID — all of which are extracted to populate the CBS message template. |

**External state / instance fields read:** None. This method is stateless and does not read any instance fields.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCKMvnoCustInfoAddCC.setNull` | JCKMvnoCustInfoAddCC | - | Calls `setNull` in `JCKMvnoCustInfoAddCC` |
| - | `JKKKapKeiInfoCancelCC.setNull` | JKKKapKeiInfoCancelCC | - | Calls `setNull` in `JKKKapKeiInfoCancelCC` |
| - | `JKKKisnUwHmdkAddCC.setNull` | JKKKisnUwHmdkAddCC | - | Calls `setNull` in `JKKKisnUwHmdkAddCC` |
| - | `JKKKojiChgPlaceNoCC.setNull` | JKKKojiChgPlaceNoCC | - | Calls `setNull` in `JKKKojiChgPlaceNoCC` |
| - | `JKKMvnoSvcKeiStaAddCC.setNull` | JKKMvnoSvcKeiStaAddCC | - | Calls `setNull` in `JKKMvnoSvcKeiStaAddCC` |
| - | `SCW00701SFLogic.getName` | SCW00701SFLogic | - | Calls `getName` in `SCW00701SFLogic` |

### Direct method calls within `editTkniKiki3Msg`:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `CAANMsg.set` | - | - | Sets a field value on the CBS message template for various parameters (funcCode, operateDate, operateDatetime, operatorID, key_tk_mdl_cd, key_kk_seizo_no, key_tk_sbt_cd) |
| - | `CAANMsg.setNull` | - | - | Nullifies a field on the CBS message template (key_tk_mdl_cd, key_kk_seizo_no, key_tk_sbt_cd, key_stbid) |
| - | `HashMap.put` | - | - | Stores the templates array into `paramMap` under `JCMConstants.TEMPLATE_LIST_KEY` so the SC framework can retrieve it |

Note: This method does not directly invoke any SC/CBS service components or access any database tables. It is a pure **message builder** — its sole responsibility is to prepare the `CAANMsg` template and attach it to `paramMap`. The actual SC invocation (`scCall.run`) is performed by the caller (`unlink` method) after this method returns.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `setNull` [-], `set` [-], `setNull` [-], `setNull` [-], `setNull` [-], `put` [-], `set` [-], `set` [-], `set` [-]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | BP: DKSV0081 (Returned Equipment Approval) | `DKSV0081OPOperation.unlink` -> `JDKCommon08CC.unlink` -> `JDKCommon08CC.editTkniKiki3Msg` | `paramMap.put` [U] TEMPLATE_LIST_KEY |

**Call chain detail:**
- `DKSV0081OPOperation.unlink()` is the BPM operation that manages the returned equipment approval business flow.
- It calls `JDKCommon08CC.unlink()` to perform the unlink (de-registration) logic for returned devices.
- `unlink()` queries the equipment management system via `EZM0411A010CBSMsg` to retrieve device details (including `taknkiki_sbt_cd`), then calls `editTkniKiki3Msg()` to build the indoor device list inquiry (3) message template with the retrieved device subtype code.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] Message Template Initialization (L2578)

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg(EWCA0010001CBSMsg.class.getName())` |
| 2 | SET | `template.set(EWCA0010001CBSMsg.TEMPLATEID, "EWCA0010001")` |

> Creates the CBS message template using schema class `EWCA0010001CBSMsg` and sets the service ID to "EWCA0010001" (宅内機器一覧照会(4)スキーマクラッシュ — the schema for the indoor device list inquiry service).

**Block 2** — [IF] Operational Metadata Population `(inMap != null)` (L2581)

> If the calling context provides user data (`inMap` is non-null), populate the template with operational metadata from `tmpParamMap`. Otherwise, skip operational metadata entirely.

**Block 2.1** — [ELSE-IF body / inside IF] Set funcCode and operational data when `inMap != null` (L2583)

| # | Type | Code |
|---|------|------|
| 1 | SET | `template.set(EWCA0010001CBSMsg.FUNC_CODE, "1")` // funcCode=1 (default), 機能コード（デフォルト：1） |
| 2 | SET | `template.set(EWCA0010001CBSMsg.OPERATEDATE, tmpParamMap.get("operate_date_key"))` // 運用日付 |
| 3 | SET | `template.set(EWCA0010001CBSMsg.OPERATEDATETIME, tmpParamMap.get("operate_datetime_key"))` // 運用日時 |
| 4 | SET | `template.set(EWCA0010001CBSMsg.OPERATORID, tmpParamMap.get("operator_id"))` // オペレーターID |

**Block 3** — [IF] Device Model Code Setting `(taknkiki_mdl_cd null/empty or C-CAS)` (L2591)

> **Conditional logic:** The model code is NOT set when either (a) it is null or empty, OR (b) the device subtype is "C0" (C-CAS, a Cable-CAS integrated device). In both cases, the field is nullified on the template. Otherwise, the model code is set from `tmpParamMap`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `null` |
| 2 | SET | `"".equals(tmpParamMap.get("taknkiki_mdl_cd"))` |
| 3 | SET | `JDKStrConst.CCAS` [-> CCAS="C0" (JDKStrConst.java:407)] `equals(tmpParamMap.get("taknkiki_sbt_cd"))` // 宅内機器種別コードが「C-CAS」の場合 |

**Block 3.1** — [IF-TRUE] Nullify model code when model code is null/empty or device is C-CAS (L2595)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull(EWCA0010001CBSMsg.KEY_TK_MDL_CD)` // キー T K M D L C D |

> When the device subtype is C-CAS ("C0"), the model code is intentionally omitted because C-CAS devices do not carry a model code in this context. This is an OM-2017-0001015 modification.

**Block 3.2** — [IF-FALSE] Set model code from tmpParamMap when device is not C-CAS and model code exists (L2598)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(EWCA0010001CBSMsg.KEY_TK_MDL_CD, tmpParamMap.get("taknkiki_mdl_cd"))` // キー T K M D L C D |

**Block 4** — [IF] Equipment Manufacturing Number Setting `(kiki_seizo_no null/empty)` (L2601)

> Sets the equipment manufacturing number if present in `tmpParamMap`, otherwise nullifies the field.

**Block 4.1** — [IF-TRUE] Nullify manufacturing number (L2602)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull(EWCA0010001CBSMsg.KEY_KK_SEIZO_NO)` // キー K K 製造番号 |

**Block 4.2** — [IF-FALSE] Set manufacturing number (L2605)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(EWCA0010001CBSMsg.KEY_KK_SEIZO_NO, tmpParamMap.get("kiki_seizo_no"))` // キー K K 製造番号 |

**Block 5** — [IF] Device Subtype Code Setting `(taknkiki_sbt_cd null/empty)` (L2608)

> Sets the indoor equipment subtype code if present. This code classifies the type of indoor device (e.g., PON, GPON, EPON).

**Block 5.1** — [IF-TRUE] Nullify subtype code (L2610)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull(EWCA0010001CBSMsg.KEY_TK_SBT_CD)` // キー T K 種別コード |

**Block 5.2** — [IF-FALSE] Set subtype code (L2613)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(EWCA0010001CBSMsg.KEY_TK_SBT_CD, tmpParamMap.get("taknkiki_sbt_cd"))` // キー T K 種別コード |

**Block 6** — [SET] STBID Nullification (L2616)

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull(EWCA0010001CBSMsg.KEY_STBID)` // キー S T B I D |

> STBID is always nullified. This method does not populate the Set-Top Box ID; it is set by a different caller context.

**Block 7** — [SET] Template Array Construction and Return (L2618)

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` |
| 2 | SET | `templates[0] = template` |
| 3 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` |
| 4 | RETURN | `return paramMap` |

> Creates a single-element `CAANMsg` array containing the built template and stores it in `paramMap` under `JCMConstants.TEMPLATE_LIST_KEY`. The caller (e.g., `unlink()`) retrieves this array and passes it to `scCall.run()` for actual service execution.

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `EWCA0010001` | CBS ID | Indoor Device List Inquiry (4) CBS Schema — the service interface ID for querying indoor equipment details |
| `KEY_TK_MDL_CD` | Field | Key Takashoku Model Code — Indoor device model code identifier in the CBS message template |
| `KEY_KK_SEIZO_NO` | Field | Key KK Seizo Number — Indoor equipment manufacturing number in the CBS message template |
| `KEY_STBID` | Field | Key STB ID — Set-Top Box identifier in the CBS message template; always nullified in this method |
| `KEY_TK_SBT_CD` | Field | Key TK Subtype Code — Indoor device subtype code (e.g., GPON, EPON) in the CBS message template |
| `func_code` | Field | Function Code — Indicates the operation type sent to the CBS (value "1" = default/inquiry) |
| `operate_date_key` | Field | Operation date key — The business date of the operation, extracted from `tmpParamMap` |
| `operate_datetime_key` | Field | Operation datetime key — The business date and time of the operation |
| `operator_id` | Field | Operator ID — The ID of the operator performing the operation |
| `taknkiki_mdl_cd` | Field | Takashoku Kiki Model Code — Equipment model code carried in the intermediate parameter map |
| `taknkiki_sbt_cd` | Field | Takashoku Kiki Subtype Code — Equipment subtype code carried in the intermediate parameter map |
| `kiki_seizo_no` | Field | Kiki Seizo Number — Equipment manufacturing serial number |
| C-CAS | Business term | "C0" — A Cable-CAS integrated set-top box subtype. These devices do not require a model code for indoor device inquiry, hence the special branch in this method |
| CAANMsg | Technical | CAAN message object — The Fujitsu application framework message class used to construct CBS request/response payloads |
| EWCA0010001CBSMsg | Technical | CBS message schema class — Defines the field structure for the Indoor Device List Inquiry (4) service interface |
| TEMPLATE_LIST_KEY | Constant | Key used in paramMap to store the array of CAANMsg templates for SC invocation |
| DKSV0081 | Screen/Operation | Returned Equipment Approval (返品機器承認) — The BPM operation that manages the returned device approval workflow |
| `JDKStrConst.CCAS` | Constant | "C0" — The constant representing the C-CAS device subtype code |
