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

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

## 1. Role

### JKKSmtvlYoSanshoFukaInfCC.editInMsg()

This method performs **upstream message mapping** (上りマッピング処理) — it constructs an inbound request message for a service interface by assembling metadata, control information, and business data into a structured parameter map. It is a shared utility method called by the same class (`JKKSmtvlYoSanshoFukaInfCC`) from `callSC()` and `getInvokeCBS()`, serving as the message-construction step within the service call chain. The method uses the **Builder design pattern** — it creates a `CAANMsg` template instance, populates it with header fields and business fields, then wraps it into a template array inside the output parameter map. Its role in the larger system is to transform raw incoming request parameters and a flat field-value table (`mapData`) into a properly structured CBS (Component-Based Service) inbound message, with all control/metadata fields resolved from the request context.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg(param, svcIfId, funcCode, mapData)"])
    CREATE_MAP["Create paramMap = new HashMap"]
    
    GET_TELEGRAM["param.getTelegramID()"]
    GET_USECASE["param.getUsecaseID()"]
    GET_OPERATION["param.getOperationID()"]
    GET_CALLTYPE["param.getCallType()"]
    
    PUT_TELEGRAM["paramMap.put(TRANZACTION_ID_KEY, telegramID)"]
    PUT_USECASE["paramMap.put(USECASE_ID_KEY, usecaseID)"]
    PUT_OPERATION["paramMap.put(OPERATION_ID_KEY, operationID)"]
    PUT_CALLTYPE["paramMap.put(CALL_TYPE_KEY, callType)"]
    
    GET_HOST["param.getControlMapData(REQ_HOSTNAME)"]
    GET_IP["param.getControlMapData(REQ_HOSTIP)"]
    GET_SCREEN["param.getControlMapData(REQ_VIEWID)"]
    GET_OPERATOR["param.getControlMapData(OPERATOR_ID)"]
    
    PUT_HOST["paramMap.put(CLIENT_HOST_NAME_KEY, hostname)"]
    PUT_IP["paramMap.put(CLIENT_IP_ADDRESS_KEY, clientIP)"]
    PUT_SCREEN["paramMap.put(INVOKE_GAMEN_ID_KEY, screenID)"]
    PUT_OPERATOR["paramMap.put(OPERATOR_ID_KEY, operatorId)"]
    
    CREATE_TEMPLATE["Create CAANMsg template = new CAANMsg(eo.ejb.cbs.cbsmsg.<svcIfId>CBSMsg)"]
    SET_TEMPLATE_ID["template.set(TEMPLATE_ID_KEY, svcIfId)"]
    SET_FUNC_CODE["template.set(FUNC_CODE_KEY, funcCode)"]
    SET_OPERATOR_TPL["template.set(OPERATOR_ID_KEY, operatorId)"]
    SET_OPE_DATE["template.set(OPERATE_DATE_KEY, operateDate)"]
    SET_OPE_DATETIME["template.set(OPERATE_DATETIME_KEY, operateDateTime)"]
    
    I_INIT["i = 0"]
    I_CHECK["i < mapData.length?"]
    GET_MAPVAL["mapVal = mapData[i]"]
    CHECK_EMPTY["mapVal[1].equals(empty string)?"]
    SET_NULL["template.setNull((String)mapVal[0])"]
    SET_VAL["template.set((String)mapVal[0], (String)mapVal[1])"]
    I_INC["i++"]
    
    CREATE_ARRAY["templates = new CAANMsg[1]"]
    FILL_ARRAY["templates[0] = template"]
    PUT_TEMPLATES["paramMap.put(TEMPLATE_LIST_KEY, templates)"]
    RETURN_MAP["return paramMap"]
    
    START --> CREATE_MAP
    CREATE_MAP --> GET_TELEGRAM
    GET_TELEGRAM --> PUT_TELEGRAM
    PUT_TELEGRAM --> GET_USECASE
    GET_USECASE --> PUT_USECASE
    PUT_USECASE --> GET_OPERATION
    GET_OPERATION --> PUT_OPERATION
    PUT_OPERATION --> GET_CALLTYPE
    GET_CALLTYPE --> PUT_CALLTYPE
    PUT_CALLTYPE --> GET_HOST
    GET_HOST --> PUT_HOST
    PUT_HOST --> GET_IP
    GET_IP --> PUT_IP
    PUT_IP --> GET_SCREEN
    GET_SCREEN --> PUT_SCREEN
    PUT_SCREEN --> GET_OPERATOR
    GET_OPERATOR --> CREATE_TEMPLATE
    CREATE_TEMPLATE --> SET_TEMPLATE_ID
    SET_TEMPLATE_ID --> SET_FUNC_CODE
    SET_FUNC_CODE --> SET_OPERATOR_TPL
    SET_OPERATOR_TPL --> SET_OPE_DATE
    SET_OPE_DATE --> SET_OPE_DATETIME
    SET_OPE_DATETIME --> I_INIT
    I_INIT --> I_CHECK
    I_CHECK -->|true| GET_MAPVAL
    I_CHECK -->|false| CREATE_ARRAY
    GET_MAPVAL --> CHECK_EMPTY
    CHECK_EMPTY -->|true| SET_NULL
    CHECK_EMPTY -->|false| SET_VAL
    SET_NULL --> I_INC
    SET_VAL --> I_INC
    I_INC --> I_CHECK
    CREATE_ARRAY --> FILL_ARRAY
    FILL_ARRAY --> PUT_TEMPLATES
    PUT_TEMPLATES --> RETURN_MAP
```

**Constant Resolution:**
The constants used are from `JCMConstants` and `SCControlMapKeys`, which are imported dependencies. Key constants resolved:

| Constant | Module | Business Meaning |
|----------|--------|------------------|
| `JCMConstants.TRANZACTION_ID_KEY` | JCM | Transaction/Telegram identifier key |
| `JCMConstants.USECASE_ID_KEY` | JCM | Use-case identifier key |
| `JCMConstants.OPERATION_ID_KEY` | JCM | Operation identifier key |
| `JCMConstants.CALL_TYPE_KEY` | JCM | Service call type discriminator |
| `JCMConstants.CLIENT_HOST_NAME_KEY` | JCM | Client hostname key |
| `JCMConstants.CLIENT_IP_ADDRESS_KEY` | JCM | Client IP address key |
| `JCMConstants.INVOKE_GAMEN_ID_KEY` | JCM | Screen/page invocation ID key |
| `JCMConstants.OPERATOR_ID_KEY` | JCM | Operator (user) ID key |
| `JCMConstants.OPERATE_DATE_KEY` | JCM | Operational date key |
| `JCMConstants.OPERATE_DATETIME_KEY` | JCM | Operational datetime key |
| `JCMConstants.TEMPLATE_ID_KEY` | JCM | Template ID key |
| `JCMConstants.FUNC_CODE_KEY` | JCM | Function code key |
| `JCMConstants.TEMPLATE_LIST_KEY` | JCM | Template list (array) key |
| `SCControlMapKeys.REQ_HOSTNAME` | SC | Requested hostname control key |
| `SCControlMapKeys.REQ_HOSTIP` | SC | Requested client IP control key |
| `SCControlMapKeys.REQ_VIEWID` | SC | Requested screen ID control key |
| `SCControlMapKeys.OPERATOR_ID` | SC | Operator ID control key |
| `SCControlMapKeys.OPE_DATE` | SC | Operational date control key |
| `SCControlMapKeys.OPE_TIME` | SC | Operational time control key |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The inbound request parameter object carrying the full request context including transaction metadata (telegram ID, use-case ID, operation ID), call type classification, and control-map data (client hostname, client IP, screen ID, operator ID, operational date/time). It is the primary source of all header-level metadata. |
| 2 | `svcIfId` | `String` | The service interface identifier. Used to dynamically construct the `CAANMsg` message bundle key (format: `"eo.ejb.cbs.cbsmsg." + svcIfId + "CBSMsg"`) — this resolves the i18n message resources for the specific CBS service being invoked. |
| 3 | `funcCode` | `String` | The function code that identifies which business function is being invoked within the service interface. Set directly on the template for downstream CBS routing. |
| 4 | `mapData` | `Object[][]` | A 2D array of field-value pairs where each row is `[fieldName, fieldValue]`. The first column is the field name (String), the second is the field value (String). Used to populate the `CAANMsg` template with business-level fields. |

**External/Instance State Read:**
- None — this method is entirely stateless and depends only on its parameters.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `CAANMsg.<init>(String bundleKey)` | - | - | Creates a new `CAANMsg` message template instance using the service interface bundle key |
| - | `CAANMsg.set(String key, Object value)` | - | - | Sets a field value on the message template |
| - | `CAANMsg.setNull(String key)` | - | - | Marks a field on the message template as null (used when mapData value is empty string) |
| - | `param.getTelegramID()` | - | - | Reads the transaction/telegram ID from the request parameter |
| - | `param.getUsecaseID()` | - | - | Reads the use-case ID from the request parameter |
| - | `param.getOperationID()` | - | - | Reads the operation ID from the request parameter |
| - | `param.getCallType()` | - | - | Reads the service call type from the request parameter |
| - | `param.getControlMapData(String key)` | - | - | Reads control-map data (hostname, IP, screen ID, operator ID, date, time) from the request parameter |

## 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` [-], `set` [-], `set` [-], `set` [-], `set` [-], `set` [-], `set` [-], `set` [-], `set` [-], `set` [-]

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | CBS:JKKSmtvlYoSanshoFukaInfCC | `callSC` -> `editInMsg` | `template.set / setNull [-]` |
| 2 | CBS:JKKSmtvlYoSanshoFukaInfCC | `getInvokeCBS` -> `editInMsg` | `template.set / setNull [-]` |

## 6. Per-Branch Detail Blocks

**Block 1** — [PROCESSING] `(paramMap initialization)` (L452)

> Initializes the outbound parameter map and populates it with transaction-level metadata extracted from the request parameter object.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` |
| 2 | EXEC | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` // 【取得元：電文ヘッド(ヘッド)】電文ID (Source: Message Header) Transaction ID |
| 3 | EXEC | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` // 【取得元：電文ヘッド(ヘッド)】ユーセケースID (Source: Message Header) Use-case ID |
| 4 | EXEC | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` // 【取得元：電文ヘッド(ヘッド)】オペレーションID (Source: Message Header) Operation ID |
| 5 | EXEC | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` // 【取得元：電文ヘッド(ヘッド)】サービス呼び出し区分 (Source: Message Header) Service call type discriminator |

**Block 2** — [PROCESSING] `(control-map data extraction)` (L457)

> Extracts client and operational control metadata from the request's control-map and stores them in the parameter map.

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

**Block 3** — [PROCESSING] `(CAANMsg template creation and header configuration)` (L463)

> Creates a `CAANMsg` template using a dynamically constructed message bundle key based on `svcIfId`, then configures the template header fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg("eo.ejb.cbs.cbsmsg." + svcIfId + "CBSMsg")` // Service interface message bundle |
| 2 | EXEC | `template.set(JCMConstants.TEMPLATE_ID_KEY, svcIfId)` // テンプレートID (Template ID) |
| 3 | EXEC | `template.set(JCMConstants.FUNC_CODE_KEY, funcCode)` // 機能コード (Function code) |
| 4 | SET | `operatorId = param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // 依存元画面のオペレータID (Operator ID from requesting screen) |
| 5 | EXEC | `template.set(JCMConstants.OPERATOR_ID_KEY, operatorId)` // オペレータID (Operator ID) |
| 6 | SET | `operateDate = param.getControlMapData(SCControlMapKeys.OPE_DATE)` // 運用日付 (Operational date) |
| 7 | EXEC | `template.set(JCMConstants.OPERATE_DATE_KEY, operateDate)` // 運用日付 (Operational date) |
| 8 | SET | `operateDateTime = param.getControlMapData(SCControlMapKeys.OPE_TIME)` // 運用日時 (Operational datetime) |
| 9 | EXEC | `template.set(JCMConstants.OPERATE_DATETIME_KEY, operateDateTime)` // 運用日時 (Operational datetime) |

**Block 4** — [FOR LOOP] `(iterate over mapData rows)` (L475)

> Iterates over each row of `mapData`, setting or nulling fields on the template based on whether the value is empty.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` |
| 2 | SET | `mapVal = mapData[i]` |
| 3 | IF | `"".equals(mapVal[1])` (empty string check) |
| 4 | EXEC | `template.setNull((String)mapVal[0])` // Field set to null |
| 5 | EXEC | `template.set((String)mapVal[0], (String)mapVal[1])` // Field set to value |
| 6 | SET | `i++` |
| 7 | LOOP | `i < mapData.length` |

**Block 4.1** — [ELSE-IF: value is non-empty] `(mapVal[1] is not empty string)` (L498)

> When the field value in `mapData` is a non-empty string, the field name and value are both set on the `CAANMsg` template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `fieldName = (String)mapVal[0]` |
| 2 | SET | `fieldValue = (String)mapVal[1]` |
| 3 | EXEC | `template.set(fieldName, fieldValue)` |

**Block 4.0** — [IF: value is empty] `(mapVal[1].equals(""))` (L496)

> When the field value in `mapData` is an empty string, the field is explicitly nullified on the `CAANMsg` template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `fieldName = (String)mapVal[0]` |
| 2 | EXEC | `template.setNull(fieldName)` |

**Block 5** — [PROCESSING] `(template array wrapping and return)` (L502)

> Wraps the single `CAANMsg` template into an array, adds it to the parameter map, and returns it.

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

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `editInMsg` | Method | Upstream (inbound) message mapping — constructs CBS service inbound request messages |
| `svcIfId` | Field | Service Interface ID — identifies which CBS service interface is being invoked |
| `funcCode` | Field | Function Code — identifies the specific business function within a service interface |
| `mapData` | Field | Mapping Data — 2D array of [fieldName, fieldValue] pairs for business-level fields |
| `paramMap` | Field | Parameter Map — the constructed HashMap output carrying all request context for downstream CBS invocation |
| `CAANMsg` | Class | CAAN (Common Application Architecture for Async Notifications) Message — a message template used to build CBS service request/response payloads |
| `TRANZACTION_ID_KEY` | Constant | Transaction/Telegram ID key — uniquely identifies the message exchange session (note: misspelled as "TRANZACTION" in source) |
| `USECASE_ID_KEY` | Constant | Use-case ID key — identifies the business use-case context |
| `OPERATION_ID_KEY` | Constant | Operation ID key — identifies the specific operation being performed |
| `CALL_TYPE_KEY` | Constant | Call Type key — distinguishes the service call type (e.g., synchronous, asynchronous) |
| `CLIENT_HOST_NAME_KEY` | Constant | Client Hostname key — hostname of the requesting client |
| `CLIENT_IP_ADDRESS_KEY` | Constant | Client IP Address key — IP address of the requesting client |
| `INVOKE_GAMEN_ID_KEY` | Constant | Invoke Screen ID key — the screen from which the service was invoked |
| `OPERATOR_ID_KEY` | Constant | Operator ID key — the user ID of the operator performing the action |
| `OPERATE_DATE_KEY` | Constant | Operate Date key — the operational date |
| `OPERATE_DATETIME_KEY` | Constant | Operate Datetime key — the operational date and time |
| `TEMPLATE_ID_KEY` | Constant | Template ID key — identifies the message template |
| `FUNC_CODE_KEY` | Constant | Function Code key — the function code for CBS routing |
| `TEMPLATE_LIST_KEY` | Constant | Template List key — holds the array of `CAANMsg` templates |
| `REQ_HOSTNAME` | Constant | Requested Hostname — control map key for client hostname |
| `REQ_HOSTIP` | Constant | Requested Host IP — control map key for client IP address |
| `REQ_VIEWID` | Constant | Requested View ID — control map key for source screen ID |
| `OPE_DATE` | Constant | Operate Date — control map key for operational date |
| `OPE_TIME` | Constant | Operate Time — control map key for operational time |
| `JCMConstants` | Class | Java Common Message Constants — central constant definitions for message keys |
| `SCControlMapKeys` | Class | Service Component Control Map Keys — constant definitions for control-map data keys |
| `RequestParameterException` | Exception | Exception thrown when request parameter processing fails |
| `上りマッピング処理` | Japanese term | Upstream (inbound) mapping processing — the business operation this method performs |
| `電文ヘッド` | Japanese term | Message Header — the header portion of an electronic message containing routing and metadata fields |
| `ユーザエリア` | Japanese term | User Area — the user-defined portion of the message context |
| `コントローラマップ` | Japanese term | Control Map — a map of operational control data (hostname, IP, screen ID, operator, date/time) |
| `電文ID` | Japanese term | Transaction/Telegram ID — unique identifier for the message exchange |
| `ユーセケースID` | Japanese term | Use-case ID — identifies the business use-case |
| `オペレーションID` | Japanese term | Operation ID — identifies the operation |
| `サービス呼び出し区分` | Japanese term | Service call type discriminator — classifies the type of service call |
| `依存先ホスト名` | Japanese term | Requested/destination hostname — the hostname of the service target |
| `依存元IPアドレス` | Japanese term | Request source IP address — the IP address of the originating client |
| `依存元画面ID` | Japanese term | Request source screen ID — the screen from which the request originated |
| `オペレータID` | Japanese term | Operator ID — the user performing the action |
| `運用日付` | Japanese term | Operational date — the date of the operation |
| `運用日時` | Japanese term | Operational datetime — the date and time of the operation |
| `機能コード` | Japanese term | Function code — identifies the business function within a service |
| `CBS` | Acronym | Component-Based Service — the service invocation architecture pattern |
| `CC` | Acronym | Common Component — shared infrastructure code, not screen-specific |
