# Business Logic — JKKAdchgKakuteiKikiDslCC.editInMsg() [53 LOC]

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

## 1. Role

### JKKAdchgKakuteiKikiDslCC.editInMsg()

The `editInMsg` method is a private utility that constructs inbound message payloads (parameter maps) for invoking Service Component (SC) remote calls within the Fujitsu Futurity business platform. It acts as a **message builder** that collects telecommunication header metadata and user session context data, assembles a `CAANMsg` template dynamically based on a service interface name, populates the template with field mappings from an `Object[][]` configuration, and packages everything into a `HashMap` that serves as the input parameter map for `ServiceComponentRequestInvoker.run()`. This method implements the **delegation + builder pattern** — it encapsulates the boilerplate of mapping request parameters into a CBS (Component-Based System) message envelope so that callers (e.g., `callSC`) only need to pass raw data and receive a ready-to-execute parameter map. It is the central message assembly point used by all SC invocations within `JKKAdchgKakuteiKikiDslCC`, ensuring consistent header propagation, operator attribution, and template lifecycle management across every business screen that performs address change confirmations (as suggested by the class name `JKKAdchgKakuteiKikiDslCC` — "Address Change Determination Timing DSL Component Controller"). The method handles both non-null field population and null-value clearing for template fields, making it safe for partial or sparse mapping configurations.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg(param, mappingData)"])
    NODE1["Create paramMap: new HashMap"]
    NODE2["Populate paramMap with telegram header fields
TRANZACTION_ID_KEY <- param.getTelegramID()
USECASE_ID_KEY <- param.getUsecaseID()
OPERATION_ID_KEY <- param.getOperationID()
CALL_TYPE_KEY <- param.getCallType()"]
    NODE3["Populate paramMap with user control map data
CLIENT_HOST_NAME_KEY <- param.getControlMapData(REQ_HOSTNAME)
CLIENT_IP_ADDRESS_KEY <- param.getControlMapData(REQ_HOSTIP)
INVOKE_GAMEN_ID_KEY <- param.getControlMapData(REQ_VIEWID)
OPERATOR_ID_KEY <- param.getControlMapData(OPERATOR_ID)"]
    NODE4["Extract svcIf from mappingData[0][1]"]
    NODE5["Create template: CAANMsg with template name
'eoj.ejb.cbs.cbsmsg.{svcIf}CBSMsg'"]
    NODE6["Set template fields:
OPERATOR_ID_KEY <- controlMapData(OPERATOR_ID)
OPERATE_DATE_KEY <- controlMapData(OPE_DATE)
OPERATE_DATETIME_KEY <- controlMapData(OPE_TIME)"]
    NODE7["Loop: for i = 0; i < mappingData.length"]
    NODE8["mappingData[i][1] equals empty string?"]
    NODE9["template.setNull((String)mappingData[i][0])"]
    NODE10["template.set((String)mappingData[i][0], mappingData[i][1])"]
    NODE11["i++"]
    NODE12["Create CAANMsg[] templates = new CAANMsg[1]"]
    NODE13["templates[0] = template"]
    NODE14["paramMap.put(TEMPLATE_LIST_KEY, templates)"]
    NODE15["Return paramMap"]
    END(["Return paramMap"])

    START --> NODE1
    NODE1 --> NODE2
    NODE2 --> NODE3
    NODE3 --> NODE4
    NODE4 --> NODE5
    NODE5 --> NODE6
    NODE6 --> NODE7
    NODE7 --> NODE8
    NODE8 -->|"true: EMPTY=\"\""| NODE9
    NODE8 -->|"false: non-empty value"| NODE10
    NODE9 --> NODE11
    NODE10 --> NODE11
    NODE11 --> NODE7
    NODE7 -->|"loop ended"| NODE12
    NODE12 --> NODE13
    NODE13 --> NODE14
    NODE14 --> NODE15
    NODE15 --> END
```

**Constant Resolution:**
The method uses the following constants (resolved from `JCMConstants`):

| Constant | Value | Business Meaning |
|----------|-------|------------------|
| `TRANZACTION_ID_KEY` | (string key) | Transaction ID key for the parameter map |
| `USECASE_ID_KEY` | (string key) | Use case ID key |
| `OPERATION_ID_KEY` | (string key) | Operation ID key |
| `CALL_TYPE_KEY` | (string key) | Service call type discriminator |
| `CLIENT_HOST_NAME_KEY` | (string key) | Requestor hostname key |
| `CLIENT_IP_ADDRESS_KEY` | (string key) | Requestor IP address key |
| `INVOKE_GAMEN_ID_KEY` | (string key) | Invoked screen ID key |
| `OPERATOR_ID_KEY` | (string key) | Operator ID key [-> JFUStrConst.java:204] |
| `OPERATE_DATE_KEY` | (string key) | Operation date key |
| `OPERATE_DATETIME_KEY` | (string key) | Operation datetime key |
| `TEMPLATE_LIST_KEY` | (string key) | Template list array key for result extraction |

All these constant keys originate from `JCMConstants` (Fujitsu JCM platform constants), and their string values are resolved at compile time.

Additionally, the constant `EMPTY=""` from `JFUStrConst.java:207` is used inline as `""` to compare against `mappingData[i][1]`.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter carrier that holds all input context for the current business transaction. It provides telecommunication header data (telegram ID, use case ID, operation ID, call type) via getter methods, and user session metadata (hostname, IP, screen ID, operator ID) via `getControlMapData(key)`. This object is the single source of truth for environment and user context that must be propagated to downstream CBS invocations. |
| 2 | `mappingData` | `Object[][]` | A 2D array defining the mapping between CBS message template fields and their values. Each row `[i]` represents one field: `mappingData[i][0]` is the field name (a string key matching the CBS message template's field identifier), and `mappingData[i][1]` is the value to assign (or an empty string to clear the field). The first row `mappingData[0][1]` is special — it contains the service interface name (`svcIf`) used to construct the dynamic `CAANMsg` template name (e.g., `"EKK1681B001CBSMsg"`). |

**Instance fields / external state read:** None. This method is purely functional — it does not read any instance fields or static state (except compile-time constants from `JCMConstants` and `JFUStrConst`).

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JCMConstants` | - | - | Read of compile-time constant string keys for parameter map population |
| - | `param.getTelegramID()` | - | - | Read of telegram ID from request parameter (transaction identifier) |
| - | `param.getUsecaseID()` | - | - | Read of use case ID from request parameter |
| - | `param.getOperationID()` | - | - | Read of operation ID from request parameter |
| - | `param.getCallType()` | - | - | Read of service call type discriminator |
| - | `param.getControlMapData(...)` | - | - | Read of control map data fields (hostname, IP, screen ID, operator ID, date, datetime) |
| - | `new CAANMsg(...)` | - | - | Creation of a CBS message envelope with dynamic template name |
| - | `template.set(...)` | - | - | Set (write) of operator ID, operation date, and operation datetime to template |
| - | `template.setNull(...)` | - | - | Clear (null assignment) of template field when value is empty string |
| - | `template.set(...)` | - | - | Set (write) of mapped field values to template within loop |
| - | `paramMap.put(...)` | - | - | Build the outbound parameter map for SC invocation |

**Note:** This method itself does not perform any direct database CRUD operations or SC calls. It is a pure message assembly method. The actual Create/Read/Update/Delete operations are performed by the caller `callSC()` after this method returns, which invokes `scCall.run(paramMap, handle)` to execute the CBS service.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method (internal).
Terminal operations from this method: `setNull` [-], `set` [-], `set` [-], `set` [-], `set` [-], `paramMap.put` [-], `paramMap.put` [-].

This method is **private** and called exclusively by its sibling method `callSC` within the same class `JKKAdchgKakuteiKikiDslCC`. It is never invoked directly from screens, batches, or external components.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Internal: `callSC()` (JKKAdchgKakuteiKikiDslCC) | `JKKAdchgKakuteiKikiDslCC.callSC` -> `editInMsg` -> `scCall.run()` (external SC invocation) | `scCall.run() [R/C] CBS Service` |

The `callSC` method is itself called by various business screen integration points within the `JKKAdchgKakuteiKikiDslCC` class (address change confirmation timing DSL CC), which is triggered by screens prefixed with `KKSV` (e.g., `KKSV0004`-style screens) that handle address change determinations.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/ASSIGN] `HashMap creation and header population` (L1677)

> Creates the parameter map and populates it with telecommunication header fields extracted from the request parameter object. This establishes the envelope metadata required for every CBS call.

| # | Type | Code |
|---|------|------|
| 1 | SET | `HashMap<String, Object> paramMap = new HashMap<String, Object>();` // Initialize the parameter map |
| 2 | CALL | `param.getTelegramID()` // Read telegram ID from request [-> JCMConstants.TRANZACTION_ID_KEY] |
| 3 | SET | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID());` // Set transaction ID [-> JFUStrConst.java:204] |
| 4 | CALL | `param.getUsecaseID()` // Read use case ID |
| 5 | SET | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID());` // Set use case ID |
| 6 | CALL | `param.getOperationID()` // Read operation ID |
| 7 | SET | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID());` // Set operation ID |
| 8 | CALL | `param.getCallType()` // Read service call type discriminator |
| 9 | SET | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType());` // Set call type [-> JFUStrConst.java:204] |

**Block 2** — [SET/ASSIGN] `User control map data population` (L1685)

> Enriches the parameter map with user session context extracted from the control map — including requestor hostname, IP address, invoked screen ID, and operator ID. These fields enable auditability and routing in the CBS layer.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME)` // Read requestor hostname |
| 2 | SET | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, ...)` // Set client hostname [-> JFUStrConst.java:204] |
| 3 | CALL | `param.getControlMapData(SCControlMapKeys.REQ_HOSTIP)` // Read requestor IP address |
| 4 | SET | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, ...)` // Set client IP [-> JFUStrConst.java:204] |
| 5 | CALL | `param.getControlMapData(SCControlMapKeys.REQ_VIEWID)` // Read invoked screen ID |
| 6 | SET | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, ...)` // Set screen ID [-> JFUStrConst.java:204] |
| 7 | CALL | `param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // Read operator ID |
| 8 | SET | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, ...)` // Set operator ID [-> JFUStrConst.java:204] |

**Block 3** — [SET/ASSIGN] `Service interface extraction and template creation` (L1692)

> Extracts the service interface name from the first row of mappingData and uses it to construct a dynamically-named `CAANMsg` template. The template name follows the pattern `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`, which maps to a CBS message configuration file.

| # | Type | Code |
|---|------|------|
| 1 | SET | `String svcIf = (String)mappingData[0][1];` // Extract service interface name from first mapping row |
| 2 | SET | `CAANMsg template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf));` // Create dynamic CAANMsg template |

**Block 4** — [SET/ASSIGN] `Template header field population` (L1695)

> Populates the `CAANMsg` template's operational header fields with values from the control map — operator ID, operation date, and operation datetime. These are standard fields required by every CBS invocation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // Read operator ID |
| 2 | SET | `template.set(JCMConstants.OPERATOR_ID_KEY, ...)` // Set operator ID on template [-> JFUStrConst.java:204] |
| 3 | CALL | `param.getControlMapData(SCControlMapKeys.OPE_DATE)` // Read operation date |
| 4 | SET | `template.set(JCMConstants.OPERATE_DATE_KEY, ...)` // Set operation date [-> JFUStrConst.java:204] |
| 5 | CALL | `param.getControlMapData(SCControlMapKeys.OPE_TIME)` // Read operation time |
| 6 | SET | `template.set(JCMConstants.OPERATE_DATETIME_KEY, ...)` // Set operation datetime [-> JFUStrConst.java:204] |

**Block 5** — [FOR LOOP] `Field mapping loop` (L1700)

> Iterates over all remaining rows in `mappingData` (starting from index 0, which also includes the service interface name row) and populates the template with field-value pairs. For each row, it checks if the value is an empty string — if so, it clears the field; otherwise, it sets the field value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `for (int i = 0; i < mappingData.length; i++)` // Loop over all mapping rows |

**Block 5.1** — [IF/ELSE] `Null vs value check` `EMPTY=""` (L1702)

> For each mapping row, determines whether the value at `mappingData[i][1]` is an empty string. This controls whether the template field should be cleared (null) or set to the provided value.

| # | Type | Code |
|---|------|------|
| 1 | IF | `"".equals(mappingData[i][1])` // Check if value is empty [-> JFUStrConst.java:207: EMPTY=""] |

**Block 5.1.1** — [ELSE-IF BRANCH] `Null field` (L1704)

> When the mapped value is an empty string, clears the corresponding template field by calling `setNull`. This ensures fields that should not be transmitted (or that represent optional fields not filled in this context) are explicitly cleared.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `template.setNull((String)mappingData[i][0]);` // Clear template field [-> JFUStrConst.java:207] |

**Block 5.1.2** — [ELSE BRANCH] `Set field value` (L1707)

> When the mapped value is non-empty, assigns the value to the corresponding template field. The value is stored as `Object`, preserving type information.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `template.set((String)mappingData[i][0], mappingData[i][1]);` // Set template field with value [-> JFUStrConst.java:207] |

**Block 6** — [SET/ASSIGN] `Template list packaging and return` (L1713)

> Wraps the fully-populated `CAANMsg` template into a single-element array and stores it in the parameter map under the template list key. The parameter map, now containing both header metadata and the assembled template, is returned to the caller for use in the SC invocation.

| # | Type | Code |
|---|------|------|
| 1 | SET | `CAANMsg[] templates = new CAANMsg[1];` // Create single-element template array |
| 2 | SET | `templates[0] = template;` // Populate with assembled template |
| 3 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates);` // Store template list in paramMap |
| 4 | RETURN | `return paramMap;` // Return the complete parameter map for SC invocation |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `param` | Parameter | IRequestParameterReadWrite — the central request context object carrying all input data for a business transaction in the Fujitsu JCM platform |
| `mappingData` | Parameter | Object[][] — a 2D configuration array mapping CBS message template field names to their values; `mappingData[0][1]` additionally holds the service interface name |
| `paramMap` | Variable | HashMap<String, Object> — the outbound parameter map assembled by this method, which is passed to the ServiceComponentRequestInvoker for CBS execution |
| `template` | Variable | CAANMsg — a CBS message envelope object that holds the field-value pairs for a specific CBS service invocation |
| `svcIf` | Variable | String — the service interface name extracted from mappingData, used to dynamically construct the CAANMsg template name (e.g., `EKK1681B001CBSMsg`) |
| `JCMConstants` | Class | Fujitsu JCM platform constants class containing predefined string keys for transaction ID, use case ID, operation ID, call type, client host/IP, screen ID, operator ID, operation date/datetime, and template list |
| `SCControlMapKeys` | Class | Control map key constants class defining keys for hostname (`REQ_HOSTNAME`), IP address (`REQ_HOSTIP`), screen ID (`REQ_VIEWID`), operator ID, operation date (`OPE_DATE`), operation time (`OPE_TIME`), and return code |
| `CAANMsg` | Class | Fujitsu's CBS message envelope class — provides `set()`, `setNull()`, and `getInt()` methods for manipulating CBS service input/output messages |
| `callSC` | Method | Internal method in `JKKAdchgKakuteiKikiDslCC` that calls `editInMsg`, then executes the actual SC invocation via `ServiceComponentRequestInvoker.run()` |
| `JFUStrConst.EMPTY` | Constant | `""` — empty string constant used for null-value checks in mappingData |
| `JFUStrConst.OPERATOR_ID` | Constant | `" "` — half-space string constant (note: used as a value, not as a key — the actual operator ID key comes from SCControlMapKeys) |
| SC | Acronym | Service Component — a remote service unit in the Fujitsu Futurity platform that is invoked via `ServiceComponentRequestInvoker` |
| CBS | Acronym | Component-Based System — the enterprise service architecture layer where business logic is encapsulated as invocable services |
| telegram ID | Field | Unique identifier for a telecommunication transaction/interaction in the platform |
| use case ID | Field | Identifier for the business use case being executed |
| operation ID | Field | Identifier for the specific operation within a use case |
| call type | Field | Discriminator that indicates the type of service call being made |
| client hostname | Field | Hostname of the machine that originated the request |
| client IP address | Field | IP address of the requestor for audit and logging |
| invoked screen ID | Field | The UI screen ID that triggered the current business transaction |
| operator ID | Field | The user ID of the person performing the operation |
| operation date | Field | The date of the operation, extracted from the control map |
| operation datetime | Field | The full datetime of the operation, extracted from the control map |
| `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg` | Template format | The resource bundle path pattern for CBS message configuration files, where `{svcIf}` is the service interface name |
| Address Change | Business domain | The business context of this class — processing address change confirmation requests in the telecom service management system |