# Business Logic — JKKSmtvlYoSanshoKeiInfCC.editInMsg() [66 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKSmtvlYoSanshoKeiInfCC` |
| Layer | CC / Common Component (Business logic common component — part of the Fujitsu Futurity service customization layer) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKSmtvlYoSanshoKeiInfCC.editInMsg()

This method performs **incoming message mapping** (上りマッピング処理) — it assembles the inbound request parameters into a structured `HashMap` that serves as the invocation payload for a downstream CBS (Call-Based Service). Specifically, it extracts telecommunication header data (transaction ID, use case ID, operation ID, and call type) from the request parameter object, enriches them with client control context (host name, IP address, screen ID, operator ID), and builds a `CAANMsg` template object configured with the service interface ID, function code, operator, and operational date/time. It then iterates over the `mapData` parameter — a 2D object array of key/value pairs — and applies each field to the template, using `setNull` for blank values to explicitly clear fields that the CBS may need to recognize as intentionally unset. The method follows a **delegation + builder** design pattern: it constructs a CBS invocation payload by delegating to `CAANMsg` for template management and composing the final structure from multiple source objects. Its role in the larger system is that of a **shared utility** for CBS request assembly — it is called by `callSC()` and `getInvokeCBS()` within the same class, and is the common data preparation step before any CBS invocation in the `JKKSmtvlYoSanshoKeiInfCC` service interface.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg(params)"])
    
    START --> INIT["Initialize paramMap: new HashMap<String, Object>()"]
    
    INIT --> HEADER["Extract Telegram Header Data"]
    HEADER --> H1["paramMap.put(TRANZACTION_ID_KEY, param.getTelegramID())"]
    H1 --> H2["paramMap.put(USECASE_ID_KEY, param.getUsecaseID())"]
    H2 --> H3["paramMap.put(OPERATION_ID_KEY, param.getOperationID())"]
    H3 --> H4["paramMap.put(CALL_TYPE_KEY, param.getCallType())"]
    
    H4 --> CONTROL["Extract Control Map Data"]
    CONTROL --> C1["paramMap.put(CLIENT_HOST_NAME_KEY, param.getControlMapData(REQ_HOSTNAME))"]
    C1 --> C2["paramMap.put(CLIENT_IP_ADDRESS_KEY, param.getControlMapData(REQ_HOSTIP))"]
    C2 --> C3["paramMap.put(INVOKE_GAMEN_ID_KEY, param.getControlMapData(REQ_VIEWID))"]
    C3 --> C4["paramMap.put(OPERATOR_ID_KEY, param.getControlMapData(OPERATOR_ID))"]
    
    C4 --> TEMPLATE["Create CAANMsg template"]
    TEMPLATE --> T1["new CAANMsg(eo.ejb.cbs.cbsmsg. + svcIfId + CBSMsg)"]
    T1 --> T2["template.set(TEMPLATE_ID_KEY, svcIfId)"]
    T2 --> T3["template.set(FUNC_CODE_KEY, funcCode)"]
    T3 --> T4["template.set(OPERATOR_ID_KEY, operatorId)"]
    T4 --> T5["template.set(OPERATE_DATE_KEY, operateDate)"]
    T5 --> T6["template.set(OPERATE_DATETIME_KEY, operateDateTime)"]
    
    T6 --> LOOP_START["For each entry in mapData"]
    LOOP_START --> CHECK_VALUE{"mapVal[1] is empty string?"}
    CHECK_VALUE -->|Yes| NULL_SET["template.setNull(mapVal[0])"]
    CHECK_VALUE -->|No| SET["template.set(mapVal[0], mapVal[1])"]
    
    NULL_SET --> NEXT_ITEM["i++"]
    SET --> NEXT_ITEM
    NEXT_ITEM --> LOOP_CHECK{"i < mapData.length?"}
    LOOP_CHECK -->|Yes| LOOP_START
    LOOP_CHECK -->|No| WRAP["Wrap template in CAANMsg array"]
    
    WRAP --> ARRAY["CAANMsg[] templates = new CAANMsg[1]"]
    ARRAY --> ASSIGN["templates[0] = template"]
    ASSIGN --> PUT_TEMPLATE["paramMap.put(TEMPLATE_LIST_KEY, templates)"]
    
    PUT_TEMPLATE --> RETURN["Return paramMap"]
    RETURN --> END(["end"])
```

**CRITICAL — Constant Resolution:**

This method references the following constants from `JCMConstants`:
- `TRANZACTION_ID_KEY` — Key for transaction ID in the paramMap
- `USECASE_ID_KEY` — Key for use case ID
- `OPERATION_ID_KEY` — Key for operation ID
- `CALL_TYPE_KEY` — Key for service call type classification
- `CLIENT_HOST_NAME_KEY` — Key for requesting client host name
- `CLIENT_IP_ADDRESS_KEY` — Key for requesting client IP address
- `INVOKE_GAMEN_ID_KEY` — Key for invoking screen ID
- `OPERATOR_ID_KEY` — Key for operator ID
- `TEMPLATE_ID_KEY` — Key for CBS message template ID
- `FUNC_CODE_KEY` — Key for function code
- `OPERATE_DATE_KEY` — Key for operational date
- `OPERATE_DATETIME_KEY` — Key for operational date/time
- `TEMPLATE_LIST_KEY` — Key for the CAANMsg template list array

The method also references `SCControlMapKeys` control map constants:
- `REQ_HOSTNAME` — Request hostname control map key
- `REQ_HOSTIP` — Request host IP control map key
- `REQ_VIEWID` — Request view/screen ID control map key
- `OPERATOR_ID` — Operator ID control map key
- `OPE_DATE` — Operational date control map key
- `OPE_TIME` — Operational time control map key

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The inbound request parameter object carrying the complete telecom request context. It provides access to telegram header fields (transaction ID, use case ID, operation ID, call type) and a control map containing client-side context (hostname, IP, screen ID, operator ID, operational date/time). This is the primary source of all metadata needed to assemble the CBS invocation payload. |
| 2 | `svcIfId` | `String` | The service interface identifier. It is used to construct the CBS message template lookup key (`"eo.ejb.cbs.cbsmsg." + svcIfId + "CBSMsg"`), which determines which message template file the CAANMsg framework loads for this particular CBS invocation. Each CBS endpoint has a unique service interface ID. |
| 3 | `funcCode` | `String` | The function code identifying the specific business function being invoked within the CBS. This code is embedded into the CAANMsg template and used by downstream processing to determine what operation the CBS should perform (e.g., registration, inquiry, cancellation). |
| 4 | `mapData` | `Object[][]` | A 2D object array representing key-value pairs that map business fields to their values. Each row contains `[fieldName, fieldValue]` where `fieldName` is a string key and `fieldValue` is the corresponding string value. Empty string values (`""`) are explicitly converted to null via `template.setNull()`, allowing the CBS to distinguish between an intentionally cleared field and an unset field. |

**External state / instance fields referenced:** None. This method is fully stateless and relies solely on its parameters.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCMConstants access` | - | - | Static constant access for paramMap keys |
| - | `param.getTelegramID()` | - | - | Reads transaction ID from request header |
| - | `param.getUsecaseID()` | - | - | Reads use case ID from request header |
| - | `param.getOperationID()` | - | - | Reads operation ID from request header |
| - | `param.getCallType()` | - | - | Reads service call type from request header |
| - | `param.getControlMapData(key)` | - | - | Reads control map fields (hostname, IP, screen ID, operator ID, date/time) |
| - | `new CAANMsg(...)` | - | - | Creates a new CBS message template instance |
| - | `template.set(...)` | - | - | Sets a field value in the CBS message template |
| - | `template.setNull(...)` | - | - | Sets a field to null in the CBS message template |

**Additional analysis of called methods and their downstream effects:**

The method does not directly invoke any CBS (SC/CBS) methods. Instead, it **constructs the invocation payload** (`paramMap`) which contains the `CAANMsg` template wrapped in a `CAANMsg[]` array under the `TEMPLATE_LIST_KEY`. This payload is then passed to caller methods (e.g., `callSC()`, `getInvokeCBS()`) which perform the actual CBS invocation.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `new CAANMsg(templateKey)` | - | - | Creates a new CBS message template using the service interface ID to look up the appropriate message properties file (e.g., `"eo.ejb.cbs.cbsmsg.{svcIfId}CBSMsg"`) |
| - | `template.set(key, value)` | - | - | Populates a field in the CBS message template with a string value. Called for template ID, function code, operator ID, operate date, operate datetime, and each entry from mapData. |
| - | `template.setNull(key)` | - | - | Explicitly nullifies a field in the CBS message template when the corresponding mapData value is an empty string. This is critical for CBS behavior — it signals that a field should be cleared rather than left at a previous value. |
| R | `param.getControlMapData(SCControlMapKeys.*)` | - | - | Reads client context data from the control map: hostname, IP address, screen ID, operator ID, operation date, and operation time. These are used both for the paramMap metadata and for populating the CAANMsg template. |

## 5. Dependency Trace

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

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

The method is a **private utility** — it has no direct public callers outside its class. It is invoked by:

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS: JKKSmtvlYoSanshoKeiInfCC.callSC() | `callSC()` -> `JKKSmtvlYoSanshoKeiInfCC.editInMsg(param, svcIfId, funcCode, mapData)` | `template.set()`, `template.setNull()` — populates CBS message fields |
| 2 | CBS: JKKSmtvlYoSanshoKeiInfCC.getInvokeCBS() | `getInvokeCBS()` -> `JKKSmtvlYoSanshoKeiInfCC.editInMsg(param, svcIfId, funcCode, mapData)` | `template.set()`, `template.setNull()` — populates CBS message fields |

The method does not reach any screen or batch entry points. Its terminal operations are all internal to the `CAANMsg` template population — it writes field values (via `set`) and nullifies empty fields (via `setNull`). The assembled `paramMap` is returned to the caller, which then uses it for the actual CBS invocation.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `(L722)`

Initialize the request parameter map that will hold all data for the CBS invocation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` // Create new HashMap for CBS invocation payload |

**Block 2** — [EXEC: Telegram Header Extraction] `(L725–L730)`

Extract header data from the incoming request's telegram. This section captures the core telecom request metadata.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramMap.put(TRANZACTION_ID_KEY, param.getTelegramID())` // 【取得元: 電文ヘッダ(ヘッダ)】— Transaction ID (電文ID) |
| 2 | EXEC | `paramMap.put(USECASE_ID_KEY, param.getUsecaseID())` // 【取得元: 電文ヘッダ(ヘッダ)】— Use case ID (ユーズケースID) |
| 3 | EXEC | `paramMap.put(OPERATION_ID_KEY, param.getOperationID())` // 【取得元: 電文ヘッダ(ヘッダ)】— Operation ID (オペレーションID) |
| 4 | EXEC | `paramMap.put(CALL_TYPE_KEY, param.getCallType())` // 【取得元: 電文ヘッダ(ヘッダ)】— Service call type classification (サービス呼び出し区分) |

**Block 3** — [EXEC: Control Map Data Extraction] `(L733–L738)`

Extract client-side control context from the request's control map. This provides the CBS with information about the originating client.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramMap.put(CLIENT_HOST_NAME_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME))` // 【取得元: ユーザエリア(コントローラマップ)】— Request host name (依頼先ホスト名) |
| 2 | EXEC | `paramMap.put(CLIENT_IP_ADDRESS_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTIP))` // 【取得元: ユーザエリア(コントローラマップ)】— Request source IP address (依頼元IPアドレス) |
| 3 | EXEC | `paramMap.put(INVOKE_GAMEN_ID_KEY, param.getControlMapData(SCControlMapKeys.REQ_VIEWID))` // 【取得元: ユーザエリア(コントローラマップ)】— Request source screen ID (依頼元画面ID) |
| 4 | EXEC | `paramMap.put(OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // 【取得元: ユーザエリア(コントローラマップ)】— Operator ID (オペレータID) |

**Block 4** — [SET + EXEC: CAANMsg Template Creation] `(L740–L743)`

Create a new `CAANMsg` message template object, loading the message properties file identified by the service interface ID.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg("eo.ejb.cbs.cbsmsg." + svcIfId + "CBSMsg")` // Create CBS message template — message key follows pattern: eo.ejb.cbs.cbsmsg.{svcIfId}CBSMsg |
| 2 | EXEC | `template.set(TEMPLATE_ID_KEY, svcIfId)` // 【テンプレートID】— Template ID (テンプレートID) |
| 3 | EXEC | `template.set(FUNC_CODE_KEY, funcCode)` // 【機能コード】— Function code (機能コード) |

**Block 5** — [EXEC: Template Metadata Population] `(L746–L755)`

Populate the CAANMsg template with operator and operational context data. These fields are shared across all CBS messages and provide audit trail information.

| # | Type | Code |
|---|------|------|
| 1 | SET | `operatorId = param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // Read operator ID from control map |
| 2 | EXEC | `template.set(OPERATOR_ID_KEY, operatorId)` // 【オペレータID】— Operator ID (オペレータID) |
| 3 | SET | `operateDate = param.getControlMapData(SCControlMapKeys.OPE_DATE)` // 【運用日付】— Operational date (運用日付) |
| 4 | EXEC | `template.set(OPERATE_DATE_KEY, operateDate)` // Set operate date in template |
| 5 | SET | `operateDateTime = param.getControlMapData(SCControlMapKeys.OPE_TIME)` // 【運用日時】— Operational date/time (運用日時) |
| 6 | EXEC | `template.set(OPERATE_DATETIME_KEY, operateDateTime)` // Set operate datetime in template |

**Block 6** — [FOR: MapData Iteration with Conditional Branch] `(L757–L766)`

Iterate over the `mapData` 2D array. For each key-value pair, determine whether the value is an empty string and either set it as null (to explicitly clear the field) or set it with the actual value. This is the core business data mapping logic — it transfers field-level data from the caller's mapData into the CAANMsg template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` // Loop counter |
| 2 | LOOP | `for (i = 0; i < mapData.length; i++)` // Iterate over all rows in mapData |
| 3 | SET | `mapVal = mapData[i]` // Current row as Object[] |

**Block 6.1** — [IF/ELSE-IF] `[mapVal[1] is empty string]` `(L759)`

Check whether the current field's value is an empty string. Empty values are treated as explicit nulls, allowing the CBS to recognize that a field was intentionally cleared.

| # | Type | Code |
|---|------|------|
| 1 | CONDITION | `"".equals(mapVal[1])` // Compare: is field value an empty string? |

**Block 6.1.1** — [IF] `[mapVal[1] == ""]` `(L760)`

The field value is empty — nullify the field in the template. This ensures the CBS knows the field was explicitly set to null, rather than being omitted.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull((String)mapVal[0])` // Set field to null — (String)mapVal[0] is the field name key |

**Block 6.1.2** — [ELSE] `[mapVal[1] != ""]` `(L763)`

The field has a value — set it in the template with the provided value.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set((String)mapVal[0], (String)mapVal[1])` // Set field with (String)mapVal[0] as key, (String)mapVal[1] as value |

**Block 7** — [SET: Template Array Wrapping] `(L768–L770)`

Wrap the single `CAANMsg` template in a `CAANMsg[]` array and register it in the paramMap under the `TEMPLATE_LIST_KEY`. This array structure is consumed by the CBS invocation framework.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` // Create array to hold CBS templates |
| 2 | SET | `templates[0] = template` // Place the constructed template at index 0 |
| 3 | EXEC | `paramMap.put(TEMPLATE_LIST_KEY, templates)` // Add template array to paramMap |

**Block 8** — [RETURN] `(L772)`

Return the fully assembled parameter map to the caller. The map contains:
- `TRANZACTION_ID_KEY` — Transaction ID
- `USECASE_ID_KEY` — Use case ID
- `OPERATION_ID_KEY` — Operation ID
- `CALL_TYPE_KEY` — Call type
- `CLIENT_HOST_NAME_KEY` — Client hostname
- `CLIENT_IP_ADDRESS_KEY` — Client IP address
- `INVOKE_GAMEN_ID_KEY` — Screen ID
- `OPERATOR_ID_KEY` — Operator ID
- `TEMPLATE_LIST_KEY` — CAANMsg array containing the constructed CBS message template

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap` // Return assembled CBS invocation payload |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `editInMsg` | Method | Incoming message mapping processing (上りマッピング処理) — Assembles a CBS invocation payload from request parameters |
| `svcIfId` | Field / Parameter | Service interface ID — Unique identifier for a CBS endpoint, used to select the correct message template file |
| `funcCode` | Field / Parameter | Function code (機能コード) — Identifies the specific business operation within a CBS (e.g., registration, inquiry, cancellation) |
| `mapData` | Field / Parameter | Mapping data — 2D array of field name/value pairs representing business data to be sent to the CBS |
| `CAANMsg` | Class | Message template class — Framework class for constructing CBS request/response messages. Supports `set()` for setting field values and `setNull()` for nullifying fields |
| `IRequestParameterReadWrite` | Interface | Request parameter interface — Provides access to telecom request header data and control map data |
| `TRANZACTION_ID_KEY` | Constant | Transaction ID key — Uniquely identifies a single request transaction in the telecom system |
| `USECASE_ID_KEY` | Constant | Use case ID key — Identifies the use case context of the request |
| `OPERATION_ID_KEY` | Constant | Operation ID key — Identifies the specific operation being performed |
| `CALL_TYPE_KEY` | Constant | Call type key — Classifies the type of service call (e.g., synchronous, asynchronous) |
| `CLIENT_HOST_NAME_KEY` | Constant | Client hostname key — The hostname of the requesting client |
| `CLIENT_IP_ADDRESS_KEY` | Constant | Client IP address key — The IP address of the requesting client |
| `INVOKE_GAMEN_ID_KEY` | Constant | Invoke screen ID key — The screen ID from which the request originated (画面ID) |
| `TEMPLATE_ID_KEY` | Constant | Template ID key — The CBS message template identifier |
| `FUNC_CODE_KEY` | Constant | Function code key — The function code within the CBS message |
| `OPERATOR_ID_KEY` | Constant | Operator ID key — The ID of the operator performing the action |
| `OPERATE_DATE_KEY` | Constant | Operate date key — The date of the operation (運用日付) |
| `OPERATE_DATETIME_KEY` | Constant | Operate datetime key — The date/time of the operation (運用日時) |
| `TEMPLATE_LIST_KEY` | Constant | Template list key — The key for the CAANMsg array in the paramMap |
| `SCControlMapKeys.REQ_HOSTNAME` | Constant | Request hostname key — Control map key for the client hostname |
| `SCControlMapKeys.REQ_HOSTIP` | Constant | Request host IP key — Control map key for the client IP address |
| `SCControlMapKeys.REQ_VIEWID` | Constant | Request view/screen ID key — Control map key for the originating screen ID |
| `SCControlMapKeys.OPERATOR_ID` | Constant | Operator ID control map key |
| `SCControlMapKeys.OPE_DATE` | Constant | Operational date control map key |
| `SCControlMapKeys.OPE_TIME` | Constant | Operational time control map key |
| CBS | Acronym | Call-Based Service — A service component invoked via RPC/RMI-style calls in the Fujitsu Futurity platform |
| SC | Acronym | Service Component — A backend service module |
| CC | Acronym | Common Component — A shared business logic component |
| CAANMsg | Class | Message template framework class used for CBS request/response message construction |
| 電文ヘッダ | Japanese term | Telegram header — The header section of a telecom request containing metadata like transaction ID, use case ID, etc. |
| ユーザエリア | Japanese term | User area — The section of the request containing user-provided or control map data (コントローラマップ) |
| 依頼先ホスト名 | Japanese term | Request destination hostname — The hostname of the client making the request |
| 依頼元IPアドレス | Japanese term | Request source IP address — The IP address of the client making the request |
| 依頼元画面ID | Japanese term | Request source screen ID — The screen from which the request was initiated |
| オペレータID | Japanese term | Operator ID — The ID of the user performing the operation |
| テンプレートID | Japanese term | Template ID — The identifier for the CBS message template |
| 運用日付 | Japanese term | Operational date — The date of the operation |
| 運用日時 | Japanese term | Operational date/time — The full date and time of the operation |
