# Business Logic — JKKTvSvcKeiCancelCC.editInMsg() [38 LOC]

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

## 1. Role

### JKKTvSvcKeiCancelCC.editInMsg()

`editInMsg` is a **message preparation and data-mapping utility** used during the service-line cancellation flow (`JKKTvSvcKeiCancelCC` — "Service Category Cancel Common Component"). It collects operational context from the request parameters and control maps, assembles them into a `paramMap` for downstream processing, and simultaneously enriches the `CAANMsg` (the service-call message envelope) with operator identity and runtime timestamps. Specifically, it extracts four header-level identifiers from the request (transaction ID, usecase ID, operation ID, call type), four user-context fields from the control map (client hostname, client IP address, invoked screen ID, operator ID), and pushes the operator identity plus operational date/time onto the outbound `CAANMsg`. After that, it invokes `setNullToMsg` to pre-clear error fields in the message schema, wraps the enriched message into a `CAANMsg` template array, and returns the fully assembled parameter map. This method acts as a **bridge** between the request-control layer and the service-component call layer, ensuring that every downstream SC invocation carries complete operational audit data. It has no conditional branches — it executes a deterministic sequence of extractions, mappings, and a helper call.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg starts"])
    CREATE_MAP["Create paramMap: new HashMap<String, Object>()"]
    PUT_TXN_ID["PUT TRANZACTION_ID_KEY = param.getTelegramID()"]
    PUT_USECASE_ID["PUT USECASE_ID_KEY = param.getUsecaseID()"]
    PUT_OP_ID["PUT OPERATION_ID_KEY = param.getOperationID()"]
    PUT_CALL_TYPE["PUT CALL_TYPE_KEY = param.getCallType()"]
    PUT_HOSTNAME["PUT CLIENT_HOST_NAME_KEY = param.getControlMapData(REQ_HOSTNAME)"]
    PUT_IP["PUT CLIENT_IP_ADDRESS_KEY = param.getControlMapData(REQ_HOSTIP)"]
    PUT_SCREEN_ID["PUT INVOKE_GAMEN_ID_KEY = param.getControlMapData(REQ_VIEWID)"]
    PUT_OPER_ID_PARAM["PUT OPERATOR_ID_KEY = param.getControlMapData(OPERATOR_ID)"]
    MSG_SET_OPER_ID["msg.set(OPERATOR_ID_KEY, param.getControlMapData(OPERATOR_ID))"]
    MSG_SET_DATE["msg.set(OPERATE_DATE_KEY, param.getControlMapData(OPE_DATE))"]
    MSG_SET_TIME["msg.set(OPERATE_DATETIME_KEY, param.getControlMapData(OPE_TIME))"]
    CALL_SET_NULL["setNullToMsg(msg)"]
    CREATE_TEMPLATE["Create CAANMsg[] templates = new CAANMsg[]{msg}"]
    PUT_TEMPLATE["PUT TEMPLATE_LIST_KEY = templates"]
    RETURN_MAP["Return paramMap"]

    START --> CREATE_MAP --> PUT_TXN_ID --> PUT_USECASE_ID --> PUT_OP_ID --> PUT_CALL_TYPE --> PUT_HOSTNAME --> PUT_IP --> PUT_SCREEN_ID --> PUT_OPER_ID_PARAM --> MSG_SET_OPER_ID --> MSG_SET_DATE --> MSG_SET_TIME --> CALL_SET_NULL --> CREATE_TEMPLATE --> PUT_TEMPLATE --> RETURN_MAP
```

**Processing description:**

The method performs a **linear, sequential mapping** without any conditional branches. It follows a three-phase pattern:

1. **Header extraction** — Extracts four identifiers from the request parameter object (`param.getTelegramID()`, `getUsecaseID()`, `getOperationID()`, `getCallType()`) and stores them in the parameter map. These values identify the current transaction session and routing context.
2. **User-context extraction** — Reads four fields from the control map (a shared data structure that carries runtime environment metadata), including the originating client hostname, IP address, invoked screen ID, and operator ID.
3. **Message enrichment** — Sets the operator ID, operate date, and operate datetime directly on the `CAANMsg` envelope, calls `setNullToMsg` to pre-initialize error fields, wraps the message in a template array, and returns the parameter map.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying the full request context. It provides access to header-level identifiers (transaction ID, usecase ID, operation ID, call type) and control-map data (hostname, IP, screen ID, operator ID, operational date/time) that identify who is performing the action, from where, and which screen initiated the request. |
| 2 | `msg` | `CAANMsg` | The outbound service-call message envelope. This object is enriched in-place with operator identity and runtime timestamps before being passed as a template to downstream service components. Its schema determines which error fields will be pre-initialized by `setNullToMsg`. |

**Control-map keys read from `param` (via `SCControlMapKeys`):**

| Key | Business Meaning |
|-----|-----------------|
| `REQ_HOSTNAME` | Requesting client hostname |
| `REQ_HOSTIP` | Requesting client IP address |
| `REQ_VIEWID` | Invoked screen ID (identifies which screen initiated the request) |
| `OPERATOR_ID` | ID of the operator performing the cancellation |
| `OPE_DATE` | Operational date (runtime date) |
| `OPE_TIME` | Operational datetime (runtime time) |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `JKKTvSvcKeiCancelCC.setNullToMsg` | - | - | Calls `setNullToMsg` in `JKKTvSvcKeiCancelCC` — initializes null values on error fields in the CAANMsg schema |
| R | `JKKejbCallTypeChecker.getCallType` | - | - | Called indirectly through `param.getCallType()` |

**Method call analysis:**

All method calls in `editInMsg` are **parameter/method operations** (getter/setter on the `param` object) or a **self-call** to `setNullToMsg`. The `setNullToMsg` helper initializes error fields (`_err` suffixed keys) in the message schema to null, ensuring a clean state before the service component processes the request. There are **no direct database queries, entity operations, or SC/CBS invocations** within this method itself — it is purely a data-preparation step that feeds into the downstream `callSC` invocation (which lives in the caller's scope).

## 5. Dependency Trace

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

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

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:KKSV0729 | `KKSV0729OPOperation` -> `JKKTvSvcKeiCancelCC` -> `editInMsg` | `setNullToMsg` [-] |
| 2 | Screen:KKSV0484 | `KKSV0484OPOperation` -> `JKKTvSvcKeiCancelCC` -> `editInMsg` | `setNullToMsg` [-] |

**Notes:**
- `KKSV0729` and `KKSV0484` are screen-operation classes that configure and invoke the `JKKTvSvcKeiCancelCC` common component for service-line cancellation operations.
- `editInMsg` is a **private** method, so it is only called within the `JKKTvSvcKeiCancelCC` class itself. Its callers are other methods in the same class (such as the cancellation workflow methods) that in turn are invoked by the screen operation classes listed above.

## 6. Per-Branch Detail Blocks

This method has **no conditional branches** (no if/else, switch, or loops). It executes as a single deterministic sequence.

**Block 1** — [LINEAR SEQUENCE] (L890)

> The method creates a parameter map, extracts header and control data, enriches the message, and returns.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap = new HashMap<String, Object>()` // Create the parameter map |
| 2 | **Comment:** `【取得元:電文ヘッダ(ヘッダ)】` → *(Source: Message Header (Header))* |
| 3 | SET | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` // Extract transaction ID from request |
| 4 | SET | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` // Extract usecase ID from request |
| 5 | SET | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` // Extract operation ID from request |
| 6 | SET | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` // Extract service call type identifier |
| 7 | **Comment:** `【取得元:ユーザエリア(コントロールマップ)】` → *(Source: User Area (Control Map))* |
| 8 | SET | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME))` // Extract client hostname |
| 9 | SET | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTIP))` // Extract client IP address |
| 10 | SET | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, param.getControlMapData(SCControlMapKeys.REQ_VIEWID))` // Extract invoked screen ID |
| 11 | SET | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // Extract operator ID |
| 12 | **Comment:** `オペレータID` → *(Operator ID)* |
| 13 | EXEC | `msg.set(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // Push operator ID onto CAANMsg |
| 14 | **Comment:** `運用日付` → *(Operational date)* |
| 15 | EXEC | `msg.set(JCMConstants.OPERATE_DATE_KEY, param.getControlMapData(SCControlMapKeys.OPE_DATE))` // Push operational date onto CAANMsg |
| 16 | **Comment:** `運用日時` → *(Operational datetime)* |
| 17 | EXEC | `msg.set(JCMConstants.OPERATE_DATETIME_KEY, param.getControlMapData(SCControlMapKeys.OPE_TIME))` // Push operational datetime onto CAANMsg |
| 18 | CALL | `setNullToMsg(msg)` // Pre-initialize error fields in the message schema (recursive for sub-messages) |
| 19 | SET | `templates = new CAANMsg[]{msg}` // Wrap the enriched message into a template array |
| 20 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` // Store template list in parameter map |
| 21 | RETURN | `return paramMap` |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `JKKTvSvcKeiCancelCC` | Class | Service Category Cancel Common Component — a shared component handling service-line cancellation operations. "Kei" (種) means "type" or "category" in Japanese. |
| `editInMsg` | Method | Edit Input Message — prepares and enriches the message envelope for downstream service component calls. |
| `IRequestParameterReadWrite` | Interface | Request parameter interface providing access to transaction headers and control-map data. |
| `CAANMsg` | Class | CAAN message envelope — the standard message container used for service component requests/responses. |
| `TRANZACTION_ID_KEY` | Constant Key | Transaction ID — uniquely identifies the current request session across the system. (Note: the constant is spelled "TRANZACTION" with a Z.) |
| `USECASE_ID_KEY` | Constant Key | Usecase ID — identifies the business usecase or scenario being executed. |
| `OPERATION_ID_KEY` | Constant Key | Operation ID — identifies the specific operation being performed within a usecase. |
| `CALL_TYPE_KEY` | Constant Key | Call type — identifies the service routing type (e.g., synchronous, asynchronous). |
| `CLIENT_HOST_NAME_KEY` | Constant Key | Client hostname — the hostname of the machine that initiated the request. |
| `CLIENT_IP_ADDRESS_KEY` | Constant Key | Client IP address — the IP address of the requesting client. |
| `INVOKE_GAMEN_ID_KEY` | Constant Key | Invoked screen ID — the screen identifier (Gamenum = 画面, "screen" in Japanese) that triggered the request. |
| `OPERATOR_ID_KEY` | Constant Key | Operator ID — the ID of the user performing the action. |
| `OPERATE_DATE_KEY` | Constant Key | Operate date — the operational date from the control map. |
| `OPERATE_DATETIME_KEY` | Constant Key | Operate datetime — the operational time from the control map. |
| `TEMPLATE_LIST_KEY` | Constant Key | Template list — holds the CAANMsg templates to be passed to service components. |
| `SCControlMapKeys.REQ_HOSTNAME` | Constant Key | Request hostname — key to retrieve the client hostname from the control map. |
| `SCControlMapKeys.REQ_HOSTIP` | Constant Key | Request host IP — key to retrieve the client IP address from the control map. |
| `SCControlMapKeys.REQ_VIEWID` | Constant Key | Request view ID — key to retrieve the invoked screen ID from the control map. |
| `SCControlMapKeys.OPERATOR_ID` | Constant Key | Operator ID — key to retrieve the operator ID from the control map. |
| `SCControlMapKeys.OPE_DATE` | Constant Key | Operation date — key to retrieve the operational date from the control map. |
| `SCControlMapKeys.OPE_TIME` | Constant Key | Operation time — key to retrieve the operational time from the control map. |
| `setNullToMsg` | Method | Set Null to Message — recursively initializes error fields (`_err` suffixed) to null in the CAANMsg schema before service processing. |
| `paramMap` | Variable | Parameter map — a `HashMap<String, Object>` that accumulates all extracted operational context for downstream use. |
| `KKSV0729` | Screen | Screen operation class for service-line cancellation — invokes this CC for cancel operations. |
| `KKSV0484` | Screen | Screen operation class for service-line cancellation — invokes this CC for cancel operations. |
| `KKKTvSvcKeiCancelCC` | Class | Common component for service detail cancel operations. "KKKT" is a Fujitsu internal prefix, "vSvc" = virtual Service, "Kei" (種) = category/type, "Cancel" = cancel operation. |
