# Business Logic — JKKSvkeiShosaChkCC.editInMsg() [71 LOC]

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

## 1. Role

### JKKSvkeiShosaChkCC.editInMsg()

This method constructs a standardized inbound message envelope for CBS (Core Business System) operations. It acts as a shared utility that assembles common operational metadata (transaction ID, use case ID, operation ID, call type, client hostname, client IP, screen ID, and operator ID) into a parameter map, then builds a `CAANMsg` message template loaded from a resource bundle named after the service interface. The method implements a **builder pattern** — it gathers request-level context from the `IRequestParameterReadWrite` parameter and the `mappingData` array, configures the message template with both the extracted control metadata and the field-level mappings, wraps the resulting template in an array, and returns the complete parameter map for downstream CBS invocation. Its role in the larger system is as a **message assembly intermediary**: it bridges screen/control-layer request context with CBS-side message templates, enabling any CBS interface to receive a pre-populated message without repeating boilerplate metadata extraction.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg call"])
    
    START --> A["Initialize paramMap HashMap"]
    A --> B["Set TRANSACTION_ID_KEY from param.getTelegramID()"]
    B --> C["Set USECASE_ID_KEY from param.getUsecaseID()"]
    C --> D["Set OPERATION_ID_KEY from param.getOperationID()"]
    D --> E["Set CALL_TYPE_KEY from param.getCallType()"]
    E --> F["Set CLIENT_HOST_NAME_KEY from controlMapData"]
    F --> G["Set CLIENT_IP_ADDRESS_KEY from controlMapData"]
    G --> H["Set INVOKE_GAMEN_ID_KEY from controlMapData"]
    H --> I["Set OPERATOR_ID_KEY from controlMapData"]
    I --> J["Extract svcIf from mappingData[0][1]"]
    J --> K["Create CAANMsg template with resource bundle"]
    K --> L["Set template OPERATOR_ID_KEY"]
    L --> M["Set template OPERATE_DATE_KEY"]
    M --> N["Set template OPERATE_DATETIME_KEY"]
    N --> O["Loop: for i from 0 to mappingData.length"]
    O --> P{"mappingData[i][1] instanceof CAANMsg[]"}
    P --> |true| Q["template.set(key, CAANMsg[])"]
    P --> |false| R{"mappingData[i][1] is empty string?"}
    R --> |true| S["template.setNull(key)"]
    R --> |false| T["template.set(key, value)"]
    Q --> U["i++"]
    S --> U
    T --> U
    U --> V{"i < mappingData.length?"}
    V --> |true| P
    V --> |false| W["Wrap template in CAANMsg[] array"]
    W --> X["Set TEMPLATE_LIST_KEY in paramMap"]
    X --> Y["Return paramMap"]
    Y --> END(["Return"])

    style START fill:#e1f5fe
    style END fill:#e1f5fe
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying all control-context metadata — transaction ID, use case ID, operation ID, call type, and the control map (hostname, IP, screen ID, operator ID). It serves as the single source of operational context passed through the CBS invocation pipeline. |
| 2 | `mappingData` | `Object[][]` | A 2D mapping array that configures the message template. Row 0, column 1 holds the service interface name (`svcIf`) used to load the correct resource bundle. Subsequent rows map field keys (`mappingData[i][0]`) to values or nested `CAANMsg[]` arrays (`mappingData[i][1]`), defining which message template fields to populate, set to null, or pass as nested messages. |

**Instance/External State:**
- `JCMConstants.*` — Constant key identifiers for transaction ID, use case ID, operation ID, call type, client hostname, client IP, invoke screen ID, operator ID, template list, operate date, and operate datetime.
- `SCControlMapKeys.*` — Constant keys for control map lookups: `REQ_HOSTNAME`, `REQ_HOSTIP`, `REQ_VIEWID`, `OPERATOR_ID`, `OPE_DATE`, `OPE_TIME`.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `JKKejbCallTypeChecker.getCallType` | JKKejbCallTypeChecker | - | Calls `getCallType` in `JKKejbCallTypeChecker` |
| - | `JCKMvnoCustInfoAddCC.setNull` | JCKMvnoCustInfoAddCC | - | Called via `template.setNull()` in the loop (null-setting on message template field) |
| - | `JKKKapKeiInfoCancelCC.setNull` | JKKKapKeiInfoCancelCC | - | Called via `template.setNull()` in the loop (null-setting on message template field) |
| - | `JKKKikiModelKappuInfoCC.setNull` | JKKKikiModelKappuInfoCC | - | Called via `template.setNull()` in the loop (null-setting on message template field) |
| - | `JKKKisnUwHmdkAddCC.setNull` | JKKKisnUwHmdkAddCC | - | Called via `template.setNull()` in the loop (null-setting on message template field) |
| - | `JKKMvnoSvcKeiStaAddCC.setNull` | JKKMvnoSvcKeiStaAddCC | - | Called via `template.setNull()` in the loop (null-setting on message template field) |

### Method calls within `editInMsg`:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `param.getTelegramID()` | - | - | Reads transaction ID from the request parameter |
| R | `param.getUsecaseID()` | - | - | Reads use case ID from the request parameter |
| R | `param.getOperationID()` | - | - | Reads operation ID from the request parameter |
| R | `param.getCallType()` | - | - | Reads service call type classification from the request parameter |
| R | `param.getControlMapData(key)` | - | - | Reads control map values (hostname, IP, screen ID, operator ID, date, time) from the request parameter |
| - | `CAANMsg.<constructor>` | - | - | Creates a new CAANMsg instance, loading a resource bundle named `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg` |
| - | `template.set(key, value)` | - | - | Populates message template fields with values from mappingData or control metadata |
| - | `template.set(key, CAANMsg[])` | - | - | Sets nested message arrays into the template |
| - | `template.setNull(key)` | - | - | Marks a template field as null (cleared) |
| - | `paramMap.put(key, value)` | - | - | Builds the output parameter map with transaction metadata and wrapped template array |

## 5. Dependency Trace

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

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

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

## 6. Per-Branch Detail Blocks

**Block 1** — [INITIALIZATION] (L1931)

> Creates the parameter map and populates it with common metadata from the request telegram header.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` |
| 2 | EXEC | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` | // [-> JCMConstants.TRANZACTION_ID_KEY="TRANZACTION_ID_KEY"] (Sets transaction ID from telegram header) |
| 3 | EXEC | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` | // [-> JCMConstants.USECASE_ID_KEY="USECASE_ID_KEY"] (Sets use case ID from telegram header) |
| 4 | EXEC | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` | // [-> JCMConstants.OPERATION_ID_KEY="OPERATION_ID_KEY"] (Sets operation ID from telegram header) |
| 5 | EXEC | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` | // [-> JCMConstants.CALL_TYPE_KEY="CALL_TYPE_KEY"] (Sets service call type classification from telegram header) |

**Block 2** — [INITIALIZATION cont.] (L1943)

> Populates the parameter map with operational metadata from the control map (client context).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME))` | // [-> JCMConstants.CLIENT_HOST_NAME_KEY="CLIENT_HOST_NAME_KEY"] [-> SCControlMapKeys.REQ_HOSTNAME="REQ_HOSTNAME"] (Sets client hostname) |
| 2 | EXEC | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTIP))` | // [-> JCMConstants.CLIENT_IP_ADDRESS_KEY="CLIENT_IP_ADDRESS_KEY"] [-> SCControlMapKeys.REQ_HOSTIP="REQ_HOSTIP"] (Sets client IP address) |
| 3 | EXEC | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, param.getControlMapData(SCControlMapKeys.REQ_VIEWID))` | // [-> JCMConstants.INVOKE_GAMEN_ID_KEY="INVOKE_GAMEN_ID_KEY"] [-> SCControlMapKeys.REQ_VIEWID="REQ_VIEWID"] (Sets invoking screen ID) |
| 4 | EXEC | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` | // [-> JCMConstants.OPERATOR_ID_KEY="OPERATOR_ID_KEY"] [-> SCControlMapKeys.OPERATOR_ID="OPERATOR_ID"] (Sets operator ID) |

**Block 3** — [INITIALIZATION cont.] (L1952-L1953)

> Extracts the service interface name and creates the CAANMsg template from a resource bundle.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcIf = (String) mappingData[0][1]` | // [-> SCControlMapKeys.REQ_HOSTIP="REQ_HOSTIP"] (Extracts service interface name from mappingData row 0) |
| 2 | SET | `template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf))` | // Loads resource bundle for the specific CBS service interface |

**Block 4** — [INITIALIZATION cont.] (L1955-L1962)

> Configures the message template with operational metadata (operator ID, operate date, operate datetime).

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` | // [-> JCMConstants.OPERATOR_ID_KEY="OPERATOR_ID_KEY"] [-> SCControlMapKeys.OPERATOR_ID="OPERATOR_ID"] (Sets operator ID on template) |
| 2 | EXEC | `template.set(JCMConstants.OPERATE_DATE_KEY, param.getControlMapData(SCControlMapKeys.OPE_DATE))` | // [-> JCMConstants.OPERATE_DATE_KEY="OPERATE_DATE_KEY"] [-> SCControlMapKeys.OPE_DATE="OPE_DATE"] (Sets operate date on template) |
| 3 | EXEC | `template.set(JCMConstants.OPERATE_DATETIME_KEY, param.getControlMapData(SCControlMapKeys.OPE_TIME))` | // [-> JCMConstants.OPERATE_DATETIME_KEY="OPERATE_DATETIME_KEY"] [-> SCControlMapKeys.OPE_TIME="OPE_TIME"] (Sets operate datetime on template) |

**Block 5** — [FOR LOOP] (L1965)

> Iterates over all rows in `mappingData` (starting from index 1, since row 0 is the service interface) to populate the message template with field-level data.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` | // Loop initialization |
| 2 | EXEC | `template.set((String) mappingData[i][0], (CAANMsg[]) mappingData[i][1])` | // Branch: mappingData[i][1] is CAANMsg[] — nested message array |
| 3 | EXEC | `template.setNull((String) mappingData[i][0])` | // Branch: mappingData[i][1] equals "" (empty string) — field marked as null |
| 4 | EXEC | `template.set((String) mappingData[i][0], mappingData[i][1])` | // Branch: mappingData[i][1] is a regular value — standard field set |
| 5 | SET | `i++` | // Increment loop counter |

**Block 5.1** — [IF — Branch A] `(mappingData[i][1] instanceof CAANMsg[])` (L1967-L1969)

> If the mapped value is a nested array of `CAANMsg` objects, set it as a nested message structure in the template. This supports complex message fields that contain their own sub-message hierarchies.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set((String) mappingData[i][0], (CAANMsg[]) mappingData[i][1])` | // Sets nested CAANMsg array as message field value |

**Block 5.2** — [ELSE — Branch B: IF] `("".equals(mappingData[i][1]))` (L1972-L1974)

> If the mapped value is an empty string, explicitly set the field to null on the template. This allows the template to clear or omit a field.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.setNull((String) mappingData[i][0])` | // Clears the field on the message template, marking it as null |

**Block 5.3** — [ELSE — Branch C] (L1975-L1977)

> For all other cases (non-null, non-empty, non-CAANMsg[] values), set the field with its value directly.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set((String) mappingData[i][0], mappingData[i][1])` | // Populates the template field with the mapped value |

**Block 6** — [INITIALIZATION] (L1980-L1984)

> Wraps the configured template in a `CAANMsg[]` array and stores it in the parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` | // Creates a single-element CAANMsg array |
| 2 | SET | `templates[0] = template` | // Assigns the configured template as the sole element |
| 3 | EXEC | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` | // [-> JCMConstants.TEMPLATE_LIST_KEY="TEMPLATE_LIST_KEY"] (Stores wrapped template array in parameter map) |

**Block 7** — [RETURN] (L1986)

> Returns the fully constructed parameter map containing all transaction metadata and the message template.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap` | // Returns assembled inbound message parameters |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `param` | Field | Request parameter object — carries all request-level context (transaction ID, use case ID, operation ID, call type, control map data) passed between CBS components |
| `mappingData` | Field | 2D mapping array — row 0 defines the service interface; subsequent rows define message template field-key to value mappings |
| `svcIf` | Field | Service Interface name — the identifier used to locate the correct resource bundle (e.g., `EOCBSMsg`) for message template loading |
| `CAANMsg` | Class | CAAN Message — a message framework class used in the Fujitsu CBS framework to construct and manage message templates loaded from resource bundles |
| `paramMap` | Field | Parameter map — the output HashMap containing all metadata keys and the wrapped template array, passed to downstream CBS processing |
| `TRANZACTION_ID_KEY` | Constant | Transaction ID key — identifies the unique transaction for audit and correlation purposes (note: spelling as defined in JCMConstants) |
| `USECASE_ID_KEY` | Constant | Use Case ID key — identifies which business use case is executing |
| `OPERATION_ID_KEY` | Constant | Operation ID key — identifies the specific operation within the use case |
| `CALL_TYPE_KEY` | Constant | Call Type key — classifies the service call type for routing and processing decisions |
| `CLIENT_HOST_NAME_KEY` | Constant | Client Host Name key — the hostname of the requesting client system |
| `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 that initiated the CBS call (GAMEN = Japanese for "screen") |
| `OPERATOR_ID_KEY` | Constant | Operator ID key — the ID of the user/operator performing the operation |
| `TEMPLATE_LIST_KEY` | Constant | Template List key — key under which the CAANMsg template array is stored in the parameter map |
| `OPERATE_DATE_KEY` | Constant | Operate Date key — the business date for the operation |
| `OPERATE_DATETIME_KEY` | Constant | Operate Datetime key — the full datetime for the operation |
| `REQ_HOSTNAME` | Constant | Request Hostname — control map key for client hostname lookup |
| `REQ_HOSTIP` | Constant | Request Host IP — control map key for client IP address lookup |
| `REQ_VIEWID` | Constant | Request View ID — control map key for screen/view ID lookup |
| `OPE_DATE` | Constant | Operation Date — control map key for operation date lookup |
| `OPE_TIME` | Constant | Operation Time — control map key for operation time lookup |
| CBS | Acronym | Core Business System — the backend enterprise system that processes business transactions |
| CAAN | Acronym | Common Application Access Network — the message framework used for CBS message construction |
| resource bundle | Technical term | Internationalized message definition file (`.properties` or equivalent) loaded by CAANMsg to provide field definitions and error messages |
