# Business Logic — JKKCmpMalwareBlockingApiCC.editInMsg() [70 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `com.fujitsu.futurity.bp.custom.common.JKKCmpMalwareBlockingApiCC` |
| Layer | Common Component (CC — shared business logic helpers) |
| Module | `common` (Package: `com.fujitsu.futurity.bp.custom.common`) |

## 1. Role

### JKKCmpMalwareBlockingApiCC.editInMsg()

This method is the **incoming message builder** for service component (SC) invocations within the malware-blocking API layer. It assembles a fully populated `HashMap<String, Object>` request envelope (`paramMap`) that feeds into `callSC()` — the framework's service component invocation mechanism. The map combines three categories of data: (1) header metadata extracted directly from the request parameter object (`RequestParameterReadWrite`), including transaction ID, usecase ID, operation ID, and call type; (2) runtime control context pulled from the control map (client hostname, IP address, screen ID, operator ID); and (3) a service-specific message template (`CAANMsg`) populated from `mappingData` — a structured mapping array that encodes the key-value pairs required by the target SC's CBS message contract. This method implements the **builder** design pattern, transforming generic mapping data into a strongly-typed SC request envelope ready for framework dispatch. Its role in the larger system is as a **shared utility** called from the `callSC()` method within the same class, acting as the bridge between screen-level request parameters and the downstream service component execution layer. It supports any service interface whose CBS message bundle follows the naming convention `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg(params)"])
    STEP1["Create paramMap HashMap"]
    STEP2["Put transaction ID from param.getTelegramID()"]
    STEP3["Put usecase ID from param.getUsecaseID()"]
    STEP4["Put operation ID from param.getOperationID()"]
    STEP5["Put call type from param.getCallType()"]
    STEP6["Put client hostname from control map SCControlMapKeys.REQ_HOSTNAME"]
    STEP7["Put client IP from control map SCControlMapKeys.REQ_HOSTIP"]
    STEP8["Put screen ID from control map SCControlMapKeys.REQ_VIEWID"]
    STEP9["Put operator ID from control map SCControlMapKeys.OPERATOR_ID"]
    STEP10["Extract svcIf from mappingData[0][1]"]
    STEP11["Create CAANMsg template with bundle eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg"]
    STEP12["Set operator ID on template"]
    STEP13["Set operate date on template"]
    STEP14["Set operate datetime on template"]
    STEP15["Loop: for each row i in mappingData"]
    COND1{"mappingData[i][1] == null or empty?"}
    STEP15NULL["template.setNull(mappingData[i][0])"]
    COND2{"mappingData[i][1] is Array?"}
    STEP15ARRAY["template.set(key, (CAANMsg[])value)"]
    STEP15SINGLE["template.set(key, value)"]
    STEP16["Wrap template in CAANMsg[] array"]
    STEP17["Put template array into paramMap as TEMPLATE_LIST_KEY"]
    STEP18["Return paramMap"]
    END(["editInMsg Returns"])

    START --> STEP1
    STEP1 --> STEP2
    STEP2 --> STEP3
    STEP3 --> STEP4
    STEP4 --> STEP5
    STEP5 --> STEP6
    STEP6 --> STEP7
    STEP7 --> STEP8
    STEP8 --> STEP9
    STEP9 --> STEP10
    STEP10 --> STEP11
    STEP11 --> STEP12
    STEP12 --> STEP13
    STEP13 --> STEP14
    STEP14 --> STEP15
    STEP15 --> COND1
    COND1 -->|true| STEP15NULL
    COND1 -->|false| COND2
    STEP15NULL --> NEXT
    COND2 -->|true| STEP15ARRAY
    COND2 -->|false| STEP15SINGLE
    STEP15ARRAY --> NEXT
    STEP15SINGLE --> NEXT
    NEXT{More rows?}
    NEXT -->|yes| STEP15
    NEXT -->|no| STEP16
    STEP16 --> STEP17
    STEP17 --> STEP18
    STEP18 --> END
```

**CRITICAL — Constant Resolution:**

| Constant | Value | Business Meaning |
|----------|-------|-----------------|
| `JCMConstants.TRANZACTION_ID_KEY` | (framework-defined string key) | Transaction ID key — unique identifier for the service call session |
| `JCMConstants.USECASE_ID_KEY` | (framework-defined string key) | Usecase ID key — identifies the business usecase |
| `JCMConstants.OPERATION_ID_KEY` | (framework-defined string key) | Operation ID key — identifies the specific operation within the usecase |
| `JCMConstants.CALL_TYPE_KEY` | (framework-defined string key) | Call type key — identifies the type of service call (e.g., CBS, SOD) |
| `JCMConstants.CLIENT_HOST_NAME_KEY` | (framework-defined string key) | Client hostname key — source machine name |
| `JCMConstants.CLIENT_IP_ADDRESS_KEY` | (framework-defined string key) | Client IP address key — source machine IP |
| `JCMConstants.INVOKE_GAMEN_ID_KEY` | (framework-defined string key) | Screen ID key — originating screen identifier |
| `JCMConstants.OPERATOR_ID_KEY` | (framework-defined string key) | Operator ID key — user executing the operation |
| `JCMConstants.OPERATE_DATE_KEY` | (framework-defined string key) | Operate date key — effective processing date |
| `JCMConstants.OPERATE_DATETIME_KEY` | (framework-defined string key) | Operate datetime key — effective processing timestamp |
| `JCMConstants.TEMPLATE_LIST_KEY` | (framework-defined string key) | Template list key — holds the CAANMsg array for the SC |
| `SCControlMapKeys.REQ_HOSTNAME` | (framework-defined string key) | Requested hostname control map key |
| `SCControlMapKeys.REQ_HOSTIP` | (framework-defined string key) | Requested host IP control map key |
| `SCControlMapKeys.REQ_VIEWID` | (framework-defined string key) | Requested screen/view ID control map key |
| `SCControlMapKeys.OPERATOR_ID` | (framework-defined string key) | Operator ID control map key |

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying the full context of the incoming service call, including the transaction/session identifier (`telegramID`), the business usecase identifier, the operation identifier, the call type (determining the invocation path), and a control map containing runtime metadata such as client hostname, IP, screen ID, and operator ID. |
| 2 | `mappingData` | `Object[][]` | A 2D mapping array that encodes the key-value pairs for the target service component's message. Each row `[i][0]` is a string key (the CBS message field name), and each row `[i][1]` is the corresponding value — which may be a scalar, a `CAANMsg[]` array (for nested message structures), `null`, or an empty string. The first row (`mappingData[0]`) also provides the `svcIf` (service interface name) used to construct the resource bundle key for message localization. |

## 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` |
| R | `JKKejbCallTypeChecker.getCallType` | JKKejbCallTypeChecker | - | Calls `getCallType` in `JKKejbCallTypeChecker` |

### Method-specific CRUD analysis:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `CAANMsg.set(String, Object)` | - | - | Sets a key-value pair on the CAANMsg template (UPDATE pattern within the message envelope) |
| - | `CAANMsg.setNull(String)` | - | - | Sets a field to null on the CAANMsg template for null/empty mapping values |
| - | `CAANMsg` constructor | - | - | Creates a new CAANMsg instance using a resource bundle key for message localization |

**Classification Notes:** This method is purely a **message construction/assembly** method. It does not perform any direct CRUD operations on databases. Instead, it builds the in-message (`inMsg`) that is passed to `callSC()` — the actual CRUD execution occurs in the downstream service component. The `CAANMsg.set()` and `CAANMsg.setNull()` calls modify the in-memory message envelope structure, which is an UPDATE-style operation on the transient message object.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 83 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:JKKCmpMalwareBlockingApiCC.callSC() | `callSC(handle, scCall, param, fixedText, inMsg, contents)` -> `editInMsg(param, mappingData)` | `callSC [R] downstream CBS` |

**Call Chain Details:**
- `callSC()` is the central SC invocation dispatcher within `JKKCmpMalwareBlockingApiCC`. It calls `editInMsg()` to build the request envelope, then passes the result to the framework's `ServiceComponentRequestInvoker`.
- The downstream CBS (e.g., `EKK0081A010CBS`, `EKK0091A010CBS`, `EKK0091C040CBS`, `EKK1091D010CBS`, `EKK0011D020CBS`, `EKK0021C060CBS`) executes the actual database operations — but these are NOT terminal operations *of* `editInMsg()`. `editInMsg()` itself is purely data assembly with no direct DB interaction.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET] `paramMap` initialization (L742)

> Initializes the request parameter map that will serve as the SC invocation envelope.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` // Creates the request envelope |

**Block 2** — [EXEC] Header metadata extraction from param (L745–L752)

> Extracts core session and call metadata from the request parameter object. These values identify the transaction context for audit and routing purposes.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` | [-> "Transaction ID from the request"] |
| 2 | EXEC | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` | [-> "Business usecase identifier"] |
| 3 | EXEC | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` | [-> "Specific operation within the usecase"] |
| 4 | EXEC | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` | [-> "Call type classification (e.g., CBS)"] |

**Block 3** — [EXEC] Control context extraction (L755–L762)

> Extracts runtime control metadata from the control map. These values identify the calling client, network, and operator for audit and routing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME))` | [-> Client hostname] |
| 2 | EXEC | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTIP))` | [-> Client IP address] |
| 3 | EXEC | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, param.getControlMapData(SCControlMapKeys.REQ_VIEWID))` | [-> Source screen ID] |
| 4 | EXEC | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` | [-> Operator performing the operation] |

**Block 4** — [SET] Service interface extraction (L764)

> Extracts the service interface name from the first row of mappingData. This drives resource bundle selection for message localization.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcIf = (String) mappingData[0][1]` | [-> Service interface name, e.g. "EKK0081A010"] |

**Block 5** — [CALL] CAANMsg template creation (L766)

> Creates the service-specific message template using a resource bundle for message localization. The bundle key follows the convention `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`, which resolves to a properties file containing Japanese/English message text for the target SC.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf))` | Creates localized message template |

**Block 6** — [EXEC] Template initialization with runtime context (L769–L780)

> Populates the CAANMsg template with operator and timestamp context needed by the CBS for audit logging and date-based business logic.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` | Sets operator on template |
| 2 | EXEC | `template.set(JCMConstants.OPERATE_DATE_KEY, param.getControlMapData(SCControlMapKeys.OPE_DATE))` | Sets effective date |
| 3 | EXEC | `template.set(JCMConstants.OPERATE_DATETIME_KEY, param.getControlMapData(SCControlMapKeys.OPE_TIME))` | Sets effective datetime |

**Block 7** — [FOR] mappingData iteration loop (L783–L800)

> Iterates over all rows in mappingData, populating the CAANMsg template with the field-value pairs. This is the core message assembly step — each row encodes one CBS message field. The loop handles four distinct cases: null fields, empty-string fields, array-valued fields (nested messages), and scalar fields.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0; i < mappingData.length` | Loop over all mapping rows |

**Block 7.1** — [IF] Null or empty value check (L785–L787) `[EMPTY_OR_NULL="null || isEmpty()"]` (L785)

> If the mapping value is null or an empty string, explicitly sets the field to null on the template. This ensures the CBS receives an explicit null rather than a missing field.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `template.setNull((String) mappingData[i][0])` | Sets field to null in message envelope |

**Block 7.2** — [ELSE-IF] Array type check (L789–L791) `[IS_ARRAY="mappingData[i][1] is java.lang.reflect.Array"]` (L789)

> If the mapping value is a Java array (typically `CAANMsg[]` for nested message structures), sets it as an array on the template. This supports hierarchical message formats where a single CBS field contains multiple nested sub-messages.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `template.set((String) mappingData[i][0], (CAANMsg[]) mappingData[i][1])` | Sets nested CAANMsg array on template |

**Block 7.3** — [ELSE] Scalar value assignment (L793–L795)

> For non-array values, sets the scalar value directly onto the template. This covers primitive types, strings, and simple objects that map one-to-one to CBS message fields.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `template.set((String) mappingData[i][0], mappingData[i][1])` | Sets scalar value on template |

**Block 8** — [SET] Template array wrapping (L802–L804)

> Wraps the single CAANMsg template in a `CAANMsg[]` array. The framework expects a template list (array) even when only one template is used, maintaining consistency with multi-template invocation patterns.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` | Creates single-element array |
| 2 | SET | `templates[0] = template` | Assigns template to array slot |
| 3 | EXEC | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` | Puts template array into paramMap |

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

> Returns the fully assembled request parameter map, which contains all header metadata, control context, and the CAANMsg template array. This map is returned to `callSC()`, which invokes the target service component with it.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap` | Returns SC request envelope |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `telegramID` | Field | Transaction/session identifier — unique ID for the current service call session across distributed components |
| `usecaseID` | Field | Business usecase identifier — classifies the overall business process (e.g., customer registration, service change) |
| `operationID` | Field | Operation identifier — specifies the particular operation within the usecase (e.g., add, update, cancel) |
| `callType` | Field | Call type classification — identifies the type of service call (e.g., CBS for Call-Based Service, SOD for Service Order Data) |
| `svcIf` | Field | Service interface name — the identifier of the target service component's interface (e.g., `EKK0081A010`), derived from the first mappingData row |
| `mappingData` | Field | Mapping data array — a 2D structure encoding key-value pairs that map request fields to CBS message fields |
| `CAANMsg` | Class | CAAN message object — a Fujitsu middleware message class used for service component request/response serialization. Supports hierarchical message structures with `set()` and `setNull()` methods |
| `paramMap` | Field | Request parameter map — a HashMap acting as the SC invocation envelope, containing header metadata, control context, and the template list |
| JCMConstants | Class | Japan Common Messages Constants — framework constant class defining string keys for standard message fields (transaction ID, usecase ID, operator ID, etc.) |
| SCControlMapKeys | Class | Service Component Control Map Keys — constant class defining keys for runtime control map entries (hostname, IP, screen ID, operator, date, time) |
| CBS | Acronym | Call-Based Service — a service component invocation style where a synchronous call is made to a remote service |
| SC | Acronym | Service Component — a modular business logic unit invoked via the framework's service component infrastructure |
| SC invocation | Pattern | The process of invoking a downstream service component with a prepared request envelope, executing business logic, and returning a response |
| Request bundle | Concept | Resource bundle file (`eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg.properties`) containing localized message templates for a service component |
| Template list | Concept | An array of CAANMsg objects passed to the SC invocation framework, allowing multiple message templates per invocation |
