# Business Logic — JFUMkmInfoAddFrontiaPreTrnCC.editInMsg() [68 LOC]

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

## 1. Role

### JFUMkmInfoAddFrontiaPreTrnCC.editInMsg()

This method constructs the input message payload (`CAANMsg` template and control parameter map) required to invoke a backend CBS (Component-Based Service) for the Fujitsu Frontia cloud platform's fiber optic installation information addition workflow. It acts as a **message assembler / builder** that bridges the request parameter layer with the CBS invocation layer.

The method extracts header-level transaction metadata (transaction ID, usecase ID, operation ID, call type) from the incoming `IRequestParameterReadWrite` object, then enriches the control map with runtime context (client hostname, client IP address, invoking screen ID, operator ID) from the request's control data. It uses the `svcIf` service interface name extracted from `mappingData[0][1]` to build a resource-bundle-based `CAANMsg` template whose fully qualified resource key follows the pattern `eo.ejb.cbs.cbsmsg.\<svcIf>CBSMsg`.

The method then iterates over the remaining `mappingData` entries to populate the `CAANMsg` template — handling three distinct value types: nested `CAANMsg[]` arrays, empty strings (which are explicitly mapped to SQL `NULL` via `setNull`), and regular scalar values via `set`. The assembled template is wrapped in a single-element `CAANMsg` array and stored under the `TEMPLATE_LIST_KEY` in the returned `paramMap`.

Its **role in the larger system** is to serve as the message serialization step within the CBS invocation chain — it transforms loosely-typed `mappingData` and request-scoped control parameters into a strongly-typed `CAANMsg` structure that the downstream CBS call engine can consume. It is called exclusively by `callSC()` within the same class, acting as an internal helper in the service component dispatch path.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg method entry"])
    A["Create paramMap HashMap<String, Object>"]
    B["Populate paramMap from param:
TRANZACTION_ID_KEY
USECASE_ID_KEY
OPERATION_ID_KEY
CALL_TYPE_KEY"]
    C["Populate paramMap from control map:
CLIENT_HOST_NAME_KEY
CLIENT_IP_ADDRESS_KEY
INVOKE_GAMEN_ID_KEY
OPERATOR_ID_KEY"]
    D["Extract svcIf = mappingData[0][1]"]
    E["Build CAANMsg template from resource bundle
eo.ejb.cbs.cbsmsg.\<svcIf>CBSMsg"]
    F["Set template fields:
OPERATOR_ID_KEY
OPERATE_DATE_KEY
OPERATE_DATETIME_KEY"]
    G["Loop: iterate mappingData rows"]
    H["Check if mappingData[i][1] is CAANMsg[]"]
    I["template.set(key, CAANMsg[])"]
    J["Check if mappingData[i][1] is empty string"]
    K["template.setNull(key)"]
    L["template.set(key, value)"]
    M["Create CAANMsg[1] array wrapping template"]
    N["Put TEMPLATE_LIST_KEY with array on paramMap"]
    O["Return paramMap"]

    START --> A --> B --> C --> D --> E --> F --> G --> H
    H -- "CAANMsg[]" --> I --> G
    H -- "Other" --> J
    J -- "Yes" --> K --> G
    J -- "No" --> L --> G
    G --> M --> N --> O
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The incoming request parameter carrier holding transaction-level headers (telegram ID, usecase ID, operation ID, call type) and control map data (client hostname, IP, screen ID, operator ID). It represents the complete inbound request context from the Frontia platform screen or batch entry point. |
| 2 | `mappingData` | `Object[][]` | A 2D mapping array that defines the CBS message template content. Each row is `[key, value]` where the key is a `String` field name and the value is the field value (either a `String`, `CAANMsg[]` for nested message structures, or an empty `String` to signal a `NULL` value). The first row (`mappingData[0][1]`) is treated specially — its value is used as the `svcIf` service interface name for building the resource bundle template key. |

**Instance fields read by this method:** None directly — this method is purely stateless with respect to instance fields.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCMConstants` references | - | - | Constant key references — used as map/template field identifiers, not database operations |
| R | `param.getTelegramID()` | - | - | Reads transaction header ID from the request parameter |
| R | `param.getUsecaseID()` | - | - | Reads usecase identifier from the request parameter |
| R | `param.getOperationID()` | - | - | Reads operation identifier from the request parameter |
| R | `param.getCallType()` | - | - | Reads call type discriminator from the request parameter |
| R | `param.getControlMapData(...)` | - | - | Reads control context data (hostname, IP, screen ID, operator ID, date, time) from the request control map |
| C | `new CAANMsg(...)` | - | - | Creates a new CAANMsg template instance from the resource bundle |
| C | `template.set(...)` / `template.setNull(...)` | - | - | Populates the CAANMsg template with field values; empty strings result in NULL assignments |
| - | `new CAANMsg[1]` | - | - | Creates a single-element array wrapping the assembled template |
| - | `paramMap.put(...)` | - | - | Builds the output parameter map with transaction keys and the template list |

## 5. Dependency Trace

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

Direct callers found: 1 method (`JFUMkmInfoAddFrontiaPreTrnCC.callSC()`).
Terminal operations from this method: `setNull` [-], `set` [-], `set(CAANMsg[])` [-]  # NOSONAR

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: `JFUMkmInfoAddFrontiaPreTrnCC.callSC()` | `callSC()` -> `editInMsg(param, mappingData)` | `template.set(key, value)` [-] |
| 2 | CBS: `JFUMkmInfoAddFrontiaPreTrnCC.callSC()` | `callSC()` -> `editInMsg(param, mappingData)` | `template.setNull(key)` [-] |
| 3 | CBS: `JFUMkmInfoAddFrontiaPreTrnCC.callSC()` | `callSC()` -> `editInMsg(param, mappingData)` | `template.set(key, CAANMsg[])` [-] |

This method is a **private helper** — it has no external screen/batch entry point. The `callSC()` method within the same class is the CBS (Component-Based Service) dispatch method that invokes `editInMsg()` to prepare the input message before calling the downstream CBS service. The dependency chain flows from screen -> `callSC()` -> `editInMsg()` -> CAANMsg template assembly -> downstream CBS invocation.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `paramMap = new HashMap<String, Object>()` (L1968)

Creates the output parameter map that will hold transaction context and the assembled CAANMsg template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` |

**Block 2** — [SET] Populate paramMap with transaction header fields (L1972–L1979)

Extracts header-level metadata from the `param` request object and stores it in the parameter map. These keys map to the transaction processing infrastructure.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` // 【取得元：電文ヘッダ(ヘッダ)】Transaction ID |
| 2 | SET | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` // Use case ID |
| 3 | SET | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` // Operation ID |
| 4 | SET | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` // Service call type separator |

**Block 3** — [SET] Populate paramMap with control map context (L1983–L1992)

Extracts runtime control data from the request's control map. These fields provide audit and routing information for the CBS invocation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME))` // Dependency host name |
| 2 | SET | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTIP))` // Dependency source IP address |
| 3 | SET | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, param.getControlMapData(SCControlMapKeys.REQ_VIEWID))` // Dependency source screen ID |
| 4 | SET | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // Operator ID |

**Block 4** — [SET] Extract service interface name (L1994)

Reads the service interface identifier from the first row of `mappingData`, which drives the resource bundle template key pattern.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcIf = (String) mappingData[0][1]` |

**Block 5** — [SET] Build CAANMsg template from resource bundle (L1996–L1997)

Constructs a `CAANMsg` instance using a resource bundle key pattern. The template key follows the convention `eo.ejb.cbs.cbsmsg.\<svcIf>CBSMsg`, which resolves to a localized CBS message definition file.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf))` // Resource bundle path |

**Block 6** — [EXEC] Set template metadata fields (L1999–L2006)

Populates the CAANMsg template with operator and operational timestamp data.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // Operator ID |
| 2 | EXEC | `template.set(JCMConstants.OPERATE_DATE_KEY, param.getControlMapData(SCControlMapKeys.OPE_DATE))` // Operation date |
| 3 | EXEC | `template.set(JCMConstants.OPERATE_DATETIME_KEY, param.getControlMapData(SCControlMapKeys.OPE_TIME))` // Operation datetime |

**Block 7** — [FOR] Iterate mappingData to populate template (L2008–L2022)

Loops through each row of `mappingData` (starting from index 1, since index 0 was used for `svcIf`). For each row, it determines the value type and dispatches to the appropriate CAANMsg setter.

| # | Type | Code |
|---|------|------|
| 1 | FOR | `for (int i = 0; i < mappingData.length; i++)` // CAANMsg[] field population loop |

**Block 7.1** — [IF] `mappingData[i][1] instanceof CAANMsg[]` (L2010–L2013)

The value is a nested `CAANMsg[]` array (e.g., a multi-level message structure). Sets the nested message array directly onto the template.

> 【CAANMsgの場合】 — "In the case of CAANMsg"

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set((String) mappingData[i][0], (CAANMsg[]) mappingData[i][1])` |

**Block 7.2** — [ELSE] `mappingData[i][1]` is not a `CAANMsg[]` (L2015–L2021)

The value is a scalar — further branches on whether the string is empty.

> 【CAANMsg[]以外】 — "Not CAANMsg[]"

**Block 7.2.1** — [IF] `"".equals(mappingData[i][1])` (L2017–L2019)

The value is an empty string, which signals that the field should be set to SQL `NULL` in the CBS message.

> 【nullの場合】 — "In the case of null"

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull((String) mappingData[i][0])` |

**Block 7.2.2** — [ELSE] Value is a non-empty string or other object (L2021–L2023)

The value is a regular field value to be set on the template.

> 【他の場合】 — "Other case"

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set((String) mappingData[i][0], mappingData[i][1])` |

**Block 8** — [SET] Wrap template and set in paramMap (L2024–L2026)

Wraps the fully assembled `CAANMsg` template in a single-element array and stores it under the template list key.

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

**Block 9** — [RETURN] Return paramMap (L2028)

Returns the assembled parameter map containing all transaction context, control data, and the CAANMsg template array for downstream CBS invocation.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `TRANZACTION_ID_KEY` | Constant | Transaction ID key — unique identifier for the request transaction (note: "TRANZACTION" is the constant naming convention in JCMConstants) |
| `USECASE_ID_KEY` | Constant | Use case ID key — identifies the business use case being executed |
| `OPERATION_ID_KEY` | Constant | Operation ID key — identifies the specific operation within a use case |
| `CALL_TYPE_KEY` | Constant | Call type key — distinguishes service call types (e.g., synchronous vs asynchronous) |
| `CLIENT_HOST_NAME_KEY` | Constant | Client host name key — the hostname of the requesting system |
| `CLIENT_IP_ADDRESS_KEY` | Constant | Client IP address key — the source IP of the request |
| `INVOKE_GAMEN_ID_KEY` | Constant | Invoke screen ID key — the screen ID that initiated the request (`gamEN` is Japanese for screen) |
| `OPERATOR_ID_KEY` | Constant | Operator ID key — the user ID of the person performing the action |
| `TEMPLATE_LIST_KEY` | Constant | Template list key — map key for the CAANMsg array containing CBS message templates |
| `OPE_DATE` | Constant | Operation date key — the operational date from the control map |
| `OPE_TIME` | Constant | Operation time key — the operational time from the control map |
| `REQ_HOSTNAME` | Constant | Request hostname key — control map key for the client hostname |
| `REQ_HOSTIP` | Constant | Request host IP key — control map key for the client IP address |
| `REQ_VIEWID` | Constant | Request view ID key — control map key for the screen/view ID |
| `svcIf` | Field | Service interface — the service interface name derived from `mappingData[0][1]`, used to build the resource bundle template key |
| `CAANMsg` | Class | CAAN Message — a message template class used in the Frontia platform for CBS (Component-Based Service) message construction |
| `IRequestParameterReadWrite` | Interface | Request parameter read/write interface — the contract for the inbound request parameter carrier |
| `mappingData` | Parameter | Mapping data — a 2D object array defining CBS message field mappings as `[key, value]` pairs |
| CBS | Acronym | Component-Based Service — the service component pattern used in the Frontia platform for backend business logic |
| CC | Acronym | Common Component — a shared utility/connector component in the Frontia architecture |
| 【取得元：電文ヘッダ(ヘッダ)】 | Comment | Source: Telegram header (header) — indicates the data originates from the message header |
| 【電文ID】 | Comment | Transaction ID — the unique message identifier |
| 【ユーザーセッションID】 | Comment | User session ID (usecase ID) — identifies the user's business session |
| 【オペレーションID】 | Comment | Operation ID — identifies the specific operation being performed |
| 【サービス呼び出し区分】 | Comment | Service call type discriminator — categorizes the type of service invocation |
| 【取得元：ユーザーエリア(コントローラマップ)】 | Comment | Source: User area (controller map) — indicates data comes from the request controller map |
| 【依存先ホスト名】 | Comment | Dependency host name — the hostname of the system being called |
| 【依存元IPアドレス】 | Comment | Dependency source IP address — the source IP of the caller |
| 【依存元画面ID】 | Comment | Dependency source screen ID — the originating screen identifier |
| 【オペレータID】 | Comment | Operator ID — the ID of the operator/user performing the action |
| 【運⽤⽇付】 | Comment | Operation date — the business operation date |
| 【運⽤⽇時】 | Comment | Operation datetime — the business operation date and time |
| 【CAANMsgの場合】 | Comment | In the case of CAANMsg — branch for nested message array values |
| 【CAANMsg[]以外】 | Comment | Not CAANMsg[] — branch for non-nested values |
| 【nullの場合】 | Comment | In the case of null — branch for empty-string values that map to NULL |
| 【他の場合】 | Comment | Other case — branch for regular scalar values |
| CAAN | Acronym | (Platform-specific messaging framework identifier) |
| Frontia | Business term | Fujitsu's cloud service platform for telecommunications service fulfillment |
