# Business Logic — JKKTicktUseSisakListUkCC.editInMsg() [64 LOC]

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

## 1. Role

### JKKTicktUseSisakListUkCC.editInMsg()

This method is the shared message-integration utility used across the K-Opticom customer base system (eo customer base system) to assemble a complete input parameter map (`paramMap`) that is passed to a CBS (Central Business System) invocation. It performs a **builder pattern** by creating a `HashMap<String, Object>` that aggregates data from two distinct sources: the **Telegram Header** (system-level identifiers such as transaction ID, use-case ID, operation ID, and call type) and the **User Area / Control Map** (runtime request context such as client hostname, client IP address, invoking screen ID, and operator ID). It then merges those system fields with a **message template** — a `CAANMsg` object loaded from an internationalized message resource bundle whose key is dynamically derived from the service interface name (`svcIf`) embedded in the `mappingData` parameter. Finally, it iterates over the remaining `mappingData` rows to populate or nullify individual template fields, and packages the template into a single-element array under the `TEMPLATE_LIST_KEY`. This method is called by `callSC()` within the same class, acting as the data-assembly layer immediately before a Service Component (SC) remote call is dispatched. In business terms, it bridges the gap between a screen's request parameters and the CBS request envelope, ensuring all required infrastructure fields and business-specific template data are correctly structured.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg method entry"])
    
    N1["Create paramMap HashMap"]
    N2["Source: Telegram Header"]
    N3["Put TRANZACTION_ID_KEY from param.getTelegramID()"]
    N4["Put USECASE_ID_KEY from param.getUsecaseID()"]
    N5["Put OPERATION_ID_KEY from param.getOperationID()"]
    N6["Put CALL_TYPE_KEY from param.getCallType()"]
    N7["Source: User Area (Control Map)"]
    N8["Put CLIENT_HOST_NAME_KEY from param.getControlMapData(REQ_HOSTNAME)"]
    N9["Put CLIENT_IP_ADDRESS_KEY from param.getControlMapData(REQ_HOSTIP)"]
    N10["Put INVOKE_GAMEN_ID_KEY from param.getControlMapData(REQ_VIEWID)"]
    N11["Put OPERATOR_ID_KEY from param.getControlMapData(OPERATOR_ID)"]
    N12["Extract svcIf from mappingData[0][1]"]
    N13["Create CAANMsg template with format eo.ejb.cbs.cbsmsg.%sCBSMsg using svcIf"]
    N14["Set OPERATOR_ID_KEY on template from param.getControlMapData(OPERATOR_ID)"]
    N15["Set OPERATE_DATE_KEY on template from param.getControlMapData(OPE_DATE)"]
    N16["Set OPERATE_DATETIME_KEY on template from param.getControlMapData(OPE_TIME)"]
    
    LOOP["For each row in mappingData"]
    COND["mappingData[i][1] is empty string?"]
    NULL_SET["template.setNull(mappingData[i][0])"]
    VALUE_SET["template.set(mappingData[i][0], mappingData[i][1])"]
    NEXT["Increment i"]
    
    TEMPLATES["Create CAANMsg array templates length 1"]
    TEMPLATES_SET["templates[0] = template"]
    FINAL_PUT["Put TEMPLATE_LIST_KEY with templates into paramMap"]
    END_NODE(["Return paramMap"])
    
    START --> N1 --> N2 --> N3 --> N4 --> N5 --> N6 --> N7 --> N8 --> N9 --> N10 --> N11 --> N12 --> N13 --> N14 --> N15 --> N16 --> LOOP --> COND
    COND -- Yes --> NULL_SET --> NEXT
    COND -- No --> VALUE_SET --> NEXT
    NEXT --> LOOP
    LOOP --> TEMPLATES --> TEMPLATES_SET --> FINAL_PUT --> END_NODE
```

**Processing steps summary:**

1. **Initialize** — Create an empty `HashMap<String, Object>` called `paramMap` to hold the assembled input for the CBS call.
2. **Telegram Header extraction** — Read 4 system-level fields from `param`: transaction ID, use-case ID, operation ID, and call type. These identify the request context at the messaging infrastructure level.
3. **Control Map extraction** — Read 4 runtime request-context fields from `param.getControlMapData()`: client hostname, client IP address, invoking screen ID, and operator ID. These provide auditing and traceability for the request origin.
4. **Service interface resolution** — Extract `svcIf` from `mappingData[0][1]`, which is the service interface name string used to derive the resource bundle path for message templates (e.g., `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`).
5. **Template instantiation** — Create a `CAANMsg` object loaded from the i18n message bundle specified by the formatted service interface name.
6. **Template infrastructure fields** — Set the operator ID, operation date, and operation datetime fields on the template from the control map.
7. **Mapping data iteration** — Loop over all remaining rows of `mappingData`. For each row, if the value (`mappingData[i][1]`) is an empty string, call `template.setNull()` to clear the field (key is `mappingData[i][0]`). Otherwise, call `template.set()` to assign the value. This enables the caller to pass in field mappings with empty strings signaling null values.
8. **Template packaging** — Wrap the single template into a `CAANMsg[]` array and store it under `TEMPLATE_LIST_KEY` in the paramMap.
9. **Return** — Return the completed `paramMap` for consumption by the caller (e.g., `callSC()`).

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying both system-level identifiers (transaction ID, use-case ID, operation ID, call type) and runtime control map data (hostname, IP, screen ID, operator ID, operation date/time). This object is populated by the framework from the incoming HTTP/screen request and serves as the primary source of system audit fields for the CBS invocation envelope. |
| 2 | `mappingData` | `Object[][]` | A two-dimensional mapping table where each row is `[fieldName, fieldValue]`. Row 0, column 1 (`mappingData[0][1]`) is reserved for the service interface name (`svcIf`) used to load the correct i18n message template. Remaining rows (index 1+) contain business-specific field-to-value mappings that populate the `CAANMsg` template. An empty string value in column 1 signals that the field should be nullified rather than set. This allows callers to pass in arbitrary CBS input field mappings without knowing the CBS schema in advance. |

**External state / instance fields read:** None. This method is stateless and does not access any instance variables.

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `JKKejbCallTypeChecker.getCallType` | - | - | Calls `getCallType` in `JKKejbCallTypeChecker` — determines the EJBCall type |

### Detailed analysis of method calls within `editInMsg()`:

All method calls in this method are local framework interactions or object mutations — they do not constitute remote CBS/SC calls or direct database operations. The method is a **data assembler** (pre-call preparation). No SC Codes (e.g., `EKK0361A010SC`) or database tables are directly accessed by this method.

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `param.getTelegramID()` | - | - | Reads transaction ID from request parameter |
| U | `param.getUsecaseID()` | - | - | Reads use-case ID from request parameter |
| U | `param.getOperationID()` | - | - | Reads operation ID from request parameter |
| U | `param.getCallType()` | - | - | Reads call type classification from request parameter |
| U | `param.getControlMapData(key)` | - | - | Reads control map values (hostname, IP, screen ID, operator ID, date, time) by key |
| U | `paramMap.put(key, value)` | - | - | Writes key-value pairs into the output parameter map |
| U | `new CAANMsg(bundlePath)` | - | - | Instantiates an i18n message template from the resource bundle |
| U | `template.set(key, value)` | - | - | Sets a field value on the message template |
| U | `template.setNull(key)` | - | - | Nullifies a field on the message template |
| U | `paramMap.put(TEMPLATE_LIST_KEY, templates)` | - | - | Stores the assembled CAANMsg array into the parameter map |

**Note:** `setNull` and `set` operations on `CAANMsg` are **in-memory updates** to the message template object — they do not correspond to Create/Read/Update/Delete operations on a database table. They configure the CBS input message before it is serialized and transmitted.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 method.
Terminal operations from this method: `setNull` [-], `set` [-], `getTelegramID` [-], `getUsecaseID` [-], `getOperationID` [-], `getCallType` [-], `getControlMapData` [-]

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

**Call chain detail:**

The method is invoked from `callSC()` within the same class `JKKTicktUseSisakListUkCC`. The `callSC()` method is the entry point for making a Service Component call in the context of the "Point of Use Application Target Policy List" screen. `editInMsg()` is called to assemble the CBS input parameters before the SC dispatch. No direct screen or batch class calls this method externally — it is a private utility internal to the common component class.

## 6. Per-Branch Detail Blocks

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

> Creates the output parameter map that will be returned to the caller.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` // Initialize empty output map |

**Block 2** — [EXEC] `[IF]` Source: Telegram Header (L473–L479)

> Reads system-level identifiers from the request parameter and populates the paramMap. These fields are used by the messaging infrastructure for request tracking and routing.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.getTelegramID()` // Read transaction ID [-> TRANZACTION_ID_KEY] |
| 2 | SET | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` // Store transaction ID |
| 3 | EXEC | `param.getUsecaseID()` // Read use-case ID |
| 4 | SET | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` // Store use-case ID |
| 5 | EXEC | `param.getOperationID()` // Read operation ID |
| 6 | SET | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` // Store operation ID |
| 7 | EXEC | `param.getCallType()` // Read call type |
| 8 | SET | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` // Store call type |

**Block 3** — [EXEC] `[IF]` Source: User Area (Control Map) (L481–L491)

> Reads runtime request context from the control map. These fields provide auditing: who made the request, from where, and from which screen.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME)` // Read client hostname |
| 2 | SET | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, ...)` // Store client hostname |
| 3 | EXEC | `param.getControlMapData(SCControlMapKeys.REQ_HOSTIP)` // Read client IP address |
| 4 | SET | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, ...)` // Store client IP address |
| 5 | EXEC | `param.getControlMapData(SCControlMapKeys.REQ_VIEWID)` // Read invoking screen ID |
| 6 | SET | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, ...)` // Store invoking screen ID |
| 7 | EXEC | `param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // Read operator ID |
| 8 | SET | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, ...)` // Store operator ID |

**Block 4** — [SET] `svcIf extraction` (L493)

> Extracts the service interface name from the first row of mappingData. This is used to derive the i18n message bundle path.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcIf = (String)mappingData[0][1]` // Service interface name for template bundle resolution |

**Block 5** — [SET] `template instantiation` (L495)

> Creates a CAANMsg template from the internationalized message bundle. The bundle path is constructed using the service interface name.

| # | Type | Code |
|---|------|------|
| 1 | SET | `template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf))` // Load i18n template for the service interface |

**Block 6** — [EXEC] `template infrastructure fields` (L497–L507)

> Sets auditing and operational timestamp fields on the template.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `param.getControlMapData(SCControlMapKeys.OPERATOR_ID)` // Read operator ID |
| 2 | EXEC | `template.set(JCMConstants.OPERATOR_ID_KEY, ...)` // Set operator ID on template |
| 3 | EXEC | `param.getControlMapData(SCControlMapKeys.OPE_DATE)` // Read operation date |
| 4 | EXEC | `template.set(JCMConstants.OPERATE_DATE_KEY, ...)` // Set operation date on template |
| 5 | EXEC | `param.getControlMapData(SCControlMapKeys.OPE_TIME)` // Read operation time |
| 6 | EXEC | `template.set(JCMConstants.OPERATE_DATETIME_KEY, ...)` // Set operation datetime on template |

**Block 7** — [FOR] `mappingData iteration` `(i = 0; i < mappingData.length; i++)` (L509–L519)

> Iterates over all rows of mappingData to populate or nullify template fields. This is the core data-mapping loop that transforms the caller's field-to-value pairs into template content.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` // Initialize loop counter |
| 2 | EXEC | `i < mappingData.length` // Check loop condition |
| 3 | SET | `i++` // Increment loop counter |

**Block 7.1** — [IF] `[ELSE]` `(mappingData[i][1] is empty string)` (L511)

> If the value for a field is an empty string, nullify the corresponding field on the template. Otherwise, set the field to the provided value.

| # | Type | Code |
|---|------|------|
| 1 | SET | `"".equals(mappingData[i][1])` // Check if value is empty string |
| 2 | EXEC | `template.setNull((String)mappingData[i][0])` // Branch YES: nullify field by key |
| 3 | EXEC | `template.set((String)mappingData[i][0], mappingData[i][1])` // Branch NO: set field value |

**Block 8** — [SET] `template array packaging` (L521–L524)

> Wraps the single template into a `CAANMsg[]` array as required by the CBS invocation framework, and stores it in the parameter map.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` // Create single-element CAANMsg array |
| 2 | SET | `templates[0] = template` // Assign template to array element |
| 3 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` // Store template array in paramMap |

**Block 9** — [RETURN] `(return paramMap)` (L526)

> Returns the fully assembled parameter map to the caller for CBS invocation.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap` // Return assembled CBS input parameters |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `paramMap` | Field | Output parameter map — a HashMap containing all fields required for CBS (Central Business System) invocation, including system identifiers, audit fields, and the message template list |
| `svcIf` | Field | Service interface name — the identifier string (extracted from `mappingData[0][1]`) that determines which i18n message template bundle to load for the CBS call |
| `TRANZACTION_ID_KEY` | Constant | Telegram transaction ID key — the map key for the unique message transaction identifier. Note: the constant name includes a non-standard spelling ("TRANZACTION") as defined in JCMConstants. |
| `USECASE_ID_KEY` | Constant | Use-case ID key — identifies the business use case for this request in the framework |
| `OPERATION_ID_KEY` | Constant | Operation ID key — identifies the specific operation within a use case |
| `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 machine name or service identifier of the request origin |
| `CLIENT_IP_ADDRESS_KEY` | Constant | Client IP address key — the network address of the request origin for auditing |
| `INVOKE_GAMEN_ID_KEY` | Constant | Invoking screen ID key — the screen/module identifier that initiated the request (Japanese: gamen = screen) |
| `OPERATOR_ID_KEY` | Constant | Operator ID key — the user ID of the operator performing the action |
| `OPERATE_DATE_KEY` | Constant | Operation date key — the business date for the operation |
| `OPERATE_DATETIME_KEY` | Constant | Operation datetime key — the full timestamp of the operation |
| `TEMPLATE_LIST_KEY` | Constant | Template list key — the map key under which the `CAANMsg[]` array is stored |
| `mappingData` | Field | Mapping data table — a 2D array where each row is `[fieldName, fieldValue]` for CBS input field population |
| `IRequestParameterReadWrite` | Type | Framework interface for reading and writing request parameters — provides access to Telegram header fields and Control Map data |
| `CAANMsg` | Type | Message template model — an i18n-aware message object loaded from a Java ResourceBundle, used to construct CBS request messages |
| CBS | Acronym | Central Business System — the backend service that processes business operations |
| SC | Acronym | Service Component — a service layer class that executes business logic and communicates with the CBS |
| i18n | Acronym | Internationalization — the CAANMsg template is loaded from a ResourceBundle with locale-specific message files (e.g., `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`) |
| Control Map | Technical | A map within the request parameter that stores runtime request metadata (hostname, IP, screen ID, operator ID, date/time) populated by the web framework |
| Telegram Header | Technical | The top-level messaging metadata in the request parameter containing system identifiers (transaction ID, use-case ID, operation ID, call type) |
| eo (customer base system) | Business term | K-Opticom's customer base management system (Japanese: eo顧客基幹システム) — the core telecommunications customer information system |
| JCMConstants | Class | Common constants class — defines all message parameter keys used across the framework for CBS communication |
| SCControlMapKeys | Class | Control map key constants — defines the keys used to look up runtime request metadata from the control map |
