# Business Logic — JKKNsidPwdChgOrsjgsCC.editInMsg() [63 LOC]

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

## 1. Role

### JKKNsidPwdChgOrsjgsCC.editInMsg()

This method serves as a **shared inbound message builder** for the NT password change (NTSID) service component. Its business purpose is to assemble a complete inbound parameter map (`paramMap`) that is passed to downstream service components for execution. Specifically, it gathers operational context from two sources — the request parameter object (`param`) and the mapping data array (`mappingData`) — and constructs a fully-populated `HashMap<String, Object>` containing the transaction identifier, use case identifier, operation identifier, call type classification, client network information (hostname, IP address, screen ID, operator ID), and a `CAANMsg` template populated with all field mappings for the service call.

The method implements the **template building pattern**: it creates a `CAANMsg` instance that is backed by a Java `ResourceBundle` (loaded from a message properties file such as `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`), which provides the text templates for all return message fields. It then iterates over the `mappingData` array to populate each field — either with a direct value, an empty-null marker, or a nested `CAANMsg[]` sub-template — before packaging the result into a one-element `CAANMsg[]` array stored under the template list key.

Because this method is **private** and called only from the companion method `callSC()`, its role in the larger system is a **data preparation utility** within the NT password change or registration screen flow. It ensures that every service component invocation has a consistent inbound envelope containing both metadata and the message template payload.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["editInMsg(param, mappingData)"])
    STEP1["Create paramMap HashMap"]
    STEP2["Extract Telegram ID, UseCase ID, Operation ID, Call Type from param"]
    STEP3["Extract Client Host, Client IP, Invoke Gamen ID, Operator ID from control map"]
    STEP4["Extract svcIf from mappingData[0][1]"]
    STEP5["Create CAANMsg template with resource bundle key eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg"]
    STEP6["Set Operator ID, Operate Date, Operate Date Time on template"]
    STEP7["Initialize loop counter i=0"]
    LOOP["i < mappingData.length"]
    STEP8{"mappingData[i][1] is CAANMsg[]?"}
    BRANCH_ARRAY["Set template with CAANMsg[] array"]
    BRANCH_VALUE{"mappingData[i][1] equals empty string?"}
    BRANCH_EMPTY["SetNull on template for this key"]
    BRANCH_FILL["Set template value for this key"]
    INCR["i++"]
    STEP9["Create CAANMsg[] array, populate with template"]
    STEP10["Put template list into paramMap"]
    STEP11["Return paramMap"]
    END_NODE(["End"])

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> STEP6 --> STEP7 --> LOOP
    LOOP --> STEP8
    STEP8 -->|"Yes"| BRANCH_ARRAY
    STEP8 -->|"No"| BRANCH_VALUE
    BRANCH_ARRAY --> INCR
    BRANCH_VALUE -->|"Yes"| BRANCH_EMPTY
    BRANCH_VALUE -->|"No"| BRANCH_FILL
    BRANCH_EMPTY --> INCR
    BRANCH_FILL --> INCR
    INCR --> LOOP
    LOOP -->|"No"| STEP9 --> STEP10 --> STEP11 --> END_NODE
```

**Processing summary:**

1. **paramMap initialization** — A new `HashMap<String, Object>` is created to serve as the inbound message envelope.
2. **Extract request metadata** — Five values are pulled directly from the `param` object: the telegram ID (transaction identifier), use case ID, operation ID, and call type. These map to keys defined in `JCMConstants` (`TRANZACTION_ID_KEY`, `USECASE_ID_KEY`, `OPERATION_ID_KEY`, `CALL_TYPE_KEY`).
3. **Extract control map context** — Four additional values are retrieved from the control map embedded in `param`: client hostname, client IP address, invoke screen ID (gamen), and operator ID. These are keyed by `SCControlMapKeys` (`REQ_HOSTNAME`, `REQ_HOSTIP`, `REQ_VIEWID`, `OPERATOR_ID`) and stored under the corresponding `JCMConstants` keys.
4. **Determine service interface** — The service interface name (`svcIf`) is extracted from `mappingData[0][1]` and used to construct a `ResourceBundle` resource key in the format `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg`. This resource bundle contains the message templates for the service call.
5. **Initialize template** — A `CAANMsg` template object is instantiated from the resource bundle. Three operational fields are set on it: operator ID, operate date, and operate datetime.
6. **Populate field mappings** — The method iterates over every row of `mappingData`. For each row, it checks whether the value is a `CAANMsg[]` sub-template (e.g., for nested message structures), an empty string (signalling a null field), or a regular value. The corresponding `set()` or `setNull()` method is invoked on the template.
7. **Package and return** — The populated template is wrapped in a one-element `CAANMsg[]` array and stored in `paramMap` under the template list key. The completed `paramMap` is returned.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `IRequestParameterReadWrite` | The request parameter object carrying the inbound RPC envelope. It contains the transaction identifier, use case identifier, operation identifier, call type classification, and a control map with client network context (hostname, IP address, screen/ gamen ID, operator ID, operate date/time). This object is the primary source of metadata for the inbound message envelope. |
| 2 | `mappingData` | `Object[][]` | A 2D mapping table where each row contains `[key, value]`. Row 0, column 1 holds the service interface name (`svcIf`) used to load the correct message properties file. Subsequent rows map field names (as `String` keys) to their values. Values may be: a plain object (string, date, etc.), a `CAANMsg[]` sub-template for nested message structures, or an empty string `""` which signals that the field should be set to null in the message template. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| - | `CAANMsg.<init>` | - | - | Constructs a new `CAANMsg` instance from a Java `ResourceBundle` keyed by service interface name |
| - | `CAANMsg.set` | - | - | Sets a single field value on the message template |
| - | `CAANMsg.setNull` | - | - | Sets a field value to null on the message template (empty-string sentinel) |
| - | `CAANMsg.set(String, CAANMsg[])` | - | - | Sets a nested sub-template on the message template |
| R | `param.getTelegramID` | - | - | Retrieves the transaction ID from the request envelope |
| R | `param.getUsecaseID` | - | - | Retrieves the use case ID from the request envelope |
| R | `param.getOperationID` | - | - | Retrieves the operation ID from the request envelope |
| R | `param.getCallType` | - | - | Retrieves the call type classification from the request envelope |
| R | `param.getControlMapData` | - | - | Retrieves control map values: hostname, IP, screen ID, operator ID, date, time |

**Analysis notes:** This method performs **no database or entity-level CRUD operations**. It is a pure data assembly method that:
- **Reads** metadata from the request parameter object (`IRequestParameterReadWrite`)
- **Builds** a `CAANMsg` template from a resource bundle
- **Populates** the template with field mappings from `mappingData`

All operations are in-memory data transformations — no persistent data access occurs.

## 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: `set` [-], `setNull` [-], `set(String, CAANMsg[])` [-]

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

**Analysis notes:** This method is **private** and called exclusively by the companion method `callSC()` within the same class (`JKKNsidPwdChgOrsjgsCC`). It is not directly invoked by any screen or batch entry point. The `callSC()` method acts as the service component entry point for the NT password change/registration business service, and `editInMsg()` serves as its internal message-building helper.

## 6. Per-Branch Detail Blocks

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

The method begins by creating the outbound parameter map that will hold all inbound metadata.

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

**Block 2** — [EXEC] `[Telegram ID, UseCase ID, Operation ID, Call Type]` (L838–L841)

Extracts four metadata values from the request parameter object. Each is placed into `paramMap` under a `JCMConstants` key.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(JCMConstants.TRANZACTION_ID_KEY, param.getTelegramID())` // Transaction ID [Request Header] |
| 2 | SET | `paramMap.put(JCMConstants.USECASE_ID_KEY, param.getUsecaseID())` // Use Case ID [Request Header] |
| 3 | SET | `paramMap.put(JCMConstants.OPERATION_ID_KEY, param.getOperationID())` // Operation ID [Request Header] |
| 4 | SET | `paramMap.put(JCMConstants.CALL_TYPE_KEY, param.getCallType())` // Call Type classification [Request Header] |

**Block 3** — [EXEC] `[Control Map: Client Host, Client IP, Invoke Gamen ID, Operator ID]` (L845–L848)

Retrieves four network-level context values from the control map embedded within the request parameter.

| # | Type | Code |
|---|------|------|
| 1 | SET | `paramMap.put(JCMConstants.CLIENT_HOST_NAME_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTNAME))` // Client hostname [Control Map] |
| 2 | SET | `paramMap.put(JCMConstants.CLIENT_IP_ADDRESS_KEY, param.getControlMapData(SCControlMapKeys.REQ_HOSTIP))` // Client IP address [Control Map] |
| 3 | SET | `paramMap.put(JCMConstants.INVOKE_GAMEN_ID_KEY, param.getControlMapData(SCControlMapKeys.REQ_VIEWID))` // Invoke screen (gamen) ID [Control Map] |
| 4 | SET | `paramMap.put(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // Operator ID [Control Map] |

**Block 4** — [SET] `[Service Interface extraction]` (L852–L853)

Extracts the service interface name from `mappingData[0][1]` and uses it to construct a `ResourceBundle` resource key for the message properties file.

| # | Type | Code |
|---|------|------|
| 1 | SET | `svcIf = (String) mappingData[0][1]` // Service interface name (e.g., "JKKNsidPwdChgOrsjgs") [mappingData row 0] |
| 2 | SET | `template = new CAANMsg(String.format("eo.ejb.cbs.cbsmsg.%sCBSMsg", svcIf))` // CAANMsg template from ResourceBundle |

**Block 5** — [EXEC] `[Template: Operator ID, Operate Date, Operate Date Time]` (L855–L859)

Populates the message template with three operational context fields.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `template.set(JCMConstants.OPERATOR_ID_KEY, param.getControlMapData(SCControlMapKeys.OPERATOR_ID))` // Operator ID on template |
| 2 | EXEC | `template.set(JCMConstants.OPERATE_DATE_KEY, param.getControlMapData(SCControlMapKeys.OPE_DATE))` // Operate date on template |
| 3 | EXEC | `template.set(JCMConstants.OPERATE_DATETIME_KEY, param.getControlMapData(SCControlMapKeys.OPE_TIME))` // Operate date/time on template |

**Block 6** — [FOR] `[Loop over mappingData]` (L861)

Iterates over every row in `mappingData` (starting from index 0) to populate all remaining fields on the message template.

| # | Type | Code |
|---|------|------|
| 1 | SET | `i = 0` // Loop counter |
| 2 | CONDITION | `i < mappingData.length` // Iterate while rows remain |
| 3 | SET | `i++` // Increment counter |

**Block 6.1** — [IF] `[CAANMsg[] branch]` (L863–L865)

Checks whether the mapping value is a nested `CAANMsg[]` sub-template (used for structured nested message fields).

| # | Type | Code |
|---|------|------|
| 1 | IF | `mappingData[i][1] instanceof CAANMsg[]` // Nested sub-template? |
| 2 | EXEC | `template.set((String) mappingData[i][0], (CAANMsg[]) mappingData[i][1])` // Set nested CAANMsg[] array |

**Block 6.2** — [ELSE] `[Value vs Empty-string branch]` (L866–L875)

Handles non-template values: distinguishes between empty-string (null marker) and regular values.

**Block 6.2.1** — [IF] `[Empty string sentinel]` (L867–L869)

| # | Type | Code |
|---|------|------|
| 1 | IF | `"".equals(mappingData[i][1])` // Empty string = null marker |
| 2 | EXEC | `template.setNull((String) mappingData[i][0])` // Explicitly set field to null |

**Block 6.2.2** — [ELSE] `[Regular value]` (L871–L873)

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

**Block 7** — [SET] `[Template array packaging]` (L879–L882)

Wraps the fully-populated `CAANMsg` template in a one-element array and stores it in `paramMap`.

| # | Type | Code |
|---|------|------|
| 1 | SET | `templates = new CAANMsg[1]` // Single-element array for template list |
| 2 | SET | `templates[0] = template` // Populate with the built template |
| 3 | SET | `paramMap.put(JCMConstants.TEMPLATE_LIST_KEY, templates)` // Store template list in paramMap |

**Block 8** — [RETURN] `(Return paramMap)` (L885)

Returns the fully constructed inbound message envelope.

| # | Type | Code |
|---|------|------|
| 1 | RETURN | `return paramMap` // Inbound message envelope ready for service component |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `JCMConstants` | Constant class | Fujitsu JCM (Java Component Middleware) constants — defines standard keys for transaction ID, use case ID, operation ID, call type, client hostname, client IP, invoke screen ID, operator ID, operate date, operate datetime, and template list |
| `SCControlMapKeys` | Constant class | Service Component control map keys — defines keys for request hostname, request IP, request view ID, operator ID, operate date, operate time, and other runtime control data |
| `TRANZACTION_ID_KEY` | Constant | Request header key for the transaction/telegram identifier (note: constant name uses "TRANZACTION" spelling per codebase convention) |
| `USECASE_ID_KEY` | Constant | Request header key for the use case identifier — identifies the business use case flow |
| `OPERATION_ID_KEY` | Constant | Request header key for the operation identifier |
| `CALL_TYPE_KEY` | Constant | Request header key for the call type classification (e.g., synchronous vs asynchronous) |
| `CLIENT_HOST_NAME_KEY` | Constant | Request header key for the originating client hostname |
| `CLIENT_IP_ADDRESS_KEY` | Constant | Request header key for the originating client IP address |
| `INVOKE_GAMEN_ID_KEY` | Constant | Request header key for the invoke screen ID — "gamen" is Japanese for "screen" |
| `OPERATOR_ID_KEY` | Constant | Request header key for the operator who initiated the request |
| `OPERATE_DATE_KEY` | Constant | Request header key for the operate/batch processing date |
| `OPERATE_DATETIME_KEY` | Constant | Request header key for the operate/batch processing date and time |
| `TEMPLATE_LIST_KEY` | Constant | Request header key for the list of message templates (CAANMsg array) |
| `REQ_HOSTNAME` | Constant | Control map key for the request source hostname |
| `REQ_HOSTIP` | Constant | Control map key for the request source IP address |
| `REQ_VIEWID` | Constant | Control map key for the request source screen/view ID |
| `OPE_DATE` | Constant | Control map key for the operate date |
| `OPE_TIME` | Constant | Control map key for the operate time |
| `IRequestParameterReadWrite` | Interface | Request parameter interface providing read/write access to request metadata and control map data |
| `CAANMsg` | Class | Fujitsu message template class backed by a Java `ResourceBundle` — holds message text templates for service call responses |
| `ResourceBundle` | Java API | Java internationalization mechanism that loads message text from `.properties` files at runtime |
| `eo.ejb.cbs.cbsmsg.{svcIf}CBSMsg` | Resource key pattern | ResourceBundle key pattern for service component message properties — `{svcIf}` is replaced with the service interface name (e.g., `eo.ejb.cbs.cbsmsg.JKKNsidPwdChgOrsjgsCBSMsg`). The corresponding `.properties` file contains the text templates for all return message fields. |
| `svcIf` | Field | Service interface name extracted from `mappingData[0][1]` — determines which message properties file to load |
| `mappingData` | Parameter | 2D mapping table `[key, value]` — maps field names to values for the message template; row 0 column 1 holds the service interface name |
| `paramMap` | Local variable | The outbound HashMap that serves as the complete inbound message envelope for the service component call |
| NT password | Business term | Windows/Active Directory password — this service component (JKKNsidPwdChgOrsjgs) handles NT password change or registration operations |
| NSID | Acronym | NT Service ID — the user identifier used in Fujitsu's NT authentication system |
| CBS | Acronym | Component-Based System — Fujitsu's service component architecture; "CBS" in file/class names denotes service component implementations |
| JCM | Acronym | Java Component Middleware — Fujitsu's middleware framework for enterprise component development |
